summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2004-02-06 03:04:50 +0000
committerjlam <jlam>2004-02-06 03:04:50 +0000
commitd446ccd672bee0419a7fe14c5a48da4d9057d5b9 (patch)
tree429ebb5ed1cad414f69277d63bfae94e1170955a /mk
parent8f09416c8a3e46929130c54844cab505f73727bc (diff)
downloadpkgsrc-d446ccd672bee0419a7fe14c5a48da4d9057d5b9.tar.gz
We only prepend a directory to the PATH if we haven't already done so
(by checking PREPEND_PATH) and only for those phases of the build that care about the PATH (buildlink or later). We also pass the PATH to those same phases of the build so that executing ${CC} will work correctly from custom {pre,do,post}-* targets that occur at buildlink time or later.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk21
-rw-r--r--mk/buildlink2/bsd.buildlink2.mk8
-rw-r--r--mk/buildlink3/bsd.buildlink3.mk10
-rw-r--r--mk/compiler/ccache.mk8
-rw-r--r--mk/compiler/distcc.mk9
-rw-r--r--mk/compiler/gcc.mk32
-rw-r--r--mk/compiler/mipspro.mk8
-rw-r--r--mk/compiler/sunpro.mk8
-rw-r--r--mk/tools.mk8
9 files changed, 81 insertions, 31 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index c163f3838cb..68c47e758d4 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1373 2004/02/05 17:20:46 hubertf Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1374 2004/02/06 03:04:50 jlam Exp $
#
# This file is in the public domain.
#
@@ -1319,6 +1319,11 @@ SCRIPTS_ENV+= CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
SCRIPTS_ENV+= BATCH=yes
.endif
+# Initialize a variable used by Makefiles to check whether to prepend
+# to the PATH.
+#
+PREPEND_PATH= # empty
+
# Get the proper dependencies and set the PATH to use the compiler
# named in PKGSRC_COMPILER.
#
@@ -1337,6 +1342,8 @@ NO_BUILDLINK= # defined
.include "../../mk/tools.mk"
+MAKEFLAGS+= PREPEND_PATH="${PREPEND_PATH}"
+
.MAIN: all
# Use aliases, so that all versions of English are acceptable
@@ -3142,7 +3149,7 @@ ${TOOLS_COOKIE}:
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-tools PKG_PHASE=tools
${BUILDLINK_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-buildlink PKG_PHASE=buildlink
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} PATH=${PATH} ${MAKE} ${MAKEFLAGS} real-buildlink PKG_PHASE=buildlink
${CONFIGURE_COOKIE}:
.if ${INTERACTIVE_STAGE:Mconfigure} == "configure" && defined(BATCH)
@@ -3151,7 +3158,7 @@ ${CONFIGURE_COOKIE}:
@${TOUCH} ${INTERACTIVE_COOKIE}
@${FALSE}
.else
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-configure PKG_PHASE=configure
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} PATH=${PATH} ${MAKE} ${MAKEFLAGS} real-configure PKG_PHASE=configure
.endif
${BUILD_COOKIE}:
@@ -3161,11 +3168,11 @@ ${BUILD_COOKIE}:
@${TOUCH} ${INTERACTIVE_COOKIE}
@${FALSE}
.else
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-build PKG_PHASE=build
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} PATH=${PATH} ${MAKE} ${MAKEFLAGS} real-build PKG_PHASE=build
.endif
${TEST_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-test PKG_PHASE=test
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} PATH=${PATH} ${MAKE} ${MAKEFLAGS} real-test PKG_PHASE=test
${INSTALL_COOKIE}:
.if ${INTERACTIVE_STAGE:Minstall} == "install" && defined(BATCH)
@@ -3174,11 +3181,11 @@ ${INSTALL_COOKIE}:
@${TOUCH} ${INTERACTIVE_COOKIE}
@${FALSE}
.else
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-install PKG_PHASE=install
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} PATH=${PATH} ${MAKE} ${MAKEFLAGS} real-install PKG_PHASE=install
.endif
${PACKAGE_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-package PKG_PHASE=package
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} PATH=${PATH} ${MAKE} ${MAKEFLAGS} real-package PKG_PHASE=package
.PHONY: extract-message patch-message tools-message buildlink-message
.PHONY: configure-message build-message test-message
diff --git a/mk/buildlink2/bsd.buildlink2.mk b/mk/buildlink2/bsd.buildlink2.mk
index a4d8370c174..fe3175c49d7 100644
--- a/mk/buildlink2/bsd.buildlink2.mk
+++ b/mk/buildlink2/bsd.buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink2.mk,v 1.110 2004/02/05 09:57:53 jlam Exp $
+# $NetBSD: bsd.buildlink2.mk,v 1.111 2004/02/06 03:04:50 jlam Exp $
#
# An example package buildlink2.mk file:
#
@@ -125,7 +125,11 @@ LDFLAGS+= ${FLAG}
# Prepend ${BUILDLINK_DIR}/bin to the PATH so that the wrappers are found
# first when searching for executables.
#
-PATH:= ${BUILDLINK_DIR}/bin:${PATH}
+.if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${BUILDLINK_DIR}/bin)
+PREPEND_PATH+= ${BUILDLINK_DIR}/bin
+PATH:= ${BUILDLINK_DIR}/bin:${PATH}
+.endif
.for _pkg_ in ${BUILDLINK_PACKAGES}
#
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk
index 28a4be01c85..7caec21041c 100644
--- a/mk/buildlink3/bsd.buildlink3.mk
+++ b/mk/buildlink3/bsd.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.75 2004/02/05 07:17:14 jlam Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.76 2004/02/06 03:04:50 jlam Exp $
#
# An example package buildlink3.mk file:
#
@@ -54,10 +54,14 @@ BUILDLINK_OPSYS?= ${OPSYS}
# Prepend ${BUILDLINK_DIR}/bin to the PATH so that the wrappers are found
# first when searching for executables.
#
-.if defined(_OPSYS_DEFAULT_PATH)
+.if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${BUILDLINK_DIR}/bin)
+PREPEND_PATH+= ${BUILDLINK_DIR}/bin
+. if defined(_OPSYS_DEFAULT_PATH)
PATH:= ${BUILDLINK_DIR}/bin:${_OPSYS_DEFAULT_PATH}
-.else
+. else
PATH:= ${BUILDLINK_DIR}/bin:${PATH}
+. endif
.endif
# BUILDLINK_DEPENDS contains the list of packages for which we add
diff --git a/mk/compiler/ccache.mk b/mk/compiler/ccache.mk
index 1b07936060b..22ce3a7e6ab 100644
--- a/mk/compiler/ccache.mk
+++ b/mk/compiler/ccache.mk
@@ -1,4 +1,4 @@
-# $NetBSD: ccache.mk,v 1.8 2004/02/05 03:39:17 jlam Exp $
+# $NetBSD: ccache.mk,v 1.9 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_CCACHE_MK)
COMPILER_CCACHE_MK= one
@@ -58,7 +58,11 @@ COMPILER_CCACHE_MK+= two
. if !empty(_USE_CCACHE:M[yY][eE][sS])
. if !empty(_LANGUAGES.ccache)
-PATH:= ${_CCACHE_DIR}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_CCACHE_DIR}/bin)
+PREPEND_PATH+= ${_CCACHE_DIR}/bin
+PATH:= ${_CCACHE_DIR}/bin:${PATH}
+. endif
. endif
BUILD_DEPENDS+= ccache-[0-9]*:../../devel/ccache
diff --git a/mk/compiler/distcc.mk b/mk/compiler/distcc.mk
index 603b2932094..c93040344d8 100644
--- a/mk/compiler/distcc.mk
+++ b/mk/compiler/distcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: distcc.mk,v 1.11 2004/02/05 03:39:17 jlam Exp $
+# $NetBSD: distcc.mk,v 1.12 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_DISTCC_MK)
COMPILER_DISTCC_MK= one
@@ -58,8 +58,13 @@ COMPILER_DISTCC_MK+= two
. if !empty(_USE_DISTCC:M[yY][eE][sS])
. if !empty(_LANGUAGES.distcc)
-PATH:= ${_DISTCC_DIR}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_DISTCC_DIR}/bin)
+PREPEND_PATH+= ${_DISTCC_DIR}/bin
+PATH:= ${_DISTCC_DIR}/bin:${PATH}
+. endif
. endif
+. endif
BUILD_DEPENDS+= distcc-[0-9]*:../../devel/distcc
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index 948cf73ac6b..b3295ed0333 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.37 2004/02/05 04:12:28 jlam Exp $
+# $NetBSD: gcc.mk,v 1.38 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_GCC_MK)
COMPILER_GCC_MK= one
@@ -18,14 +18,19 @@ _GCC2_PATTERNS= 2.8 2.8.* 2.9 2.9.* 2.[1-8][0-9] 2.[1-8][0-9].* \
_GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \
2.[1-9][0-9][0-9]* 3.* [4-9]*
+. if !defined(_CC)
_CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
-. for _dir_ in ${PATH:C/\:/ /g}
-. if empty(_CC:M/*)
-. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//})
+. for _dir_ in ${PATH:C/\:/ /g}
+. if empty(_CC:M/*)
+. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//})
_CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
+. endif
. endif
+. endfor
+. if !empty(_CC:M/*)
+MAKEFLAGS+= _CC="${_CC}"
. endif
-. endfor
+. endif
. if !defined(_GCC_VERSION)
_GCC_VERSION_STRING!= \
@@ -293,12 +298,19 @@ COMPILER_GCC_MK+= two
# Prepend the path to the compiler to the PATH.
. if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
. if exists(${_GCC_PREFIX}bin/gcc) && !empty(_LANGUAGES.gcc)
-PATH:= ${_GCC_PREFIX}bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_GCC_PREFIX}bin)
+PREPEND_PATH+= ${GCC_PREFIX}bin
+PATH:= ${_GCC_PREFIX}bin:${PATH}
+. endif
. endif
-. else
-. if !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
-. if !empty(_CC:M/*)
-PATH:= ${_CC:H}:${PATH}
+. elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
+_CC_DIRPATH= ${_CC:H}
+. if !empty(_CC_DIRPATH:M/*)
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_CC_DIRPATH})
+PREPEND_PATH+= ${_CC_DIRPATH}
+PATH:= ${_CC_DIRPATH}:${PATH}
. endif
. endif
. endif
diff --git a/mk/compiler/mipspro.mk b/mk/compiler/mipspro.mk
index 6da479e238a..0868c146c13 100644
--- a/mk/compiler/mipspro.mk
+++ b/mk/compiler/mipspro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: mipspro.mk,v 1.11 2004/02/05 22:05:42 jlam Exp $
+# $NetBSD: mipspro.mk,v 1.12 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_MIPSPRO_MK)
COMPILER_MIPSPRO_MK= one
@@ -40,7 +40,11 @@ COMPILER_MIPSPRO_MK+= two
# Prepend the path to the compiler to the PATH.
. if !empty(_LANGUAGES.mipspro)
-PATH:= ${MIPSPROBASE}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${MIPSPROBASE}/bin)
+PREPEND_PATH+= ${MIPSPROBASE}/bin
+PATH:= ${MIPSPROBASE}/bin:${PATH}
+. endif
. endif
. endif # COMPILER_MIPSPRO_MK
.endif # BSD_PREFS_MK
diff --git a/mk/compiler/sunpro.mk b/mk/compiler/sunpro.mk
index e624e908ded..827eb990edc 100644
--- a/mk/compiler/sunpro.mk
+++ b/mk/compiler/sunpro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: sunpro.mk,v 1.8 2004/02/05 03:39:17 jlam Exp $
+# $NetBSD: sunpro.mk,v 1.9 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_SUNPRO_MK)
COMPILER_SUNPRO_MK= one
@@ -41,7 +41,11 @@ COMPILER_SUNPRO_MK+= two
# Prepend the path to the compiler to the PATH.
. if !empty(_LANGUAGES.sunpro)
-PATH:= ${SUNWSPROBASE}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${SUNWSPROBASE}/bin)
+PREPEND_PATH+= ${SUNWSPROBASE}/bin
+PATH:= ${SUNWSPROBASE}/bin:${PATH}
+. endif
. endif
. endif # COMPILER_SUNPRO_MK
.endif # BSD_PREFS_MK
diff --git a/mk/tools.mk b/mk/tools.mk
index 0753aaddf01..483ad3a7b0b 100644
--- a/mk/tools.mk
+++ b/mk/tools.mk
@@ -1,4 +1,4 @@
-# $NetBSD: tools.mk,v 1.23 2004/02/03 08:57:20 grant Exp $
+# $NetBSD: tools.mk,v 1.24 2004/02/06 03:04:50 jlam Exp $
#
# This Makefile creates a ${TOOLS_DIR} directory and populates the bin
# subdir with tools that hide the ones outside of ${TOOLS_DIR}.
@@ -6,11 +6,17 @@
.if !defined(TOOLS_MK)
TOOLS_MK= # defined
+.include "../../mk/bsd.prefs.mk"
+
# Prepend ${TOOLS_DIR}/bin to the PATH so that our scripts are found
# first when searching for executables.
#
TOOLS_DIR= ${WRKDIR}/.tools
+.if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${TOOLS_DIR}/bin)
+PREPEND_PATH+= ${TOOLS_DIR}/bin
PATH:= ${TOOLS_DIR}/bin:${PATH}
+.endif
TOOLS_SHELL?= ${SH}
_TOOLS_WRAP_LOG= ${WRKLOG}