summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2003-08-16 08:50:17 +0000
committerjlam <jlam@pkgsrc.org>2003-08-16 08:50:17 +0000
commitac0258dd3cb43d7851d44bde98ed32c1e22ff6d2 (patch)
tree30ed6a009df883a6bc69e0407c4cf1a6b6bcbbdd /mk
parentd742be9bfff852098589aa99188b11e0cf7d5610 (diff)
downloadpkgsrc-ac0258dd3cb43d7851d44bde98ed32c1e22ff6d2.tar.gz
Move the hide-tools portion of bsd.buildlink2.mk into tools.mk, and
put the tools in ${WRKDIR}/.tools/bin instead of in ${BUILDLINK_DIR}, and remove the need for buildlink2 to use USE_GNU_TOOLS. In the modified USE_GNU_TOOLS implementation, the following implementation- specific variables have the following meanings: _TOOLS_REPLACE.<tool> means that we want ${AWK}, ${SED}, etc. symlinked into ${TOOLS_DIR} as awk, sed, etc. _TOOLS_NEED_GNU.<tool> means that we want to use the pkgsrc version of <tool> symlinked info ${TOOLS_DIR} as awk, sed, etc. If this is "YES", then it always trumps _TOOLS_REPLACE.<tool>. And we want nothing to happen if we're building the pkgsrc GNU tool itself. The modified USE_GNU_TOOLS implementation should also hopefully fix the circular dependency problem. Create a new target "tools" that is run after "patch" and before "buildlink" that populates the ${TOOLS_DIR} directory. This ensures that it's always run at the right time, instead of relying on pre-buildlink or pre-configure, which may be cancelled by NO_BUILDLINK or NO_CONFIGURE. XXX There is some possible fallout in texinfo.mk with the MAKE_ENV and XXX CONFIGURE_ENV settings for INSTALL_INFO and MAKEINFO. It looks XXX like the MAKE_ENV and CONFIGURE_ENV settings should move from XXX tools.mk into texinfo.mk, and they no longer need to be XXX conditional on USE_BUILDLINK2. I'll leave it to the texinfo.mk XXX dude (Hi, Stoned!).
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk132
-rw-r--r--mk/buildlink2/bsd.buildlink2.mk95
-rw-r--r--mk/tools.mk316
3 files changed, 230 insertions, 313 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 646dd8e6670..94baa77f2a8 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1238 2003/08/12 15:55:21 seb Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1239 2003/08/16 08:50:17 jlam Exp $
#
# This file is in the public domain.
#
@@ -298,6 +298,7 @@ INSTALL_COOKIE= ${WRKDIR}/.install_done
TEST_COOKIE= ${WRKDIR}/.test_done
BUILD_COOKIE= ${WRKDIR}/.build_done
PATCH_COOKIE= ${WRKDIR}/.patch_done
+TOOLS_COOKIE= ${WRKDIR}/.tools_done
PACKAGE_COOKIE= ${WRKDIR}/.package_done
INTERACTIVE_COOKIE= .interactive_stage
NULL_COOKIE= ${WRKDIR}/.null
@@ -550,9 +551,6 @@ PLIST_SUBST+= PERL5_SITEARCH=${PERL5_SITEARCH:S/^${LOCALBASE}\///}
PLIST_SUBST+= PERL5_ARCHLIB=${PERL5_ARCHLIB:S/^${LOCALBASE}\///}
.endif
-# base vs. GNU tools
-. include "../../mk/tools.mk"
-
# Handle info files
#
INFO_FILES?= # default to no info files to handle
@@ -1191,6 +1189,8 @@ NO_BUILDLINK= # defined
. include "../../mk/buildlink2/bsd.buildlink2.mk"
.endif
+.include "../../mk/tools.mk"
+
.MAIN: all
# Use aliases, so that all versions of English are acceptable
@@ -1364,10 +1364,17 @@ checksum: fetch
@${DO_NADA}
.endif
+# Disable tools
+.PHONY: tools
+.if defined(NO_TOOLS) && !target(tools)
+tools: patch
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${TOOLS_COOKIE}
+.endif
+
# Disable buildlink
.PHONY: buildlink
.if defined(NO_BUILDLINK) && !target(configure)
-buildlink: patch
+buildlink: tools
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_COOKIE}
.endif
@@ -2143,77 +2150,6 @@ do-pkgconfig-override:
. endfor
.endif
-.if empty(USE_BUILDLINK2:M[nN][oO])
-#
-# By default, prevent invocation of GNU "auto*" driven by the generated
-# Makefiles during the build process by touching various auto{conf,make}
-# source files to make them up-to-date. Packages that require regenerating
-# the configure script and Makefile.in files should make the appropriate
-# calls to auto{conf,make} in a pre-configure target.
-#
-# The rationale for the choice of patterns is:
-#
-# Before configure script is run:
-# * configure.in might be generated from configure.in.in,
-# * aclocal.m4 is generated by aclocal from acinclude.m4 and
-# configure.in,
-# * stamp-h.in, stamp-h[0-9].in are the automake timestamp files
-# for config.h.in,
-# * config.h.in is generated by autoheader from configure.in
-# * Makefile.in is generated from Makefile.am,
-# * the configure script is generated by autoconf from configure.in,
-# aclocal.m4, and various other *.m4 files.
-#
-# After configure script is run:
-# * config.status is generated by the configure script,
-# * Makefile, stamp-h, stamp-h[0-9] are generated by config.status.
-# * config.h are generated by config.status.
-#
-# NOTE: If you change the patterns listed below, then it's recommended that
-# you verify that the changes are correct by trying to build the
-# following packages:
-#
-# sysutils/fileutils, www/curl, x11/lesstif, x11/kdelibs2
-#
-AUTOMAKE_OVERRIDE?= YES
-. if empty(AUTOMAKE_OVERRIDE:M[nN][oO])
-AUTOMAKE_PATTERNS+= aclocal.m4
-AUTOMAKE_PATTERNS+= configure.in
-AUTOMAKE_PATTERNS+= Makefile.in
-AUTOMAKE_PATTERNS+= stamp-h.in stamp-h\[0-9\].in
-AUTOMAKE_PATTERNS+= stamp-vti
-AUTOMAKE_PATTERNS+= config.h.in
-AUTOMAKE_PATTERNS+= ${CONFIGURE_SCRIPT:T}
-
-_CONFIGURE_PREREQ+= automake-pre-override
-.PHONY: automake-pre-override
-automake-pre-override:
-. if defined(HAS_CONFIGURE)
- ${_PKG_SILENT}${_PKG_DEBUG} \
- (for _PATTERN in ${AUTOMAKE_PATTERNS}; do \
- ${FIND} ${WRKSRC} -type f -name "$$_PATTERN" -print; \
- done; echo ${NULL_COOKIE} ) | \
- ${XARGS} ${TOUCH} ${TOUCH_FLAGS}
-. endif
-
-AUTOMAKE_POST_PATTERNS+= config.status
-AUTOMAKE_POST_PATTERNS+= Makefile
-AUTOMAKE_POST_PATTERNS+= stamp-h stamp-h[0-9]
-AUTOMAKE_POST_PATTERNS+= config.h
-
-_CONFIGURE_POSTREQ+= automake-post-override
-.PHONY: automake-post-override
-automake-post-override:
-. if defined(HAS_CONFIGURE)
- ${_PKG_SILENT}${_PKG_DEBUG} \
- (for _PATTERN in ${AUTOMAKE_POST_PATTERNS}; do \
- ${FIND} ${WRKSRC} -type f -name "$$_PATTERN" -print; \
- done; echo ${NULL_COOKIE} ) | \
- ${XARGS} ${TOUCH} ${TOUCH_FLAGS}
-. endif
-. endif # AUTOMAKE_OVERRIDE
-.endif # USE_BUILDLINK != "no"
-
# By adding this target, it makes sure the the above PREREQ's work.
.PHONY: pre-configure-override
pre-configure-override: ${_CONFIGURE_PREREQ}
@@ -2785,12 +2721,14 @@ show-shlib-type:
. endif # libc.dylib
.endif
-.PHONY: acquire-extract-lock acquire-patch-lock acquire-buildlink-lock
-.PHONY: acquire-configure-lock acquire-build-lock
+.PHONY: acquire-extract-lock acquire-patch-lock acquire-tools-lock
+.PHONY: acquire-buildlink-lock acquire-configure-lock acquire-build-lock
acquire-extract-lock:
${_ACQUIRE_LOCK}
acquire-patch-lock:
${_ACQUIRE_LOCK}
+acquire-tools-lock:
+ ${_ACQUIRE_LOCK}
acquire-buildlink-lock:
${_ACQUIRE_LOCK}
acquire-configure-lock:
@@ -2798,12 +2736,14 @@ acquire-configure-lock:
acquire-build-lock:
${_ACQUIRE_LOCK}
-.PHONY: release-extract-lock release-patch-lock release-buildlink-lock
-.PHONY: release-configure-lock release-build-lock
+.PHONY: release-extract-lock release-patch-lock release-tools-lock
+.PHONY: release-buildlink-lock release-configure-lock release-build-lock
release-extract-lock:
${_RELEASE_LOCK}
release-patch-lock:
${_RELEASE_LOCK}
+release-tools-lock:
+ ${_RELEASE_LOCK}
release-buildlink-lock:
${_RELEASE_LOCK}
release-configure-lock:
@@ -2836,9 +2776,14 @@ extract: checksum ${WRKDIR} acquire-extract-lock ${EXTRACT_COOKIE} release-extra
patch: extract acquire-patch-lock ${PATCH_COOKIE} release-patch-lock
.endif
+.PHONY: tools
+.if !target(tools)
+tools: patch acquire-tools-lock ${TOOLS_COOKIE} release-tools-lock
+.endif
+
.PHONY: buildlink
.if !target(buildlink)
-buildlink: patch acquire-buildlink-lock ${BUILDLINK_COOKIE} release-buildlink-lock
+buildlink: tools acquire-buildlink-lock ${BUILDLINK_COOKIE} release-buildlink-lock
.endif
.PHONY: configure
@@ -2893,6 +2838,9 @@ ${EXTRACT_COOKIE}:
${PATCH_COOKIE}:
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-patch
+${TOOLS_COOKIE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-tools
+
${BUILDLINK_COOKIE}:
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-buildlink
@@ -2932,12 +2880,14 @@ ${INSTALL_COOKIE}:
${PACKAGE_COOKIE}:
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-package
-.PHONY: extract-message patch-message buildlink-message configure-message
-.PHONY: build-message test-message
+.PHONY: extract-message patch-message tools-message buildlink-message
+.PHONY: configure-message build-message test-message
extract-message:
@${ECHO_MSG} "${_PKGSRC_IN}> Extracting for ${PKGNAME}"
patch-message:
@${ECHO_MSG} "${_PKGSRC_IN}> Patching for ${PKGNAME}"
+tools-message:
+ @${ECHO_MSG} "${_PKGSRC_IN}> Overriding tools for ${PKGNAME}"
buildlink-message:
@${ECHO_MSG} "${_PKGSRC_IN}> Buildlinking for ${PKGNAME}"
configure-message:
@@ -2947,12 +2897,14 @@ build-message:
test-message:
@${ECHO_MSG} "${_PKGSRC_IN}> Testing for ${PKGNAME}"
-.PHONY: extract-cookie patch-cookie buildlink-cookie configure-cookie
-.PHONY: build-cookie test-cookie
+.PHONY: extract-cookie patch-cookie tools-cookie buildlink-cookie
+.PHONY: configure-cookie build-cookie test-cookie
extract-cookie:
${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} >> ${EXTRACT_COOKIE}
patch-cookie:
${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
+tools-cookie:
+ ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${TOOLS_COOKIE}
buildlink-cookie:
${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_COOKIE}
configure-cookie:
@@ -2965,6 +2917,7 @@ test-cookie:
.ORDER: pre-fetch do-fetch post-fetch
.ORDER: extract-message install-depends pre-extract do-extract post-extract extract-cookie
.ORDER: patch-message pre-patch do-patch post-patch patch-cookie
+.ORDER: tools-message pre-tools do-tools post-tools tools-cookie
.ORDER: buildlink-message pre-buildlink do-buildlink post-buildlink buildlink-cookie
.ORDER: configure-message pre-configure pre-configure-override do-configure post-configure configure-cookie
.ORDER: build-message pre-build do-build post-build build-cookie
@@ -2973,12 +2926,13 @@ test-cookie:
# Please note that the order of the following targets is important, and
# should not be modified (.ORDER is not recognised by make(1) in a serial
# make i.e. without -j n)
-.PHONY: real-fetch real-extract real-patch real-buildlink real-configure
-.PHONY: real-build real-test real-install real-package real-replace
-.PHONY: real-undo-replace
+.PHONY: real-fetch real-extract real-patch real-tools real-buildlink
+.PHONY: real-configure real-build real-test real-install real-package
+.PHONY: real-replace real-undo-replace
real-fetch: pre-fetch do-fetch post-fetch
real-extract: extract-message install-depends pre-extract do-extract post-extract extract-cookie
real-patch: patch-message pre-patch do-patch post-patch patch-cookie
+real-tools: tools-message pre-tools do-tools post-tools tools-cookie
real-buildlink: buildlink-message pre-buildlink do-buildlink post-buildlink buildlink-cookie
real-configure: configure-message pre-configure pre-configure-override do-configure post-configure configure-cookie
real-build: build-message pre-build do-build post-build build-cookie
@@ -3055,7 +3009,7 @@ do-su-undo-replace:
# Empty pre-* and post-* targets
-.for name in fetch extract patch buildlink configure build test install-script install package
+.for name in fetch extract patch tools buildlink configure build test install-script install package
. if !target(pre-${name})
pre-${name}:
diff --git a/mk/buildlink2/bsd.buildlink2.mk b/mk/buildlink2/bsd.buildlink2.mk
index bc5c9415d1a..a603b7532f6 100644
--- a/mk/buildlink2/bsd.buildlink2.mk
+++ b/mk/buildlink2/bsd.buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink2.mk,v 1.93 2003/08/09 10:24:54 seb Exp $
+# $NetBSD: bsd.buildlink2.mk,v 1.94 2003/08/16 08:50:20 jlam Exp $
#
# An example package buildlink2.mk file:
#
@@ -584,7 +584,7 @@ _BLNK_WRAP_CACHE_TRANSFORM= ${BUILDLINK_DIR}/bin/.cache-trans
_BLNK_WRAP_POST_CACHE= ${BUILDLINK_DIR}/bin/.post-cache
_BLNK_WRAP_LOGIC= ${BUILDLINK_DIR}/bin/.logic
_BLNK_WRAP_LOGIC_TRANSFORM= ${BUILDLINK_DIR}/bin/.logic-trans
-_BLNK_WRAP_LOG= ${BUILDLINK_DIR}/.wrapper.log
+_BLNK_WRAP_LOG= ${WRKLOG}
_BLNK_LIBTOOL_DO_INSTALL= ${BUILDLINK_DIR}/bin/.libtool-do-install
_BLNK_LIBTOOL_FIX_LA= ${BUILDLINK_DIR}/bin/.libtool-fix-la
_BLNK_FAKE_LA= ${BUILDLINK_DIR}/bin/.fake-la
@@ -982,94 +982,3 @@ buildlink-check:
@if [ -f ${_BLNK_WRAP_LOG} ]; then \
${GREP} ${_BLNK_CHECK_PATTERNS} ${_BLNK_WRAP_LOG} || ${TRUE}; \
fi
-
-# Create shell scripts in ${BUILDLINK_DIR} that simply return an error
-# status for each of the GNU auto* tools, which should cause GNU configure
-# scripts to think that they can't be found.
-#
-AUTOMAKE_OVERRIDE?= yes
-_GNU_MISSING= ${.CURDIR}/../../mk/gnu-config/missing
-_HIDE_PROGS.autoconf= bin/autoconf bin/autoconf-2.13 \
- bin/autoheader bin/autoheader-2.13 \
- bin/autom4te \
- bin/autoreconf bin/autoreconf-2.13 \
- bin/autoscan bin/autoscan-2.13 \
- bin/autoupdate bin/autoupdate-2.13 \
- bin/ifnames bin/ifnames-2.13
-_HIDE_PROGS.automake= bin/aclocal bin/aclocal-1.4 \
- bin/aclocal-1.5 \
- bin/aclocal-1.6 \
- bin/aclocal-1.7 \
- bin/automake bin/automake-1.4 \
- bin/automake-1.5 \
- bin/automake-1.6 \
- bin/automake-1.7
-
-.if empty(AUTOMAKE_OVERRIDE:M[nN][oO])
-do-buildlink: hide-autotools
-.endif
-
-hide-autotools: # empty
-
-.for _autotool_ in autoconf automake
-hide-autotools: hide-${_autotool_}
-. for _prog_ in ${_HIDE_PROGS.${_autotool_}}
-hide-${_autotool_}: ${BUILDLINK_DIR}/${_prog_}
-${BUILDLINK_DIR}/${_prog_}: ${_GNU_MISSING}
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} "#!${BUILDLINK_SHELL}" > ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} "exec ${_GNU_MISSING} ${_prog_:T:C/-[0-9].*$//}" >> ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
-. endfor
-.endfor
-
-# install-info and makeinfo handling.
-#
-# Create an install-info script that is a "no operation" command
-# as registration of info files is handled by the INSTALL script.
-CONFIGURE_ENV+= INSTALL_INFO="${BUILDLINK_DIR}/bin/install-info"
-MAKE_ENV+= INSTALL_INFO="${BUILDLINK_DIR}/bin/install-info"
-
-do-buildlink: hide-install-info
-
-hide-install-info: ${BUILDLINK_DIR}/bin/install-info
-${BUILDLINK_DIR}/bin/install-info:
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} "#!${BUILDLINK_SHELL}" > ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} '${ECHO} "==> Noop install-info $$*" >> ${_BLNK_WRAP_LOG}' >> ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
-
-# Create a makeinfo script that will invoke the right makeinfo
-# command if USE_MAKEINFO is 'yes' or will exit on error if not.
-CONFIGURE_ENV+= MAKEINFO="${BUILDLINK_DIR}/bin/makeinfo"
-MAKE_ENV+= MAKEINFO="${BUILDLINK_DIR}/bin/makeinfo"
-
-.if empty(USE_MAKEINFO:M[nN][oO])
-do-buildlink: makeinfo-wrapper
-makeinfo-wrapper: ${BUILDLINK_DIR}/bin/makeinfo
-${BUILDLINK_DIR}/bin/makeinfo:
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} "#!${BUILDLINK_SHELL}" > ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} 'echo "${MAKEINFO} $$*" >> ${_BLNK_WRAP_LOG}' >> ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} 'exec ${MAKEINFO} "$$@"' >> ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
-.else # !USE_MAKEINFO
-do-buildlink: hide-makeinfo
-hide-makeinfo: ${BUILDLINK_DIR}/bin/makeinfo
-${BUILDLINK_DIR}/bin/makeinfo: ${_GNU_MISSING}
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} "#!${BUILDLINK_SHELL}" > ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} '${ECHO} "==> [buildlink2] Error: makeinfo $$*" >> ${_BLNK_WRAP_LOG}' >> ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} 'exit 1' >> ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
-.endif # USE_MAKEINFO
diff --git a/mk/tools.mk b/mk/tools.mk
index f6993c991fd..be4410ad22a 100644
--- a/mk/tools.mk
+++ b/mk/tools.mk
@@ -1,175 +1,229 @@
-# $NetBSD: tools.mk,v 1.4 2003/08/12 11:39:46 grant Exp $
+# $NetBSD: tools.mk,v 1.5 2003/08/16 08:50:19 jlam Exp $
#
-# handle platforms with broken tools in the base system, such as sed
-# and awk.
-#
-# symlink the suitable versions of tools into .buildlink/bin (if they
-# exist in the base system) and allow packages to force the use of
-# pkgsrc GNU tools when they are not present in the base system by
-# defining e.g. USE_GNU_TOOLS+="awk sed". version numbers are not
-# considered.
+# This Makefile creates a ${TOOLS_DIR} directory and populates the bin
+# subdir with tools that hide the ones outside of ${TOOLS_DIR}.
+
+.if !defined(TOOLS_MK)
+TOOLS_MK= # defined
+
+# Prepend ${TOOLS_DIR}/bin to the PATH so that our scripts are found
+# first when search for executables.
#
-# this functionality is buildlink2 only.
+TOOLS_DIR= ${WRKDIR}/.tools
+PATH:= ${TOOLS_DIR}/bin:${PATH}
+
+TOOLS_SHELL?= ${SH}
+_TOOLS_WRAP_LOG= ${WRKLOG}
+
+.PHONY: do-tools
+.if !target(do-tools)
+do-tools: override-tools
+.endif
+
+.PHONY: override-tools
+override-tools: # empty
+
+# Create shell scripts in ${TOOLS_DIR}/bin that simply return an error
+# status for each of the GNU auto* tools, which should cause GNU configure
+# scripts to think that they can't be found.
#
-# packages should always use eg.
+AUTOMAKE_OVERRIDE?= yes
+_GNU_MISSING= ${.CURDIR}/../../mk/gnu-config/missing
+_HIDE_PROGS.autoconf= bin/autoconf bin/autoconf-2.13 \
+ bin/autoheader bin/autoheader-2.13 \
+ bin/autom4te \
+ bin/autoreconf bin/autoreconf-2.13 \
+ bin/autoscan bin/autoscan-2.13 \
+ bin/autoupdate bin/autoupdate-2.13 \
+ bin/ifnames bin/ifnames-2.13
+_HIDE_PROGS.automake= bin/aclocal bin/aclocal-1.4 \
+ bin/aclocal-1.5 \
+ bin/aclocal-1.6 \
+ bin/aclocal-1.7 \
+ bin/automake bin/automake-1.4 \
+ bin/automake-1.5 \
+ bin/automake-1.6 \
+ bin/automake-1.7
+
+.if empty(AUTOMAKE_OVERRIDE:M[nN][oO])
+. for _autotool_ in autoconf automake
+. for _prog_ in ${_HIDE_PROGS.${_autotool_}}
+override-tools: ${TOOLS_DIR}/${_prog_}
+${TOOLS_DIR}/${_prog_}: ${_GNU_MISSING}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} '#!${TOOLS_SHELL}'; \
+ ${ECHO} 'exec ${_GNU_MISSING} ${_prog_:T:C/-[0-9].*$//}' \
+ ) > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. endfor
+. endfor
+.endif # AUTOMAKE_OVERRIDE != NO
+
+# Create an install-info script that is a "no operation" command,
+# as registration of info files is handled by the INSTALL script.
#
-# USE_GNU_TOOLS+= grep
+CONFIGURE_ENV+= INSTALL_INFO="${TOOLS_DIR}/bin/install-info"
+MAKE_ENV+= INSTALL_INFO="${TOOLS_DIR}/bin/install-info"
+
+override-tools: ${TOOLS_DIR}/bin/install-info
+${TOOLS_DIR}/bin/install-info:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} '#!${TOOLS_SHELL}'; \
+ ${ECHO} 'wrapperlog="$${TOOLS_WRAPPER_LOG-${_TOOLS_WRAP_LOG}}"'; \
+ ${ECHO} '${ECHO} "==> No-op install-info $$*" >> $$wrapperlog' \
+ ) > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+
+# Create a makeinfo script that will invoke the right makeinfo
+# command if USE_MAKEINFO is 'yes' or will exit on error if not.
#
-# to be sure not to override the setting passed by the user.
+CONFIGURE_ENV+= MAKEINFO="${TOOLS_DIR}/bin/makeinfo"
+MAKE_ENV+= MAKEINFO="${TOOLS_DIR}/bin/makeinfo"
+
+override-tools: ${TOOLS_DIR}/bin/makeinfo
+.if empty(USE_MAKEINFO:M[nN][oO])
+${TOOLS_DIR}/bin/makeinfo:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "#!${TOOLS_SHELL}"; \
+ ${ECHO} 'wrapperlog="$${TOOLS_WRAPPER_LOG-${_TOOLS_WRAP_LOG}}"'; \
+ ${ECHO} '${ECHO} "${MAKEINFO} $$*" >> $$wrapperlog'; \
+ ${ECHO} 'exec ${MAKEINFO} "$$@"' \
+ ) > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+.else # !USE_MAKEINFO
+${TOOLS_DIR}/bin/makeinfo: ${_GNU_MISSING}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "#!${TOOLS_SHELL}"; \
+ ${ECHO} 'wrapperlog="$${TOOLS_WRAPPER_LOG-${_TOOLS_WRAP_LOG}}"'; \
+ ${ECHO} '${ECHO} "==> Error: makeinfo $$*" >> $$wrapperlog'; \
+ ${ECHO} 'exit 1' \
+ ) > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+.endif # USE_MAKEINFO
+
+# Handle platforms with broken tools in the base system, e.g. sed, awk.
#
+# Symlink the suitable versions of tools into ${TOOLS_DIR}/bin (if they
+# exist in the base system) and allow packages to force the use of
+# pkgsrc GNU tools when they are not present in the base system by
+# defining e.g. USE_GNU_TOOLS+="awk sed". Version numbers are not
+# considered.
-.if !defined(TOOLS_MK)
-TOOLS_MK= # defined
-
-.if empty(USE_BUILDLINK2:M[nN][oO])
_TOOLS= awk grep sed
-# define which platforms already have GNU tools, so no need to pull in
-# the pkgsrc versions.
+# These platforms already have GNU versions of the tools in the base
+# system, so no need to pull in the pkgsrc versions; we will use these
+# instead.
+#
_TOOLS_OPSYS_HAS_GNU.awk+= FreeBSD-*-* Linux-*-* NetBSD-*-* OpenBSD-*-*
_TOOLS_OPSYS_HAS_GNU.grep+= Darwin-*-* FreeBSD-*-* Linux-*-*
_TOOLS_OPSYS_HAS_GNU.grep+= NetBSD-*-* OpenBSD-*-*
_TOOLS_OPSYS_HAS_GNU.sed+= Linux-*-*
-# where said tool is completely unusable, and no suitable replacement
-# is available.
+# These platforms have GNUish versions of the tools available in the base
+# system, which we already define as ${AWK}, ${SED}, etc. (refer to
+# defs.*.mk for the definitions), so no need to pull in the pkgsrc
+# versions; we will use these instead.
+#
+_TOOLS_REPLACE_OPSYS.awk+= SunOS-*-*
+_TOOLS_REPLACE_OPSYS.grep+= SunOS-*-*
+_TOOLS_REPLACE_OPSYS.sed+= # empty
+
+# These platforms have completely unusable versions of these tools, and
+# no suitable replacement is available.
+#
_TOOLS_OPSYS_INCOMPAT.awk+= # empty
_TOOLS_OPSYS_INCOMPAT.grep+= # empty
_TOOLS_OPSYS_INCOMPAT.sed+= # empty
-# a suitable alternative version is available in the base system, as
-# eg. ${AWK}, ${SED}, ... refer to defs.*.mk for the definitions.
-_TOOLS_REPLACE_OPSYS.awk+= SunOS-*-*
-_TOOLS_REPLACE_OPSYS.grep+= SunOS-*-*
-_TOOLS_REPLACE_OPSYS.sed+= # empty
+# Default to not requiring GNU tools.
+.for _tool_ in ${_TOOLS}
+_TOOLS_NEED_GNU.${_tool_}?= NO
+_TOOLS_REPLACE.${_tool_}?= NO
+_TOOLS_OVERRIDE.${_tool_}?= NO
+.endfor
-# what GNU tools did the package or user ask for, and does the OS
-# already have it?
.for _tool_ in ${USE_GNU_TOOLS}
-_TOOLS_NEED_GNU.${_tool_}= YES
+#
+# What GNU tools did the package or user ask for, and does the base
+# system already have it?
+#
+_TOOLS_NEED_GNU.${_tool_}= YES
. for _pattern_ in ${_TOOLS_OPSYS_HAS_GNU.${_tool_}}
. if !empty(MACHINE_PLATFORM:M${_pattern_})
-_TOOLS_NEED_GNU.${_tool_}= NO
+_TOOLS_NEED_GNU.${_tool_}= NO
. endif
. endfor
-.endfor
-
-# default to not requiring GNU tools.
-.for _tool_ in ${_TOOLS}
-_TOOLS_NEED_GNU.${_tool_}?= NO
-_TOOLS_REPLACE.${_tool_}?= NO
-
-# do we know it's broken?
+#
+# Do we know the base system tool is broken?
+#
. for _pattern_ in ${_TOOLS_OPSYS_INCOMPAT.${_tool_}}
. if !empty(MACHINE_PLATFORM:M${_pattern_})
-_TOOLS_NEED_GNU.${_tool_}= YES
+_TOOLS_NEED_GNU.${_tool_}= YES
. endif
. endfor
-
-# are we replacing it with a better version?
+#
+# Are we using a GNUish system tool in place of the needed GNU tool?
+#
. for _pattern_ in ${_TOOLS_REPLACE_OPSYS.${_tool_}}
. if !empty(MACHINE_PLATFORM:M${_pattern_})
-_TOOLS_REPLACE.${_tool_}= YES
+TOOLS_REPLACE.${_tool_}= YES
. endif
. endfor
+.endfor # USE_GNU_TOOLS
-.endfor # ${_TOOLS}
-
-.if ${_TOOLS_NEED_GNU.awk} == "YES" && empty(PKGPATH:Mlang/gawk)
-_TOOLS_PROGNAME.gawk= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}awk
-# catch the case where we are in between package installs, thus don't
-# have gawk available yet.
-. if exists(${_TOOLS_PROGNAME.gawk})
-AWK= ${_TOOLS_PROGNAME.gawk}
-. endif
-BUILDLINK_DEPENDS.gawk?= gawk>=3.1.1
-BUILDLINK_PKGSRCDIR.gawk?= ../../lang/gawk
-BUILDLINK_DEPMETHOD.gawk?= build
-BUILDLINK_PACKAGES+= gawk
-BUILDLINK_PREFIX.gawk_DEFAULT= ${LOCALBASE}
-BUILDLINK_FILES.gawk= bin/${GNU_PROGRAM_PREFIX}awk
-EVAL_PREFIX+= BUILDLINK_PREFIX.gawk=gawk
-.endif
-
-.if ${_TOOLS_NEED_GNU.awk} == "YES" || ${_TOOLS_REPLACE.awk} == "YES"
-BUILDLINK_TARGETS+= gawk-buildlink gawk-buildlink-bin
+.if ${_TOOLS_REPLACE.awk} == "YES"
+_TOOLS_OVERRIDE.awk= YES
+_TOOLS_PROGNAME.awk= ${AWK}
.endif
-
-.if ${_TOOLS_NEED_GNU.grep} == "YES" && empty(PKGPATH:Mtextproc/grep)
-_TOOLS_PROGNAME.grep= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}grep
-. if exists(${_TOOLS_PROGNAME.grep})
-GREP= ${_TOOLS_PROGNAME.grep}
-. endif
-BUILDLINK_DEPENDS.grep?= grep>=2.5.1
-BUILDLINK_PKGSRCDIR.grep?= ../../textproc/grep
-BUILDLINK_DEPMETHOD.grep?= build
-BUILDLINK_PACKAGES+= grep
-BUILDLINK_PREFIX.grep= ${LOCALBASE}
-BUILDLINK_FILES.grep= bin/${GNU_PROGRAM_PREFIX}grep
-EVAL_PREFIX+= BUILDLINK_PREFIX.grep=grep
+.if (${_TOOLS_NEED_GNU.awk} == "YES") && empty(PKGPATH:Mlang/gawk)
+BUILD_DEPENDS+= gawk>=3.1.1:../../lang/gawk
+_TOOLS_OVERRIDE.awk= YES
+_TOOLS_PROGNAME.awk= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}awk
+AWK:= ${_TOOLS_PROGNAME.awk}
.endif
-.if ${_TOOLS_NEED_GNU.grep} == "YES" || ${_TOOLS_REPLACE.grep} == "YES"
-BUILDLINK_TARGETS+= grep-buildlink grep-buildlink-bin
+.if ${_TOOLS_REPLACE.grep} == "YES"
+_TOOLS_OVERRIDE.grep= YES
+_TOOLS_PROGNAME.grep= ${GREP}
.endif
-
-.if ${_TOOLS_NEED_GNU.sed} == "YES" && empty(PKGPATH:Mtextproc/gsed)
-_TOOLS_PROGNAME.gsed= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}sed
-. if exists(${_TOOLS_PROGNAME.gsed})
-SED= ${_TOOLS_PROGNAME.gsed}
-. endif
-BUILDLINK_DEPENDS.gsed?= gsed>=3.0.2
-BUILDLINK_PKGSRCDIR.gsed?= ../../textproc/gsed
-BUILDLINK_DEPMETHOD.gsed?= build
-BUILDLINK_PACKAGES+= gsed
-BUILDLINK_PREFIX.gsed_DEFAULT= ${LOCALBASE}
-BUILDLINK_FILES.gsed= bin/${GNU_PROGRAM_PREFIX}sed
-EVAL_PREFIX+= BUILDLINK_PREFIX.gsed=gsed
+.if (${_TOOLS_NEED_GNU.grep} == "YES") && empty(PKGPATH:Mtextproc/grep)
+BUILD_DEPENDS+= grep>=2.5.1:../../textproc/grep
+_TOOLS_OVERRIDE.grep= YES
+_TOOLS_PROGNAME.grep= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}grep
+GREP:= ${_TOOLS_PROGNAME.grep}
.endif
-.if ${_TOOLS_NEED_GNU.sed} == "YES" || ${_TOOLS_REPLACE.sed} == "YES"
-BUILDLINK_TARGETS+= gsed-buildlink gsed-buildlink-bin
+.if ${_TOOLS_REPLACE.sed} == "YES"
+_TOOLS_OVERRIDE.sed= YES
+_TOOLS_PROGNAME.sed= ${SED}
.endif
-
-gawk-buildlink: _BUILDLINK_USE
-gawk-buildlink-bin:
-.if ${_TOOLS_NEED_GNU.awk} == "YES" && empty(PKGPATH:Mlang/gawk)
- ${_PKG_SILENT}${_PKG_DEBUG} \
- [ ! -f ${BUILDLINK_DIR}/bin/awk ] && \
- ${LN} -fs ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}awk \
- ${BUILDLINK_DIR}/bin/awk
-.elif ${_TOOLS_REPLACE.awk} == "YES"
- ${_PKG_SILENT}${_PKG_DEBUG} \
- [ ! -f ${BUILDLINK_DIR}/bin/awk ] && \
- ${LN} -fs ${AWK} ${BUILDLINK_DIR}/bin/awk
+.if (${_TOOLS_NEED_GNU.sed} == "YES") && empty(PKGPATH:Mtextproc/gsed)
+BUILD_DEPENDS+= gsed>=3.0.2:../../textproc/gsed
+_TOOLS_OVERRIDE.sed= YES
+_TOOLS_PROGNAME.sed= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}sed
+SED:= ${_TOOLS_PROGNAME.sed}
.endif
-grep-buildlink: _BUILDLINK_USE
-grep-buildlink-bin:
-.if ${_TOOLS_NEED_GNU.grep} == "YES" && empty(PKGPATH:Mtextproc/grep)
- ${_PKG_SILENT}${_PKG_DEBUG} \
- [ ! -f ${BUILDLINK_DIR}/bin/grep ] && \
- ${LN} -fs ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}grep \
- ${BUILDLINK_DIR}/bin/grep
-.elif ${_TOOLS_REPLACE.grep} == "YES"
- ${_PKG_SILENT}${_PKG_DEBUG} \
- [ ! -f ${BUILDLINK_DIR}/bin/grep ] && \
- ${LN} -fs ${GREP} ${BUILDLINK_DIR}/bin/grep
-.endif
-
-gsed-buildlink: _BUILDLINK_USE
-gsed-buildlink-bin:
-.if ${_TOOLS_NEED_GNU.sed} == "YES" && empty(PKGPATH:Mtextproc/gsed)
- ${_PKG_SILENT}${_PKG_DEBUG} \
- [ ! -f ${BUILDLINK_DIR}/bin/sed ] && \
- ${LN} -fs ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}sed \
- ${BUILDLINK_DIR}/bin/sed
-.elif ${_TOOLS_REPLACE.sed} == "YES"
- ${_PKG_SILENT}${_PKG_DEBUG} \
- [ ! -f ${BUILDLINK_DIR}/bin/sed ] && \
- ${LN} -fs ${SED} ${BUILDLINK_DIR}/bin/sed
-.endif
-
-.endif # USE_BUILDLINK2
+# If _TOOLS_OVERRIDE.<tool> is actually set to "YES", then we override
+# the tool with the one specified in _TOOLS_PROGNAME.<tool>.
+#
+.for _tool_ in ${_TOOLS}
+. if ${_TOOLS_OVERRIDE.${_tool_}} == "YES"
+override-tools: ${TOOLS_DIR}/bin/${_tool_}
+
+${TOOLS_DIR}/bin/${_tool_}:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ src="${_TOOLS_PROGNAME.${_tool_}}"; \
+ if [ -x $$src -a ! -f ${.TARGET} ]; then \
+ ${MKDIR} ${.TARGET:H}; \
+ ${LN} -sf $$src ${.TARGET}; \
+ fi
+. endif
+.endfor
.endif # TOOLS_MK