Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 1 | SUMMARY = "AppArmor another MAC control system" |
| 2 | DESCRIPTION = "user-space parser utility for AppArmor \ |
| 3 | This provides the system initialization scripts needed to use the \ |
| 4 | AppArmor Mandatory Access Control system, including the AppArmor Parser \ |
| 5 | which is required to convert AppArmor text profiles into machine-readable \ |
| 6 | policies that are loaded into the kernel for use with the AppArmor Linux \ |
| 7 | Security Module." |
| 8 | HOMEAPAGE = "http://apparmor.net/" |
| 9 | SECTION = "admin" |
| 10 | |
| 11 | LICENSE = "GPLv2 & GPLv2+ & BSD-3-Clause & LGPLv2.1+" |
| 12 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fd57a4b0bc782d7b80fd431f10bbf9d0" |
| 13 | |
| 14 | DEPENDS = "bison-native apr gettext-native coreutils-native swig-native" |
| 15 | |
| 16 | SRC_URI = " \ |
| 17 | git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-3.0 \ |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 18 | file://run-ptest \ |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 19 | file://disable_perl_h_check.patch \ |
| 20 | file://crosscompile_perl_bindings.patch \ |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 21 | file://0001-Makefile.am-suppress-perllocal.pod.patch \ |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 22 | file://0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch \ |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 23 | file://0001-Makefile-fix-hardcoded-installation-directories.patch \ |
| 24 | file://0001-rc.apparmor.debian-add-missing-functions.patch \ |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 25 | " |
| 26 | |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 27 | SRCREV = "b0f08aa9d678197b8e3477c2fbff790f50a1de5e" |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 28 | S = "${WORKDIR}/git" |
| 29 | |
| 30 | PARALLEL_MAKE = "" |
| 31 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 32 | COMPATIBLE_MACHINE:mips64 = "(!.*mips64).*" |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 33 | |
Andrew Geissler | 8b13928 | 2021-03-05 15:22:30 -0600 | [diff] [blame] | 34 | inherit pkgconfig autotools-brokensep update-rc.d python3native python3targetconfig perlnative cpan systemd features_check bash-completion |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 35 | |
| 36 | REQUIRED_DISTRO_FEATURES = "apparmor" |
| 37 | |
| 38 | PACKAGECONFIG ?= "python perl aa-decode" |
| 39 | PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages" |
| 40 | PACKAGECONFIG[python] = "--with-python, --without-python, python3 , python3-core python3-modules" |
| 41 | PACKAGECONFIG[perl] = "--with-perl, --without-perl, " |
| 42 | PACKAGECONFIG[apache2] = ",,apache2," |
| 43 | PACKAGECONFIG[aa-decode] = ",,,bash" |
| 44 | |
| 45 | python() { |
| 46 | if 'apache2' in d.getVar('PACKAGECONFIG').split() and \ |
| 47 | 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split(): |
| 48 | raise bb.parse.SkipRecipe('Requires meta-webserver to be present.') |
| 49 | } |
| 50 | |
| 51 | DISABLE_STATIC = "" |
| 52 | |
| 53 | do_configure() { |
| 54 | cd ${S}/libraries/libapparmor |
| 55 | aclocal |
| 56 | autoconf --force |
| 57 | libtoolize --automake -c --force |
| 58 | automake -ac |
| 59 | ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
| 60 | } |
| 61 | |
| 62 | do_compile () { |
| 63 | sed -i "s@sed -ie 's///g' Makefile.perl@@" ${S}/libraries/libapparmor/swig/perl/Makefile |
| 64 | oe_runmake -C ${B}/libraries/libapparmor |
| 65 | oe_runmake -C ${B}/binutils |
| 66 | oe_runmake -C ${B}/utils |
| 67 | oe_runmake -C ${B}/parser |
| 68 | oe_runmake -C ${B}/profiles |
| 69 | |
| 70 | if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then |
| 71 | oe_runmake -C ${B}/changehat/mod_apparmor |
| 72 | fi |
| 73 | |
| 74 | if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then |
| 75 | oe_runmake -C ${B}/changehat/pam_apparmor |
| 76 | fi |
| 77 | } |
| 78 | |
| 79 | do_install () { |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 80 | oe_runmake -C ${B}/libraries/libapparmor DESTDIR="${D}" install |
| 81 | oe_runmake -C ${B}/binutils DESTDIR="${D}" install |
| 82 | oe_runmake -C ${B}/utils DESTDIR="${D}" install |
| 83 | oe_runmake -C ${B}/parser DESTDIR="${D}" install |
| 84 | oe_runmake -C ${B}/profiles DESTDIR="${D}" install |
| 85 | |
| 86 | if ! ${@bb.utils.contains('PACKAGECONFIG','aa-decode','true','false', d)}; then |
| 87 | rm -f ${D}${sbindir}/aa-decode |
| 88 | fi |
| 89 | |
| 90 | if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then |
| 91 | oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install |
| 92 | fi |
| 93 | |
| 94 | if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 95 | oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install |
| 96 | fi |
| 97 | |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 98 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then |
| 99 | install -d ${D}${sysconfdir}/init.d |
| 100 | install -m 755 ${B}/parser/rc.apparmor.debian ${D}${sysconfdir}/init.d/apparmor |
| 101 | fi |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 102 | |
| 103 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 104 | oe_runmake -C ${B}/parser DESTDIR="${D}" install-systemd |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 105 | fi |
| 106 | } |
| 107 | |
| 108 | #Building ptest on arm fails. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 109 | do_compile_ptest:aarch64 () { |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 110 | : |
| 111 | } |
| 112 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 113 | do_compile_ptest:arm () { |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 114 | : |
| 115 | } |
| 116 | |
| 117 | do_compile_ptest () { |
| 118 | sed -i -e 's/cpp \-dM/${HOST_PREFIX}gcc \-dM/' ${B}/tests/regression/apparmor/Makefile |
| 119 | oe_runmake -C ${B}/tests/regression/apparmor USE_SYSTEM=0 |
| 120 | oe_runmake -C ${B}/libraries/libapparmor |
| 121 | } |
| 122 | |
| 123 | do_install_ptest () { |
| 124 | t=${D}/${PTEST_PATH}/testsuite |
| 125 | install -d ${t} |
| 126 | install -d ${t}/tests/regression/apparmor |
| 127 | cp -rf ${B}/tests/regression/apparmor ${t}/tests/regression |
| 128 | |
| 129 | cp ${B}/parser/apparmor_parser ${t}/parser |
| 130 | cp ${B}/parser/frob_slack_rc ${t}/parser |
| 131 | |
| 132 | install -d ${t}/libraries/libapparmor |
| 133 | cp -rf ${B}/libraries/libapparmor ${t}/libraries |
| 134 | |
| 135 | install -d ${t}/common |
| 136 | cp -rf ${B}/common ${t} |
| 137 | |
| 138 | install -d ${t}/binutils |
| 139 | cp -rf ${B}/binutils ${t} |
| 140 | } |
| 141 | |
| 142 | #Building ptest on arm fails. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 143 | do_install_ptest:aarch64 () { |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 144 | : |
| 145 | } |
| 146 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 147 | do_install_ptest:arm() { |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 148 | : |
| 149 | } |
| 150 | |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 151 | INITSCRIPT_PACKAGES = "${PN}" |
| 152 | INITSCRIPT_NAME = "apparmor" |
| 153 | INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ." |
| 154 | |
| 155 | SYSTEMD_PACKAGES = "${PN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 156 | SYSTEMD_SERVICE:${PN} = "apparmor.service" |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 157 | SYSTEMD_AUTO_ENABLE ?= "enable" |
| 158 | |
| 159 | PACKAGES += "mod-${PN}" |
| 160 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 161 | FILES:${PN} += "${nonarch_base_libdir}/apparmor/ ${base_libdir}/security/ ${sysconfdir}/apparmor ${nonarch_libdir}/${PYTHON_DIR}/site-packages" |
| 162 | FILES:mod-${PN} = "${libdir}/apache2/modules/*" |
| 163 | FILES:${PN}-dbg += "${base_libdir}/security/.debug" |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 164 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 165 | DEPENDS:append:libc-musl = " fts " |
| 166 | RDEPENDS:${PN}:libc-musl += "musl-utils" |
| 167 | RDEPENDS:${PN}:libc-glibc += "glibc-utils" |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 168 | |
| 169 | # Add coreutils and findutils only if sysvinit scripts are in use |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 170 | RDEPENDS:${PN} += "${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" |
| 171 | RDEPENDS:${PN}:remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" |
| 172 | RDEPENDS:${PN}-ptest += "perl coreutils dbus-lib bash" |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 173 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 174 | INSANE_SKIP:${PN} = "ldflags" |
| 175 | PRIVATE_LIBS:${PN}-ptest = "libapparmor.so*" |