1 # Maintainer: David Runge <dvzrv@archlinux.org>
6 pkgdesc="Mandatory Access Control (MAC) using Linux Security Module (LSM)"
8 url="https://gitlab.com/apparmor/apparmor"
10 depends=(audit glibc pam python)
11 makedepends=(apache libxcrypt python-setuptools ruby swig)
12 checkdepends=(dejagnu perl-locale-gettext python-notify2 python-psutil)
14 'perl: for perl bindings'
15 'python-notify2: for aa-notify'
16 'python-psutil: for aa-notify'
17 'ruby: for ruby bindings'
19 provides=(libapparmor.so)
21 etc/apparmor/easyprof.conf
22 etc/apparmor/logprof.conf
23 etc/apparmor/notify.conf
24 etc/apparmor/parser.conf
25 etc/apparmor/severity.db
27 source=(https://launchpad.net/$pkgname/${pkgver%.[0-9]}/$pkgver/+download/$pkgname-$pkgver.tar.gz{,.asc})
28 sha512sums=('88ffb21813d1874e640ad407aa566d898fb47b65f819e321d2d451845be86088af7e1bcb4abac6601bedf353ef5d3cb6a07a7f57d0a666449a5f768ea0e49c94'
30 b2sums=('a2aaec3e5439bc75509b6810c477df55ba837fc595b772bd884ded4860db32e8ce9d5fb015b269ce1597b84d69d78d5ebb45d775f658b4d05d51ed392aad7549'
32 validpgpkeys=('3ECDCBA5FB34D254961CC53F6689E64E3D3664BB') # AppArmor Development Team (AppArmor signing key) <apparmor@lists.ubuntu.com>
33 _core_perl="/usr/bin/core_perl"
36 cd $pkgname-$pkgver/libraries/libapparmor/
41 local configure_options=(
51 # export required perl executable locations
52 export MAKEFLAGS+=" POD2MAN=$_core_perl/pod2man"
53 export MAKEFLAGS+=" POD2HTML=$_core_perl/pod2html"
54 export MAKEFLAGS+=" PODCHECKER=$_core_perl/podchecker"
55 export MAKEFLAGS+=" PROVE=$_core_perl/prove"
57 cd libraries/libapparmor/
58 ./configure "${configure_options[@]}"
65 make -C changehat/pam_apparmor
66 make -C changehat/mod_apparmor
69 # copy to test location as some tests render the resulting python bytecode
70 # unreproducible: https://gitlab.com/apparmor/apparmor/-/issues/184
72 cp -av $pkgname-$pkgver $pkgname-$pkgver-test
76 cd $pkgname-$pkgver-test
77 echo "INFO: Running check: libraries/libapparmor"
78 make -C libraries/libapparmor check
79 echo "INFO: Running check binutils"
80 make -C binutils check
81 echo "INFO: Running check parser"
83 # NOTE: the profiles checks are notoriously broken, so run each separately
84 echo "INFO: Running check-abstractions.d profiles"
85 make -C profiles check-abstractions.d
86 # # many hardcoded paths are not accounted for:
87 # # https://gitlab.com/apparmor/apparmor/-/issues/137
88 # echo "INFO: Running check-logprof profiles"
89 # make -C profiles check-logprof
90 echo "INFO: Running check-parser profiles"
91 make -C profiles check-parser
92 echo "INFO: Running check utils"
93 # we do not care about linting when running tests
94 # https://gitlab.com/apparmor/apparmor/-/issues/121
95 make PYFLAKES='/usr/bin/true' -C utils check
99 depends+=(libcrypt.so)
102 make -C libraries/libapparmor DESTDIR="$pkgdir" install
103 make -C changehat/pam_apparmor DESTDIR="$pkgdir/usr" install
104 make -C changehat/mod_apparmor DESTDIR="$pkgdir" install
105 make -C binutils DESTDIR="$pkgdir" SBINDIR="$pkgdir/usr/bin" USR_SBINDIR="$pkgdir/usr/bin" install
106 make -C parser -j1 DESTDIR="$pkgdir" SBINDIR="$pkgdir/usr/bin" USR_SBINDIR="$pkgdir/usr/bin" APPARMOR_BIN_PREFIX="$pkgdir/usr/lib/apparmor" install install-systemd
107 make -C profiles DESTDIR="$pkgdir" install
108 make -C utils DESTDIR="$pkgdir" SBINDIR="$pkgdir/usr/bin" USR_SBINDIR="$pkgdir/usr/bin" BINDIR="$pkgdir/usr/bin" VIM_INSTALL_PATH="$pkgdir/usr/share/vim/vimfiles/syntax" install
110 # set file mode to allow the perl library to be stripped:
111 # https://gitlab.com/apparmor/apparmor/issues/34
112 find "$pkgdir/usr/lib/perl5/" -type f -iname "*.so" -exec chmod 755 {} \;
114 # remove empty core_perl directory:
115 # https://gitlab.com/apparmor/apparmor/issues/40
116 rm -rv "${pkgdir}"/usr/lib/perl5/*/core_perl
117 # move ruby bindings to vendor_ruby:
118 # https://gitlab.com/apparmor/apparmor/issues/35
119 mv -v "$pkgdir/usr/lib/ruby/"{site,vendor}_ruby
120 # adding files below /etc/apparmor.d to backup array
122 # trick extract_function_variable() in makepkg into not detecting the
123 # backup array modification and adding remaining configuration files
124 [[ /usr/bin/true ]] && backup=( ${backup[@]} $(find "etc/$pkgname.d/" -type f | LC_ALL=C sort) )