2024-10-14 18:05:54 +08:00
|
|
|
# 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
|
2024-10-14 18:47:02 +08:00
|
|
|
pkgver=2.70
|
2024-10-14 18:05:54 +08:00
|
|
|
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')
|
2024-10-14 18:47:02 +08:00
|
|
|
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'"
|
|
|
|
)
|
2024-10-14 18:05:54 +08:00
|
|
|
|
|
|
|
prepare() {
|
2024-10-14 18:47:02 +08:00
|
|
|
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
|
2024-10-14 18:05:54 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2024-10-14 18:47:02 +08:00
|
|
|
cd ${pkgname}-${pkgver}
|
2024-10-14 18:05:54 +08:00
|
|
|
|
2024-10-14 18:47:02 +08:00
|
|
|
export GOPATH=${PWD}
|
2024-10-14 18:05:54 +08:00
|
|
|
|
2024-10-14 18:47:02 +08:00
|
|
|
make "${_common_make_options[@]}" \
|
|
|
|
DYNAMIC=yes \
|
|
|
|
KERNEL_HEADERS=/usr/include \
|
|
|
|
lib=lib64 \
|
|
|
|
prefix=/usr
|
|
|
|
make -C pam_cap
|
2024-10-14 18:05:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2024-10-14 18:47:02 +08:00
|
|
|
cd ${pkgname}-${pkgver}
|
|
|
|
|
|
|
|
export GOPATH=${PWD}
|
2024-10-14 18:05:54 +08:00
|
|
|
|
2024-10-14 18:47:02 +08:00
|
|
|
make "${_common_make_options[@]}" \
|
|
|
|
DESTDIR=${pkgdir} \
|
|
|
|
RAISE_SETFCAP=no \
|
|
|
|
lib=lib64 \
|
|
|
|
prefix=/usr \
|
|
|
|
install
|
2024-10-14 18:05:54 +08:00
|
|
|
|
2024-10-14 18:47:02 +08:00
|
|
|
install -vDm644 pam_cap/capability.conf ${pkgdir}/etc/security/capability.conf
|
2024-10-14 18:05:54 +08:00
|
|
|
}
|