Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / java-env.mk
blob42e014be5d1c058a4614ee6495ced4d75a0faa85
1 # $NetBSD: java-env.mk,v 1.11 2007/11/09 00:49:54 joerg Exp $
3 # This Makefile fragment handles Java wrappers and is meant to be included
4 # by packages that provide a Java build-time and/or run-time environment.
6 # The following variables can be defined in package Makefiles to tune the
7 # behavior of this file:
9 # JAVA_CLASSPATH Classpath that will be prepended on all invocations
10 # to this implementation. Optional.
12 # JAVA_LD_LIBRARY_PATH
13 # Value to prepend to LD_LIBRARY_PATH before running
14 # the real command. Optional; use *only* if necessary.
16 # JAVA_HOME Path to the directory holding the Java implementation.
17 # Required.
19 # JAVA_NAME Base name of the Java implementation. This will be
20 # used as part of wrappers' names. Required.
22 # JAVA_UNLIMIT List of resources to be unlimited at runtime.
23 # Can include any of cmdsize, datasize and stacksize.
24 # Optional.
26 # JAVA_WRAPPERS List of wrappers to be created under ${PREFIX}/bin,
27 # pointing to binaries under ${JAVA_HOME}/bin. The
28 # names must match files in the later directory.
29 # Required (if empty, the inclusion of this file is
30 # useless).
33 .if !defined(JAVA_ENV_MK)
34 JAVA_ENV_MK= # defined
36 JAVA_NAME?= # undefined
37 JAVA_HOME?= # undefined
38 JAVA_CLASSPATH?= # empty
39 JAVA_LD_LIBRARY_PATH?= # empty
40 JAVA_UNLIMIT?= # empty
41 JAVA_WRAPPERS?= # empty
43 .include "../../mk/bsd.prefs.mk"
45 .if !empty(JAVA_WRAPPERS)
46 INSTALLATION_DIRS+= bin
48 ALTERNATIVES_SRC= ${WRKDIR}/.ALTERNATIVES
49 ${WRKDIR}/.ALTERNATIVES:
50 . for w in ${JAVA_WRAPPERS}
51 @${ECHO} 'bin/${w} ${PREFIX}/bin/${JAVA_NAME}-${w}' \
52 >>${WRKDIR}/.ALTERNATIVES
53 . endfor
55 . for w in ${JAVA_WRAPPERS}
57 JAVA_WRAPPER_BIN.${w}?= ${JAVA_HOME}/bin/${w}
59 post-build: ${WRKDIR}/${w}
61 .PHONY: install-java-wrapper-${w}
62 post-install: install-java-wrapper-${w}
64 . if !target(${WRKDIR}/${w})
65 ${WRKDIR}/${w}:
66 @${ECHO} 'Generating ${w} wrapper...'
67 @${ECHO} '#! ${SH}' >${WRKDIR}/${w}
68 @${ECHO} 'PATH=${JAVA_HOME}/bin:$${PATH}; export PATH' >>${WRKDIR}/${w}
69 @${ECHO} 'JAVA_HOME=${JAVA_HOME}; export JAVA_HOME' >>${WRKDIR}/${w}
70 @${ECHO} 'JVM_HOME=${JAVA_HOME}; export JVM_HOME' >>${WRKDIR}/${w}
71 . if !empty(JAVA_CLASSPATH)
72 @${ECHO} 'CLASSPATH=${JAVA_CLASSPATH}:$${CLASSPATH}; export CLASSPATH' \
73 >>${WRKDIR}/${w}
74 . endif
75 . if !empty(JAVA_LD_LIBRARY_PATH)
76 @${ECHO} 'LD_LIBRARY_PATH=${JAVA_LD_LIBRARY_PATH}$${LD_LIBRARY_PATH:+:}$${LD_LIBRARY_PATH}; export LD_LIBRARY_PATH' \
77 >>${WRKDIR}/${w}
78 . endif
79 . for f in ${JAVA_UNLIMIT}
80 @${ECHO} '${ULIMIT_CMD_${f}}' >>${WRKDIR}/${w}
81 . endfor
82 . undef f
83 @${ECHO} '${JAVA_WRAPPER_BIN.${w}} "$$@"' >>${WRKDIR}/${w}
84 . endif
86 install-java-wrapper-${w}:
87 ${INSTALL_SCRIPT} ${WRKDIR}/${w} ${DESTDIR}${PREFIX}/bin/${JAVA_NAME}-${w}
89 . endfor
90 . undef w
91 .endif
93 # Handle the ${PREFIX}/java shared directory automatically.
94 REQD_DIRS+= ${PREFIX}/java
96 PLIST_SUBST+= JAVA_HOME=${JAVA_HOME:Q}
97 FILES_SUBST+= JAVA_HOME=${JAVA_HOME:Q}
99 .endif # JAVA_ENV_MK