# This is an example PKGBUILD file. Use this as a start to creating your own, # and remove these comments. For more information, see 'man PKGBUILD'. # NOTE: Please fill out the license field for your package! If it is unknown, # then please put 'unknown'. # Maintainer: Future Linux Team pkgname=libcap pkgver=2.70 pkgrel=1 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=('glibc' 'gcc-libs' 'linux-pam') makedepends=('linux-api-headers' 'go') options=('!lto') source=(https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/${pkgname}-${pkgver}.tar.xz libcap-2.69-cgo_flags.patch) sha256sums=(23a6ef8aadaf1e3e875f633bb2d116cfef8952dba7bc7c569b13458e1952b30f f7c0e863879c76a1fd20654932e8b13af64405ce969c5cae52a75731b6ea8a2e) # 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() { cd ${pkgname}-${pkgver} # ensure to use CGO_ENABLED all the way (so that we can have full RELRO) patch -Np1 -i ${srcdir}/libcap-2.69-cgo_flags.patch } build() { cd ${pkgname}-${pkgver} export GOPATH=${PWD} make "${_common_make_options[@]}" \ DYNAMIC=yes \ KERNEL_HEADERS=/usr/include \ lib=lib64 \ prefix=/usr make -C pam_cap } package() { cd ${pkgname}-${pkgver} export GOPATH=${PWD} make "${_common_make_options[@]}" \ DESTDIR=${pkgdir} \ RAISE_SETFCAP=no \ lib=lib64 \ prefix=/usr \ install install -vDm644 pam_cap/capability.conf ${pkgdir}/etc/security/capability.conf }