- ifneq ($(HOST_OS),Linux)
- TAR := trapret 2 $(PKG_UNPACK) $(TAR)
+ ifeq ($(strip $(PKG_CAT)),)
+ # try to autodetect file type
+ EXT:=$(call ext,$(PKG_SOURCE))
+ EXT1:=$(EXT)
+
+ ifeq ($(filter gz tgz,$(EXT)),$(EXT))
+ EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
+ UNPACK:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) |
+ endif
+ ifeq ($(filter bzip2 bz2 bz tbz2 tbz,$(EXT)),$(EXT))
+ EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
+ UNPACK:=bzcat $(DL_DIR)/$(PKG_SOURCE) |
+ endif
+ ifeq ($(filter tgz tbz tbz2,$(EXT1)),$(EXT1))
+ EXT:=tar
+ endif
+ UNPACK ?= cat $(DL_DIR)/$(PKG_SOURCE) |
+ ifeq ($(EXT),tar)
+ PKG_UNPACK:=$(UNPACK) $(TAR_CMD)
+ endif
+ ifeq ($(EXT),cpio)
+ PKG_UNPACK:=$(UNPACK) (cd $(PKG_BUILD_DIR)/..; cpio -i -d)
+ endif
+ ifeq ($(EXT),zip)
+ PKG_UNPACK:=$(UNZIP_CMD)
+ endif