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