summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authormspo <mspo@pkgsrc.org>2013-04-02 00:28:57 +0000
committermspo <mspo@pkgsrc.org>2013-04-02 00:28:57 +0000
commit1a37c2ef5b3a05dcb2358d245ffcefbce92aee63 (patch)
treeb7489a9f48fcf58f667d0dc719e02a8b0cd11d2c /mk
parent86d0565a8bc3e0c02036f0680ccf2c8df177675e (diff)
downloadpkgsrc-1a37c2ef5b3a05dcb2358d245ffcefbce92aee63.tar.gz
add some tricks to handle #!/usr/bin/env, do please improve
Diffstat (limited to 'mk')
-rw-r--r--mk/configure/replace-interpreter.mk5
1 files changed, 3 insertions, 2 deletions
diff --git a/mk/configure/replace-interpreter.mk b/mk/configure/replace-interpreter.mk
index 95316dbd3b8..ffce4fbd1b0 100644
--- a/mk/configure/replace-interpreter.mk
+++ b/mk/configure/replace-interpreter.mk
@@ -1,4 +1,4 @@
-# $NetBSD: replace-interpreter.mk,v 1.11 2012/02/06 06:18:36 sbd Exp $
+# $NetBSD: replace-interpreter.mk,v 1.12 2013/04/02 00:28:57 mspo Exp $
# This file provides common templates for replacing #! interpreters
# in script files.
@@ -99,7 +99,8 @@ replace-interpreter:
cd ${WRKSRC}; \
for f in ${REPLACE_FILES.${_lang_}}; do \
if [ -f "$${f}" ]; then \
- ${SED} -e '1s|^#![[:space:]]*${REPLACE.${_lang_}.old}|#!${REPLACE.${_lang_}.new}|' \
+ ${SED} -e '1{ /env -i/!s|^#![[:space:]]*/usr/bin/env|#!|;}' \
+ -e '1s|^#![[:space:]]*${REPLACE.${_lang_}.old}|#!${REPLACE.${_lang_}.new}|' \
< "$${f}" > "$${f}.new"; \
if [ -x "$${f}" ]; then \
${CHMOD} a+x "$${f}.new"; \