Browse Source

zsh: size optimizations and fix build without musl

Disable dynamic libraries and enable LTO
Only use `--enable-libc-musl` when musl is selected
Shrinks ipk size by about 200KB

Signed-off-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
lilik-openwrt-22.03
Deng Qingfang 6 years ago
parent
commit
b09d620139
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      utils/zsh/Makefile

+ 6
- 5
utils/zsh/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=zsh PKG_NAME:=zsh
PKG_VERSION:=5.6.2 PKG_VERSION:=5.6.2
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@SF/zsh PKG_SOURCE_URL:=@SF/zsh
@ -47,8 +47,8 @@ define Build/Configure
$(call Build/Configure/Default, \ $(call Build/Configure/Default, \
--disable-etcdir \ --disable-etcdir \
--disable-gdbm \ --disable-gdbm \
--enable-dynamic \
--enable-libc-musl \
--disable-dynamic \
$(if $(CONFIG_USE_MUSL),--enable-libc-musl) \
--enable-pcre \ --enable-pcre \
--enable-cap \ --enable-cap \
--enable-multibyte \ --enable-multibyte \
@ -83,6 +83,9 @@ define Build/Configure
$(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" prep $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" prep
endef endef
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
TARGET_LDFLAGS += -Wl,--gc-sections -flto
define Package/zsh/postinst define Package/zsh/postinst
#!/bin/sh #!/bin/sh
grep zsh $${IPKG_INSTROOT}/etc/shells || \ grep zsh $${IPKG_INSTROOT}/etc/shells || \
@ -97,11 +100,9 @@ endef
define Package/zsh/install define Package/zsh/install
$(INSTALL_DIR) $(1)/bin $(INSTALL_DIR) $(1)/bin
$(INSTALL_DIR) $(1)/$(CONFIGURE_PREFIX)/bin $(INSTALL_DIR) $(1)/$(CONFIGURE_PREFIX)/bin
$(INSTALL_DIR) $(1)/$(CONFIGURE_PREFIX)/lib/zsh/$(PKG_VERSION)
$(INSTALL_DIR) $(1)/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION) $(INSTALL_DIR) $(1)/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/$(CONFIGURE_PREFIX)/bin/zsh $(1)/$(CONFIGURE_PREFIX)/bin/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/$(CONFIGURE_PREFIX)/bin/zsh $(1)/$(CONFIGURE_PREFIX)/bin/
$(CP) $(PKG_INSTALL_DIR)/$(CONFIGURE_PREFIX)/lib/zsh/$(PKG_VERSION)/* $(1)/$(CONFIGURE_PREFIX)/lib/zsh/$(PKG_VERSION)/
$(CP) $(PKG_INSTALL_DIR)/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION)/* $(1)/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION)/ $(CP) $(PKG_INSTALL_DIR)/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION)/* $(1)/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION)/
endef endef


Loading…
Cancel
Save