aboutsummaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorGravatar Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>2013-08-02 11:05:14 +0200
committerGravatar Peter Korsgaard <jacmet@sunsite.dk>2013-09-06 23:30:27 +0200
commitf8d89f051032a8835bdb77edec518e73170006c1 (patch)
treeec2976891f2a09075b7f827db208947bddb0d354 /package
parent741cbccb746b4bda41c5a51bf2d9d8977c902439 (diff)
downloadbuildroot-f8d89f051032a8835bdb77edec518e73170006c1.tar.gz
buildroot-f8d89f051032a8835bdb77edec518e73170006c1.tar.bz2
infra: introduce suitable-extractor helper function
In order to simplify determining the right extractor tool for a given file type, this patch introduces a make function 'suitable-extractor'. Its usage is $(call suitable-extractor,filename), and it returns the path to the suitable extractor. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package')
-rw-r--r--package/lsof/lsof.mk2
-rw-r--r--package/perl/perl.mk2
-rw-r--r--package/pkg-generic.mk4
-rw-r--r--package/pkg-utils.mk2
-rw-r--r--package/tar/tar.mk2
5 files changed, 8 insertions, 4 deletions
diff --git a/package/lsof/lsof.mk b/package/lsof/lsof.mk
index f1c9474c61..693bb9183b 100644
--- a/package/lsof/lsof.mk
+++ b/package/lsof/lsof.mk
@@ -41,7 +41,7 @@ endif
# The .tar.bz2 contains another .tar, which contains the source code.
define LSOF_EXTRACT_CMDS
- $(INFLATE.bz2) $(DL_DIR)/$(LSOF_SOURCE) | \
+ $(call suitable-extractor,$(LSOF_SOURCE)) $(DL_DIR)/$(LSOF_SOURCE) | \
$(TAR) -O $(TAR_OPTIONS) - lsof_$(LSOF_VERSION)/lsof_$(LSOF_VERSION)_src.tar | \
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(LSOF_DIR) $(TAR_OPTIONS) -
endef
diff --git a/package/perl/perl.mk b/package/perl/perl.mk
index 25314f041e..5ef0b24151 100644
--- a/package/perl/perl.mk
+++ b/package/perl/perl.mk
@@ -30,7 +30,7 @@ endef
PERL_POST_DOWNLOAD_HOOKS += PERL_CROSS_DOWNLOAD
define PERL_CROSS_EXTRACT
- $(INFLATE$(suffix $(PERL_CROSS_SOURCE))) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
+ $(call suitable-extractor,$(PERL_CROSS_SOURCE)) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -
endef
PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 2e2e66f283..65ab8c63da 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -539,7 +539,9 @@ else ifeq ($$($(2)_SITE_METHOD),hg)
DL_TOOLS_DEPENDENCIES += hg
endif # SITE_METHOD
-DL_TOOLS_DEPENDENCIES += $(firstword $(INFLATE$(suffix $($(2)_SOURCE))))
+# $(firstword) is used here because the extractor can have arguments, like
+# ZCAT="gzip -d -c", and to check for the dependency we only want 'gzip'.
+DL_TOOLS_DEPENDENCIES += $(firstword $(call suitable-extractor,$($(2)_SOURCE)))
endif # $(2)_KCONFIG_VAR
endef # inner-generic-package
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 15db0969e3..5930f2cfc2 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -62,6 +62,8 @@ INFLATE.tbz2 = $(BZCAT)
INFLATE.tgz = $(ZCAT)
INFLATE.xz = $(XZCAT)
INFLATE.tar = cat
+# suitable-extractor(filename): returns extractor based on suffix
+suitable-extractor = $(INFLATE$(suffix $(1)))
# MESSAGE Macro -- display a message in bold type
MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
diff --git a/package/tar/tar.mk b/package/tar/tar.mk
index 3ffeaf083f..6198ffdfed 100644
--- a/package/tar/tar.mk
+++ b/package/tar/tar.mk
@@ -23,7 +23,7 @@ HOST_TAR_SOURCE = tar-$(TAR_VERSION).cpio.gz
define HOST_TAR_EXTRACT_CMDS
mkdir -p $(@D)
cd $(@D) && \
- $(INFLATE.gz) $(DL_DIR)/$(HOST_TAR_SOURCE) | cpio -i
+ $(call suitable-extractor,$(HOST_TAR_SOURCE)) $(DL_DIR)/$(HOST_TAR_SOURCE) | cpio -i
mv $(@D)/tar-$(TAR_VERSION)/* $(@D)
rmdir $(@D)/tar-$(TAR_VERSION)
endef