summaryrefslogtreecommitdiff
path: root/mk/configure/libtool-override.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-07-05 06:09:15 +0000
committerjlam <jlam@pkgsrc.org>2006-07-05 06:09:15 +0000
commite31200b87c973f65d2a1f7c8949cc1891040e67e (patch)
tree5cda57cdca85b18146d681fc321900e0b05b7666 /mk/configure/libtool-override.mk
parent00478b39e6c53023f76627af6ffacebafc9db9d6 (diff)
downloadpkgsrc-e31200b87c973f65d2a1f7c8949cc1891040e67e.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/libtool-override.mk')
-rw-r--r--mk/configure/libtool-override.mk83
1 files changed, 83 insertions, 0 deletions
diff --git a/mk/configure/libtool-override.mk b/mk/configure/libtool-override.mk
new file mode 100644
index 00000000000..36b79685da2
--- /dev/null
+++ b/mk/configure/libtool-override.mk
@@ -0,0 +1,83 @@
+# $NetBSD: libtool-override.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $
+
+######################################################################
+### {ltconfig,libtool,shlibtool}-override (PRIVATE)
+######################################################################
+### {ltconfig,libtool,shlibtool}-override replace any existing ltconfig
+### and libtool under ${WRKSRC} with the versions installed by pkgsrc.
+###
+.if defined(LTCONFIG_OVERRIDE)
+do-configure-pre-hook: ltconfig-override
+.endif
+do-configure-post-hook: libtool-override
+.if defined(SHLIBTOOL_OVERRIDE)
+do-configure-post-hook: shlibtool-override
+.endif
+
+OVERRIDE_DIRDEPTH.ltconfig?= ${OVERRIDE_DIRDEPTH}
+OVERRIDE_DIRDEPTH.libtool?= ${OVERRIDE_DIRDEPTH}
+OVERRIDE_DIRDEPTH.shlibtool?= ${OVERRIDE_DIRDEPTH}
+
+_SCRIPT.ltconfig-override= \
+ ${RM} -f $$file; \
+ ${ECHO} "${RM} -f libtool; ${LN} -s ${_LIBTOOL} libtool" > $$file; \
+ ${CHMOD} +x $$file
+
+.PHONY: ltconfig-override
+ltconfig-override:
+.if defined(LTCONFIG_OVERRIDE) && !empty(LTCONFIG_OVERRIDE)
+ @${STEP_MSG} "Modifying ltconfig scripts to use pkgsrc libtool"
+ ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
+ cd ${WRKSRC}; \
+ for file in ${LTCONFIG_OVERRIDE}; do \
+ ${TEST} -f "$$file" || continue; \
+ ${_SCRIPT.${.TARGET}}; \
+ done
+.else
+ ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
+ cd ${WRKSRC}; \
+ depth=0; pattern=ltconfig; \
+ while ${TEST} $$depth -le ${OVERRIDE_DIRDEPTH.ltconfig}; do \
+ for file in $$pattern; do \
+ ${TEST} -f "$$file" || continue; \
+ ${_SCRIPT.${.TARGET}}; \
+ done; \
+ depth=`${EXPR} $$depth + 1`; pattern="*/$$pattern"; \
+ done
+.endif
+
+_OVERRIDE_VAR.libtool= LIBTOOL_OVERRIDE
+_OVERRIDE_VAR.shlibtool= SHLIBTOOL_OVERRIDE
+_OVERRIDE_PATH.libtool= ${_LIBTOOL}
+_OVERRIDE_PATH.shlibtool= ${_SHLIBTOOL}
+
+.for _script_ in libtool shlibtool
+_SCRIPT.${_script_}-override= \
+ ${ECHO} "\#!"${TOOLS_SH:Q} > $$file; \
+ ${ECHO} "exec" ${_OVERRIDE_PATH.${_script_}:Q} '"$$@"' >> $$file; \
+ ${CHMOD} +x $$file
+
+.PHONY: ${_script_}-override
+${_script_}-override:
+. if defined(${_OVERRIDE_VAR.${_script_}}) && \
+ !empty(${_OVERRIDE_VAR.${_script_}})
+ @${STEP_MSG} "Replacing libtool scripts with pkgsrc ${_script_}"
+ ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
+ cd ${WRKSRC}; \
+ for file in ${${_OVERRIDE_VAR.${_script_}}}; do \
+ ${TEST} -f "$$file" || continue; \
+ ${_SCRIPT.${.TARGET}}; \
+ done
+. else
+ ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
+ cd ${WRKSRC}; \
+ depth=0; pattern=libtool; \
+ while ${TEST} $$depth -le ${OVERRIDE_DIRDEPTH.${_script_}}; do \
+ for file in $$pattern; do \
+ ${TEST} -f "$$file" || continue; \
+ ${_SCRIPT.${.TARGET}}; \
+ done; \
+ depth=`${EXPR} $$depth + 1`; pattern="*/$$pattern"; \
+ done
+. endif
+.endfor