tools/7z: cleanup Makefile
authorMichael Pratt <mcpratt@pm.me>
Thu, 11 Jul 2024 07:54:29 +0000 (03:54 -0400)
committerRobert Marko <robimarko@gmail.com>
Sat, 27 Jul 2024 18:32:20 +0000 (20:32 +0200)
Define the version in one variable,
and use Make functions to use variations of it elsewhere.

Correct the CPE ID.

Override the default tar directory flag
by adding a new value to the tar options
instead of defining the entire command.

Use variables for adjusting build recipes
instead of adding custom build recipes.

Remove unnecessary lines and add spacing.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15991
Signed-off-by: Robert Marko <robimarko@gmail.com>
tools/7z/Makefile

index 2d75d9059e6d6566218899e9701a6cab020af4b8..3b3ceeb0966efcddab54a69c3682b68c91de6fe5 100644 (file)
@@ -2,32 +2,26 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=7z
 PKG_VERSION:=23.01
-PKG_SOURCE_VERSION:=2301
 
-PKG_SOURCE:=$(PKG_NAME)$(PKG_SOURCE_VERSION)-src.tar.xz
+PKG_SOURCE:=$(PKG_NAME)$(subst .,,$(PKG_VERSION))-src.tar.xz
 PKG_SOURCE_URL:=https://7-zip.org/a/
 PKG_HASH:=356071007360e5a1824d9904993e8b2480b51b570e8c9faf7c0f58ebe4bf9f74
-PKG_CPE_ID:=cpe:/a:7-zip:7zip
+
+PKG_CPE_ID:=cpe:/a:7-zip:7-zip
 
 # This builds the 7zr variant which supports only 7z, so no non-LGPL code should be included
 PKG_LICENSE:=LGPL-2.1-or-later
 PKG_LICENSE_FILES:=DOC/License.txt DOC/copying.txt
 
-HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
+HOST_MAKE_PATH:=CPP/7zip/Bundles/Alone7z
 
 include $(INCLUDE_DIR)/host-build.mk
 
-TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
-
-ALONE_DIR=$(HOST_BUILD_DIR)/CPP/7zip/Bundles/Alone7z
-
-define Host/Compile
-       $(MAKE) -C $(ALONE_DIR) -f makefile.gcc
-endef
+TAR_OPTIONS := -C $(HOST_BUILD_DIR) $(TAR_OPTIONS)
+HOST_MAKE_FLAGS += -f makefile.gcc
 
 define Host/Install
-       $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
-       $(INSTALL_BIN) $(ALONE_DIR)/_o/7zr $(STAGING_DIR_HOST)/bin/7zr
+       $(INSTALL_BIN) $(HOST_BUILD_DIR)/$(HOST_MAKE_PATH)/_o/7zr $(STAGING_DIR_HOST)/bin/
 endef
 
 define Host/Clean