policycoreutils: rework host installation
authorArnout Vandecappelle <arnout@mind.be>
Wed, 5 Jul 2017 11:14:52 +0000 (13:14 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 5 Jul 2017 14:06:53 +0000 (16:06 +0200)
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@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/policycoreutils/policycoreutils.mk

index 480fd6e09d50ea6fde8b03b31cd0ef70be3927e6..6fec4afb25d5347c450c6cdef626705aa5292581 100644 (file)
@@ -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