Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [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." |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 8 | HOMEPAGE = "http://apparmor.net/" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 9 | SECTION = "admin" |
| 10 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 11 | LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & LGPL-2.1-or-later" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 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 = " \ |
Andrew Geissler | 2daf84b | 2023-03-31 09:57:23 -0500 | [diff] [blame] | 17 | git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-3.1 \ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 18 | file://run-ptest \ |
| 19 | file://crosscompile_perl_bindings.patch \ |
| 20 | file://0001-Makefile.am-suppress-perllocal.pod.patch \ |
| 21 | file://0001-Makefile-fix-hardcoded-installation-directories.patch \ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 22 | " |
| 23 | |
Andrew Geissler | 2daf84b | 2023-03-31 09:57:23 -0500 | [diff] [blame] | 24 | SRCREV = "e69cb5047946818e6a9df326851483bb075a5cfe" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 25 | S = "${WORKDIR}/git" |
| 26 | |
| 27 | PARALLEL_MAKE = "" |
| 28 | |
| 29 | COMPATIBLE_MACHINE:mips64 = "(!.*mips64).*" |
| 30 | |
| 31 | inherit pkgconfig autotools-brokensep update-rc.d python3native python3targetconfig perlnative cpan systemd features_check bash-completion setuptools3 |
| 32 | |
| 33 | REQUIRED_DISTRO_FEATURES = "apparmor" |
| 34 | |
| 35 | PACKAGECONFIG ?= "python perl aa-decode" |
| 36 | PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages" |
| 37 | PACKAGECONFIG[python] = "--with-python, --without-python, python3 , python3-core python3-modules" |
| 38 | PACKAGECONFIG[perl] = "--with-perl, --without-perl, " |
| 39 | PACKAGECONFIG[apache2] = ",,apache2," |
| 40 | PACKAGECONFIG[aa-decode] = ",,,bash" |
| 41 | |
| 42 | python() { |
| 43 | if 'apache2' in d.getVar('PACKAGECONFIG').split() and \ |
| 44 | 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split(): |
| 45 | raise bb.parse.SkipRecipe('Requires meta-webserver to be present.') |
| 46 | } |
| 47 | |
| 48 | DISABLE_STATIC = "" |
| 49 | |
| 50 | do_configure() { |
| 51 | cd ${S}/libraries/libapparmor |
| 52 | aclocal |
| 53 | autoconf --force |
| 54 | libtoolize --automake -c --force |
| 55 | automake -ac |
| 56 | ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
| 57 | } |
| 58 | |
| 59 | do_compile () { |
| 60 | sed -i "s@sed -ie 's///g' Makefile.perl@@" ${S}/libraries/libapparmor/swig/perl/Makefile |
| 61 | oe_runmake -C ${B}/libraries/libapparmor |
| 62 | oe_runmake -C ${B}/binutils |
| 63 | oe_runmake -C ${B}/utils |
| 64 | oe_runmake -C ${B}/parser |
| 65 | oe_runmake -C ${B}/profiles |
| 66 | |
| 67 | if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then |
| 68 | oe_runmake -C ${B}/changehat/mod_apparmor |
| 69 | fi |
| 70 | |
| 71 | if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then |
| 72 | oe_runmake -C ${B}/changehat/pam_apparmor |
| 73 | fi |
| 74 | } |
| 75 | |
| 76 | do_install () { |
| 77 | oe_runmake -C ${B}/libraries/libapparmor DESTDIR="${D}" install |
| 78 | oe_runmake -C ${B}/binutils DESTDIR="${D}" install |
| 79 | oe_runmake -C ${B}/utils DESTDIR="${D}" install |
| 80 | oe_runmake -C ${B}/parser DESTDIR="${D}" install |
| 81 | oe_runmake -C ${B}/profiles DESTDIR="${D}" install |
| 82 | |
| 83 | if ! ${@bb.utils.contains('PACKAGECONFIG','aa-decode','true','false', d)}; then |
| 84 | rm -f ${D}${sbindir}/aa-decode |
| 85 | fi |
| 86 | |
| 87 | if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then |
| 88 | oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install |
| 89 | fi |
| 90 | |
| 91 | if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then |
| 92 | oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install |
| 93 | fi |
| 94 | |
| 95 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then |
| 96 | install -d ${D}${sysconfdir}/init.d |
Andrew Geissler | 2daf84b | 2023-03-31 09:57:23 -0500 | [diff] [blame] | 97 | install -m 755 ${B}/parser/rc.apparmor.functions ${D}${sysconfdir}/init.d/apparmor |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 98 | fi |
| 99 | |
| 100 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
| 101 | oe_runmake -C ${B}/parser DESTDIR="${D}" install-systemd |
| 102 | fi |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 103 | chown root:root -R ${D}/${sysconfdir}/apparmor.d |
| 104 | chown root:root -R ${D}/${datadir}/apparmor |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | #Building ptest on arm fails. |
| 108 | do_compile_ptest:aarch64 () { |
| 109 | : |
| 110 | } |
| 111 | |
| 112 | do_compile_ptest:arm () { |
| 113 | : |
| 114 | } |
| 115 | |
| 116 | do_compile_ptest () { |
| 117 | sed -i -e 's/cpp \-dM/${HOST_PREFIX}gcc \-dM/' ${B}/tests/regression/apparmor/Makefile |
| 118 | oe_runmake -C ${B}/tests/regression/apparmor USE_SYSTEM=0 |
| 119 | oe_runmake -C ${B}/libraries/libapparmor |
| 120 | } |
| 121 | |
| 122 | do_install_ptest () { |
| 123 | t=${D}/${PTEST_PATH}/testsuite |
| 124 | install -d ${t} |
| 125 | install -d ${t}/tests/regression/apparmor |
| 126 | cp -rf ${B}/tests/regression/apparmor ${t}/tests/regression |
| 127 | |
| 128 | cp ${B}/parser/apparmor_parser ${t}/parser |
| 129 | cp ${B}/parser/frob_slack_rc ${t}/parser |
| 130 | |
| 131 | install -d ${t}/libraries/libapparmor |
| 132 | cp -rf ${B}/libraries/libapparmor ${t}/libraries |
| 133 | |
| 134 | install -d ${t}/common |
| 135 | cp -rf ${B}/common ${t} |
| 136 | |
| 137 | install -d ${t}/binutils |
| 138 | cp -rf ${B}/binutils ${t} |
| 139 | } |
| 140 | |
| 141 | #Building ptest on arm fails. |
| 142 | do_install_ptest:aarch64 () { |
| 143 | : |
| 144 | } |
| 145 | |
| 146 | do_install_ptest:arm() { |
| 147 | : |
| 148 | } |
| 149 | |
| 150 | INITSCRIPT_PACKAGES = "${PN}" |
| 151 | INITSCRIPT_NAME = "apparmor" |
| 152 | INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ." |
| 153 | |
| 154 | SYSTEMD_PACKAGES = "${PN}" |
| 155 | SYSTEMD_SERVICE:${PN} = "apparmor.service" |
| 156 | SYSTEMD_AUTO_ENABLE ?= "enable" |
| 157 | |
| 158 | PACKAGES += "mod-${PN}" |
| 159 | |
| 160 | FILES:${PN} += "${nonarch_base_libdir}/apparmor/ ${base_libdir}/security/ ${sysconfdir}/apparmor ${nonarch_libdir}/${PYTHON_DIR}/site-packages" |
| 161 | FILES:mod-${PN} = "${libdir}/apache2/modules/*" |
| 162 | FILES:${PN}-dbg += "${base_libdir}/security/.debug" |
| 163 | |
| 164 | DEPENDS:append:libc-musl = " fts " |
| 165 | RDEPENDS:${PN}:libc-musl += "musl-utils" |
| 166 | RDEPENDS:${PN}:libc-glibc += "glibc-utils" |
| 167 | |
| 168 | # Add coreutils and findutils only if sysvinit scripts are in use |
| 169 | RDEPENDS:${PN} += "${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" |
| 170 | RDEPENDS:${PN}:remove = "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" |
| 171 | RDEPENDS:${PN}-ptest += "perl coreutils dbus-lib bash" |
| 172 | |
| 173 | INSANE_SKIP:${PN} = "ldflags" |
| 174 | PRIVATE_LIBS:${PN}-ptest = "libapparmor.so*" |