hyperscan: symlinks redundant ABI shared objects
authorJohn Audia <therealgraysky@proton.me>
Thu, 22 Feb 2024 20:21:46 +0000 (15:21 -0500)
committerRosen Penev <rosenp@gmail.com>
Fri, 23 Feb 2024 00:04:08 +0000 (16:04 -0800)
Use $(CP) macro rather than $(INSTALL_DATA) to preserve symlinks
on shared objects which saves approx 11.8 M of space.

From hyperscan-runtime_5.4.2-1:

% ls -lh /usr/lib/libhs*
-rw-r--r-- 1 root root 4.7M Feb 16 14:29 /usr/lib/libhs.so
-rw-r--r-- 1 root root 4.7M Feb 16 14:29 /usr/lib/libhs.so.5
-rw-r--r-- 1 root root 4.7M Feb 16 14:29 /usr/lib/libhs.so.5.4.2
-rw-r--r-- 1 root root 1.2M Feb 16 14:29 /usr/lib/libhs_runtime.so
-rw-r--r-- 1 root root 1.2M Feb 16 14:29 /usr/lib/libhs_runtime.so.5
-rw-r--r-- 1 root root 1.2M Feb 16 14:29 /usr/lib/libhs_runtime.so.5.4.2

% grep Installed-Size /usr/lib/opkg/info/hyperscan-runtime.control
Installed-Size: 18370560

From hyperscan-runetime_5.4.2-2 (created by this PR):

% ls -lh /usr/lib/libhs*
lrwxr-xr-x 1 root root   10 Feb 22 15:56 /usr/lib/libhs.so -> libhs.so.5
lrwxr-xr-x 1 root root   14 Feb 22 15:56 /usr/lib/libhs.so.5 -> libhs.so.5.4.2
-rwxr-xr-x 1 root root 4.6M Feb 22 15:27 /usr/lib/libhs.so.5.4.2
lrwxr-xr-x 1 root root   18 Feb 22 15:56 /usr/lib/libhs_runtime.so -> libhs_runtime.so.5
lrwxr-xr-x 1 root root   22 Feb 22 15:56 /usr/lib/libhs_runtime.so.5 -> libhs_runtime.so.5.4.2
-rwxr-xr-x 1 root root 1.2M Feb 22 15:27 /usr/lib/libhs_runtime.so.5.4.2

% grep Installed-Size /usr/lib/opkg/info/hyperscan-runtime.control
Installed-Size: 5918720

Credit to @efahl for pointing this out.

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
libs/hyperscan/Makefile

index ce106afa871fa1874bde5f7bcc6504a9016f8c7f..92f97f3b9f776285440c707e4863430d1c1eeba0 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hyperscan
 PKG_VERSION:=5.4.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/intel/hyperscan/tar.gz/v$(PKG_VERSION)?
@@ -62,7 +62,7 @@ define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include/hs
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/hs/* $(1)/usr/include/hs/
        $(INSTALL_DIR) $(1)/usr/lib
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libhs* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libhs* $(1)/usr/lib/
        $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
        $(INSTALL_DATA) $(PKG_BUILD_DIR)/libhs.pc $(1)/usr/lib/pkgconfig/libhs.pc
 endef
@@ -75,7 +75,7 @@ endef
 
 define Package/hyperscan-runtime/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libhs* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libhs* $(1)/usr/lib/
 endef
 
 $(eval $(call BuildPackage,hyperscan-headers))