Skip to content

Commit

Permalink
Merge down deferred PREPEND_PATH handling from the tv-derecurse branch.
Browse files Browse the repository at this point in the history
Also merge in deferred CLASSPATH handling, which can now be moved back
to java-vm.mk for cleanliness.
  • Loading branch information
tv committed Jan 24, 2005
1 parent 44f00aa commit 605975d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 45 deletions.
62 changes: 23 additions & 39 deletions mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
# $NetBSD: bsd.pkg.mk,v 1.1570 2005/01/24 18:44:38 tv Exp $
# $NetBSD: bsd.pkg.mk,v 1.1571 2005/01/24 19:32:33 tv Exp $
#
# This file is in the public domain.
#
Expand Down Expand Up @@ -955,24 +955,6 @@ RMAN?= ${X11BASE}/bin/rman
. endif
.endif

# Set the CLASSPATH for Java packages. This must come after EVAL_PREFIX
# is evaluated because PKG_JAVA_HOME is used in a .if.endif conditional,
# and its value is indirectly set by EVAL_PREFIX.
#
.if defined(USE_JAVA)
. if exists(${PKG_JAVA_HOME}/lib/${_JAVA_BASE_CLASSES})
_JAVA_CLASSES_ZIP= ${PKG_JAVA_HOME}/lib/${_JAVA_BASE_CLASSES}:
. endif
. if exists(${PKG_JAVA_HOME}/lib/tools.jar)
_JAVA_TOOLS_JAR= ${PKG_JAVA_HOME}/lib/tools.jar:
. endif
CLASSPATH?= ${_JAVA_CLASSES_ZIP}${_JAVA_TOOLS_JAR}.

MAKE_ENV+= CLASSPATH=${CLASSPATH}
CONFIGURE_ENV+= CLASSPATH=${CLASSPATH}
SCRIPTS_ENV+= CLASSPATH=${CLASSPATH}
.endif

# Include popular master sites
.include "../../mk/bsd.sites.mk"

Expand Down Expand Up @@ -1178,18 +1160,6 @@ USE_LANGUAGES?= # empty
. include "../../mk/wrapper/bsd.wrapper.mk"
.endif

# Find out the PREFIX of dependencies where the PREFIX is needed at build time.
.if defined(EVAL_PREFIX)
. for def in ${EVAL_PREFIX}
. if !defined(${def:C/=.*$//})
${def:C/=.*$//}_DEFAULT?=${LOCALBASE}
_${def:C/=.*$//}_CMD= ${PKG_INFO} -qp ${def:C/^.*=//} 2>/dev/null | ${AWK} '{ print $$2; exit }' | grep '' || ${ECHO} ${${def:C/=.*$//}_DEFAULT}
${def:C/=.*$//}= ${_${def:C/=.*$//}_CMD:sh}
MAKEFLAGS+= ${def:C/=.*//}=${_${def:C/=.*$//}_CMD:sh}
. endif
. endfor
.endif

.if defined(RECOMMENDED)
. if !empty(IGNORE_RECOMMENDED:M[nN][oO])
DEPENDS+= ${RECOMMENDED}
Expand All @@ -1207,19 +1177,33 @@ DEPENDS:= ${REDUCED_DEPENDS}
. include "../../mk/dirs.mk"
.endif

_PREPENDED_TO_PATH?= # empty
.for _dir_ in ${PREPEND_PATH}
. if empty(_PREPENDED_TO_PATH:M${_dir_})
_PREPENDED_TO_PATH+= ${_dir_}
PATH:= ${_dir_}:${PATH}
. endif
.endfor
# Find out the PREFIX of dependencies where the PREFIX is needed at build time.
.if defined(EVAL_PREFIX)
. for def in ${EVAL_PREFIX}
. if !defined(${def:C/=.*$//})
${def:C/=.*$//}_DEFAULT?=${LOCALBASE}
_${def:C/=.*$//}_CMD= ${PKG_INFO} -qp ${def:C/^.*=//} 2>/dev/null | ${AWK} '{ print $$2; exit }' | grep '' || ${ECHO} ${${def:C/=.*$//}_DEFAULT}
${def:C/=.*$//}= ${_${def:C/=.*$//}_CMD:sh}
MAKEFLAGS+= ${def:C/=.*//}=${_${def:C/=.*$//}_CMD:sh}
. endif
. endfor
.endif

.if !defined(_PATH_ORIG)
_PATH_ORIG:= ${PATH}
MAKEFLAGS+= _PATH_ORIG=${_PATH_ORIG:Q}

# This is very Special. Because PREPEND_PATH is set with += in reverse order,
# the awk expression reverses the order again (since bootstrap bmake doesn't
# yet support the :[-1..1] construct).
_PATH_CMD= ${ECHO} `${ECHO} ${PREPEND_PATH:Q} | ${AWK} '{ORS=":";for (i=NF;i>0;i--) print $$i}'`${_PATH_ORIG}
PATH= ${_PATH_CMD:sh} # DOES NOT use :=, to defer evaluation
.endif

# Add these bits to the environment use when invoking the sub-make
# processes for build-related phases.
#
BUILD_ENV+= PATH=${PATH:Q}
BUILD_ENV+= _PREPENDED_TO_PATH=${_PREPENDED_TO_PATH:Q}

.MAIN: all

Expand Down
20 changes: 14 additions & 6 deletions mk/java-vm.mk
@@ -1,4 +1,4 @@
# $NetBSD: java-vm.mk,v 1.36 2005/01/12 17:23:46 tv Exp $
# $NetBSD: java-vm.mk,v 1.37 2005/01/24 19:32:33 tv Exp $
#
# This Makefile fragment handles Java dependencies and make variables,
# and is meant to be included by packages that require Java either at
Expand Down Expand Up @@ -315,12 +315,20 @@ PKG_JAVA_HOME?= ${BUILDLINK_JAVA_PREFIX.${_PKG_JVM}}
.else
PKG_JAVA_HOME?= ${_JAVA_HOME}
.endif
.if !defined(CLASSPATH)
CLASSPATH_cmd= ${ECHO} `for p in \
${PKG_JAVA_HOME}/lib/${_JAVA_BASE_CLASSES} \
${PKG_JAVA_HOME}/lib/tools.jar; do \
${TEST} ! -f $$p || ${ECHO} $$p; done` \
. | ${TR} ' ' :
CLASSPATH?= ${CLASSPATH_cmd:sh}
.endif

CONFIGURE_ENV+= CLASSPATH=${CLASSPATH:Q} JAVA_HOME=${PKG_JAVA_HOME}
MAKE_ENV+= CLASSPATH=${CLASSPATH:Q} JAVA_HOME=${PKG_JAVA_HOME}
SCRIPTS_ENV+= CLASSPATH=${CLASSPATH:Q} JAVA_HOME=${PKG_JAVA_HOME}
BUILD_DEFS+= PKG_JVM PKG_JAVA_HOME
PATH:= ${PKG_JAVA_HOME}/bin:${PATH}
MAKEFLAGS+= PKG_JVM=${PKG_JVM}

MAKE_ENV+= JAVA_HOME=${PKG_JAVA_HOME}
CONFIGURE_ENV+= JAVA_HOME=${PKG_JAVA_HOME}
SCRIPTS_ENV+= JAVA_HOME=${PKG_JAVA_HOME}
PREPEND_PATH+= ${PKG_JAVA_HOME}/bin

.endif # JAVA_VM_MK

0 comments on commit 605975d

Please sign in to comment.