Wed Mar 12 15:51:39 2008 UTC ()
Invent new variable EXTRACTOR that has the environment and path to the
extract script.  This can be used in a more natural way by custom
do-extract targets than EXTRACT_CMD.


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

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

--- pkgsrc/mk/extract/extract.mk 2008/03/12 15:48:21 1.25
+++ pkgsrc/mk/extract/extract.mk 2008/03/12 15:51:39 1.26
@@ -1,23 +1,26 @@ @@ -1,23 +1,26 @@
1# $NetBSD: extract.mk,v 1.25 2008/03/12 15:48:21 jlam Exp $ 1# $NetBSD: extract.mk,v 1.26 2008/03/12 15:51:39 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# EXTRACTOR is the the the environment and path used to execute the
 12# all-purpose extract script.
 13#
11# EXTRACT_CMD is a shell command list that extracts the contents of 14# EXTRACT_CMD is a shell command list that extracts the contents of
12# an archive named by the variable ${DOWNLOADED_DISTFILE} to the 15# an archive named by the variable ${DOWNLOADED_DISTFILE} to the
13# current working directory. The default is ${EXTRACT_CMD_DEFAULT}. 16# current working directory. The default is ${EXTRACT_CMD_DEFAULT}.
14# 17#
15# EXTRACT_OPTS is a list of options to pass to the "extract" script 18# 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 19# when using EXTRACT_CMD_DEFAULT. See the comments at the head of
17# the "extract" script for a definitive list of the available 20# the "extract" script for a definitive list of the available
18# options. The default list is empty. 21# options. The default list is empty.
19# 22#
20# EXTRACT_USING specifies the tool used to extract tar/ustar-format 23# EXTRACT_USING specifies the tool used to extract tar/ustar-format
21# archives when using EXTRACT_CMD_DEFAULT. The possible values are 24# archives when using EXTRACT_CMD_DEFAULT. The possible values are
22# "gtar", "nbtar", and "pax". By default, we use the "nbtar" tool 25# "gtar", "nbtar", and "pax". By default, we use the "nbtar" tool
23# (pkgsrc's pax-as-tar). 26# (pkgsrc's pax-as-tar).
@@ -178,31 +181,30 @@ _EXTRACT_ENV+= ${EXTRACT_ENV} @@ -178,31 +181,30 @@ _EXTRACT_ENV+= ${EXTRACT_ENV}
178_EXTRACT_TAR= ${TOOLS_PATH.gtar} 181_EXTRACT_TAR= ${TOOLS_PATH.gtar}
179.elif !empty(EXTRACT_USING:Mnbtar) 182.elif !empty(EXTRACT_USING:Mnbtar)
180_EXTRACT_TAR= ${TOOLS_TAR} 183_EXTRACT_TAR= ${TOOLS_TAR}
181.elif !empty(EXTRACT_USING:Mpax) 184.elif !empty(EXTRACT_USING:Mpax)
182_EXTRACT_TAR= ${TOOLS_PAX} 185_EXTRACT_TAR= ${TOOLS_PAX}
183.else 186.else
184_EXTRACT_TAR= 187_EXTRACT_TAR=
185.endif 188.endif
186 189
187.if !empty(_EXTRACT_TAR) 190.if !empty(_EXTRACT_TAR)
188EXTRACT_OPTS+= -t ${_EXTRACT_TAR} 191EXTRACT_OPTS+= -t ${_EXTRACT_TAR}
189.endif 192.endif
190 193
191EXTRACT_CMD_DEFAULT= \ 194EXTRACTOR= \
192 ${SETENV} ${_EXTRACT_ENV} \ 195 ${SETENV} ${_EXTRACT_ENV} ${SH} ${PKGSRCDIR}/mk/extract/extract
193 ${SH} ${PKGSRCDIR}/mk/extract/extract \ 196EXTRACT_CMD_DEFAULT= \
194 ${EXTRACT_OPTS} \ 197 ${EXTRACTOR} ${EXTRACT_OPTS} ${DOWNLOADED_DISTFILE} ${EXTRACT_ELEMENTS}
195 ${DOWNLOADED_DISTFILE} ${EXTRACT_ELEMENTS} 
196 198
197EXTRACT_CMD?= ${EXTRACT_CMD_DEFAULT} 199EXTRACT_CMD?= ${EXTRACT_CMD_DEFAULT}
198 200
199DOWNLOADED_DISTFILE= $${extract_file} 201DOWNLOADED_DISTFILE= $${extract_file}
200 202
201.if !target(do-extract) 203.if !target(do-extract)
202do-extract: ${WRKDIR} 204do-extract: ${WRKDIR}
203. for f in ${EXTRACT_ONLY} 205. for f in ${EXTRACT_ONLY}
204 ${RUN} extract_file=${_DISTDIR:Q}/${f:Q}; export extract_file; \ 206 ${RUN} extract_file=${_DISTDIR:Q}/${f:Q}; export extract_file; \
205 cd ${WRKDIR} && cd ${EXTRACT_DIR} && ${EXTRACT_CMD} 207 cd ${WRKDIR} && cd ${EXTRACT_DIR} && ${EXTRACT_CMD}
206. endfor 208. endfor
207.endif 209.endif
208 210