Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [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 = " \ |
| 17 | http://archive.ubuntu.com/ubuntu/pool/main/a/${BPN}/${BPN}_${PV}.orig.tar.gz \ |
| 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 \ |
| 24 | file://run-ptest \ |
| 25 | " |
| 26 | |
| 27 | SRC_URI[md5sum] = "49054f58042f8e51ea92cc866575a833" |
| 28 | SRC_URI[sha256sum] = "8a2b0cd083faa4d0640f579024be3a629faa7db3b99540798a1a050e2eaba056" |
| 29 | |
| 30 | PARALLEL_MAKE = "" |
| 31 | |
| 32 | inherit pkgconfig autotools-brokensep update-rc.d python3native perlnative ptest cpan |
| 33 | inherit ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)} |
| 34 | |
| 35 | S = "${WORKDIR}/apparmor-${PV}" |
| 36 | |
| 37 | PACKAGECONFIG ?="man python perl" |
| 38 | PACKAGECONFIG[man] = "--enable-man-pages, --disable-man-pages" |
| 39 | PACKAGECONFIG[python] = "--with-python, --without-python, python3 swig-native" |
| 40 | PACKAGECONFIG[perl] = "--with-perl, --without-perl, perl perl-native swig-native" |
| 41 | PACKAGECONFIG[apache2] = ",,apache2," |
| 42 | |
| 43 | PAMLIB="${@bb.utils.contains('DISTRO_FEATURES', 'pam', '1', '0', d)}" |
| 44 | HTTPD="${@bb.utils.contains('PACKAGECONFIG', 'apache2', '1', '0', d)}" |
| 45 | |
| 46 | |
| 47 | python() { |
| 48 | if 'apache2' in d.getVar('PACKAGECONFIG').split() and \ |
| 49 | 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split(): |
| 50 | raise bb.parse.SkipRecipe('Requires meta-webserver to be present.') |
| 51 | } |
| 52 | |
| 53 | CONFIGUREOPTS_remove = "--disable-static" |
| 54 | EXTRA_OECONF_append = " --enable-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 | sed -i -e 's#^YACC.*#YACC := bison#' ${S}/parser/Makefile |
| 64 | sed -i -e 's#^LEX.*#LEX := flex#' ${S}/parser/Makefile |
| 65 | } |
| 66 | |
| 67 | do_compile () { |
| 68 | oe_runmake -C ${B}/libraries/libapparmor |
| 69 | oe_runmake -C ${B}/binutils |
| 70 | oe_runmake -C ${B}/utils |
| 71 | oe_runmake -C ${B}/parser |
| 72 | oe_runmake -C ${B}/profiles |
| 73 | |
| 74 | if test -z "${HTTPD}" ; then |
| 75 | oe_runmake -C ${B}/changehat/mod_apparmor |
| 76 | fi |
| 77 | |
| 78 | if test -z "${PAMLIB}" ; then |
| 79 | oe_runmake -C ${B}/changehat/pam_apparmor |
| 80 | fi |
| 81 | } |
| 82 | |
| 83 | do_install () { |
| 84 | install -d ${D}/${INIT_D_DIR} |
| 85 | install -d ${D}/lib/apparmor |
| 86 | |
| 87 | oe_runmake -C ${B}/libraries/libapparmor DESTDIR="${D}" install |
| 88 | oe_runmake -C ${B}/binutils DESTDIR="${D}" install |
| 89 | oe_runmake -C ${B}/utils DESTDIR="${D}" install |
| 90 | oe_runmake -C ${B}/parser DESTDIR="${D}" install |
| 91 | oe_runmake -C ${B}/profiles DESTDIR="${D}" install |
| 92 | |
| 93 | if test -z "${HTTPD}" ; then |
| 94 | oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install |
| 95 | fi |
| 96 | |
| 97 | if test -z "${PAMLIB}" ; then |
| 98 | oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install |
| 99 | fi |
| 100 | |
| 101 | # aa-easyprof is installed by python-tools-setup.py, fix it up |
| 102 | sed -i -e 's:/usr/bin/env.*:/usr/bin/python3:' ${D}${bindir}/aa-easyprof |
| 103 | chmod 0755 ${D}${bindir}/aa-easyprof |
| 104 | |
| 105 | install ${WORKDIR}/apparmor ${D}/${INIT_D_DIR}/apparmor |
| 106 | install ${WORKDIR}/functions ${D}/lib/apparmor |
| 107 | if [ "${VIRTUAL-RUNTIME_init_manager}" = "systemd" ]; then |
| 108 | install -d ${D}${systemd_system_unitdir} |
| 109 | install ${WORKDIR}/apparmor.service \ |
| 110 | ${D}${systemd_system_unitdir} |
| 111 | fi |
| 112 | } |
| 113 | |
| 114 | do_compile_ptest () { |
| 115 | oe_runmake -C ${B}/tests/regression/apparmor |
| 116 | oe_runmake -C ${B}/parser/tst |
| 117 | oe_runmake -C ${B}/libraries/libapparmor |
| 118 | } |
| 119 | |
| 120 | do_install_ptest () { |
| 121 | t=${D}/${PTEST_PATH}/testsuite |
| 122 | install -d ${t} |
| 123 | install -d ${t}/tests/regression/apparmor |
| 124 | cp -rf ${B}/tests/regression/apparmor ${t}/tests/regression |
| 125 | |
| 126 | install -d ${t}/parser/tst |
| 127 | cp -rf ${B}/parser/tst ${t}/parser |
| 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 | INITSCRIPT_PACKAGES = "${PN}" |
| 142 | INITSCRIPT_NAME = "apparmor" |
| 143 | INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ." |
| 144 | |
| 145 | SYSTEMD_PACKAGES = "${PN}" |
| 146 | SYSTEMD_SERVICE_${PN} = "apparmor.service" |
| 147 | SYSTEMD_AUTO_ENABLE = "disable" |
| 148 | |
| 149 | PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'mod-${PN}', '', d)}" |
| 150 | |
| 151 | FILES_${PN} += "/lib/apparmor/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}" |
| 152 | FILES_mod-${PN} = "${libdir}/apache2/modules/*" |
| 153 | |
| 154 | ALLOW_EMPTY_${PN} = "1" |
| 155 | |
| 156 | RDEPENDS_${PN} += "bash lsb" |
| 157 | RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG','python','python3 python3-modules','', d)}" |
| 158 | RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" |
| 159 | RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib" |