diff options
author | jlam <jlam@pkgsrc.org> | 2005-05-20 21:36:05 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2005-05-20 21:36:05 +0000 |
commit | 50b6b1d60e5d6d4264f3faeb7cf5213d6e67eab1 (patch) | |
tree | 5a7819f8df8584a274396aac5fd6a1e58c3da052 /mk | |
parent | 725598f8a9262cea5ba3f4b2d05dd75b7b107bce (diff) | |
download | pkgsrc-50b6b1d60e5d6d4264f3faeb7cf5213d6e67eab1.tar.gz |
Change instances where we stored `shell command` in a make variable into
variables that use the :sh modifier. This still causes expansion to only
happen when referenced, and has the advantage of being :Q-safe.
Bring back the changes from revision 1.19 of mk/subst.mk now that the
problem noted above has been fixed. This passes the buildlink-unwrap
regression test.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.mk | 11 | ||||
-rw-r--r-- | mk/subst.mk | 45 | ||||
-rw-r--r-- | mk/wrapper/bsd.wrapper.mk | 11 |
3 files changed, 32 insertions, 35 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 38ac3c68505..9a6783e1bc7 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1672 2005/05/18 23:59:44 rillig Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1673 2005/05/20 21:36:05 jlam Exp $ # # This file is in the public domain. # @@ -1727,12 +1727,11 @@ _REPLACE_LOCALEDIR_PATTERNS+= [Mm]akefile.in* . else _REPLACE_LOCALEDIR_PATTERNS+= [Mm]akefile* . endif -_REPLACE_LOCALEDIR_PATTERNS_FIND= \ - \( ${_REPLACE_LOCALEDIR_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \) +_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd= \ + cd ${WRKSRC} && ${FIND} . \( ${_REPLACE_LOCALEDIR_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \) -print | ${SED} -e 's|^\./||' | ${GREP} -v '\.orig' | ${SORT} -u REPLACE_LOCALEDIR?= # empty -_REPLACE_LOCALEDIR= \ - ${REPLACE_LOCALEDIR} \ - `${FIND} . ${_REPLACE_LOCALEDIR_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${GREP} -v '\.orig' | ${SORT} -u` +_REPLACE_LOCALEDIR= ${REPLACE_LOCALEDIR} \ + ${_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd:sh} _CONFIGURE_PREREQ+= subst-pkglocaledir . if empty(USE_PKGLOCALEDIR:M[nN][oO]) diff --git a/mk/subst.mk b/mk/subst.mk index 8d0f993a0ca..da36a4c914d 100644 --- a/mk/subst.mk +++ b/mk/subst.mk @@ -1,4 +1,4 @@ -# $NetBSD: subst.mk,v 1.20 2005/05/20 18:40:42 jlam Exp $ +# $NetBSD: subst.mk,v 1.21 2005/05/20 21:36:05 jlam Exp $ # # This Makefile fragment implements a general text replacement facility. # Package makefiles define a ``class'', for each of which a paricular @@ -47,7 +47,7 @@ _SUBST_BACKUP_SUFFIX= .subst.sav _SUBST_COOKIE.${_class_}= ${WRKDIR}/.subst_${_class_}_done SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}} -SUBST_POSTCMD.${_class_}?= ${RM} -f $$file${_SUBST_BACKUP_SUFFIX} +SUBST_POSTCMD.${_class_}?= ${RM} -f "$$tmpfile" SUBST_TARGETS+= subst-${_class_} _SUBST_TARGETS.${_class_}= subst-${_class_}-message @@ -77,26 +77,25 @@ subst-${_class_}: ${_SUBST_TARGETS.${_class_}} ${_SUBST_COOKIE.${_class_}}: ${_PKG_SILENT}${_PKG_DEBUG} \ - cd ${WRKSRC}; \ - files="${SUBST_FILES.${_class_}}"; \ - case "$$files" in \ - "") ;; \ - *) for file in $${files}; do \ - if ${_SUBST_IS_TEXT_FILE}; then \ - ${MV} -f $$file $$file${_SUBST_BACKUP_SUFFIX} || exit 1; \ - ${CAT} $$file${_SUBST_BACKUP_SUFFIX} \ - | ${SUBST_FILTER_CMD.${_class_}} \ - > $$file; \ - if [ -x $$file${_SUBST_BACKUP_SUFFIX} ]; then \ - ${CHMOD} +x $$file; \ - fi; \ - if ${CMP} -s $$file${_SUBST_BACKUP_SUFFIX} $$file; then \ - ${MV} -f $$file${_SUBST_BACKUP_SUFFIX} $$file; \ - else \ - ${SUBST_POSTCMD.${_class_}}; \ - ${ECHO} $$file >> ${.TARGET}; \ - fi; \ + cd ${WRKSRC:Q}; \ + files=${SUBST_FILES.${_class_}:Q}; \ + for file in $$files; do \ + file="./$$file"; \ + tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q}; \ + if ${_SUBST_IS_TEXT_FILE}; then \ + ${MV} -f "$$file" "$$tmpfile" || exit 1; \ + ${CAT} "$$tmpfile" \ + | ${SUBST_FILTER_CMD.${_class_}} \ + > "$$file"; \ + if ${TEST} -x "$$tmpfile"; then \ + ${CHMOD} +x "$$file"; \ fi; \ - done ;; \ - esac + if ${CMP} -s "$$tmpfile" "$$file"; then \ + ${MV} -f "$$tmpfile" "$$file"; \ + else \ + ${SUBST_POSTCMD.${_class_}}; \ + ${ECHO} "$$file" >> ${.TARGET}; \ + fi; \ + fi; \ + done .endfor diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk index aae9a54e3ef..fdcc0ffb89c 100644 --- a/mk/wrapper/bsd.wrapper.mk +++ b/mk/wrapper/bsd.wrapper.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.wrapper.mk,v 1.30 2005/05/11 22:08:19 jlam Exp $ +# $NetBSD: bsd.wrapper.mk,v 1.31 2005/05/20 21:36:05 jlam Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -695,12 +695,11 @@ _UNWRAP_PATTERNS= ${UNWRAP_PATTERNS} _UNWRAP_PATTERNS+= *-config _UNWRAP_PATTERNS+= *Conf.sh _UNWRAP_PATTERNS+= *.pc -_UNWRAP_PATTERNS_FIND= \ - \( ${_UNWRAP_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \) +_UNWRAP_PATTERNS_FIND_cmd= \ + cd ${WRKSRC} && ${FIND} . \( ${_UNWRAP_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \) -print | ${SED} -e 's|^\./||' | ${SORT} -u UNWRAP_FILES?= # empty -_UNWRAP_FILES= \ - ${UNWRAP_FILES} \ - `${FIND} . ${_UNWRAP_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${SORT} -u` +_UNWRAP_FILES= ${UNWRAP_FILES} \ + ${_UNWRAP_PATTERNS_FIND_cmd:sh} _UNWRAP_SED?= # empty SUBST_CLASSES+= unwrap |