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