Skip to contentSkip to conversation

Custom extract command again

Buildroot New Allan W. Nielsen 1 participant 2 messages May 10, 2011

lore
Share & tools
lore
#0 lore raw

New patch which based on the implementation sugegsted by Thomas Petazzoni

--
Allan W. Nielsen

#1 lore raw

PATCH 1/1 Makefile.package.in: Makes it possible to override the default extract commands

When using GENTARGETS (or macroes depending on it), there is no way of specifying a custom extraction procedure. When using the patch one can simply define $(PACKAGE_NAME)_EXTRACT_CMDS which will override the default. If non is defined it will fall back to the default extract procedure.

An example could look like this:

--- PACKAGE BEGIN ---
FGLRX_VERSION=11-3 FGLRX_SOURCE:=ati-driver-installer-$(FGLRX_VERSION)-x86.x86_64.run FGLRX_SITE:=http://www2.ati.com/drivers/linux/

define FGLRX_EXTRACT_CMDS

	sh $(DL_DIR)/$(FGLRX_SOURCE) --extract $(@D)

endef

$(eval $(call GENTARGETS,package,fglrx))
--- PACKAGE END ---

---
 package/Makefile.package.in |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
package/Makefile.package.in +10 -2
index bf4e1b4..d308c33 100644
@@ -84,6 +84,12 @@ ifeq ($(DL_DIR),)
 DL_DIR:=$(TOPDIR)/dl
 endif
 
+# Default extract command to be used
+define DEFAULT_EXTRACT_COMMENT
+	$(Q)$(if $($(PKG)_SOURCE),$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
+	$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -)
+endef
+
 ################################################################################
 # The DOWNLOAD_{GIT,SVN,BZR} helpers are in charge of getting a
 # working copy of the source repository for their corresponding SCM,
@@ -243,8 +249,7 @@ endif
 $(BUILD_DIR)/%/.stamp_extracted:
 	@$(call MESSAGE,"Extracting")
 	$(Q)mkdir -p $(@D)
-	$(Q)$(if $($(PKG)_SOURCE),$(INFLATE$(suffix $($(PKG)_SOURCE))) $(DL_DIR)/$($(PKG)_SOURCE) | \
-	$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -)
+	$($(PKG)_EXTRACT_CMDS)
 # some packages have messed up permissions inside
 	$(Q)chmod -R ug+rw $(@D)
 	$(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
@@ -425,6 +430,9 @@ $(2)_TARGET_UNINSTALL =		$$($(2)_DIR)/.stamp_uninstalled
 $(2)_TARGET_CLEAN =		$$($(2)_DIR)/.stamp_cleaned
 $(2)_TARGET_DIRCLEAN =		$$($(2)_DIR)/.stamp_dircleaned
 
+# default extract command
+$(2)_EXTRACT_CMDS ?= DEFAULT_EXTRACT_COMMENT
+
 # post-steps hooks
 $(2)_POST_EXTRACT_HOOKS         ?=
 $(2)_POST_PATCH_HOOKS           ?=
Signature · 1 line
1.7.3.4