[OpenWrt-Devel,6/6] packages: Install files into staging directory in Host/Install
diff mbox series

Message ID 20190614183534.14768-6-jeffery.to@gmail.com
State New
Headers show
Series
  • [OpenWrt-Devel,1/6] build: Add auto file tracking / uninstall for Host/Install
Related show

Commit Message

Jeffery To June 14, 2019, 6:35 p.m. UTC
This updates Host/Install for packages to install files into the given
staging directory, instead of into $(STAGING_DIR_HOSTPKG) (or
$(STAGING_DIR_HOST)) directly, so that files can be automatically
tracked and uninstalled.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
---
 package/libs/gettext/Makefile       |  8 ++++----
 package/libs/libiconv/Makefile      | 12 ++++++------
 package/system/fwtool/Makefile      |  1 +
 package/system/iucode-tool/Makefile |  5 ++++-
 package/system/opkg/Makefile        |  4 +++-
 package/utils/bsdiff/Makefile       |  8 ++------
 package/utils/bzip2/Makefile        |  8 +++-----
 package/utils/lua/Makefile          |  9 +++------
 8 files changed, 26 insertions(+), 29 deletions(-)

Patch
diff mbox series

diff --git a/package/libs/gettext/Makefile b/package/libs/gettext/Makefile
index f37c4e4e74..2eff4410db 100644
--- a/package/libs/gettext/Makefile
+++ b/package/libs/gettext/Makefile
@@ -47,11 +47,11 @@  define Host/Compile
 endef
 
 define Host/Install
-	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/include
-	$(INSTALL_DATA) ./src/include/libintl.h $(STAGING_DIR_HOSTPKG)/include/
+	$(INSTALL_DIR) $(1)/include
+	$(INSTALL_DATA) ./src/include/libintl.h $(1)/include/
 
