add a crlf workaround similar to the one from freewrt
[openwrt/openwrt.git] / include / unpack.mk
1 ifeq ($(strip $(PKG_UNPACK)),)
2 ifneq ($(HOST_OS),Linux)
3 HOST_TAR:=trapret 2 $(TAR)
4 else
5 HOST_TAR:=$(TAR)
6 endif
7 ifneq ($(strip $(PKG_CAT)),)
8 # use existing PKG_CAT
9 PKG_UNPACK:=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
10 ifeq ($(PKG_CAT),unzip)
11 PKG_UNPACK:=unzip -d $(PKG_BUILD_DIR)/.. $(DL_DIR)/$(PKG_SOURCE)
12 endif
13 # replace zcat with $(ZCAT), because some system have it as gzcat
14 ifeq ($(PKG_CAT),zcat)
15 PKG_UNPACK:=$(ZCAT) $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
16 endif
17 else
18 # try to autodetect file type
19 endif
20 ifneq ($(strip $(CRLF_WORKAROUND)),)
21 PKG_UNPACK += && find $(PKG_BUILD_DIR) -type f -print0 | xargs -0 perl -pi -e 's!\r$$$$!!g'
22 endif
23 endif