diff --git a/patches/openwrt/0005-imagebuilder-add-hostpkgs-to-imagebuilder.patch b/patches/openwrt/0005-imagebuilder-add-hostpkgs-to-imagebuilder.patch index ee40a7b7..5f70e862 100644 --- a/patches/openwrt/0005-imagebuilder-add-hostpkgs-to-imagebuilder.patch +++ b/patches/openwrt/0005-imagebuilder-add-hostpkgs-to-imagebuilder.patch @@ -3,21 +3,31 @@ Date: Sun, 15 Aug 2021 16:56:46 +0200 Subject: imagebuilder: add hostpkgs to imagebuilder Before this commit, host packages were not installed into the -imagebuilder. This made it impossible to use lua in opkg +imagebuilder. This made it impossible to make use of hostpkgs in opkg postinstall scripts in combination with the imagebuilder. This commit changes this and ensures, that -- staging_dir/hostpkg is installed to the imagebuilder. -- staging_dir/hostpkg/lib/lua is installed into the imagebuilder. +- staging_dir/hostpkg/bin/* is installed to the imagebuilder. +- staging_dir/hostpkg/lib/lua is installed into the + imagebuilder (if existing). -After this commit, we are able to use lua in opkg postinstall -scripts in combination with the imagebuilder. +After this commit, we are able to use hostpkgs (like lua) in opkg +postinstall scripts in combination with the imagebuilder, assuming +that those packages built as hostpkgs anyways. + +With default OpenWrt configuration for x86-64, the unpacked +imagebuilder becomes this much larger: + + 1.5M staging_dir/hostpkg/bin + 3.6M staging_dir/hostpkg/lib + +Signed-off-by: Leonardo Mörlein diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile -index 0580e41c5790d8989ec2daf38e89e046cd1c0862..6a4de542f31ad94bdd7b998f4818c9c228987cfb 100644 +index 0580e41c5790d8989ec2daf38e89e046cd1c0862..c4263f4a5191042aee8478a57342d4a635dc18a6 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile -@@ -100,12 +100,22 @@ endif +@@ -100,12 +100,25 @@ endif | $(XARGS) rm -rf $(INSTALL_DIR) $(IB_IDIR) -$(CP) $(STAGING_DIR_IMAGE)/* $(IB_IDIR)/ @@ -33,9 +43,12 @@ index 0580e41c5790d8989ec2daf38e89e046cd1c0862..6a4de542f31ad94bdd7b998f4818c9c2 + $(CP) $(STAGING_DIR_HOSTPKG)/bin/* $(PKG_BUILD_DIR)/staging_dir/hostpkg/bin/ + (cd $(PKG_BUILD_DIR); find staging_dir/hostpkg/bin/ $(IB_LDIR)/scripts/dtc/ -type f | \ + $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh $(PKG_BUILD_DIR)/staging_dir/hostpkg) -+ # install lua libs -+ $(CP) $(STAGING_DIR_HOSTPKG)/lib/lua $(PKG_BUILD_DIR)/staging_dir/hostpkg/lib/ + STRIP=sstrip $(SCRIPT_DIR)/rstrip.sh $(PKG_BUILD_DIR)/staging_dir/hostpkg/bin/ ++ # install lua libs ++ if [ -d $(STAGING_DIR_HOSTPKG)/lib/lua ]; then \ ++ $(INSTALL_DIR) $(PKG_BUILD_DIR)/staging_dir/hostpkg/lib/lua; \ ++ $(CP) $(STAGING_DIR_HOSTPKG)/lib/lua $(PKG_BUILD_DIR)/staging_dir/hostpkg/lib/; \ ++ fi + # bundle (cd $(BUILD_DIR); \ tar -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' -cf $@ $(IB_NAME) \ diff --git a/patches/openwrt/0006-imagebuilder-hacky-way-add-scripts-imagebuilder-into-IB.patch b/patches/openwrt/0006-imagebuilder-hacky-way-add-scripts-imagebuilder-into-IB.patch index 4ff8be08..95369c0d 100644 --- a/patches/openwrt/0006-imagebuilder-hacky-way-add-scripts-imagebuilder-into-IB.patch +++ b/patches/openwrt/0006-imagebuilder-hacky-way-add-scripts-imagebuilder-into-IB.patch @@ -3,7 +3,7 @@ Date: Sun, 15 Aug 2021 17:06:51 +0200 Subject: imagebuilder: hacky way add scripts/imagebuilder into IB diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile -index 6a4de542f31ad94bdd7b998f4818c9c228987cfb..a5fa9d9063ee262e247eb9da105c8d32330240ee 100644 +index c4263f4a5191042aee8478a57342d4a635dc18a6..2aa193f6f9b08a7d2ef7f31c79dbc9d5800cd9c6 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -40,6 +40,11 @@ $(BIN_DIR)/$(IB_NAME).tar.xz: clean diff --git a/patches/openwrt/0007-backport-lua-make-it-easier-to-detect-host-built-Lua.patch b/patches/openwrt/0007-backport-lua-make-it-easier-to-detect-host-built-Lua.patch new file mode 100644 index 00000000..d828f3e0 --- /dev/null +++ b/patches/openwrt/0007-backport-lua-make-it-easier-to-detect-host-built-Lua.patch @@ -0,0 +1,28 @@ +From: Daniel Golle +Date: Sat, 10 Jul 2021 20:21:26 +0100 +Subject: backport: lua: make it easier to detect host-built Lua + +Install pkg-config file also for host-build, clean up Lua symlinks. + +Signed-off-by: Daniel Golle +Backport-by: Leonardo Mörlein + +diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile +index d262d1e1fc2bfa1772ff2a88e388346d4550106f..e15142d8d26e988a6fa1cecf27a3f8fad368b980 100644 +--- a/package/utils/lua/Makefile ++++ b/package/utils/lua/Makefile +@@ -134,8 +134,12 @@ define Host/Install + INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \ + install + +- $(LN) $(STAGING_DIR_HOSTPKG)/bin/lua5.1 $(STAGING_DIR_HOSTPKG)/bin/lua +- $(LN) $(STAGING_DIR_HOSTPKG)/bin/luac5.1 $(STAGING_DIR_HOSTPKG)/bin/luac ++ $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/pkgconfig ++ $(CP) $(HOST_BUILD_DIR)/etc/lua.pc $(STAGING_DIR_HOSTPKG)/lib/pkgconfig/lua5.1.pc ++ ++ $(LN) lua5.1 $(STAGING_DIR_HOSTPKG)/bin/lua ++ $(LN) luac5.1 $(STAGING_DIR_HOSTPKG)/bin/luac ++ $(LN) lua5.1.pc $(STAGING_DIR_HOSTPKG)/lib/pkgconfig/lua.pc + endef + + define Build/InstallDev