summaryrefslogtreecommitdiffstats
path: root/recipes-mac/AppArmor/apparmor_3.0.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-mac/AppArmor/apparmor_3.0.bb')
-rw-r--r--recipes-mac/AppArmor/apparmor_3.0.bb184
1 files changed, 184 insertions, 0 deletions
diff --git a/recipes-mac/AppArmor/apparmor_3.0.bb b/recipes-mac/AppArmor/apparmor_3.0.bb
new file mode 100644
index 0000000..9c98199
--- /dev/null
+++ b/recipes-mac/AppArmor/apparmor_3.0.bb
@@ -0,0 +1,184 @@
1SUMMARY = "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 swig-native"
15
16SRC_URI = " \
17 git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-3.0 \
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 file://0001-apparmor-fix-manpage-order.patch \
27 file://0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch \
28 "
29
30SRCREV = "5d51483bfecf556183558644dc8958135397a7e2"
31S = "${WORKDIR}/git"
32
33PARALLEL_MAKE = ""
34
35COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*"
36
37inherit pkgconfig autotools-brokensep update-rc.d python3native perlnative cpan systemd features_check bash-completion
38
39REQUIRED_DISTRO_FEATURES = "apparmor"
40
41PACKAGECONFIG ?= "python perl aa-decode"
42PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages"
43PACKAGECONFIG[python] = "--with-python, --without-python, python3 , python3-core python3-modules"
44PACKAGECONFIG[perl] = "--with-perl, --without-perl, "
45PACKAGECONFIG[apache2] = ",,apache2,"
46PACKAGECONFIG[aa-decode] = ",,,bash"
47
48python() {
49 if 'apache2' in d.getVar('PACKAGECONFIG').split() and \
50 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split():
51 raise bb.parse.SkipRecipe('Requires meta-webserver to be present.')
52}
53
54DISABLE_STATIC = ""
55
56do_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}
64
65do_compile () {
66 sed -i "s@sed -ie 's///g' Makefile.perl@@" ${S}/libraries/libapparmor/swig/perl/Makefile
67 oe_runmake -C ${B}/libraries/libapparmor
68 oe_runmake -C ${B}/binutils
69 oe_runmake -C ${B}/utils
70 oe_runmake -C ${B}/parser
71 oe_runmake -C ${B}/profiles
72
73 if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then
74 oe_runmake -C ${B}/changehat/mod_apparmor
75 fi
76
77 if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
78 oe_runmake -C ${B}/changehat/pam_apparmor
79 fi
80}
81
82do_install () {
83 install -d ${D}/${INIT_D_DIR}
84 install -d ${D}/lib/apparmor
85 oe_runmake -C ${B}/libraries/libapparmor DESTDIR="${D}" install
86 oe_runmake -C ${B}/binutils DESTDIR="${D}" install
87 oe_runmake -C ${B}/utils DESTDIR="${D}" install
88 oe_runmake -C ${B}/parser DESTDIR="${D}" install
89 oe_runmake -C ${B}/profiles DESTDIR="${D}" install
90
91 if ! ${@bb.utils.contains('PACKAGECONFIG','aa-decode','true','false', d)}; then
92 rm -f ${D}${sbindir}/aa-decode
93 fi
94
95 if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then
96 oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install
97 fi
98
99 if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then
100 install -d ${D}/lib/security
101 oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install
102 fi
103
104 install -m 755 ${WORKDIR}/apparmor ${D}/${INIT_D_DIR}/apparmor
105 install -m 755 ${WORKDIR}/functions ${D}/lib/apparmor
106
107 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
108 install -d ${D}${systemd_system_unitdir}
109 install -m 0644 ${WORKDIR}/apparmor.service ${D}${systemd_system_unitdir}
110 fi
111}
112
113#Building ptest on arm fails.
114do_compile_ptest_aarch64 () {
115 :
116}
117
118do_compile_ptest_arm () {
119 :
120}
121
122do_compile_ptest () {
123 sed -i -e 's/cpp \-dM/${HOST_PREFIX}gcc \-dM/' ${B}/tests/regression/apparmor/Makefile
124 oe_runmake -C ${B}/tests/regression/apparmor USE_SYSTEM=0
125 oe_runmake -C ${B}/libraries/libapparmor
126}
127
128do_install_ptest () {
129 t=${D}/${PTEST_PATH}/testsuite
130 install -d ${t}
131 install -d ${t}/tests/regression/apparmor
132 cp -rf ${B}/tests/regression/apparmor ${t}/tests/regression
133
134 cp ${B}/parser/apparmor_parser ${t}/parser
135 cp ${B}/parser/frob_slack_rc ${t}/parser
136
137 install -d ${t}/libraries/libapparmor
138 cp -rf ${B}/libraries/libapparmor ${t}/libraries
139
140 install -d ${t}/common
141 cp -rf ${B}/common ${t}
142
143 install -d ${t}/binutils
144 cp -rf ${B}/binutils ${t}
145}
146
147#Building ptest on arm fails.
148do_install_ptest_aarch64 () {
149 :
150}
151
152do_install_ptest_arm() {
153 :
154}
155
156pkg_postinst_ontarget_${PN} () {
157if [ ! -d /etc/apparmor.d/cache ] ; then
158 mkdir /etc/apparmor.d/cache
159fi
160}
161
162# We need the init script so don't rm it
163RMINITDIR_class-target_remove = " rm_sysvinit_initddir"
164
165INITSCRIPT_PACKAGES = "${PN}"
166INITSCRIPT_NAME = "apparmor"
167INITSCRIPT_PARAMS = "start 16 2 3 4 5 . stop 35 0 1 6 ."
168
169SYSTEMD_PACKAGES = "${PN}"
170SYSTEMD_SERVICE_${PN} = "apparmor.service"
171SYSTEMD_AUTO_ENABLE ?= "enable"
172
173PACKAGES += "mod-${PN}"
174
175FILES_${PN} += "/lib/apparmor/ /lib/security/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}"
176FILES_mod-${PN} = "${libdir}/apache2/modules/*"
177
178# Add coreutils and findutils only if sysvinit scripts are in use
179RDEPENDS_${PN} += "glibc-utils ${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}"
180RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}"
181RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash"
182
183INSANE_SKIP_${PN} = "ldflags"
184PRIVATE_LIBS_${PN}-ptest = "libapparmor.so*"