diff options
author | jlam <jlam@pkgsrc.org> | 2006-07-05 06:09:15 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2006-07-05 06:09:15 +0000 |
commit | e31200b87c973f65d2a1f7c8949cc1891040e67e (patch) | |
tree | 5cda57cdca85b18146d681fc321900e0b05b7666 /mk/configure | |
parent | 00478b39e6c53023f76627af6ffacebafc9db9d6 (diff) | |
download | pkgsrc-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')
-rw-r--r-- | mk/configure/bsd.configure-vars.mk | 27 | ||||
-rw-r--r-- | mk/configure/bsd.configure.mk | 39 | ||||
-rw-r--r-- | mk/configure/config-override.mk | 51 | ||||
-rw-r--r-- | mk/configure/configure.mk | 216 | ||||
-rw-r--r-- | mk/configure/gnu-configure.mk | 100 | ||||
-rw-r--r-- | mk/configure/libtool-override.mk | 83 | ||||
-rw-r--r-- | mk/configure/pkg-config-override.mk | 33 | ||||
-rw-r--r-- | mk/configure/replace-interpreter.mk | 48 | ||||
-rw-r--r-- | mk/configure/replace-localedir.mk | 45 |
9 files changed, 642 insertions, 0 deletions
diff --git a/mk/configure/bsd.configure-vars.mk b/mk/configure/bsd.configure-vars.mk new file mode 100644 index 00000000000..e857ea1b37f --- /dev/null +++ b/mk/configure/bsd.configure-vars.mk @@ -0,0 +1,27 @@ +# $NetBSD: bsd.configure-vars.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $ +# +# CONFIGURE_DIRS is the list of directories in which to run the +# configure process. If the directories are relative paths, +# then they are assumed to be relative to ${WRKSRC}. +# +# SCRIPTS_ENV is the shell environment passed to scripts invoked +# by pkgsrc, including xmkmf (used by the configure process). +# +CONFIGURE_DIRS?= ${WRKSRC} +SCRIPTS_ENV?= # empty + +SCRIPTS_ENV+= ${ALL_ENV} +SCRIPTS_ENV+= _PKGSRCDIR=${_PKGSRCDIR} +SCRIPTS_ENV+= ${BATCH:DBATCH=yes} +SCRIPTS_ENV+= CURDIR=${.CURDIR} +SCRIPTS_ENV+= DEPENDS=${DEPENDS:Q} +SCRIPTS_ENV+= DISTDIR=${DISTDIR} +SCRIPTS_ENV+= FILESDIR=${FILESDIR} +SCRIPTS_ENV+= LOCALBASE=${LOCALBASE} +SCRIPTS_ENV+= PATCHDIR=${PATCHDIR} +SCRIPTS_ENV+= PKGSRCDIR=${PKGSRCDIR} +SCRIPTS_ENV+= SCRIPTDIR=${SCRIPTDIR} +SCRIPTS_ENV+= VIEWBASE=${VIEWBASE} +SCRIPTS_ENV+= WRKDIR=${WRKDIR} +SCRIPTS_ENV+= WRKSRC=${WRKSRC} +SCRIPTS_ENV+= X11BASE=${X11BASE} diff --git a/mk/configure/bsd.configure.mk b/mk/configure/bsd.configure.mk new file mode 100644 index 00000000000..e90efd600d8 --- /dev/null +++ b/mk/configure/bsd.configure.mk @@ -0,0 +1,39 @@ +# $NetBSD: bsd.configure.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $ +# +# This Makefile fragment is included by bsd.pkg.mk and provides all +# variables and targets related to configuring packages for building. +# +# The following are the "public" targets provided by this module: +# +# configure +# +# The following targets may be overridden in a package Makefile: +# +# pre-configure, do-configure, post-configure +# + +_CONFIGURE_COOKIE= ${WRKDIR}/.configure_done + +###################################################################### +### configure (PUBLIC) +###################################################################### +### configure is a public target to configure the software for building. +### +.PHONY: configure +.if defined(NO_CONFIGURE) +. if !target(configure) +configure: patch configure-cookie +. endif +.else +. include "${PKGSRCDIR}/mk/configure/configure.mk" +.endif + +###################################################################### +### configure-cookie (PRIVATE) +###################################################################### +### configure-cookie creates the "configure" cookie file. +### +.PHONY: configure-cookie +configure-cookie: + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_CONFIGURE_COOKIE:H} + ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} >> ${_CONFIGURE_COOKIE} diff --git a/mk/configure/config-override.mk b/mk/configure/config-override.mk new file mode 100644 index 00000000000..bfa1d22755d --- /dev/null +++ b/mk/configure/config-override.mk @@ -0,0 +1,51 @@ +# $NetBSD: config-override.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $ + +###################################################################### +### config-{guess,sub,rpath}-override (PRIVATE) +###################################################################### +### config-{guess,sub,rpath}-override replace any existing config.guess, +### config.sub, and config-rpath under ${WRKSRC} with the specially-kept +### versions under pkgsrc/mk/gnu-config. +### +do-configure-pre-hook: config-guess-override +do-configure-pre-hook: config-guess-override +.if defined(CONFIG_RPATH_OVERRIDE) +do-configure-pre-hook: config-guess-override +.endif + +_OVERRIDE_VAR.guess= CONFIG_GUESS_OVERRIDE +_OVERRIDE_VAR.sub= CONFIG_SUB_OVERRIDE +_OVERRIDE_VAR.rpath= CONFIG_RPATH_OVERRIDE + +OVERRIDE_DIRDEPTH.config-guess?= ${OVERRIDE_DIRDEPTH} +OVERRIDE_DIRDEPTH.config-sub?= ${OVERRIDE_DIRDEPTH} +OVERRIDE_DIRDEPTH.config-rpath?= ${OVERRIDE_DIRDEPTH} + +.for _sub_ in guess sub rpath +_SCRIPT.config-${_sub_}-override= \ + ${RM} -f $$file; \ + ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.${_sub_} $$file + +.PHONY: config-${_sub_}-override +config-${_sub_}-override: + @${STEP_MSG} "Replacing config-* with pkgsrc versions" +. if defined(${_OVERRIDE_VAR.${_sub_}}) && !empty(${_OVERRIDE_VAR.${_sub_}}) + ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ + cd ${WRKSRC}; \ + for file in ${${_OVERRIDE_VAR.${_sub_}}}; do \ + ${TEST} -f "$$file" || continue; \ + ${_SCRIPT.${.TARGET}}; \ + done +. else + ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ + cd ${WRKSRC}; \ + depth=0; pattern=config.${_sub_}; \ + while ${TEST} $$depth -le ${OVERRIDE_DIRDEPTH.config-${_sub_}}; do \ + for file in $$pattern; do \ + ${TEST} -f "$$file" || continue; \ + ${_SCRIPT.${.TARGET}}; \ + done; \ + depth=`${EXPR} $$depth + 1`; pattern="*/$$pattern"; \ + done +. endif +.endfor diff --git a/mk/configure/configure.mk b/mk/configure/configure.mk new file mode 100644 index 00000000000..fe504e2bba4 --- /dev/null +++ b/mk/configure/configure.mk @@ -0,0 +1,216 @@ +# $NetBSD: configure.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $ +# +# CONFIGURE_SCRIPT is the path to the script to run in order to +# configure the software for building. If the path is relative, +# then it is assumed to be relative to each directory listed in +# CONFIGURE_DIRS. +# +# CONFIGURE_ENV is the shell environment that is exported to the +# configure script. +# +# CONFIGURE_ARGS is the list of arguments that is passed to the +# configure script. +# +CONFIGURE_SCRIPT?= ./configure +CONFIGURE_ENV+= ${ALL_ENV} +CONFIGURE_ARGS?= # empty +BUILD_DEFS+= CONFIGURE_ENV CONFIGURE_ARGS + +.if defined(GNU_CONFIGURE) +. include "${PKGSRCDIR}/mk/configure/gnu-configure.mk" +.endif +.if defined(OVERRIDE_GNU_CONFIG_SCRIPTS) +. include "${PKGSRCDIR}/mk/configure/config-override.mk" +.endif +.if defined(USE_LIBTOOL) +. include "${PKGSRCDIR}/mk/configure/libtool-override.mk" +.endif +.if defined(PKGCONFIG_OVERRIDE) +. include "${PKGSRCDIR}/mk/configure/pkg-config-override.mk" +.endif +.if defined(REPLACE_INTERPRETER) || defined(REPLACE_PERL) +. include "${PKGSRCDIR}/mk/configure/replace-interpreter.mk" +.endif +.if defined(USE_PKGLOCALEDIR) +. include "${PKGSRCDIR}/mk/configure/replace-localedir.mk" +.endif + +###################################################################### +### configure (PUBLIC) +###################################################################### +### configure is a public target to configure the sources for building. +### +_CONFIGURE_TARGETS+= wrapper +_CONFIGURE_TARGETS+= acquire-configure-lock +_CONFIGURE_TARGETS+= ${_CONFIGURE_COOKIE} +_CONFIGURE_TARGETS+= release-configure-lock + +.PHONY: configure +.if !target(configure) +configure: ${_CONFIGURE_TARGETS} +.endif + +.PHONY: acquire-configure-lock release-configure-lock +acquire-configure-lock: acquire-lock +release-configure-lock: release-lock + +.if !exists(${_CONFIGURE_COOKIE}) +${_CONFIGURE_COOKIE}: + ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-configure PKG_PHASE=configure || ${PKG_ERROR_HANDLER.configure} +.else +${_CONFIGURE_COOKIE}: + @${DO_NADA} +.endif + +PKG_ERROR_CLASSES+= configure +PKG_ERROR_MSG.configure= \ + "" \ + "There was an error during the \`\`configure'' phase." \ + "Please investigate the following for more information:" +.if defined(GNU_CONFIGURE) +PKG_ERROR_MSG.configure+= \ + " * config.log" \ + " * ${WRKLOG}" \ + "" +.else +PKG_ERROR_MSG.configure+= \ + " * log of the build" \ + " * ${WRKLOG}" \ + "" +.endif +.if defined(BROKEN_IN) +PKG_ERROR_MSG.configure+= \ + " * This package is broken in ${BROKEN_IN}." \ + " * It may be removed in the next branch unless fixed." +.endif + +###################################################################### +### real-configure (PRIVATE) +###################################################################### +### real-configure is a helper target onto which one can hook all of the +### targets that do the actual configuration of the sources. +### +_REAL_CONFIGURE_TARGETS+= configure-check-interactive +_REAL_CONFIGURE_TARGETS+= configure-message +_REAL_CONFIGURE_TARGETS+= configure-vars +_REAL_CONFIGURE_TARGETS+= pre-configure +_REAL_CONFIGURE_TARGETS+= do-configure-pre-hook +_REAL_CONFIGURE_TARGETS+= do-configure +_REAL_CONFIGURE_TARGETS+= do-configure-post-hook +_REAL_CONFIGURE_TARGETS+= post-configure +_REAL_CONFIGURE_TARGETS+= configure-cookie +_REAL_CONFIGURE_TARGETS+= error-check + +.PHONY: real-configure +real-configure: ${_REAL_CONFIGURE_TARGETS} + +.PHONY: configure-message +configure-message: + @${PHASE_MSG} "Configuring for ${PKGNAME}" + +###################################################################### +### configure-check-interactive (PRIVATE) +###################################################################### +### configure-check-interactive checks whether we must do an interactive +### configuration or not. +### +configure-check-interactive: +.if !empty(INTERACTIVE_STAGE:Mconfigure) && defined(BATCH) + @${ERROR_MSG} "The configure stage of this package requires user interaction" + @${ERROR_MSG} "Please configure manually with:" + @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} configure\"" + @${TOUCH} ${_INTERACTIVE_COOKIE} + @${FALSE} +.else + @${DO_NADA} +.endif + +###################################################################### +### do-configure-pre-hook (PRIVATE) +###################################################################### +### do-configure-pre-hook is a helper target onto which one can hook +### all of the targets that should be run after pre-configure but before +### do-configure. These targets typically edit the files used by the +### do-configure target. +### +.PHONY: do-configure-pre-hook +do-configure-pre-hook: + @${DO_NADA} + +###################################################################### +### do-configure-post-hook (PRIVATE) +###################################################################### +### do-configure-post-hook is a helper target onto which one can hook +### all of the targets that should be run after do-configure but before +### post-configure. These targets typically edit the files generated +### by the do-configure target that are used during the build phase. +### +.PHONY: do-configure-post-hook +do-configure-post-hook: + @${DO_NADA} + +###################################################################### +### do-configure-script (PRIVATE) +###################################################################### +### do-configure-script runs the configure script to configure the +### software for building. +### +_CONFIGURE_SCRIPT_ENV+= INSTALL=${INSTALL:Q}\ -c\ -o\ ${BINOWN}\ -g\ ${BINGRP} +_CONFIGURE_SCRIPT_ENV+= INSTALL_PROGRAM=${INSTALL_PROGRAM:Q} +_CONFIGURE_SCRIPT_ENV+= INSTALL_SCRIPT=${INSTALL_SCRIPT:Q} +_CONFIGURE_SCRIPT_ENV+= INSTALL_DATA=${INSTALL_DATA:Q} +_CONFIGURE_SCRIPT_ENV+= INSTALL_GAME=${INSTALL_GAME:Q} +_CONFIGURE_SCRIPT_ENV+= INSTALL_GAME_DATA=${INSTALL_GAME_DATA:Q} +_CONFIGURE_SCRIPT_ENV+= ${CONFIGURE_ENV} + +.PHONY: do-configure-script +do-configure-script: +.for _dir_ in ${CONFIGURE_DIRS} + ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD} \ + cd ${WRKSRC} && cd ${_dir_} && \ + ${SETENV} ${_CONFIGURE_SCRIPT_ENV} \ + ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS} +.endfor + +###################################################################### +### do-configure-imake (PRIVATE) +###################################################################### +### do-configure-imake runs xmkmf and imake to configure the software +### for building. +### +_CONFIGURE_IMAKE_ENV+= XPROJECTROOT=${X11BASE:Q} +_CONFIGURE_IMAKE_ENV+= ${SCRIPTS_ENV} + +.PHONY: do-configure-imake +do-configure-imake: +.for _dir_ in ${CONFIGURE_DIRS} + ${_PKG_SILENT}${_PKG_DEBUG} \ + cd ${WRKSRC} && cd ${_dir_} && \ + ${SETENV} ${_CONFIGURE_IMAKE_ENV} ${XMKMF} +.endfor + +###################################################################### +### pre-configure, do-configure, post-configure (PUBLIC, override) +###################################################################### +### {pre,do,post}-configure are the heart of the package-customizable +### configure targets, and may be overridden within a package Makefile. +### +.PHONY: pre-configure do-configure post-configure + +_DO_CONFIGURE_TARGETS+= ${HAS_CONFIGURE:D do-configure-script} +_DO_CONFIGURE_TARGETS+= ${USE_IMAKE:D do-configure-imake} + +.if !target(do-configure) +do-configure: ${_DO_CONFIGURE_TARGETS} + @${DO_NADA} +.endif + +.if !target(pre-configure) +pre-configure: + @${DO_NADA} +.endif + +.if !target(post-configure) +post-configure: + @${DO_NADA} +.endif diff --git a/mk/configure/gnu-configure.mk b/mk/configure/gnu-configure.mk new file mode 100644 index 00000000000..bcf15bc5c1a --- /dev/null +++ b/mk/configure/gnu-configure.mk @@ -0,0 +1,100 @@ +# $NetBSD: gnu-configure.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $ + +HAS_CONFIGURE= defined +OVERRIDE_GNU_CONFIG_SCRIPTS= defined + +CONFIG_SHELL?= ${SH} +CONFIGURE_ENV+= CONFIG_SHELL=${CONFIG_SHELL:Q} +CONFIGURE_ENV+= LIBS=${LIBS:M*:Q} +CONFIGURE_ENV+= install_sh=${INSTALL:Q} +CONFIGURE_ENV+= ac_given_INSTALL=${INSTALL:Q}\ -c\ -o\ ${BINOWN}\ -g\ ${BINGRP} + +.if (defined(USE_LIBTOOL) || !empty(PKGPATH:Mdevel/libtool-base)) && \ + defined(_OPSYS_MAX_CMDLEN_CMD) +CONFIGURE_ENV+= lt_cv_sys_max_cmd_len=${_OPSYS_MAX_CMDLEN_CMD:sh} +.endif + +GNU_CONFIGURE_PREFIX?= ${PREFIX} +CONFIGURE_ARGS+= --prefix=${GNU_CONFIGURE_PREFIX:Q} + +USE_GNU_CONFIGURE_HOST?= yes +.if !empty(USE_GNU_CONFIGURE_HOST:M[yY][eE][sS]) +CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM:Q} +.endif + +# PKGINFODIR is the subdirectory of ${PREFIX} into which the info +# files are installed unless the software was configured with an +# installation prefix other than ${PREFIX}. +# +CONFIGURE_HAS_INFODIR?= yes +.if ${GNU_CONFIGURE_PREFIX} == ${PREFIX} +GNU_CONFIGURE_INFODIR?= ${GNU_CONFIGURE_PREFIX}/${PKGINFODIR} +.else +GNU_CONFIGURE_INFODIR?= ${GNU_CONFIGURE_PREFIX}/info +.endif +.if defined(INFO_FILES) && !empty(CONFIGURE_HAS_INFODIR:M[yY][eE][sS]) +CONFIGURE_ARGS+= --infodir=${GNU_CONFIGURE_INFODIR:Q} +.endif + +# PKGMANDIR is the subdirectory of ${PREFIX} into which the man and +# catman pages are installed unless the software was configured with +# an installation prefix other than ${PREFIX}. +# +CONFIGURE_HAS_MANDIR?= yes +.if ${GNU_CONFIGURE_PREFIX} == ${PREFIX} +GNU_CONFIGURE_MANDIR?= ${GNU_CONFIGURE_PREFIX}/${PKGMANDIR} +.else +GNU_CONFIGURE_MANDIR?= ${GNU_CONFIGURE_PREFIX}/man +.endif +.if !empty(CONFIGURE_HAS_MANDIR:M[yY][eE][sS]) +CONFIGURE_ARGS+= --mandir=${GNU_CONFIGURE_MANDIR:Q} +.endif + +###################################################################### +### configure-scripts-override (PRIVATE) +###################################################################### +### configure-scripts-override modifies the GNU configure scripts in +### ${WRKSRC} so that the generated config.status scripts never do +### anything on "--recheck". This is important in pkgsrc because we +### only ever want to run the configure checks during the configure +### phase, and "recheck" is often run during the build and install +### phases. +### +do-configure-pre-hook: configure-scripts-override + +_SCRIPT.configure-scripts-override= \ + ${AWK} '/ *-recheck *\| *--recheck.*\)/ { \ + print; \ + print " : Avoid regenerating within pkgsrc"; \ + print " exit 0"; \ + next; \ + } \ + { print }' $$file > $$file.override; \ + ${CHMOD} +x $$file.override; \ + ${MV} -f $$file.override $$file + +OVERRIDE_DIRDEPTH.configure?= ${OVERRIDE_DIRDEPTH} + +.PHONY: configure-scripts-override +configure-scripts-override: + @${STEP_MSG} "Modifying GNU configure scripts to avoid --recheck" +.if defined(CONFIGURE_SCRIPTS_OVERRIDE) && !empty(CONFIGURE_SCRIPTS_OVERRIDE) + @echo HERE + ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ + cd ${WRKSRC}; \ + for file in ${CONFIGURE_SCRIPTS_OVERRIDE}; do \ + ${TEST} -f "$$file" || continue; \ + ${_SCRIPT.${.TARGET}}; \ + done +.else + ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ + cd ${WRKSRC}; \ + depth=0; pattern=${CONFIGURE_SCRIPT:T}; \ + while ${TEST} $$depth -le ${OVERRIDE_DIRDEPTH.configure}; do \ + for file in $$pattern; do \ + ${TEST} -f "$$file" || continue; \ + ${_SCRIPT.${.TARGET}}; \ + done; \ + depth=`${EXPR} $$depth + 1`; pattern="*/$$pattern"; \ + done +.endif 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 diff --git a/mk/configure/pkg-config-override.mk b/mk/configure/pkg-config-override.mk new file mode 100644 index 00000000000..d493068a33d --- /dev/null +++ b/mk/configure/pkg-config-override.mk @@ -0,0 +1,33 @@ +# $NetBSD: pkg-config-override.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $ + +###################################################################### +### pkg-config-override (PRIVATE) +###################################################################### +### pkg-config-override inserts the compiler's "rpath" flag into +### pkg-config data files so that ``pkg-config --ldflags <module>'' will +### return the full set of compiler flags needed to find libraries at +### run-time. +### +.PHONY: pkg-config-override +pkg-config-override: + @${DO_NADA} + +.if defined(_USE_RPATH) && !empty(_USE_RPATH:M[nN][oO]) +pkg-config-override: subst-pkgconfig + +PKGCONFIG_OVERRIDE_SED= \ + '/^Libs:.*[ ]/s|-L\([ ]*[^ ]*\)|${COMPILER_RPATH_FLAG}\1 -L\1|g' +PKGCONFIG_OVERRIDE_STAGE?= pre-configure + +SUBST_CLASSES+= pkgconfig +. if ${PKGCONFIG_OVERRIDE_STAGE} == "pre-configure" +SUBST_STAGE.pkgconfig= do-configure-pre-hook +. elif ${PKGCONFIG_OVERRIDE_STAGE} == "post-configure" +SUBST_STAGE.pkgconfig= do-configure-post-hook +. else +SUBST_STAGE.pkgconfig= ${PKGCONFIG_OVERRIDE_STAGE} +. endif +SUBST_MESSAGE.pkgconfig= Adding run-time search paths to pkg-config files. +SUBST_FILES.pkgconfig= ${PKGCONFIG_OVERRIDE:S/^${WRKSRC}\///} +SUBST_SED.pkgconfig= ${PKGCONFIG_OVERRIDE_SED} +.endif 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 diff --git a/mk/configure/replace-localedir.mk b/mk/configure/replace-localedir.mk new file mode 100644 index 00000000000..e045025541a --- /dev/null +++ b/mk/configure/replace-localedir.mk @@ -0,0 +1,45 @@ +# $NetBSD: replace-localedir.mk,v 1.1 2006/07/05 06:09:15 jlam Exp $ + +###################################################################### +### replace-localedir (PRIVATE) +###################################################################### +### replace-localedir replaces the path to the locale directory in +### various Makefiles with the one chosen by pkgsrc (PKGLOCALEDIR). +### +.PHONY: replace-localedir +replace-localedir: + @${DO_NADA} + +replace-localedir: subst-pkglocaledir + +_PKGLOCALEDIR= ${PREFIX}/${PKGLOCALEDIR}/locale + +REPLACE_LOCALEDIR_PATTERNS?= # empty +_REPLACE_LOCALEDIR_PATTERNS= ${REPLACE_LOCALEDIR_PATTERNS} +.if defined(HAS_CONFIGURE) +_REPLACE_LOCALEDIR_PATTERNS+= [Mm]akefile.in* +.else +_REPLACE_LOCALEDIR_PATTERNS+= [Mm]akefile* +.endif +_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd= \ + cd ${WRKSRC} && \ + ${ECHO} "__dummy-entry__" && \ + ${FIND} . \( ${_REPLACE_LOCALEDIR_PATTERNS:C/.*/-o -name "&"/g:S/-o//1} \) -print | \ + ${SED} -e 's|^\./||' | \ + ${SORT} -u + +REPLACE_LOCALEDIR?= # empty +_REPLACE_LOCALEDIR= \ + ${REPLACE_LOCALEDIR} \ + ${_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd:sh:N__dummy-entry__:N*.orig} + +.if empty(USE_PKGLOCALEDIR:M[nN][oO]) +SUBST_CLASSES+= pkglocaledir +.endif +SUBST_STAGE.pkglocaledir= do-configure-pre-hook +SUBST_MESSAGE.pkglocaledir= Fixing locale directory references. +SUBST_FILES.pkglocaledir= ${_REPLACE_LOCALEDIR} +SUBST_SED.pkglocaledir= \ + -e 's|^\(localedir[ :]*=\).*|\1 ${_PKGLOCALEDIR}|' \ + -e 's|^\(gnulocaledir[ :]*=\).*|\1 ${_PKGLOCALEDIR}|' \ + -e 's|\(-DLOCALEDIR[ ]*=\)[^ ]*\(\.\*\)|\1"\\"${_PKGLOCALEDIR}\\""\2|' |