#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=libuv
pkgver=1.44.2
pkgrel=01
pkgdesc="Multi-platform support library with a focus on asynchronous I/O"
arch=('x86_64')
url="https://github.com/libuv/libuv"
depends=('glibc' 'libnsl')
makedepends=('python-sphinx')
source=(https://dist.libuv.org/dist/v$pkgver/libuv-v$pkgver.tar.gz{,.sign})

prepare() {
    cd $pkgname-v$pkgver
    # Disable tests that fail on build.a.o (but pass locally)
    sed -e '/udp_multicast_join/d' -i test/test-list.h
}
 
build() {
    cd $pkgname-v$pkgver
    ./autogen.sh
    ./configure --prefix=/usr
    make
    make man -C docs
}

check() {
    cd $pkgname-v$pkgver
    make check
}

package() {
    cd $pkgname-v$pkgver

    make DESTDIR="$pkgdir" install

    install -Dm644 LICENSE \
        "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
    install -Dm644 AUTHORS \
        "$pkgdir"/usr/share/doc/$pkgname/AUTHORS
    install -Dm644 README.md \
        "$pkgdir"/usr/share/doc/$pkgname/README.md
    install -Dm644 ChangeLog \
        "$pkgdir"/usr/share/doc/$pkgname/ChangeLog
    install -Dm644 docs/build/man/libuv.1 \
        "$pkgdir"/usr/share/man/man1/libuv.1
}

#---- license gpg-key sha256sums ----

license=('custom')

# PGP key IDs are available from https://github.com/libuv/libuv/blob/v1.x/MAINTAINERS.md
validpgpkeys=('57353E0DBDAAA7E839B66A1AFF47D5E4AD8B4FDC'  # Colin Ihrig (@cjihrig)
              'AEAD0A4B686767751A0E4AEF34A25FB128246514' # Jameson Nash (@vtjnash)
              'CFBB9CA9A5BEAFD70E2B3C5A79A67C55A3679C8B') # Jameson Nash (@vtjnash)

sha256sums=(ccfcdc968c55673c6526d8270a9c8655a806ea92468afcbcabc2b16040f03cb4 # libuv-v1.44.2.tar.gz
	2cbf6595c2e8486b6be7e4d6fcecf5bf2f6c933df099391acc62cfa38c04e619) # libuv-v1.44.2.tar.gz.sign
