[Buildroot] [git commit] policycoreutils: rework host installation

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Wed Jul 5 14:06:53 UTC 2017


commit: https://git.buildroot.net/buildroot/commit/?id=44874939f834fb380501f0fe4d12870ba7acef18
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

policycoreutils has a pretty peculiar interpretation of DESTDIR and
PREFIX.  PREFIX is not consistently used: some installation paths and
include paths are forced to $(DESTDIR)/usr/... . In other cases,
PREFIX is indeed used. PREFIX defaults to $(DESTDIR)/usr

Try to be a little bit more correct by passing both DESTDIR and PREFIX,
both set to $(HOST_DIR). This is not a complete fix: some things are
still installed in $(HOST_DIR)/usr - but nothing we care about (just
manpages, systemd services, ...). More importantly, however, it still
looks for e.g. D-Bus in $(DESTDIR)/usr/include/dbus-1.0.

Still, it's better than nothing.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 package/policycoreutils/policycoreutils.mk | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/package/policycoreutils/policycoreutils.mk b/package/policycoreutils/policycoreutils.mk
index 480fd6e..6fec4af 100644
--- a/package/policycoreutils/policycoreutils.mk
+++ b/package/policycoreutils/policycoreutils.mk
@@ -87,13 +87,18 @@ HOST_POLICYCOREUTILS_DEPENDENCIES = \
 # Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h
 # large file support.
 # See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information
+# We need to pass DESTDIR at build time because it's used by
+# policycoreutils build system to find headers and libraries.
+# We also need to pass PREFIX because it defaults to $(DESTDIR)/usr
 HOST_POLICYCOREUTILS_MAKE_OPTS = \
 	$(HOST_CONFIGURE_OPTS) \
 	CFLAGS="$(HOST_CFLAGS) -U_FILE_OFFSET_BITS" \
 	CPPFLAGS="$(HOST_CPPFLAGS) -U_FILE_OFFSET_BITS" \
 	PYTHON="$(HOST_DIR)/bin/python" \
 	PYTHON_INSTALL_ARGS="$(HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS)" \
-	ARCH="$(HOSTARCH)"
+	ARCH="$(HOSTARCH)" \
+	DESTDIR=$(HOST_DIR) \
+	PREFIX=$(HOST_DIR)
 
 ifeq ($(BR2_PACKAGE_PYTHON3),y)
 HOST_POLICYCOREUTILS_DEPENDENCIES += host-python3
@@ -112,19 +117,15 @@ HOST_POLICYCOREUTILS_MAKE_DIRS = \
 	semodule_package setfiles restorecond \
 	audit2allow scripts semanage sepolicy
 
-# We need to pass DESTDIR at build time because it's used by
-# policycoreutils build system to find headers and libraries.
 define HOST_POLICYCOREUTILS_BUILD_CMDS
 	$(foreach d,$(HOST_POLICYCOREUTILS_MAKE_DIRS),
-		$(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) \
-			DESTDIR=$(HOST_DIR) all
+		$(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) all
 	)
 endef
 
 define HOST_POLICYCOREUTILS_INSTALL_CMDS
 	$(foreach d,$(HOST_POLICYCOREUTILS_MAKE_DIRS),
-		$(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) \
-			DESTDIR=$(HOST_DIR) install
+		$(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) install
 	)
 	# Fix python paths
 	$(SED) 's%/usr/bin/%$(HOST_DIR)/bin/%g' $(HOST_DIR)/bin/audit2allow


More information about the buildroot mailing list