Wed Mar 12 15:48:21 2008 UTC ()
Fix whitespace


(jlam)
diff -r1.24 -r1.25 pkgsrc/mk/extract/extract.mk

cvs diff -r1.24 -r1.25 pkgsrc/mk/extract/extract.mk (switch to unified diff)

--- pkgsrc/mk/extract/extract.mk 2008/01/23 14:59:35 1.24
+++ pkgsrc/mk/extract/extract.mk 2008/03/12 15:48:21 1.25
@@ -1,216 +1,216 @@ @@ -1,216 +1,216 @@
1# $NetBSD: extract.mk,v 1.24 2008/01/23 14:59:35 rillig Exp $ 1# $NetBSD: extract.mk,v 1.25 2008/03/12 15:48:21 jlam Exp $
2# 2#
3# The following variables may be set by the package Makefile and 3# The following variables may be set by the package Makefile and
4# specify how extraction happens: 4# specify how extraction happens:
5# 5#
6# EXTRACT_DIR 6# EXTRACT_DIR
7# The directory into which the files are extracted. 7# The directory into which the files are extracted.
8# 8#
9# Default value: ${WRKDIR} 9# Default value: ${WRKDIR}
10# 10#
11# EXTRACT_CMD is a shell command list that extracts the contents of 11# EXTRACT_CMD is a shell command list that extracts the contents of
12# an archive named by the variable ${DOWNLOADED_DISTFILE} to the 12# an archive named by the variable ${DOWNLOADED_DISTFILE} to the
13# current working directory. The default is ${EXTRACT_CMD_DEFAULT}. 13# current working directory. The default is ${EXTRACT_CMD_DEFAULT}.
14# 14#
15# EXTRACT_OPTS is a list of options to pass to the "extract" script 15# EXTRACT_OPTS is a list of options to pass to the "extract" script
16# when using EXTRACT_CMD_DEFAULT. See the comments at the head of 16# when using EXTRACT_CMD_DEFAULT. See the comments at the head of
17# the "extract" script for a definitive list of the available 17# the "extract" script for a definitive list of the available
18# options. The default list is empty. 18# options. The default list is empty.
19# 19#
20# EXTRACT_USING specifies the tool used to extract tar/ustar-format 20# EXTRACT_USING specifies the tool used to extract tar/ustar-format
21# archives when using EXTRACT_CMD_DEFAULT. The possible values are 21# archives when using EXTRACT_CMD_DEFAULT. The possible values are
22# "gtar", "nbtar", and "pax". By default, we use the "nbtar" tool 22# "gtar", "nbtar", and "pax". By default, we use the "nbtar" tool
23# (pkgsrc's pax-as-tar). 23# (pkgsrc's pax-as-tar).
24# 24#
25# EXTRACT_ELEMENTS is a list of files within the distfile to extract 25# EXTRACT_ELEMENTS is a list of files within the distfile to extract
26# when using EXTRACT_CMD_DEFAULT. By default, this is empty, which 26# when using EXTRACT_CMD_DEFAULT. By default, this is empty, which
27# causes all files within the archive to be extracted. 27# causes all files within the archive to be extracted.
28# 28#
29# The following are read-only variables that may be used within a package 29# The following are read-only variables that may be used within a package
30# Makefile: 30# Makefile:
31# 31#
32# DOWNLOADED_DISTFILE represents the path to the distfile that is 32# DOWNLOADED_DISTFILE represents the path to the distfile that is
33# currently being extracted, and may be used in custom EXTRACT_CMD 33# currently being extracted, and may be used in custom EXTRACT_CMD
34# overrides, e.g. 34# overrides, e.g.
35# 35#
36# EXTRACT_CMD= ${TAIL} +25 ${DOWNLOADED_DISTFILE} > foo.pl 36# EXTRACT_CMD= ${TAIL} +25 ${DOWNLOADED_DISTFILE} > foo.pl
37# 37#
38# EXTRACT_CMD_DEFAULT uses the "extract" script to unpack archives. The 38# EXTRACT_CMD_DEFAULT uses the "extract" script to unpack archives. The
39# precise manner in which extraction occurs may be tweaked by setting 39# precise manner in which extraction occurs may be tweaked by setting
40# EXTRACT_OPTS, EXTRACT_USING and EXTRACT_ELEMENTS. 40# EXTRACT_OPTS, EXTRACT_USING and EXTRACT_ELEMENTS.
41# 41#
42 42
43EXTRACT_DIR?= ${WRKDIR} 43EXTRACT_DIR?= ${WRKDIR}
44 44
45_COOKIE.extract= ${WRKDIR}/.extract_done 45_COOKIE.extract= ${WRKDIR}/.extract_done
46 46
47###################################################################### 47######################################################################
48### extract (PUBLIC) 48### extract (PUBLIC)
49###################################################################### 49######################################################################
50### extract is a public target to perform extraction. 50### extract is a public target to perform extraction.
51### 51###
52_EXTRACT_TARGETS+= check-vulnerable 52_EXTRACT_TARGETS+= check-vulnerable
53_EXTRACT_TARGETS+= tools 53_EXTRACT_TARGETS+= tools
54_EXTRACT_TARGETS+= acquire-extract-lock 54_EXTRACT_TARGETS+= acquire-extract-lock
55_EXTRACT_TARGETS+= ${_COOKIE.extract} 55_EXTRACT_TARGETS+= ${_COOKIE.extract}
56_EXTRACT_TARGETS+= release-extract-lock 56_EXTRACT_TARGETS+= release-extract-lock
57 57
58.PHONY: extract 58.PHONY: extract
59.if !target(extract) 59.if !target(extract)
60. if exists(${_COOKIE.extract}) 60. if exists(${_COOKIE.extract})
61extract: 61extract:
62 @${DO_NADA} 62 @${DO_NADA}
63. elif defined(_PKGSRC_BARRIER) 63. elif defined(_PKGSRC_BARRIER)
64extract: ${_EXTRACT_TARGETS} 64extract: ${_EXTRACT_TARGETS}
65. else 65. else
66extract: barrier 66extract: barrier
67. endif 67. endif
68.endif 68.endif
69 69
70.PHONY: acquire-extract-lock release-extract-lock 70.PHONY: acquire-extract-lock release-extract-lock
71acquire-extract-lock: acquire-lock 71acquire-extract-lock: acquire-lock
72release-extract-lock: release-lock 72release-extract-lock: release-lock
73 73
74.if exists(${_COOKIE.extract}) 74.if exists(${_COOKIE.extract})
75${_COOKIE.extract}: 75${_COOKIE.extract}:
76 @${DO_NADA} 76 @${DO_NADA}
77.else 77.else
78${_COOKIE.extract}: real-extract 78${_COOKIE.extract}: real-extract
79.endif 79.endif
80 80
81###################################################################### 81######################################################################
82### real-extract (PRIVATE) 82### real-extract (PRIVATE)
83###################################################################### 83######################################################################
84### real-extract is a helper target onto which one can hook all of the 84### real-extract is a helper target onto which one can hook all of the
85### targets that do the actual extraction work. 85### targets that do the actual extraction work.
86### 86###
87_REAL_EXTRACT_TARGETS+= extract-check-interactive 87_REAL_EXTRACT_TARGETS+= extract-check-interactive
88_REAL_EXTRACT_TARGETS+= extract-message 88_REAL_EXTRACT_TARGETS+= extract-message
89_REAL_EXTRACT_TARGETS+= extract-vars 89_REAL_EXTRACT_TARGETS+= extract-vars
90_REAL_EXTRACT_TARGETS+= extract-dir 90_REAL_EXTRACT_TARGETS+= extract-dir
91_REAL_EXTRACT_TARGETS+= pre-extract 91_REAL_EXTRACT_TARGETS+= pre-extract
92_REAL_EXTRACT_TARGETS+= do-extract 92_REAL_EXTRACT_TARGETS+= do-extract
93_REAL_EXTRACT_TARGETS+= post-extract 93_REAL_EXTRACT_TARGETS+= post-extract
94_REAL_EXTRACT_TARGETS+= extract-cookie 94_REAL_EXTRACT_TARGETS+= extract-cookie
95_REAL_EXTRACT_TARGETS+= error-check 95_REAL_EXTRACT_TARGETS+= error-check
96 96
97.PHONY: real-extract 97.PHONY: real-extract
98real-extract: ${_REAL_EXTRACT_TARGETS} 98real-extract: ${_REAL_EXTRACT_TARGETS}
99 99
100.PHONY: extract-message 100.PHONY: extract-message
101extract-message: 101extract-message:
102 @${PHASE_MSG} "Extracting for ${PKGNAME}" 102 @${PHASE_MSG} "Extracting for ${PKGNAME}"
103 103
104.PHONY: extract-dir 104.PHONY: extract-dir
105extract-dir: 105extract-dir:
106 ${RUN}${MKDIR} ${EXTRACT_DIR} 106 ${RUN}${MKDIR} ${EXTRACT_DIR}
107 107
108###################################################################### 108######################################################################
109### extract-check-interactive (PRIVATE) 109### extract-check-interactive (PRIVATE)
110###################################################################### 110######################################################################
111### extract-check-interactive checks whether we must do an interactive 111### extract-check-interactive checks whether we must do an interactive
112### extraction or not. 112### extraction or not.
113### 113###
114.PHONY: extract-check-interactive 114.PHONY: extract-check-interactive
115extract-check-interactive: 115extract-check-interactive:
116.if !empty(INTERACTIVE_STAGE:Mextract) && defined(BATCH) 116.if !empty(INTERACTIVE_STAGE:Mextract) && defined(BATCH)
117 @${ERROR_MSG} "The extract stage of this package requires user interaction" 117 @${ERROR_MSG} "The extract stage of this package requires user interaction"
118 @${ERROR_MSG} "Please extract manually with:" 118 @${ERROR_MSG} "Please extract manually with:"
119 @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} extract\"" 119 @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} extract\""
120 ${RUN} ${FALSE} 120 ${RUN} ${FALSE}
121.else 121.else
122 @${DO_NADA} 122 @${DO_NADA}
123.endif 123.endif
124 124
125###################################################################### 125######################################################################
126### extract-cookie (PRIVATE) 126### extract-cookie (PRIVATE)
127###################################################################### 127######################################################################
128### extract-cookie creates the "extract" cookie file. The contents 128### extract-cookie creates the "extract" cookie file. The contents
129### are the name of the package. 129### are the name of the package.
130### 130###
131.PHONY: extract-cookie 131.PHONY: extract-cookie
132extract-cookie: 132extract-cookie:
133 ${RUN}${TEST} ! -f ${_COOKIE.extract} || ${FALSE} 133 ${RUN}${TEST} ! -f ${_COOKIE.extract} || ${FALSE}
134 ${RUN}${MKDIR} ${_COOKIE.extract:H} 134 ${RUN}${MKDIR} ${_COOKIE.extract:H}
135 ${RUN}${ECHO} ${PKGNAME} > ${_COOKIE.extract} 135 ${RUN}${ECHO} ${PKGNAME} > ${_COOKIE.extract}
136 136
137###################################################################### 137######################################################################
138### pre-extract, do-extract, post-extract (PUBLIC, override) 138### pre-extract, do-extract, post-extract (PUBLIC, override)
139###################################################################### 139######################################################################
140### {pre,do,post}-extract are the heart of the package-customizable 140### {pre,do,post}-extract are the heart of the package-customizable
141### extract targets, and may be overridden within a package Makefile. 141### extract targets, and may be overridden within a package Makefile.
142### 142###
143.PHONY: pre-extract do-extract post-extract 143.PHONY: pre-extract do-extract post-extract
144 144
145EXTRACT_USING?= nbtar 145EXTRACT_USING?= nbtar
146EXTRACT_ELEMENTS?= # empty 146EXTRACT_ELEMENTS?= # empty
147 147
148### 148###
149### Build the default extraction command 149### Build the default extraction command
150### 150###
151_EXTRACT_ENV+= ${EXTRACT_OPTS_BIN:D EXTRACT_OPTS_BIN=${EXTRACT_OPTS_BIN:Q}} 151_EXTRACT_ENV+= ${EXTRACT_OPTS_BIN:D EXTRACT_OPTS_BIN=${EXTRACT_OPTS_BIN:Q}}
152_EXTRACT_ENV+= ${EXTRACT_OPTS_LHA:D EXTRACT_OPTS_LHA=${EXTRACT_OPTS_LHA:Q}} 152_EXTRACT_ENV+= ${EXTR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XTRACT_ENV+= ${TOOLS_CAT:D CAT=${TOOLS_CAT:Q}} 160_EXTRACT_ENV+= ${TOOLS_CAT:D CAT=${TOOLS_CAT:Q}}
161_EXTRACT_ENV+= ${TOOLS_CP:D CP=${TOOLS_CP:Q}} 161_EXTRACT_ENV+= ${TOOLS_CP:D CP=${TOOLS_CP:Q}}
162_EXTRACT_ENV+= ${TOOLS_ECHO:D ECHO=${TOOLS_ECHO:Q}} 162_EXTRACT_ENV+= ${TOOLS_ECHO:D ECHO=${TOOLS_ECHO:Q}}
163_EXTRACT_ENV+= ${TOOLS_CMDLINE.gzcat:D GZCAT=${TOOLS_CMDLINE.gzcat:Q}} 163_EXTRACT_ENV+= ${TOOLS_CMDLINE.gzcat:D GZCAT=${TOOLS_CMDLINE.gzcat:Q}}
164_EXTRACT_ENV+= ${TOOLS_LHA:D LHA=${TOOLS_LHA:Q}} 164_EXTRACT_ENV+= ${TOOLS_LHA:D LHA=${TOOLS_LHA:Q}}
165_EXTRACT_ENV+= ${TOOLS_MKDIR:D MKDIR=${TOOLS_MKDIR:Q}} 165_EXTRACT_ENV+= ${TOOLS_MKDIR:D MKDIR=${TOOLS_MKDIR:Q}}
166_EXTRACT_ENV+= ${TOOLS_RM:D RM=${TOOLS_RM:Q}} 166_EXTRACT_ENV+= ${TOOLS_RM:D RM=${TOOLS_RM:Q}}
167_EXTRACT_ENV+= ${TOOLS_RPM2PKG:D RPM2PKG=${TOOLS_RPM2PKG:Q}} 167_EXTRACT_ENV+= ${TOOLS_RPM2PKG:D RPM2PKG=${TOOLS_RPM2PKG:Q}}
168_EXTRACT_ENV+= ${TOOLS_PAX:D PAX=${TOOLS_PAX:Q}} 168_EXTRACT_ENV+= ${TOOLS_PAX:D PAX=${TOOLS_PAX:Q}}
169_EXTRACT_ENV+= ${TOOLS_SH:D SH=${TOOLS_SH:Q}} 169_EXTRACT_ENV+= ${TOOLS_SH:D SH=${TOOLS_SH:Q}}
170_EXTRACT_ENV+= ${TOOLS_TAR:D TAR=${TOOLS_TAR:Q}} 170_EXTRACT_ENV+= ${TOOLS_TAR:D TAR=${TOOLS_TAR:Q}}
171_EXTRACT_ENV+= ${TOOLS_TEST:D TEST=${TOOLS_TEST:Q}} 171_EXTRACT_ENV+= ${TOOLS_TEST:D TEST=${TOOLS_TEST:Q}}
172_EXTRACT_ENV+= ${TOOLS_UNRAR:D UNRAR=${TOOLS_UNRAR:Q}} 172_EXTRACT_ENV+= ${TOOLS_UNRAR:D UNRAR=${TOOLS_UNRAR:Q}}
173_EXTRACT_ENV+= ${TOOLS_UNZIP_CMD:D UNZIP_CMD=${TOOLS_UNZIP_CMD:Q}} 173_EXTRACT_ENV+= ${TOOLS_UNZIP_CMD:D UNZIP_CMD=${TOOLS_UNZIP_CMD:Q}}
174_EXTRACT_ENV+= ${TOOLS_UNZOO:D UNZOO=${TOOLS_UNZOO:Q}} 174_EXTRACT_ENV+= ${TOOLS_UNZOO:D UNZOO=${TOOLS_UNZOO:Q}}
175_EXTRACT_ENV+= ${EXTRACT_ENV} 175_EXTRACT_ENV+= ${EXTRACT_ENV}
176 176
177.if !empty(EXTRACT_USING:Mgtar) 177.if !empty(EXTRACT_USING:Mgtar)
178_EXTRACT_TAR= ${TOOLS_PATH.gtar} 178_EXTRACT_TAR= ${TOOLS_PATH.gtar}
179.elif !empty(EXTRACT_USING:Mnbtar) 179.elif !empty(EXTRACT_USING:Mnbtar)
180_EXTRACT_TAR= ${TOOLS_TAR} 180_EXTRACT_TAR= ${TOOLS_TAR}
181.elif !empty(EXTRACT_USING:Mpax) 181.elif !empty(EXTRACT_USING:Mpax)
182_EXTRACT_TAR= ${TOOLS_PAX} 182_EXTRACT_TAR= ${TOOLS_PAX}
183.else 183.else
184_EXTRACT_TAR= 184_EXTRACT_TAR=
185.endif 185.endif
186 186
187.if !empty(_EXTRACT_TAR) 187.if !empty(_EXTRACT_TAR)
188EXTRACT_OPTS+= -t ${_EXTRACT_TAR} 188EXTRACT_OPTS+= -t ${_EXTRACT_TAR}
189.endif 189.endif
190 190
191EXTRACT_CMD_DEFAULT= \ 191EXTRACT_CMD_DEFAULT= \
192 ${SETENV} ${_EXTRACT_ENV} \ 192 ${SETENV} ${_EXTRACT_ENV} \
193 ${SH} ${PKGSRCDIR}/mk/extract/extract \ 193 ${SH} ${PKGSRCDIR}/mk/extract/extract \
194 ${EXTRACT_OPTS} \ 194 ${EXTRACT_OPTS} \
195 ${DOWNLOADED_DISTFILE} ${EXTRACT_ELEMENTS} 195 ${DOWNLOADED_DISTFILE} ${EXTRACT_ELEMENTS}
196 196
197EXTRACT_CMD?= ${EXTRACT_CMD_DEFAULT} 197EXTRACT_CMD?= ${EXTRACT_CMD_DEFAULT}
198 198
199DOWNLOADED_DISTFILE= $${extract_file} 199DOWNLOADED_DISTFILE= $${extract_file}
200 200
201.if !target(do-extract) 201.if !target(do-extract)
202do-extract: ${WRKDIR} 202do-extract: ${WRKDIR}
203. for f in ${EXTRACT_ONLY} 203. for f in ${EXTRACT_ONLY}
204 ${RUN} extract_file=${_DISTDIR:Q}/${f:Q}; export extract_file; \ 204 ${RUN} extract_file=${_DISTDIR:Q}/${f:Q}; export extract_file; \
205 cd ${WRKDIR} && cd ${EXTRACT_DIR} && ${EXTRACT_CMD} 205 cd ${WRKDIR} && cd ${EXTRACT_DIR} && ${EXTRACT_CMD}
206. endfor 206. endfor
207.endif 207.endif
208 208
209.if !target(pre-extract) 209.if !target(pre-extract)
210pre-extract: 210pre-extract:
211 @${DO_NADA} 211 @${DO_NADA}
212.endif 212.endif
213.if !target(post-extract) 213.if !target(post-extract)
214post-extract: 214post-extract:
215 @${DO_NADA} 215 @${DO_NADA}
216.endif 216.endif