-	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/share/aclocal
-	$(INSTALL_DATA) ./src/m4/* $(STAGING_DIR_HOSTPKG)/share/aclocal/
+	$(INSTALL_DIR) $(1)/share/aclocal
+	$(INSTALL_DATA) ./src/m4/* $(1)/share/aclocal/
 endef
 
 define Package/libintl/install
diff --git a/package/libs/libiconv/Makefile b/package/libs/libiconv/Makefile
index 4d7dcd3498..7e9baa4129 100644
--- a/package/libs/libiconv/Makefile
+++ b/package/libs/libiconv/Makefile
@@ -65,14 +65,14 @@  define Host/Compile
 endef
 
 define Host/Install
-	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib
-	$(INSTALL_DATA) $(HOST_BUILD_DIR)/libiconv.a $(STAGING_DIR_HOSTPKG)/lib/
+	$(INSTALL_DIR) $(1)/lib
+	$(INSTALL_DATA) $(HOST_BUILD_DIR)/libiconv.a $(1)/lib/
 
-	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/include
-	$(INSTALL_DATA) ./src/include/iconv.h $(STAGING_DIR_HOSTPKG)/include/
+	$(INSTALL_DIR) $(1)/include
+	$(INSTALL_DATA) ./src/include/iconv.h $(1)/include/
 
-	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/share/aclocal
-	$(INSTALL_DATA) ./src/m4/* $(STAGING_DIR_HOSTPKG)/share/aclocal/
+	$(INSTALL_DIR) $(1)/share/aclocal
+	$(INSTALL_DATA) ./src/m4/* $(1)/share/aclocal/
 endef
 
 $(eval $(call HostBuild))
diff --git a/package/system/fwtool/Makefile b/package/system/fwtool/Makefile
index 901081c1f4..86ec807281 100644
--- a/package/system/fwtool/Makefile
+++ b/package/system/fwtool/Makefile
@@ -31,6 +31,7 @@  define Host/Compile
 endef
 
 define Host/Install
+	$(INSTALL_DIR) $(1)/bin
 	$(INSTALL_BIN) $(HOST_BUILD_DIR)/fwtool $(1)/bin/
 endef
 
diff --git a/package/system/iucode-tool/Makefile b/package/system/iucode-tool/Makefile
index 5f4cfb6238..afa75f61c6 100644
--- a/package/system/iucode-tool/Makefile
+++ b/package/system/iucode-tool/Makefile
@@ -22,6 +22,8 @@  PKG_LICENSE:=GPL-2.0
 
 PKG_INSTALL:=1
 
+HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST)
+
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/host-build.mk
 
@@ -40,7 +42,8 @@  define Package/iucode-tool/install
 endef
 
 define Host/Install
-	$(INSTALL_BIN) $(HOST_BUILD_DIR)/iucode_tool $(STAGING_DIR_HOST)/bin/iucode_tool
+	$(INSTALL_DIR) $(1)/bin
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/iucode_tool $(1)/bin/iucode_tool
 endef
 
 $(eval $(call HostBuild))
diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
index 313a058933..2f6735895a 100644
--- a/package/system/opkg/Makefile
+++ b/package/system/opkg/Makefile
@@ -33,6 +33,7 @@  HOST_BUILD_PARALLEL:=1
 PKG_INSTALL:=1
 
 HOST_BUILD_DEPENDS:=libubox/host
+HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST)
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/host-build.mk
@@ -96,7 +97,8 @@  define Package/opkg/install
 endef
 
 define Host/Install
-	$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
+	$(INSTALL_DIR) $(1)/bin
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(1)/bin/opkg
 endef
 
 $(eval $(call BuildPackage,opkg))
diff --git a/package/utils/bsdiff/Makefile b/package/utils/bsdiff/Makefile
index db1f320872..b9e662b3ed 100644
--- a/package/utils/bsdiff/Makefile
+++ b/package/utils/bsdiff/Makefile
@@ -58,11 +58,6 @@  define Package/bspatch/install
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bspatch $(1)/usr/bin/bspatch
 endef
 
-define Host/Install
-	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
-	$(MAKE) -C $(HOST_BUILD_DIR) PREFIX=$(STAGING_DIR_HOSTPKG)/ install
-endef
-
 define Host/Compile
 	$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) \
 		-o $(HOST_BUILD_DIR)/bsdiff \
@@ -70,7 +65,8 @@  define Host/Compile
 endef
 
 define Host/Install
-	$(INSTALL_BIN) $(HOST_BUILD_DIR)/bsdiff $(STAGING_DIR_HOSTPKG)/bin/
+	$(INSTALL_DIR) $(1)/bin
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/bsdiff $(1)/bin/
 endef
 
 $(eval $(call HostBuild))
diff --git a/package/utils/bzip2/Makefile b/package/utils/bzip2/Makefile
index 9c64d2264a..6222bc9ed7 100644
--- a/package/utils/bzip2/Makefile
+++ b/package/utils/bzip2/Makefile
@@ -97,14 +97,12 @@  HOST_MAKE_FLAGS+= \
 	LDFLAGS="$(HOST_LDFLAGS)" \
 	all
 
+HOST_MAKE_INSTALL_FLAGS += \
+	PREFIX="$(HOST_INSTALL_DIR)/$(HOST_BUILD_PREFIX)"
+
 HOST_CONFIGURE_ARGS+= \
 	--prefix=$(STAGING_DIR_HOSTPKG)
 
-define Host/Install
-	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
-	$(MAKE) -C $(HOST_BUILD_DIR) PREFIX=$(STAGING_DIR_HOSTPKG)/ install
-endef
-
 $(eval $(call HostBuild))
 
 $(eval $(call BuildPackage,libbz2))
diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile
index 077a60fbf3..a8a99d2219 100644
--- a/package/utils/lua/Makefile
+++ b/package/utils/lua/Makefile
@@ -123,18 +123,15 @@  else
 	endif
 endif
 
+HOST_MAKE_INSTALL_FLAGS += \
+	INSTALL_TOP="$(HOST_INSTALL_DIR)/$(HOST_BUILD_PREFIX)"
+
 define Host/Compile
 	$(MAKE) -C $(HOST_BUILD_DIR) \
 		CC="$(HOSTCC) -std=gnu99" \
 		$(LUA_OS)
 endef
 
-define Host/Install
-	$(MAKE) -C $(HOST_BUILD_DIR) \
-		INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \
-		install
-endef
-
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/