Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [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" |
| 15 | |
| 16 | SRC_URI = " \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 17 | git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-2.13 \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 18 | file://disable_perl_h_check.patch \ |
| 19 | file://crosscompile_perl_bindings.patch \ |
| 20 | file://apparmor.rc \ |
| 21 | file://functions \ |
| 22 | file://apparmor \ |
| 23 | file://apparmor.service \ |
Brad Bishop | f024475 | 2019-09-30 07:50:12 -0400 | [diff] [blame] | 24 | file://0001-Makefile.am-suppress-perllocal.pod.patch \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 25 | file://run-ptest \ |
| 26 | " |
| 27 | |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 28 | SRCREV = "df0ac742f7a1146181d8734d03334494f2015134" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 29 | S = "${WORKDIR}/git" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 30 | |
| 31 | PARALLEL_MAKE = "" |
| 32 | |
Andrew Geissler | cc58928 | 2020-09-18 13:34:40 -0500 | [diff] [blame] | 33 | COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" |
| 34 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 35 | inherit pkgconfig autotools-brokensep update-rc.d python3native perlnative ptest cpan manpages systemd features_check |
| 36 | REQUIRED_DISTRO_FEATURES = "apparmor" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 37 | |
Brad Bishop | 64940c3 | 2019-10-15 07:47:39 -0400 | [diff] [blame] | 38 | PACKAGECONFIG ??= "python perl aa-decode" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 39 | PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages" |
| 40 | PACKAGECONFIG[python] = "--with-python, --without-python, python3 swig-native" |
| 41 | PACKAGECONFIG[perl] = "--with-perl, --without-perl, perl perl-native swig-native" |
| 42 | PACKAGECONFIG[apache2] = ",,apache2," |
Brad Bishop | 64940c3 | 2019-10-15 07:47:39 -0400 | [diff] [blame] | 43 | PACKAGECONFIG[aa-decode] = ",,,bash" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 44 | |
| 45 | PAMLIB="${@bb.utils.contains('DISTRO_FEATURES', 'pam', '1', '0', d)}" |
| 46 | HTTPD="${@bb.utils.contains('PACKAGECONFIG', 'apache2', '1', '0', d)}" |
| 47 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 48 | python() { |
| 49 | if 'apache2' in d.getVar('PACKAGECONFIG').split() and \ |
| 50 | 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split(): |
| 51 | raise bb.parse.SkipRecipe('Requires meta-webserver to be present.') |
| 52 | } |
| 53 | |
| 54 | DISABLE_STATIC = "" |
| 55 | |
| 56 | do_configure() { |
| 57 | cd ${S}/libraries/libapparmor |
| 58 | aclocal |
| 59 | autoconf --force |
| 60 | libtoolize --automake -c --force |
| 61 | automake -ac |
| 62 | ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
| 63 | } |
| 64 | |
| 65 | do_compile () { |
| 66 | # Fixes: |
| 67 | # | sed -ie 's///g' Makefile.perl |
| 68 | # | sed: -e expression #1, char 0: no previous regular expression |
| 69 | #| Makefile:478: recipe for target 'Makefile.perl' failed |
| 70 | sed -i "s@sed -ie 's///g' Makefile.perl@@" ${S}/libraries/libapparmor/swig/perl/Makefile |
| 71 | |
| 72 | |
| 73 | oe_runmake -C ${B}/libraries/libapparmor |
| 74 | oe_runmake -C ${B}/binutils |
| 75 | oe_runmake -C ${B}/utils |
| 76 | oe_runmake -C ${B}/parser |
| 77 | oe_runmake -C ${B}/profiles |
| 78 | |
| 79 | if test -z "${HTTPD}" ; then |
| 80 | oe_runmake -C ${B}/changehat/mod_apparmor |
| 81 | fi |
| 82 | |
| 83 | if test -z "${PAMLIB}" ; then |
| 84 | oe_runmake -C ${B}/changehat/pam_apparmor |
| 85 | fi |
| 86 | } |
| 87 | |
| 88 | do_install () { |
| 89 | install -d ${D}/${INIT_D_DIR} |
| 90 | install -d ${D}/lib/apparmor |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 91 | oe_runmake -C ${B}/libraries/libapparmor DESTDIR="${D}" install |
| 92 | oe_runmake -C ${B}/binutils DESTDIR="${D}" install |
| 93 | oe_runmake -C ${B}/utils DESTDIR="${D}" install |
| 94 | oe_runmake -C ${B}/parser DESTDIR="${D}" install |
| 95 | oe_runmake -C ${B}/profiles DESTDIR="${D}" install |
| 96 | |
| 97 | # If perl is disabled this script won't be any good |
| 98 | if ! ${@bb.utils.contains('PACKAGECONFIG','perl','true','false', d)}; then |
| 99 | rm -f ${D}${sbindir}/aa-notify |
| 100 | fi |
| 101 | |
Brad Bishop | 64940c3 | 2019-10-15 07:47:39 -0400 | [diff] [blame] | 102 | if ! ${@bb.utils.contains('PACKAGECONFIG','aa-decode','true','false', d)}; then |
| 103 | rm -f ${D}${sbindir}/aa-decode |
| 104 | fi |
| 105 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 106 | if test -z "${HTTPD}" ; then |
| 107 | oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install |
| 108 | fi |
| 109 | |
| 110 | if test -z "${PAMLIB}" ; then |
| 111 | oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install |
| 112 | fi |
| 113 | |
| 114 | # aa-easyprof is installed by python-tools-setup.py, fix it up |
| 115 | sed -i -e 's:/usr/bin/env.*:/usr/bin/python3:' ${D}${bindir}/aa-easyprof |
| 116 | chmod 0755 ${D}${bindir}/aa-easyprof |
| 117 | |
| 118 | install ${WORKDIR}/apparmor ${D}/${INIT_D_DIR}/apparmor |
| 119 | install ${WORKDIR}/functions ${D}/lib/apparmor |
Brad Bishop | 5b842c8 | 2019-10-21 08:43:46 -0400 | [diff] [blame] | 120 | sed -i -e 's/getconf _NPROCESSORS_ONLN/nproc/' ${D}/lib/apparmor/functions |
| 121 | sed -i -e 's/ls -AU/ls -A/' ${D}/lib/apparmor/functions |
| 122 | |
| 123 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
| 124 | install -d ${D}${systemd_system_unitdir} |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 125 | install -m 0644 ${WORKDIR}/apparmor.service ${D}${systemd_system_unitdir} |
Brad Bishop | 5b842c8 | 2019-10-21 08:43:46 -0400 | [diff] [blame] | 126 | fi |
| 127 | } |
| 128 | |
| 129 | #Building ptest on arm fails. |
| 130 | do_compile_ptest_aarch64 () { |
| 131 | : |
| 132 | } |
| 133 | |
| 134 | do_compile_ptest_arm () { |
| 135 | : |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | do_compile_ptest () { |
| 139 | oe_runmake -C ${B}/tests/regression/apparmor |
| 140 | oe_runmake -C ${B}/parser/tst |
| 141 | oe_runmake -C ${B}/libraries/libapparmor |
| 142 | } |
| 143 | |
| 144 | do_install_ptest () { |
| 145 | t=${D}/${PTEST_PATH}/testsuite |
| 146 | install -d ${t} |
| 147 | install -d ${t}/tests/regression/apparmor |
| 148 | cp -rf ${B}/tests/regression/apparmor ${t}/tests/regression |
| 149 | |
| 150 | install -d ${t}/parser/tst |
| 151 | cp -rf ${B}/parser/tst ${t}/parser |
| 152 | cp ${B}/parser/apparmor_parser ${t}/parser |
| 153 | cp ${B}/parser/frob_slack_rc ${t}/parser |
| 154 | |
| 155 | install -d ${t}/libraries/libapparmor |
| 156 | cp -rf ${B}/libraries/libapparmor ${t}/libraries |
| 157 | |
| 158 | install -d ${t}/common |
| 159 | cp -rf ${B}/common ${t} |
| 160 | |
| 161 | install -d ${t}/binutils |
| 162 | cp -rf ${B}/binutils ${t} |
| 163 | } |
| 164 | |
Brad Bishop | 5b842c8 | 2019-10-21 08:43:46 -0400 | [diff] [blame] | 165 | #Building ptest on arm fails. |
| 166 | do_install_ptest_aarch64 () { |
| 167 | : |
| 168 | } |
| 169 | |
| 170 | do_install_ptest_arm() { |
| 171 | : |
| 172 | } |
| 173 | |
Brad Bishop | 49e29a1 | 2019-09-01 15:21:06 -0400 | [diff] [blame] | 174 | pkg_postinst_ontarget_${PN} () { |
| 175 | if [ ! -d /etc/apparmor.d/cache ] ; then |
| 176 | mkdir /etc/apparmor.d/cache |
| 177 | fi |
| 178 | } |
| 179 | |
Brad Bishop | 5b842c8 | 2019-10-21 08:43:46 -0400 | [diff] [blame] | 180 | # We need the init script so don't rm it |
| 181 | RMINITDIR_class-target_remove = " rm_sysvinit_initddir" |
| 182 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 183 | INITSCRIPT_PACKAGES = "${PN}" |
| 184 | INITSCRIPT_NAME = "apparmor" |
| 185 | INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ." |
| 186 | |
| 187 | SYSTEMD_PACKAGES = "${PN}" |
| 188 | SYSTEMD_SERVICE_${PN} = "apparmor.service" |
Brad Bishop | 5b842c8 | 2019-10-21 08:43:46 -0400 | [diff] [blame] | 189 | SYSTEMD_AUTO_ENABLE ?= "enable" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 190 | |
| 191 | PACKAGES += "mod-${PN}" |
| 192 | |
| 193 | FILES_${PN} += "/lib/apparmor/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}" |
| 194 | FILES_mod-${PN} = "${libdir}/apache2/modules/*" |
| 195 | |
Andrew Geissler | 064f75b | 2020-06-27 00:14:46 -0500 | [diff] [blame] | 196 | # Add coreutils and findutils only if sysvinit scripts are in use |
| 197 | RDEPENDS_${PN} += "${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 198 | RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" |
| 199 | RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash" |
Brad Bishop | 64940c3 | 2019-10-15 07:47:39 -0400 | [diff] [blame] | 200 | |
| 201 | PRIVATE_LIBS_${PN}-ptest = "libapparmor.so*" |