blob: 62ed611484dc402937f203a1c6ad326327ac45fe [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "AppArmor another MAC control system"
2DESCRIPTION = "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."
8HOMEAPAGE = "http://apparmor.net/"
9SECTION = "admin"
10
11LICENSE = "GPLv2 & GPLv2+ & BSD-3-Clause & LGPLv2.1+"
12LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fd57a4b0bc782d7b80fd431f10bbf9d0"
13
14DEPENDS = "bison-native apr gettext-native coreutils-native"
15
16SRC_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
27SRC_URI[md5sum] = "2439b35266b5a3a461b0a2dba6e863c3"
28SRC_URI[sha256sum] = "844def9926dfda5c7858428d06e44afc80573f9706458b6e7282edbb40b11a30"
29
30PARALLEL_MAKE = ""
31
32inherit pkgconfig autotools-brokensep update-rc.d python3native perlnative ptest cpan manpages systemd
33
34PACKAGECONFIG ??= "python perl"
35PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages"
36PACKAGECONFIG[python] = "--with-python, --without-python, python3 swig-native"
37PACKAGECONFIG[perl] = "--with-perl, --without-perl, perl perl-native swig-native"
38PACKAGECONFIG[apache2] = ",,apache2,"
39
40PAMLIB="${@bb.utils.contains('DISTRO_FEATURES', 'pam', '1', '0', d)}"
41HTTPD="${@bb.utils.contains('PACKAGECONFIG', 'apache2', '1', '0', d)}"
42
43
44python() {
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
50DISABLE_STATIC = ""
51
52do_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
61do_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
84do_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
117do_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
123do_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
144INITSCRIPT_PACKAGES = "${PN}"
145INITSCRIPT_NAME = "apparmor"
146INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ."
147
148SYSTEMD_PACKAGES = "${PN}"
149SYSTEMD_SERVICE_${PN} = "apparmor.service"
150SYSTEMD_AUTO_ENABLE = "disable"
151
152PACKAGES += "mod-${PN}"
153
154FILES_${PN} += "/lib/apparmor/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}"
155FILES_mod-${PN} = "${libdir}/apache2/modules/*"
156
157RDEPENDS_${PN} += "bash lsb"
158RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG','python','python3 python3-modules','', d)}"
159RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}"
160RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash"