mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 14:16:31 +00:00
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>
This commit is contained in:
parent
741cbccb74
commit
f8d89f0510
@ -41,7 +41,7 @@ endif
|
|||||||
|
|
||||||
# The .tar.bz2 contains another .tar, which contains the source code.
|
# The .tar.bz2 contains another .tar, which contains the source code.
|
||||||
define LSOF_EXTRACT_CMDS
|
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) -O $(TAR_OPTIONS) - lsof_$(LSOF_VERSION)/lsof_$(LSOF_VERSION)_src.tar | \
|
||||||
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(LSOF_DIR) $(TAR_OPTIONS) -
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(LSOF_DIR) $(TAR_OPTIONS) -
|
||||||
endef
|
endef
|
||||||
|
@ -30,7 +30,7 @@ endef
|
|||||||
PERL_POST_DOWNLOAD_HOOKS += PERL_CROSS_DOWNLOAD
|
PERL_POST_DOWNLOAD_HOOKS += PERL_CROSS_DOWNLOAD
|
||||||
|
|
||||||
define PERL_CROSS_EXTRACT
|
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) -
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -
|
||||||
endef
|
endef
|
||||||
PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
|
PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
|
||||||
|
@ -539,7 +539,9 @@ else ifeq ($$($(2)_SITE_METHOD),hg)
|
|||||||
DL_TOOLS_DEPENDENCIES += hg
|
DL_TOOLS_DEPENDENCIES += hg
|
||||||
endif # SITE_METHOD
|
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
|
endif # $(2)_KCONFIG_VAR
|
||||||
endef # inner-generic-package
|
endef # inner-generic-package
|
||||||
|
@ -62,6 +62,8 @@ INFLATE.tbz2 = $(BZCAT)
|
|||||||
INFLATE.tgz = $(ZCAT)
|
INFLATE.tgz = $(ZCAT)
|
||||||
INFLATE.xz = $(XZCAT)
|
INFLATE.xz = $(XZCAT)
|
||||||
INFLATE.tar = cat
|
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 Macro -- display a message in bold type
|
||||||
MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
|
MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
|
||||||
|
@ -23,7 +23,7 @@ HOST_TAR_SOURCE = tar-$(TAR_VERSION).cpio.gz
|
|||||||
define HOST_TAR_EXTRACT_CMDS
|
define HOST_TAR_EXTRACT_CMDS
|
||||||
mkdir -p $(@D)
|
mkdir -p $(@D)
|
||||||
cd $(@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)
|
mv $(@D)/tar-$(TAR_VERSION)/* $(@D)
|
||||||
rmdir $(@D)/tar-$(TAR_VERSION)
|
rmdir $(@D)/tar-$(TAR_VERSION)
|
||||||
endef
|
endef
|
||||||
|
@ -340,9 +340,9 @@ $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2):
|
|||||||
|
|
||||||
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2)
|
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2)
|
||||||
mkdir -p $(@D)
|
mkdir -p $(@D)
|
||||||
$(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_1))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) | \
|
$(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_SOURCE_1)) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) | \
|
||||||
$(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
|
$(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
|
||||||
$(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_2))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2) | \
|
$(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_SOURCE_2)) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2) | \
|
||||||
$(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
|
$(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
|
||||||
$(Q)touch $@
|
$(Q)touch $@
|
||||||
else
|
else
|
||||||
@ -352,7 +352,7 @@ $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE):
|
|||||||
|
|
||||||
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE)
|
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE)
|
||||||
mkdir -p $(@D)
|
mkdir -p $(@D)
|
||||||
$(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE))) $^ | \
|
$(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_SOURCE)) $^ | \
|
||||||
$(TAR) $(TAR_STRIP_COMPONENTS)=1 --exclude='usr/lib/locale/*' -C $(@D) $(TAR_OPTIONS) -
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 --exclude='usr/lib/locale/*' -C $(@D) $(TAR_OPTIONS) -
|
||||||
$(TOOLCHAIN_EXTERNAL_FIXUP_CMDS)
|
$(TOOLCHAIN_EXTERNAL_FIXUP_CMDS)
|
||||||
$(Q)touch $@
|
$(Q)touch $@
|
||||||
|
Loading…
x
Reference in New Issue
Block a user