jobcore/libcap/PKGBUILD

111 lines
3.8 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://git.disroot.org/joborun-pkg/jobcore/src/branch/main/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=libcap
pkgver=2.70
pkgrel=01
pkgdesc='POSIX 1003.1e capabilities'
url="https://sites.google.com/site/fullycapable/"
depends=(glibc pam gcc-libs)
makedepends=('linux-api-headers' 'go')
provides=('libcap.so' 'libpsx.so')
#options=(debug) ## removed 20230206 by arch as an option
# 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)
# 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[@]}"
}
## 2 tests failed due to a go bug rerun makepkg -e --nocheck
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/"
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('BSD-3-Clause OR GPL-2.0-only')
validpgpkeys=(38A644698C69787344E954CE29EE848AE2CCF3F4) # Andrew G. Morgan <morgan@kernel.org>
sha512sums=('4e0bf0efeccb654c409afe9727b2b53c1d4da8190d7a0a9848fc52550ff3e13502add3eacde04a68a5b7bec09e91df487f64c5746ba987f873236a9e53b3d4e8'
'SKIP'
'f1e301370b1af91d6cdca2433fcfc60f35ccfdfca7a7ce00a0b0ddfb54d67ed1b7e0a52094010c92514460bd142d12bb29eb28c13d9e7da9b92e4b61b6300d2f')
b2sums=('77b72acee53032117ea481e3380d1b497f9264b6193b9523542508c7c3e46070248ca4ed910d35809ce6e52caa60cbb31edb125c47221627eeda35c61bd0914b'
'SKIP'
'535fe70e39caeccb4b71fe0b6329e37b88b69d18361595e78171e3d148370553a055c81e4e691c5b43e54d5c2789fe5390287a1f23efc4529246877eaf8821e5')
# ARCH NOTE: contacted upstream on 2024-05-19 about unsafe (and differing) key for signed git tags and use of SHA-1 binding signatures in key used for custom source tarballs in the hopes of them using a new key in the future
sha256sums=(23a6ef8aadaf1e3e875f633bb2d116cfef8952dba7bc7c569b13458e1952b30f # libcap-2.70.tar.xz
3751538f269425ecc9fa640d2160f41220c65febf9baf6ea2ad7eaf0514034db # libcap-2.70.tar.sign
f7c0e863879c76a1fd20654932e8b13af64405ce969c5cae52a75731b6ea8a2e) # libcap-2.69-cgo_flags.patch
## 57a557536cfd7ecc86a1d6498837a0637e70c49a3ff5be7980a541b3fd0d182b libcap-2.70-01-x86_64.pkg.tar.lz