From e74dfb0d82b16fb3d25d5297e6a8ac8add936f62 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Thu, 27 Jun 2024 08:48:00 -0400 Subject: [PATCH] apparmor: fix build on musl, enable python on cross-compile --- srcpkgs/apparmor/template | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/srcpkgs/apparmor/template b/srcpkgs/apparmor/template index 13586d0976f979..e782dc50ef9bf2 100644 --- a/srcpkgs/apparmor/template +++ b/srcpkgs/apparmor/template @@ -1,7 +1,7 @@ # 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/*" @@ -20,10 +20,24 @@ distfiles="https://launchpad.net/apparmor/${version%.*}/${version}/+download/app checksum=c6c161d6dbd99c2f10758ff347cbc6848223c7381f311de62522f22b0a16de64 replaces="apparmor-vim>=0" +case "$XBPS_TARGET_MACHINE" in + x86_64*|aarch64*|i686*) + configure_args+=" --with-python" + hostmakedepends+=" swig" + makedepends+=" python3-devel" + _have_python=yes + ;; +esac + if [ -z "$CROSS_BUILD" ]; then - configure_args="--with-perl --with-python" - hostmakedepends+=" swig" - makedepends="python3-devel" + configure_args+=" --with-perl" + _have_perl=yes +fi + +# /usr/lib/perl5/core_perl/CORE/perl.h:3360:22: error: unknown type name 'off64_t'; +if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + CFLAGS+=" -D_LARGEFILE64_SOURCE" + CXXFLAGS+=" -D_LARGEFILE64_SOURCE" fi pre_build() { @@ -55,7 +69,7 @@ post_install() { make DESTDIR="${DESTDIR}" install -C profiles # requires perl bindings not generated when cross-compiling - if [ "$CROSS_BUILD" ]; then + if [ "$_have_perl" ]; then rm -f ${DESTDIR}/usr/bin/aa-notify fi @@ -71,8 +85,10 @@ libapparmor_package() { license="LGPL-2.1-only" pkg_install() { vmove "usr/lib/libapparmor.so*" - if [ -z "$CROSS_BUILD" ]; then + if [ "$_have_perl" ]; then vmove usr/lib/perl5 + fi + if [ "$_have_python" ]; then vmove "${py3_sitelib}/LibAppArmor*" fi vmove usr/share/man/man2