summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2007-01-14 17:05:02 +0000
committerrillig <rillig@pkgsrc.org>2007-01-14 17:05:02 +0000
commit4325294faec4ce9a2694974b1677c9d8d5e3c480 (patch)
tree24b2b6dba1a9fa0d1c1b1e82021419632a5f0d6c /mk
parent82ff4507d8c3a3c8351cd3c93954bb335dd7618b (diff)
downloadpkgsrc-4325294faec4ce9a2694974b1677c9d8d5e3c480.tar.gz
The new variable SUBST_SKIP_TEXT_CHECK.* can be set to "yes" to do the
substitutions in all files, whether or not file(1) says they are text.
Diffstat (limited to 'mk')
-rw-r--r--mk/subst.mk16
1 files changed, 14 insertions, 2 deletions
diff --git a/mk/subst.mk b/mk/subst.mk
index d122ffce160..048dbef9208 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.40 2007/01/11 12:12:12 rillig Exp $
+# $NetBSD: subst.mk,v 1.41 2007/01/14 17:05:02 rillig Exp $
#
# This Makefile fragment implements a general text replacement facility.
# Package makefiles define a ``class'', for each of which a particular
@@ -33,6 +33,11 @@
# Command to clean up after sed(1). Defaults to ${RM} -f
# $$file${_SUBST_BACKUP_SUFFIX}. For debugging, set it to ${DO_NADA}.
#
+# SUBST_SKIP_TEXT_CHECK.<class>
+# By default, each file is checked whether it really is a text file
+# before any substitutions are done to it. Since that test is not
+# perfect, it can be disabled by setting this variable to "yes".
+#
# Keywords: subst
#
@@ -52,6 +57,13 @@ _SUBST_COOKIE.${_class_}= ${WRKDIR}/.subst_${_class_}_done
SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}}
SUBST_POSTCMD.${_class_}?= ${RM} -f "$$tmpfile"
+SUBST_SKIP_TEXT_CHECK.${_class_}?= no
+
+.if !empty(SUBST_SKIP_TEXT_CHECK.${_class_}:M[Yy][Ee][Ss])
+_SUBST_IS_TEXT_FILE.${_class_}= ${TRUE}
+.else
+_SUBST_IS_TEXT_FILE.${_class_}= ${_SUBST_IS_TEXT_FILE}
+.endif
SUBST_TARGETS+= subst-${_class_}
@@ -76,7 +88,7 @@ ${_SUBST_COOKIE.${_class_}}:
for file in $$files; do \
case $$file in /*) ;; *) file="./$$file";; esac; \
tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q}; \
- if ${_SUBST_IS_TEXT_FILE}; then \
+ if ${_SUBST_IS_TEXT_FILE.${_class_}}; then \
${MV} -f "$$file" "$$tmpfile" || exit 1; \
${SUBST_FILTER_CMD.${_class_}} \
< "$$tmpfile" \