apparmor: fix build on musl, enable python on cross-compile

Closes: #51024 [via git-merge-pr]
This commit is contained in:
Daniel Martinez 2024-06-27 08:48:00 -04:00 committed by classabbyamp
parent 2438557df9
commit 263ba11122
No known key found for this signature in database
GPG key ID: 6BE0755918A4C7F5

View file

@ -1,13 +1,15 @@
# Template file for 'apparmor'
pkgname=apparmor
version=3.1.7
revision=1
revision=2
build_wrksrc=libraries/libapparmor
build_style=gnu-configure
conf_files="/etc/apparmor.d/local/* /etc/apparmor/*"
make_dirs="/etc/apparmor.d/disable 0755 root root"
configure_args="$(vopt_with python) $(vopt_with perl)"
hostmakedepends="bison flex gettext python3 which python3-setuptools pkg-config
perl"
perl $(vopt_if python swig)"
makedepends="$(vopt_if python python3-devel)"
depends="runit-void-apparmor libapparmor-${version}_${revision} python3-notify2
python3-psutil python3-dbus iproute2"
checkdepends="dejagnu"
@ -20,10 +22,20 @@ distfiles="https://launchpad.net/apparmor/${version%.*}/${version}/+download/app
checksum=c6c161d6dbd99c2f10758ff347cbc6848223c7381f311de62522f22b0a16de64
replaces="apparmor-vim>=0"
# /usr/lib/perl5/core_perl/CORE/perl.h:3360:22: error: unknown type name 'off64_t';
CFLAGS="-D_LARGEFILE64_SOURCE"
CXXFLAGS="-D_LARGEFILE64_SOURCE"
build_options="python perl"
case "$XBPS_TARGET_MACHINE" in
x86_64*|aarch64*|i686*)
build_options_default+=" python"
;;
esac
if [ -z "$CROSS_BUILD" ]; then
configure_args="--with-perl --with-python"
hostmakedepends+=" swig"
makedepends="python3-devel"
build_options_default+=" perl"
fi
pre_build() {
@ -55,7 +67,7 @@ post_install() {
make DESTDIR="${DESTDIR}" install -C profiles
# requires perl bindings not generated when cross-compiling
if [ "$CROSS_BUILD" ]; then
if [ -z "$build_option_perl" ]; then
rm -f ${DESTDIR}/usr/bin/aa-notify
fi
@ -71,8 +83,10 @@ libapparmor_package() {
license="LGPL-2.1-only"
pkg_install() {
vmove "usr/lib/libapparmor.so*"
if [ -z "$CROSS_BUILD" ]; then
if [ "$build_option_perl" ]; then
vmove usr/lib/perl5
fi
if [ "$build_option_python" ]; then
vmove "${py3_sitelib}/LibAppArmor*"
fi
vmove usr/share/man/man2