# Maintainer: David Runge # Contributor: Bartłomiej Piotrowski # Contributor: Allan McRae # Contributor: Hugo Doria pkgname=libcap pkgver=2.69 pkgrel=4 pkgdesc="POSIX 1003.1e capabilities" arch=(x86_64) url="https://sites.google.com/site/fullycapable/" license=('BSD-3-Clause OR GPL-2.0-only') depends=( gcc-libs glibc pam ) makedepends=( go linux-api-headers ) provides=( libcap.so libpsx.so ) # we can not use LTO as otherwise we get no reproducible package with full RELRO options=(!lto) source=( https://kernel.org/pub/linux/libs/security/linux-privs/${pkgname}2/$pkgname-$pkgver.tar.{xz,sign} libcap-2.69-cgo_flags.patch # provide flags to go build (sent upstream) ) sha512sums=('647c307dc451517da9d089495ab959b4a6fbbe41c79f4e1e9bb663569dad630ead0c2e413dfb393319e3ea14dc9848c81b392107fe3382ce1813d278c3394a7f' 'SKIP' 'f1e301370b1af91d6cdca2433fcfc60f35ccfdfca7a7ce00a0b0ddfb54d67ed1b7e0a52094010c92514460bd142d12bb29eb28c13d9e7da9b92e4b61b6300d2f') b2sums=('94d1fef7666a1c383a8b96f1f6092bd242164631532868b628d2f5de71b42a371d041a978ef7fbadfee3eeb433165444995d1078cd790275bc0433a7875a697e' 'SKIP' '535fe70e39caeccb4b71fe0b6329e37b88b69d18361595e78171e3d148370553a055c81e4e691c5b43e54d5c2789fe5390287a1f23efc4529246877eaf8821e5') validpgpkeys=(38A644698C69787344E954CE29EE848AE2CCF3F4) # Andrew G. Morgan # NOTE: with CGO_ENABLED we need all relevant make options in build(), check() and package() otherwise the package is not reproducible _common_make_options=( CGO_CPPFLAGS="$CPPFLAGS" CGO_CFLAGS="$CFLAGS" CGO_CXXFLAGS="$CXXFLAGS" CGO_LDFLAGS="$LDFLAGS" CGO_REQUIRED="1" GOFLAGS="-buildmode=pie -mod=readonly -modcacherw" GO_BUILD_FLAGS="-ldflags '-compressdwarf=false -linkmode=external'" ) prepare() { # ensure to use CGO_ENABLED all the way (so that we can have full RELRO) patch -Np1 -d $pkgname-$pkgver -i ../libcap-2.69-cgo_flags.patch } build() { export GOPATH="$srcdir" local make_options=( "${_common_make_options[@]}" DYNAMIC=yes KERNEL_HEADERS=/usr/include lib=lib prefix=/usr sbindir=bin -C $pkgname-$pkgver ) make "${make_options[@]}" } check() { export GOPATH="$srcdir" local make_options=( "${_common_make_options[@]}" test -k -C $pkgname-$pkgver ) make "${make_options[@]}" } package() { export GOPATH="$srcdir" local make_options=( "${_common_make_options[@]}" DESTDIR="$pkgdir" RAISE_SETFCAP=no lib=lib prefix=/usr sbindir=bin install -C $pkgname-$pkgver ) make "${make_options[@]}" install -vDm 644 $pkgname-$pkgver/{CHANGELOG,README} -t "$pkgdir/usr/share/doc/$pkgname/" install -vDm 644 $pkgname-$pkgver/License -t "$pkgdir/usr/share/licenses/$pkgname/" install -vDm 644 $pkgname-$pkgver/pam_cap/capability.conf -t "$pkgdir/usr/share/doc/$pkgname/examples/" }