[openwrt/openwrt] apk: build static

LEDE Commits lede-commits at lists.infradead.org
Fri Nov 29 02:32:40 PST 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/39b0f081ecaf4fb9acc622d694dc52293a4dda1f

commit 39b0f081ecaf4fb9acc622d694dc52293a4dda1f
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Thu Nov 28 13:15:29 2024 -0800

    apk: build static
    
    libapk as a library is used nowhere else and makes no sense to link it
    shared. By linking static, we can take advantage of LTO and get the size
    reduced further.
    
    Some numbers locally:
    
    Before:
    
    168K staging_dir/target-mips_24kc_musl/root-ath79/usr/bin/apk*
    252K staging_dir/target-mips_24kc_musl/root-ath79/usr/lib/libapk.so.2.99.0*
    
    Static:
    344K staging_dir/target-mips_24kc_musl/root-ath79/usr/bin/apk*
    
    Static + LTO:
    305K staging_dir/target-mips_24kc_musl/root-ath79/usr/bin/apk*
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/17109
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 package/system/apk/Makefile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile
index 693c008df9..a8d4f0b050 100644
--- a/package/system/apk/Makefile
+++ b/package/system/apk/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=apk
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL=https://gitlab.alpinelinux.org/alpine/apk-tools.git
 PKG_SOURCE_PROTO:=git
@@ -53,10 +53,12 @@ MESON_HOST_VARS+=VERSION=$(PKG_VERSION)
 MESON_VARS+=VERSION=$(PKG_VERSION)
 
 MESON_COMMON_ARGS = \
+	-Db_lto=true \
 	-Dcompressed-help=false \
 	-Ddocs=disabled \
 	-Dhelp=enabled \
 	-Dlua_version=5.1 \
+	-Ddefault_library=static \
 	-Durl_backend=wget \
 	-Dzstd=false
 
@@ -81,9 +83,6 @@ define Package/apk/default/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/apk $(1)/usr/bin/apk
 
-	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libapk.so.* $(1)/usr/lib/
-
 	$(INSTALL_DIR) $(1)/etc/apk/repositories.d
 	$(INSTALL_DATA) ./files/customfeeds.list $(1)/etc/apk/repositories.d/customfeeds.list
 endef




More information about the lede-commits mailing list