68 lines
2.1 KiB
Bash
68 lines
2.1 KiB
Bash
# 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 <future_linux@163.com>
|
|
pkgname=libcap
|
|
pkgver=2.71
|
|
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.71-cgo-flags.patch)
|
|
sha256sums=(b7006c9af5168315f35fc734bf1a8d2aa70766bd8b8c4340962e05b19c35b900
|
|
436594bed416dfa1a3a3a9df17350555c1f995d480d0ebbb739d7a29656ccc5a)
|
|
|
|
# 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.71-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
|
|
}
|