# Contributor: Allan Garret # Maintainer: Allan Garret pkgname=apparmor pkgver=2.13.3 pkgrel=0 pkgdesc="Linux application security framework - mandatory access control for programs" url="https://gitlab.com/apparmor/apparmor/wikis/home" arch="all" license="GPL-2.0-only" depends="bash" makedepends="sed python3 autoconf automake libtool bison flex perl-dev swig gettext-dev python3-dev linux-pam-dev linux-headers" checkdepends="dejagnu py3-pyflakes" subpackages=" libapparmor:_libapparmor libapparmor-doc:_libapparmor_doc libapparmor-dev:_libapparmor_dev py3-$pkgname:_py3_apparmor perl-$pkgname:_perl_apparmor $pkgname-utils:_apparmor_utils $pkgname-utils-doc:_apparmor_utils_doc $pkgname-utils-lang:_apparmor_utils_lang $pkgname-profiles:_apparmor_profiles:noarch $pkgname-pam:_apparmor_pam $pkgname-vim:_apparmor_vim:noarch $pkgname-openrc $pkgname-doc $pkgname-lang " source=" https://gitlab.com/apparmor/apparmor/-/archive/v$pkgver/apparmor-v$pkgver.tar.gz apparmor.initd 0001-Fix-linking-against-gettext-on-musl-libc.patch 0002-utils-remove-vim-from-the-default-build.patch 0003-parser-remove-specific-tests-for-rttime.patch 0004-parser-remove-specific-tests-for-ofile.patch 0005-utils-adjust-tests-to-match-the-Alpine-layout.patch 0006-utils-adjust-rc-functions-for-aa-remove-unknown.patch 0007-Remove-Locale-gettext-from-parser-tests.patch " builddir="$srcdir"/$pkgname-v$pkgver build() { export PYTHON_VERSION=3 export PYTHON_VERSIONS=python3 export PYTHON=/usr/bin/python3 cd "$builddir"/libraries/libapparmor msg "Building: libapparmor" ./autogen.sh ./configure --prefix=/usr --with-python --with-perl make cd "$builddir" msg "Building: apparmor parser" make -C parser msg "Building: apparmor-binutils" make -C binutils msg "Building: apparmor-utils" make -C utils msg "Building: apparmor-profiles" make -C profiles msg "Building: apparmor-pam" make -C changehat/pam_apparmor msg "Building: apparmor-vim" make -C utils/vim } check() { cd "$builddir"/libraries/libapparmor make check cd "$builddir" make -C parser check make -C binutils check make -j1 -e PYFLAKES=pyflakes-3 -C utils check } package() { make -C parser install DESTDIR="$pkgdir" mv "$pkgdir"/lib "$pkgdir"/usr/lib mkdir -p "$pkgdir"/usr/libexec/apparmor mv "$pkgdir"/usr/lib/apparmor/rc.apparmor.functions \ "$pkgdir"/usr/libexec/apparmor/ rmdir "$pkgdir"/usr/lib/apparmor install -Dm755 "$srcdir"/apparmor.initd \ "$pkgdir"/etc/init.d/apparmor } _libapparmor() { pkgdesc="AppArmor library" depends="bash sed" cd "$builddir" make -C libraries/libapparmor install DESTDIR="$subpkgdir" # Move development files mkdir -p "$subpkgdir"-dev/usr mv "$subpkgdir"/usr/include "$subpkgdir"-dev/usr/ mkdir -p "$subpkgdir"-dev/usr/lib mv "$subpkgdir"/usr/lib/libapparmor.a "$subpkgdir"-dev/usr/lib/ mv "$subpkgdir"/usr/lib/pkgconfig "$subpkgdir"-dev/usr/lib/ # Move python3 files mkdir -p "$subpkgdir"/../py3-$pkgname/usr/lib mv "$subpkgdir"/usr/lib/python3.* "$subpkgdir"/../py3-$pkgname/usr/lib # Move perl files mkdir -p "$subpkgdir"/../perl-$pkgname/usr/lib mv "$subpkgdir"/usr/lib/perl5 "$subpkgdir"/../perl-$pkgname/usr/lib # Move doc files mkdir -p "$subpkgdir-doc"/usr/share mv "$subpkgdir"/usr/share/man "$subpkgdir-doc"/usr/share/ } _libapparmor_doc() { pkgdesc="AppArmor Library (doc files)" cd "$builddir" for i in 2 3; do find "$subpkgdir"/usr/share/man/man"$i" -type f -exec gzip -9v {} + done } _libapparmor_dev() { pkgdesc="AppArmor Library (development files)" } _py3_apparmor() { pkgdesc="Python3 module for apparmor" depends="libapparmor python3" } _perl_apparmor() { pkgdesc="Perl module for apparmor" depends="libapparmor perl" } _apparmor_utils() { pkgdesc="AppArmor userspace utilities" depends="libapparmor perl python3 bash" cd "$builddir" make -C utils install DESTDIR="$subpkgdir" BINDIR="$subpkgdir"/usr/bin cd "$builddir" make -C binutils install DESTDIR="$subpkgdir" BINDIR="$subpkgdir"/usr/bin mkdir -p "$subpkgdir"-doc/usr/share mv "$subpkgdir"/usr/share/man "$subpkgdir"-doc/usr/share/ mkdir -p "$subpkgdir"-lang/usr/share mv "$subpkgdir"/usr/share/locale "$subpkgdir"-lang/usr/share/ } _apparmor_utils_doc() { pkgdesc="AppArmor userspace utilites (doc files)" cd "$builddir" for i in 1 5 8; do find "$subpkgdir"/usr/share/man/man"$i" -type f -exec gzip -9v {} + done cd "$subpkgdir"/usr/share/man/man8 rm apparmor_status.8 ln -s aa-status.8.gz apparmor_status.8.gz } _apparmor_utils_lang() { pkgdesc="Languages for package $subpkgname" } _apparmor_profiles() { pkgdesc="AppArmor sample pre-made profiles" depends="apparmor" cd "$builddir" make -C profiles install DESTDIR="$subpkgdir" } _apparmor_pam() { pkgdesc="AppArmor PAM library" depends="libapparmor linux-pam" cd "$builddir" make -C changehat/pam_apparmor install DESTDIR="$subpkgdir"/usr } _apparmor_pam_doc() { pkgdesc="AppArmor PAM library (doc files)" cd "$builddir" mkdir -p "$subpkgdir"/usr/share/doc/apparmor install -Dm644 changehat/pam_apparmor/README \ "$subpkgdir"/usr/share/doc/apparmor/README.pam_apparmor } _apparmor_vim() { pkgdesc="AppArmor VIM support" depends="vim" cd "$builddir"/utils/vim install -Dm644 apparmor.vim \ "$subpkgdir"/usr/share/vim/vimfiles/syntax/apparmor.vim } sha512sums="2f070e84ac3e59dcb1c7835cd2afbdafd10834656391a4f9b86c3cd2cd9a335c40f232328424644732bdc2c926e5db6c2638faf004f12a2612cc1c461ef08410 apparmor-v2.13.3.tar.gz 1a57cc577ba3aedfbe10ef6148c1e8f5d0bbf65c99e60eec80c52409c9dab59ae002024500c6e4fd0e01e8c7aeb0c85e3e6b41cacee08c17fdd869d31bca614e apparmor.initd e94f44427ed3c6f64462170939ffc92ce9ac1a58c61c7c7c3483fe16fe8e1c419daade9d56cdd342132e4d823dcac1963a86ad889f10bf71fd52b7f54c4694ed 0001-Fix-linking-against-gettext-on-musl-libc.patch 20817633590c40eb5f6132c11396cf0bbd532b6e436aa90b6ccc61d7c914794d868ec981b91406f6c11f550102aa25a32982610445cc8e5e703ee90697233263 0002-utils-remove-vim-from-the-default-build.patch 568e10bda27745ac6e1b9495bb6863e93466ee1c387912393c2c7396bcedd7400b13ee233dd953f82460328e3aae45dd2f7aba92962edef31330d6b4dbc9951b 0003-parser-remove-specific-tests-for-rttime.patch 3a84fb3b2b19ccf52e179190e98ec0da2469727eaaa73d0094b0e9c85b80738c9cb9da9242d17a472a649e6042933bedb5f78c3f574d555369a4ece38a1d8a8a 0004-parser-remove-specific-tests-for-ofile.patch be7397ab9db4aff4774b9ee8dd43644ceb36e5755fb2e38a72ab42a53ee67bcdeccc3f8c09ce9279a10f3c110ede2026d72fec81f06f1b66149e160cf9a7dd7c 0005-utils-adjust-tests-to-match-the-Alpine-layout.patch 38ebb30a0185f8eabd9103925959da365f64ef485f66ffb10180ac596fc172f9c98df39baec0b035138e9ab32056148e69a066faba9faebf9e92bf7a09c150c0 0006-utils-adjust-rc-functions-for-aa-remove-unknown.patch 093c2f216776c5cc67294a134af6ef788dd5a82477592093abbdd244d65591006890a7c911d4f72d7c0ceac5d3ee33927b055a6d3731284701057b35372e7265 0007-Remove-Locale-gettext-from-parser-tests.patch"