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