1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
pkgname=pledge
pkgver=0.0.git
pkgrel=2
pkgdesc="OpenBSD pledge(2) compatibility library for Linux"
url="https://github.com/jart/pledge"
arch="all"
license="ISC"
makedepends="build-essentials-stub"
subpackages="dev"
source="https://github.com/jart/pledge/archive/refs/heads/master.tar.gz"
builddir="$srcdir/pledge-master"
build() {
# Upstream's CLI target currently fails when linked from a nested build
# path, but the failed link happens after compiling the libc objects
# needed for libpledge.a.
make MODE=release o/release/pledge || true
ar rcs libpledge.a $(find o/release/libc -name '*.o' | sort)
}
package() {
install -Dm644 libpledge.a "$pkgdir/usr/lib/libpledge.a"
install -Dm644 libc/calls/pledge.h "$pkgdir/usr/include/pledge.h"
printf '\nint pledge(const char *, const char *);\n' >>"$pkgdir/usr/include/pledge.h"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}