summaryrefslogtreecommitdiff
path: root/mk/configure/replace-interpreter.mk
diff options
context:
space:
mode:
authorjlam <jlam>2006-07-05 06:09:15 +0000
committerjlam <jlam>2006-07-05 06:09:15 +0000
commitae760a5261f0d8bdd629f11fc996f388ef18d597 (patch)
tree5cda57cdca85b18146d681fc321900e0b05b7666 /mk/configure/replace-interpreter.mk
parentff1abac1968d3a2126fff67c56d713586d517e87 (diff)
downloadpkgsrc-ae760a5261f0d8bdd629f11fc996f388ef18d597.tar.gz
Refactor configure, build, test and wrapper phases out of bsd.pkg.mk
and into their own directories. Also do some cleanups with build/_build and pkginstall -- we get rid of _build and simply run pkginstall as part of the "build" target. Introduce a new mechanism to handle varying directory depths under ${WRKSRC} in which we find files to override, e.g. configure, config.*, libtool, etc. OVERRIDE_DIRDEPTH is a package-settable variable that specifies how far under ${WRKSRC} the various targets should look, and it defaults to "2". We preserve the meaning of the various *_OVERRIDE variables, so if they are defined, then their values supersede the OVERRIDE_DIRDEPTH mechanism. devel/tla will need to specially set OVERRIDE_DIRDEPTH to 3 (see log for revision 1.1857 for bsd.pkg.mk -- to be done in a separate commit.
Diffstat (limited to 'mk/configure/replace-interpreter.mk')
-rw-r--r--mk/configure/replace-interpreter.mk48
1 files changed, 48 insertions, 0 deletions
diff --git a/mk/configure/replace-interpreter.mk b/mk/configure/replace-interpreter.mk
new file mode 100644
index 00000000000..a82d1cc3cf2
--- /dev/null
+++ b/mk/configure/replace-interpreter.mk
@@ -0,0 +1,48 @@
+# $NetBSD: replace-interpreter.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $
+
+######################################################################
+### replace-interpreter (PRIVATE)
+######################################################################
+### replace-interpreter replaces paths to interpreters in scripts with
+### the paths to the pkgsrc-managed interpreters.
+###
+do-configure-pre-hook: replace-interpreter
+
+.if defined(REPLACE_PERL)
+REPLACE_INTERPRETER+= perl
+REPLACE.perl.old= .*/bin/perl
+REPLACE.perl.new= ${PERL5}
+REPLACE_FILES.perl= ${REPLACE_PERL}
+.endif
+
+# XXX After 2006Q2, all instances of _REPLACE.* and _REPLACE_FILES.* should
+# XXX have been replaced with REPLACE.* and REPLACE_FILES.*. This code is
+# XXX then no longer needed.
+# XXX
+.for _lang_ in ${REPLACE_INTERPRETER}
+REPLACE.${_lang_}.old?= ${_REPLACE.${_lang_}.old}
+REPLACE.${_lang_}.new?= ${_REPLACE.${_lang_}.new}
+REPLACE_FILES.${_lang_}?= ${_REPLACE_FILES.${_lang_}}
+.endfor
+
+.PHONY: replace-interpreter
+replace-interpreter:
+.for _lang_ in ${REPLACE_INTERPRETER}
+ @${STEP_MSG} "Replacing interpreter paths in scripts"
+. for _pattern_ in ${REPLACE_FILES.${_lang_}}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cd ${WRKSRC}; \
+ for file in ${_pattern_}; do \
+ if ${TEST} ! -f "$$file"; then \
+ ${WARNING_MSG} "[replace-interpreter.mk] Skipping non-existent file \"$$file\"."; \
+ continue; \
+ fi; \
+ ${SED} -e '1s|^#!${REPLACE.${_lang_}.old}|#!${REPLACE.${_lang_}.new}|' \
+ $$file > $$file.new; \
+ if ${TEST} -x $$file; then \
+ ${CHMOD} a+x $$file.new; \
+ fi; \
+ ${MV} -f $$file.new $$file; \
+ done
+. endfor
+.endfor