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 \ |
| 24 | file://run-ptest \ |
| 25 | " |
| 26 | |
Brad Bishop | 49e29a1 | 2019-09-01 15:21:06 -0400 | [diff] [blame] | 27 | SRCREV = "2f9d9ea7e01a115b29858455d3b1b5c6a0bab75c" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 28 | S = "${WORKDIR}/git" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | |
| 30 | PARALLEL_MAKE = "" |
| 31 | |
| 32 | inherit pkgconfig autotools-brokensep update-rc.d python3native perlnative ptest cpan manpages systemd |
| 33 | |
| 34 | PACKAGECONFIG ??= "python perl" |
| 35 | PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages" |
| 36 | PACKAGECONFIG[python] = "--with-python, --without-python, python3 swig-native" |
| 37 | PACKAGECONFIG[perl] = "--with-perl, --without-perl, perl perl-native swig-native" |
| 38 | PACKAGECONFIG[apache2] = ",,apache2," |
| 39 | |
| 40 | PAMLIB="${@bb.utils.contains('DISTRO_FEATURES', 'pam', '1', '0', d)}" |
| 41 | HTTPD="${@bb.utils.contains('PACKAGECONFIG', 'apache2', '1', '0', d)}" |
| 42 | |
| 43 | |
| 44 | python() { |
| 45 | if 'apache2' in d.getVar('PACKAGECONFIG').split() and \ |
| 46 | 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split(): |
| 47 | raise bb.parse.SkipRecipe('Requires meta-webserver to be present.') |
| 48 | } |
| 49 | |
| 50 | DISABLE_STATIC = "" |
| 51 | |
| 52 | do_configure() { |
| 53 | cd ${S}/libraries/libapparmor |
| 54 | aclocal |
| 55 | autoconf --force |
| 56 | libtoolize --automake -c --force |
| 57 | automake -ac |
| 58 | ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
| 59 | } |
| 60 | |
| 61 | do_compile () { |
| 62 | # Fixes: |
| 63 | # | sed -ie 's///g' Makefile.perl |
| 64 | # | sed: -e expression #1, char 0: no previous regular expression |
| 65 | #| Makefile:478: recipe for target 'Makefile.perl' failed |
| 66 | sed -i "s@sed -ie 's///g' Makefile.perl@@" ${S}/libraries/libapparmor/swig/perl/Makefile |
| 67 | |
| 68 | |
| 69 | oe_runmake -C ${B}/libraries/libapparmor |
| 70 | oe_runmake -C ${B}/binutils |
| 71 | oe_runmake -C ${B}/utils |
| 72 | oe_runmake -C ${B}/parser |
| 73 | oe_runmake -C ${B}/profiles |
| 74 | |
| 75 | if test -z "${HTTPD}" ; then |
| 76 | oe_runmake -C ${B}/changehat/mod_apparmor |
| 77 | fi |
| 78 | |
| 79 | if test -z "${PAMLIB}" ; then |
| 80 | oe_runmake -C ${B}/changehat/pam_apparmor |
| 81 | fi |
| 82 | } |
| 83 | |
| 84 | do_install () { |
| 85 | install -d ${D}/${INIT_D_DIR} |
| 86 | install -d ${D}/lib/apparmor |
| 87 | |
| 88 | oe_runmake -C ${B}/libraries/libapparmor DESTDIR="${D}" install |
| 89 | oe_runmake -C ${B}/binutils DESTDIR="${D}" install |
| 90 | oe_runmake -C ${B}/utils DESTDIR="${D}" install |
| 91 | oe_runmake -C ${B}/parser DESTDIR="${D}" install |
| 92 | oe_runmake -C ${B}/profiles DESTDIR="${D}" install |
| 93 | |
| 94 | # If perl is disabled this script won't be any good |
| 95 | if ! ${@bb.utils.contains('PACKAGECONFIG','perl','true','false', d)}; then |
| 96 | rm -f ${D}${sbindir}/aa-notify |
| 97 | fi |
| 98 | |
| 99 | if test -z "${HTTPD}" ; then |
| 100 | oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install |
| 101 | fi |
| 102 | |
| 103 | if test -z "${PAMLIB}" ; then |
| 104 | oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install |
| 105 | fi |
| 106 | |
| 107 | # aa-easyprof is installed by python-tools-setup.py, fix it up |
| 108 | sed -i -e 's:/usr/bin/env.*:/usr/bin/python3:' ${D}${bindir}/aa-easyprof |
| 109 | chmod 0755 ${D}${bindir}/aa-easyprof |
| 110 | |
| 111 | install ${WORKDIR}/apparmor ${D}/${INIT_D_DIR}/apparmor |
| 112 | install ${WORKDIR}/functions ${D}/lib/apparmor |
| 113 | install -d ${D}${systemd_system_unitdir} |
| 114 | install ${WORKDIR}/apparmor.service ${D}${systemd_system_unitdir} |
| 115 | } |
| 116 | |
| 117 | do_compile_ptest () { |
| 118 | oe_runmake -C ${B}/tests/regression/apparmor |
| 119 | oe_runmake -C ${B}/parser/tst |
| 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 | install -d ${t}/parser/tst |
| 130 | cp -rf ${B}/parser/tst ${t}/parser |
| 131 | cp ${B}/parser/apparmor_parser ${t}/parser |
| 132 | cp ${B}/parser/frob_slack_rc ${t}/parser |
| 133 | |
| 134 | install -d ${t}/libraries/libapparmor |
| 135 | cp -rf ${B}/libraries/libapparmor ${t}/libraries |
| 136 | |
| 137 | install -d ${t}/common |
| 138 | cp -rf ${B}/common ${t} |
| 139 | |
| 140 | install -d ${t}/binutils |
| 141 | cp -rf ${B}/binutils ${t} |
| 142 | } |
| 143 | |
Brad Bishop | 49e29a1 | 2019-09-01 15:21:06 -0400 | [diff] [blame] | 144 | pkg_postinst_ontarget_${PN} () { |
| 145 | if [ ! -d /etc/apparmor.d/cache ] ; then |
| 146 | mkdir /etc/apparmor.d/cache |
| 147 | fi |
| 148 | } |
| 149 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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 = "disable" |
| 157 | |
| 158 | PACKAGES += "mod-${PN}" |
| 159 | |
| 160 | FILES_${PN} += "/lib/apparmor/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}" |
| 161 | FILES_mod-${PN} = "${libdir}/apache2/modules/*" |
| 162 | |
Brad Bishop | 1fdf4aa | 2019-09-09 14:56:41 -0400 | [diff] [blame] | 163 | RDEPENDS_${PN} += "bash" |
Brad Bishop | 49e29a1 | 2019-09-01 15:21:06 -0400 | [diff] [blame] | 164 | RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 165 | RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" |
| 166 | RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash" |