kumquat-buildroot/package/apparmor/apparmor.mk

98 lines
2.9 KiB
Makefile
Raw Normal View History

################################################################################
#
# apparmor
#
################################################################################
# When updating the version here, please also update the libapparmor package
APPARMOR_VERSION_MAJOR = 3.0
APPARMOR_VERSION = $(APPARMOR_VERSION_MAJOR).3
APPARMOR_SITE = https://launchpad.net/apparmor/$(APPARMOR_VERSION_MAJOR)/$(APPARMOR_VERSION)/+download
APPARMOR_DL_SUBDIR = libapparmor
APPARMOR_LICENSE = GPL-2.0
APPARMOR_LICENSE_FILES = LICENSE parser/COPYING.GPL
APPARMOR_CPE_ID_VENDOR = canonical
APPARMOR_DEPENDENCIES = libapparmor
APPARMOR_TOOLS = parser
APPARMOR_MAKE_OPTS = USE_SYSTEM=1 DISTRO=unknown POD2MAN=true POD2HTML=true
ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
APPARMOR_DEPENDENCIES += gettext
APPARMOR_MAKE_OPTS += WITH_LIBINTL=1
endif
ifeq ($(BR2_PACKAGE_APPARMOR_BINUTILS),y)
APPARMOR_TOOLS += binutils
endif
ifeq ($(BR2_PACKAGE_APPARMOR_UTILS),y)
APPARMOR_DEPENDENCIES += host-python3 python3
APPARMOR_TOOLS += utils
APPARMOR_MAKE_OPTS += PYTHON=$(HOST_DIR)/bin/python3
ifeq ($(BR2_PACKAGE_APPARMOR_UTILS_EXTRA),)
define APPARMOR_UTILS_NO_EXTRA
$(Q)rm -f $(addprefix $(TARGET_DIR)/usr/sbin/,aa-decode aa-notify aa-remove-unknown)
endef
APPARMOR_POST_INSTALL_TARGET_HOOKS += APPARMOR_UTILS_NO_EXTRA
endif # BR2_PACKAGE_APPARMOR_UTILS_EXTRA
endif # BR2_PACKAGE_APPARMOR_UTILS
ifeq ($(BR2_PACKAGE_APPARMOR_PROFILES),y)
APPARMOR_TOOLS += profiles
endif
ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
APPARMOR_DEPENDENCIES += linux-pam
APPARMOR_TOOLS += changehat/pam_apparmor
endif
ifeq ($(BR2_PACKAGE_APACHE),y)
APPARMOR_DEPENDENCIES += apache
APPARMOR_TOOLS += changehat/mod_apparmor
APPARMOR_MAKE_OPTS += APXS=$(STAGING_DIR)/usr/bin/apxs
package/apparmor: fix per-package build with apache Per-package build of apparmor with apache fails on: /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apparmor/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/apxs -c mod_apparmor.c -L/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apparmor/host/bin/../x86_64-buildroot-linux-musl/sysroot/usr/lib -lapparmor /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../usr/build-1/libtool --silent --mode=compile /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/bin/x86_64-linux-gcc -prefer-pic -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/include -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../usr/include/apr-1 -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../usr/include/apr-1 -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../../../x86_64-buildroot-lin ux-musl/sysroot/usr/include -c -o mod_apparmor.lo mod_apparmor.c && touch mod_apparmor.slo mod_apparmor.c:28:10: fatal error: sys/apparmor.h: No such file or directory #include <sys/apparmor.h> ^~~~~~~~~~~~~~~~ The issue is that sys/appamor.h is not installed in the apache per-package directory which is mangled by APACHE_FIX_STAGING_APACHE_CONFIG, i.e. /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/include So implement the same workaround made on apache to replace those wrong apache paths by apparmor paths in apxs binary and its configuration file (i.e. config_vars.mk) as suggested by Thomas Petazzoni and Yann E. Morin during review of the first iteration of this patch Fixes: - http://autobuild.buildroot.org/results/ef1fcd57e0c09a2806bf2272bb21df6d3300b45b Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-09-05 23:47:36 +02:00
ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
define APPARMOR_FIXUP_APXS
$(SED) "s@$(PER_PACKAGE_DIR)/[^/]\+/@$(PER_PACKAGE_DIR)/apparmor/@g" \
$(STAGING_DIR)/usr/bin/apxs \
$(STAGING_DIR)/usr/build/config_vars.mk \
$(STAGING_DIR)/usr/build-1/libtool
package/apparmor: fix per-package build with apache Per-package build of apparmor with apache fails on: /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apparmor/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/apxs -c mod_apparmor.c -L/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apparmor/host/bin/../x86_64-buildroot-linux-musl/sysroot/usr/lib -lapparmor /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../usr/build-1/libtool --silent --mode=compile /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/bin/x86_64-linux-gcc -prefer-pic -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/include -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../usr/include/apr-1 -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../usr/include/apr-1 -I/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/bin/../../../../x86_64-buildroot-lin ux-musl/sysroot/usr/include -c -o mod_apparmor.lo mod_apparmor.c && touch mod_apparmor.slo mod_apparmor.c:28:10: fatal error: sys/apparmor.h: No such file or directory #include <sys/apparmor.h> ^~~~~~~~~~~~~~~~ The issue is that sys/appamor.h is not installed in the apache per-package directory which is mangled by APACHE_FIX_STAGING_APACHE_CONFIG, i.e. /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/per-package/apache/host/x86_64-buildroot-linux-musl/sysroot/usr/include So implement the same workaround made on apache to replace those wrong apache paths by apparmor paths in apxs binary and its configuration file (i.e. config_vars.mk) as suggested by Thomas Petazzoni and Yann E. Morin during review of the first iteration of this patch Fixes: - http://autobuild.buildroot.org/results/ef1fcd57e0c09a2806bf2272bb21df6d3300b45b Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-09-05 23:47:36 +02:00
endef
APPARMOR_POST_CONFIGURE_HOOKS += APPARMOR_FIXUP_APXS
endif
endif
define APPARMOR_BUILD_CMDS
$(foreach tool,$(APPARMOR_TOOLS),\
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
$(MAKE) -C $(@D)/$(tool) $(APPARMOR_MAKE_OPTS)
)
endef
define APPARMOR_INSTALL_TARGET_CMDS
$(foreach tool,$(APPARMOR_TOOLS),\
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
$(MAKE) -C $(@D)/$(tool) $(APPARMOR_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) install
)
endef
# Despite its name, apparmor.systemd is a sysv-init compatible startup script
define APPARMOR_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 $(@D)/parser/apparmor.systemd \
$(TARGET_DIR)/etc/init.d/S00apparmor
endef
define APPARMOR_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 0755 $(@D)/parser/apparmor.systemd \
$(TARGET_DIR)/lib/apparmor/apparmor.systemd
$(INSTALL) -D -m 0644 $(@D)/parser/apparmor.service \
$(TARGET_DIR)/usr/lib/systemd/system/apparmor.service
endef
$(eval $(generic-package))