kernel: add a missing kconfig symbol for 2.6.38
[openwrt.git] / include / unpack.mk
1 #
2 # Copyright (C) 2006-2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 # unpacking files with +s may break on some platforms. this typically emits error code 2
9 ifneq ($(HOST_OS),Linux)
10 HOST_TAR:=trapret 2 $(TAR)
11 else
12 HOST_TAR:=$(TAR)
13 endif
14 TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS)
15 UNZIP_CMD=unzip -d $(1)/.. $(DL_DIR)/$(PKG_SOURCE)
16
17 ifeq ($(PKG_SOURCE),)
18 PKG_UNPACK ?= true
19 else
20
21 ifeq ($(strip $(UNPACK_CMD)),)
22 ifeq ($(strip $(PKG_CAT)),)
23 # try to autodetect file type
24 EXT:=$(call ext,$(PKG_SOURCE))
25 EXT1:=$(EXT)
26
27 ifeq ($(filter gz tgz,$(EXT)),$(EXT))
28 EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
29 DECOMPRESS_CMD:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) |
30 endif
31 ifeq ($(filter bzip2 bz2 bz tbz2 tbz,$(EXT)),$(EXT))
32 EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
33 DECOMPRESS_CMD:=bzcat $(DL_DIR)/$(PKG_SOURCE) |
34 endif
35 ifeq ($(filter xz txz,$(EXT)),$(EXT))
36 EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
37 DECOMPRESS_CMD:=xzcat $(DL_DIR)/$(PKG_SOURCE) |
38 endif
39 ifeq ($(filter tgz tbz tbz2 txz,$(EXT1)),$(EXT1))
40 EXT:=tar
41 endif
42 DECOMPRESS_CMD ?= cat $(DL_DIR)/$(PKG_SOURCE) |
43 ifeq ($(EXT),tar)
44 UNPACK_CMD=$(DECOMPRESS_CMD) $(TAR_CMD)
45 endif
46 ifeq ($(EXT),cpio)
47 UNPACK_CMD=$(DECOMPRESS_CMD) (cd $(1)/..; cpio -i -d)
48 endif
49 ifeq ($(EXT),zip)
50 UNPACK_CMD=$(UNZIP_CMD)
51 endif
52 endif
53
54 # compatibility code for packages that set PKG_CAT
55 ifeq ($(strip $(UNPACK_CMD)),)
56 # use existing PKG_CAT
57 UNPACK_CMD=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD)
58 ifeq ($(PKG_CAT),unzip)
59 UNPACK_CMD=$(UNZIP_CMD)
60 endif
61 # replace zcat with $(ZCAT), because some system don't support it properly
62 ifeq ($(PKG_CAT),zcat)
63 UNPACK_CMD=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD)
64 endif
65 endif
66 ifneq ($(strip $(CRLF_WORKAROUND)),)
67 CRLF_CMD := && find $(PKG_BUILD_DIR) -type f -print0 | xargs -0 perl -pi -e 's!\r$$$$!!g'
68 else
69 CRLF_CMD :=
70 endif
71 endif
72
73 ifdef PKG_BUILD_DIR
74 PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR)) $(call CRLF_CMD,$(PKG_BUILD_DIR))
75 endif
76 ifdef HOST_BUILD_DIR
77 HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR)) $(call CRLF_CMD,$(HOST_BUILD_DIR))
78 endif
79
80 endif # PKG_SOURCE
81
This page took 0.057536 seconds and 5 git commands to generate.