/[gentoo-x86]/eclass/java-utils-2.eclass
Gentoo

Diff of /eclass/java-utils-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.20 Revision 1.36
4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> 4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
5# Copyright (c) 2004-2005, Gentoo Foundation 5# Copyright (c) 2004-2005, Gentoo Foundation
6# 6#
7# Licensed under the GNU General Public License, v2 7# Licensed under the GNU General Public License, v2
8# 8#
9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.36 2006/12/20 22:45:18 caster Exp $
9 10
10 11
11# ----------------------------------------------------------------------------- 12# -----------------------------------------------------------------------------
12# @eclass-begin 13# @eclass-begin
13# @eclass-shortdesc Java Utility eclass 14# @eclass-shortdesc Java Utility eclass
22# Java packages, or java-pkg-opt for packages that have optional Java support. 23# Java packages, or java-pkg-opt for packages that have optional Java support.
23# 24#
24# ----------------------------------------------------------------------------- 25# -----------------------------------------------------------------------------
25 26
26inherit eutils versionator multilib 27inherit eutils versionator multilib
28
29IUSE="elibc_FreeBSD"
27 30
28# ----------------------------------------------------------------------------- 31# -----------------------------------------------------------------------------
29# @section-begin variables 32# @section-begin variables
30# @section-title Variables 33# @section-title Variables
31# 34#
200 203
201 java-pkg_do_write_ 204 java-pkg_do_write_
202} 205}
203 206
204 207
208# ------------------------------------------------------------------------------
209# @internal-function depend-java-query
210#
211# Wrapper for the depend-java-query binary to enable passing USE in env.
212# Using env variables keeps this eclass working with java-config versions that
213# do not handle use flags.
214# ------------------------------------------------------------------------------
215
216depend-java-query() {
217 USE="${USE}" $(which depend-java-query) "${@}"
218}
205 219
206# ------------------------------------------------------------------------------ 220# ------------------------------------------------------------------------------
207# @ebuild-function java-pkg_regjar 221# @ebuild-function java-pkg_regjar
208# 222#
209# Records an already installed jar in the package.env 223# Records an already installed jar in the package.env
259 done 273 done
260 274
261 java-pkg_do_write_ 275 java-pkg_do_write_
262} 276}
263 277
264
265# ------------------------------------------------------------------------------ 278# ------------------------------------------------------------------------------
266# @ebuild-function java-pkg_newjar 279# @ebuild-function java-pkg_newjar
267# 280#
268# Installs a jar with a new name 281# Installs a jar with a new name
269# 282#
287 cp "${original_jar}" "${new_jar_dest}" \ 300 cp "${original_jar}" "${new_jar_dest}" \
288 || die "Failed to copy ${original_jar} to ${new_jar_dest}" 301 || die "Failed to copy ${original_jar} to ${new_jar_dest}"
289 java-pkg_dojar "${new_jar_dest}" 302 java-pkg_dojar "${new_jar_dest}"
290} 303}
291 304
292
293# ------------------------------------------------------------------------------ 305# ------------------------------------------------------------------------------
294# @ebuild-function java-pkg_addcp 306# @ebuild-function java-pkg_addcp
295# 307#
296# Add something to the package's classpath. For jars, you should use dojar, 308# Add something to the package's classpath. For jars, you should use dojar,
297# newjar, or regjar. This is typically used to add directories to the classpath. 309# newjar, or regjar. This is typically used to add directories to the classpath.
301# ------------------------------------------------------------------------------ 313# ------------------------------------------------------------------------------
302java-pkg_addcp() { 314java-pkg_addcp() {
303 java-pkg_append_ JAVA_PKG_CLASSPATH "${@}" 315 java-pkg_append_ JAVA_PKG_CLASSPATH "${@}"
304 java-pkg_do_write_ 316 java-pkg_do_write_
305} 317}
306
307 318
308# ------------------------------------------------------------------------------ 319# ------------------------------------------------------------------------------
309# @ebuild-function java-pkg_doso 320# @ebuild-function java-pkg_doso
310# 321#
311# Installs any number of JNI libraries 322# Installs any number of JNI libraries
428# ------------------------------------------------------------------------------ 439# ------------------------------------------------------------------------------
429java-pkg_dohtml() { 440java-pkg_dohtml() {
430 debug-print-function ${FUNCNAME} $* 441 debug-print-function ${FUNCNAME} $*
431 442
432 [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}" 443 [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}"
433 # TODO-nichoj find out what exactly -f package-list does 444
445 # from /usr/lib/portage/bin/dohtml -h
446 # -f Set list of allowed extensionless file names.
434 dohtml -f package-list "$@" 447 dohtml -f package-list "$@"
448
435 # this probably shouldn't be here but it provides 449 # this probably shouldn't be here but it provides
436 # a reasonable way to catch # docs for all of the 450 # a reasonable way to catch # docs for all of the
437 # old ebuilds. 451 # old ebuilds.
438 java-pkg_recordjavadoc 452 java-pkg_recordjavadoc
439} 453}
440 454
441# TODO document 455# ------------------------------------------------------------------------------
456# @ebuild-function java-pkg_dojavadoc
457#
458# Installs javadoc documentation. This should be controlled by the doc use flag.
459#
460# @param $1: - The javadoc root directory.
461#
462# @example:
463# java-pkg_dojavadoc docs/api
464#
465# ------------------------------------------------------------------------------
442java-pkg_dojavadoc() { 466java-pkg_dojavadoc() {
443 local dir="$1" 467 local dir="$1"
444 468
445 java-pkg_check-phase install 469 java-pkg_check-phase install
446 470
518# @ebuild-function java-pkg_dolauncher 542# @ebuild-function java-pkg_dolauncher
519# 543#
520# Make a wrapper script to lauch/start this package 544# Make a wrapper script to lauch/start this package
521# If necessary, the wrapper will switch to the appropriate VM. 545# If necessary, the wrapper will switch to the appropriate VM.
522# 546#
547# Can be called without parameters if the package installs only one jar
548# that has the Main-class attribute set. The wrapper will be named ${PN}.
549#
523# @param $1 - filename of launcher to create 550# @param $1 - filename of launcher to create
524# @param $2 - options, as follows: 551# @param $2 - options, as follows:
525# --main the.main.class.too.start 552# --main the.main.class.too.start
526# --jar /the/jar/too/launch.jar 553# --jar /the/jar/too/launch.jar or just <name>.jar
527# --java_args 'Extra arguments to pass to java' 554# --java_args 'Extra arguments to pass to java'
528# --pkg_args 'Extra arguments too pass to the package' 555# --pkg_args 'Extra arguments too pass to the package'
529# --pwd 556# --pwd
530# -into 557# -into
531# -pre 558# -pre
532# ------------------------------------------------------------------------------ 559# ------------------------------------------------------------------------------
533java-pkg_dolauncher() { 560java-pkg_dolauncher() {
534 debug-print-function ${FUNCNAME} $* 561 debug-print-function ${FUNCNAME} $*
535 562
536 java-pkg_check-phase install 563 java-pkg_check-phase install
537
538 [[ ${#} -lt 1 ]] && die "Need at least one argument"
539
540 java-pkg_init_paths_ 564 java-pkg_init_paths_
541 565
566 if [[ ${#} = 0 ]]; then
567 local name="${PN}"
568 else
542 local name="${1}" 569 local name="${1}"
570 shift
571 fi
572
543 # TODO rename to launcher 573 # TODO rename to launcher
544 local target="${T}/${name}" 574 local target="${T}/${name}"
545 local var_tmp="${T}/launcher_variables_tmp" 575 local var_tmp="${T}/launcher_variables_tmp"
546 local target_dir pre 576 local target_dir pre
547 shift
548 577
549 # Process the other the rest of the arguments 578 # Process the other the rest of the arguments
550 while [[ -n "${1}" && -n "${2}" ]]; do 579 while [[ -n "${1}" && -n "${2}" ]]; do
551 local var=${1} value=${2} 580 local var=${1} value=${2}
552 if [[ "${var:0:2}" == "--" ]]; then 581 if [[ "${var:0:2}" == "--" ]]; then
582 local var=${var:2}
553 echo "gjl_${var:2}=\"${value}\"" >> "${var_tmp}" 583 echo "gjl_${var}=\"${value}\"" >> "${var_tmp}"
584 local gjl_${var}="${value}"
554 elif [[ "${var}" == "-into" ]]; then 585 elif [[ "${var}" == "-into" ]]; then
555 target_dir="${value}" 586 target_dir="${value}"
556 elif [[ "${var}" == "-pre" ]]; then 587 elif [[ "${var}" == "-pre" ]]; then
557 pre="${value}" 588 pre="${value}"
558 fi 589 fi
559 shift 2 590 shift 2
560 done 591 done
592
593 # Test if no --jar and --main arguments were given and
594 # in that case check if the package only installs one jar
595 # and use that jar.
596 if [[ -z "${gjl_jar}" && -z "${gjl_main}" ]]; then
597 local cp="${JAVA_PKG_CLASSPATH}"
598 if [[ "${cp/:}" = "${cp}" && "${cp%.jar}" != "${cp}" ]]; then
599 echo "gjl_jar=\"${JAVA_PKG_CLASSPATH}\"" >> "${var_tmp}"
600 else
601 local msg="Not enough information to create a launcher given."
602 msg="${msg} Please give --jar or --main argument to ${FUNCNAME}."
603 die "${msg}"
604 fi
605 fi
561 606
562 # Write the actual script 607 # Write the actual script
563 echo "#!/bin/bash" > "${target}" 608 echo "#!/bin/bash" > "${target}"
564 [[ -n "${pre}" ]] && [[ -f "${pre}" ]] && cat "${pre}" >> "${target}" 609 [[ -n "${pre}" ]] && [[ -f "${pre}" ]] && cat "${pre}" >> "${target}"
565 echo "gjl_package=${JAVA_PKG_NAME}" >> "${target}" 610 echo "gjl_package=${JAVA_PKG_NAME}" >> "${target}"
566 cat "${var_tmp}" >> "${target}" 611 cat "${var_tmp}" >> "${target}"
612 rm -f "${var_tmp}"
567 echo "source /usr/share/java-config-2/launcher/launcher.bash" >> "${target}" 613 echo "source /usr/share/java-config-2/launcher/launcher.bash" >> "${target}"
568 614
569 if [[ -n "${target_dir}" ]]; then 615 if [[ -n "${target_dir}" ]]; then
570 DESTTREE="${target_dir}" dobin "${target}" 616 DESTTREE="${target_dir}" dobin "${target}"
571 local ret=$? 617 local ret=$?
740# The providing packages are recorded as dependencies into package.env DEPEND 786# The providing packages are recorded as dependencies into package.env DEPEND
741# line, unless "--build-only" is passed as the very first argument, for jars 787# line, unless "--build-only" is passed as the very first argument, for jars
742# that have to be present only at build time and are not needed on runtime 788# that have to be present only at build time and are not needed on runtime
743# (junit testing etc). 789# (junit testing etc).
744# 790#
745# Example: Get the classpath for xerces-2, 791# Example: Get the classpath for xerces-2 and xalan,
746# java-pkg_getjars xerces-2 xalan 792# java-pkg_getjars xerces-2,xalan
747# Example Return: 793# Example Return:
748# /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar 794# /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar
749# 795#
750# @param $1 - (optional) "--build-only" makes the jar(s) not added into 796# @param $1 - (optional) "--build-only" makes the jar(s) not added into
751# package.env DEPEND line. 797# package.env DEPEND line.
752# @param $@ - list of packages to get jars from 798# @param $2 - list of packages to get jars from
799# (passed to java-config --classpath)
753# ------------------------------------------------------------------------------ 800# ------------------------------------------------------------------------------
754java-pkg_getjars() { 801java-pkg_getjars() {
755 debug-print-function ${FUNCNAME} $* 802 debug-print-function ${FUNCNAME} $*
756 803
757 local build_only="" 804 [[ ${#} -lt 1 || ${#} -gt 2 ]] && die "${FUNCNAME} takes only one or two arguments"
758 805
759 if [[ "${1}" = "--build-only" ]]; then 806 if [[ "${1}" = "--build-only" ]]; then
760 build_only="true" 807 local build_only="true"
761 shift 808 shift
762 fi 809 fi
763 810
764 [[ ${#} -lt 1 ]] && die "At least one argument needed"
765
766 # NOTE could probably just pass $@ to java-config --classpath. and return it
767 local classpath pkg 811 local classpath pkgs="${1}"
768 for pkg in ${@//,/ }; do
769 #for pkg in $(echo "$@" | tr ',' ' '); do
770 jars="$(java-config --classpath=${pkg})" 812 jars="$(java-config --classpath=${pkgs})"
771 [[ -z "${jars}" ]] && die "java-config --classpath=${pkg} failed" 813 [[ -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed"
772 debug-print "${pkg}:${jars}" 814 debug-print "${pkgs}:${jars}"
773 815
774 if [[ -z "${classpath}" ]]; then 816 if [[ -z "${classpath}" ]]; then
775 classpath="${jars}" 817 classpath="${jars}"
776 else 818 else
777 classpath="${classpath}:${jars}" 819 classpath="${classpath}:${jars}"
778 fi 820 fi
821
779 # Only record jars that aren't build-only 822 # Only record jars that aren't build-only
780 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" 823 if [[ -z "${build_only}" ]]; then
824 oldifs="${IFS}"
825 IFS=","
826 for pkg in ${pkgs}; do
827 java-pkg_record-jar_ "${pkg}"
781 done 828 done
829 IFS="${oldifs}"
830 fi
831
782 echo "${classpath}" 832 echo "${classpath}"
783} 833}
784 834
785# ------------------------------------------------------------------------------ 835# ------------------------------------------------------------------------------
786# @ebuild-function java-pkg_getjar 836# @ebuild-function java-pkg_getjar
1159} 1209}
1160 1210
1161java-pkg_get-javac() { 1211java-pkg_get-javac() {
1162 debug-print-function ${FUNCNAME} $* 1212 debug-print-function ${FUNCNAME} $*
1163 1213
1164 java-pkg_init-compiler_ 1214
1165 local compiler="${GENTOO_COMPILER}" 1215 local compiler="${GENTOO_COMPILER}"
1166 1216
1167 local compiler_executable 1217 local compiler_executable
1168 if [[ "${compiler}" = "javac" ]]; then 1218 if [[ "${compiler}" = "javac" ]]; then
1169 # nothing fancy needs to be done for javac 1219 # nothing fancy needs to be done for javac
1177 unset JAVAC 1227 unset JAVAC
1178 # try to get value of JAVAC 1228 # try to get value of JAVAC
1179 compiler_executable="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${JAVAC})" 1229 compiler_executable="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${JAVAC})"
1180 export JAVAC=${old_javac} 1230 export JAVAC=${old_javac}
1181 1231
1182 [[ -z ${compiler_executable} ]] && die "JAVAC is empty or undefined in ${compiler_env}" 1232 if [[ -z ${compiler_executable} ]]; then
1233 echo "JAVAC is empty or undefined in ${compiler_env}"
1234 return 1
1235 fi
1183 1236
1184 # check that it's executable 1237 # check that it's executable
1185 if [[ ! -x ${compiler_executable} ]]; then 1238 if [[ ! -x ${compiler_executable} ]]; then
1186 eerror "Could not find ${compiler_executable}!"
1187 die "${compiler_executable} doesn't exist, or isn't executable" 1239 echo "${compiler_executable} doesn't exist, or isn't executable"
1240 return 1
1188 fi 1241 fi
1189 else 1242 else
1190 eerror "Could not find environment file for ${compiler}" 1243 echo "Could not find environment file for ${compiler}"
1191 die "Could not find ${compiler_env}" 1244 return 1
1192 fi 1245 fi
1193 fi 1246 fi
1194 echo ${compiler_executable} 1247 echo ${compiler_executable}
1195} 1248}
1196 1249
1213 1266
1214 debug-print "want source: ${want_source}" 1267 debug-print "want source: ${want_source}"
1215 debug-print "want target: ${want_target}" 1268 debug-print "want target: ${want_target}"
1216 1269
1217 if [[ -z "${want_source}" || -z "${want_target}" ]]; then 1270 if [[ -z "${want_source}" || -z "${want_target}" ]]; then
1218 debug-print "could not find valid -source/-target values" 1271 debug-print "could not find valid -source/-target values for javac"
1219 die "Could not find valid -source/-target values" 1272 echo "Could not find valid -source/-target values for javac"
1273 return 1
1220 else 1274 else
1221 if java-pkg_is-vm-version-ge "1.4"; then 1275 if java-pkg_is-vm-version-ge "1.4"; then
1222 echo "${source_str} ${target_str}" 1276 echo "${source_str} ${target_str}"
1223 else 1277 else
1224 echo "${target_str}" 1278 echo "${target_str}"
1228 1282
1229# TODO document 1283# TODO document
1230java-pkg_get-jni-cflags() { 1284java-pkg_get-jni-cflags() {
1231 local flags="-I${JAVA_HOME}/include" 1285 local flags="-I${JAVA_HOME}/include"
1232 1286
1287 local platform="linux"
1288 use elibc_FreeBSD && platform="freebsd"
1289
1233 # TODO do a check that the directories are valid 1290 # TODO do a check that the directories are valid
1234 # TODO figure out how to cope with other things than linux...
1235 flags="${flags} -I${JAVA_HOME}/include/linux" 1291 flags="${flags} -I${JAVA_HOME}/include/${platform}"
1236 1292
1237 echo ${flags} 1293 echo ${flags}
1238} 1294}
1239 1295
1240java-pkg_ensure-gcj() { 1296java-pkg_ensure-gcj() {
1246 die "No GCJ support found!" 1302 die "No GCJ support found!"
1247 fi 1303 fi
1248} 1304}
1249 1305
1250java-pkg_ensure-test() { 1306java-pkg_ensure-test() {
1251 if hasq test ${FEATURES} && ! hasq -test ${FEATURES} && ! use test; then 1307 if hasq test ${FEATURES} && ! hasq -test ${FEATURES} \
1308 && hasq test ${IUSE} && ! use test;
1309 then
1252 eerror "You specified FEATURES=test, but USE=test is needed" 1310 eerror "You specified FEATURES=test, but USE=test is needed"
1253 eerror "to pull in the additional dependencies for testing" 1311 eerror "to pull in the additional dependencies for testing"
1254 die "Need USE=test enabled" 1312 die "Need USE=test enabled"
1255 fi 1313 fi
1256} 1314}
1281# if is-java-strict && [[ ! ${DEPEND} =~ "dev-java/ant" ]]; then 1339# if is-java-strict && [[ ! ${DEPEND} =~ "dev-java/ant" ]]; then
1282# java-pkg_announce-qa-violation \ 1340# java-pkg_announce-qa-violation \
1283# "Using eant, but not depending on dev-java/ant or dev-java/ant-core" 1341# "Using eant, but not depending on dev-java/ant or dev-java/ant-core"
1284# fi 1342# fi
1285 1343
1286 local antflags 1344 local antflags="-Dnoget=true"
1287 java-pkg_init-compiler_ 1345 java-pkg_init-compiler_
1288 local compiler="${GENTOO_COMPILER}" 1346 local compiler="${GENTOO_COMPILER}"
1289 1347
1290 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" 1348 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}"
1291 1349
1293 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then 1351 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then
1294 die "ANT_BUILD_COMPILER undefined in ${compiler_env}" 1352 die "ANT_BUILD_COMPILER undefined in ${compiler_env}"
1295 fi 1353 fi
1296 1354
1297 if [[ ${compiler} != "javac" ]]; then 1355 if [[ ${compiler} != "javac" ]]; then
1298 antflags="-Dbuild.compiler=${build_compiler}" 1356 antflags="${antflags} -Dbuild.compiler=${build_compiler}"
1299 # Figure out any extra stuff to put on the classpath for compilers aside 1357 # Figure out any extra stuff to put on the classpath for compilers aside
1300 # from javac 1358 # from javac
1301 # ANT_BUILD_COMPILER_DEPS should be something that could be passed to 1359 # ANT_BUILD_COMPILER_DEPS should be something that could be passed to
1302 # java-config -p 1360 # java-config -p
1303 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})" 1361 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})"
1329# @param $@ - Arguments to be passed to the compiler 1387# @param $@ - Arguments to be passed to the compiler
1330# ------------------------------------------------------------------------------ 1388# ------------------------------------------------------------------------------
1331ejavac() { 1389ejavac() {
1332 debug-print-function ${FUNCNAME} $* 1390 debug-print-function ${FUNCNAME} $*
1333 1391
1334 # FIXME using get-javac ends up printing stuff with einfo 1392 java-pkg_init-compiler_
1393
1394 local compiler_executable
1335# local compiler_executable=$(java-pkg_get-javac) 1395 compiler_executable=$(java-pkg_get-javac)
1336 local compiler_executable="javac" 1396 if [[ ${?} != 0 ]]; then
1397 eerror "There was a problem determining compiler: ${compiler_executable}"
1398 die "get-javac failed"
1399 fi
1337 1400
1401 local javac_args
1402 javac_args="$(java-pkg_javac-args)"
1403 if [[ ${?} != 0 ]]; then
1404 eerror "There was a problem determining JAVACFLAGS: ${javac_args}"
1405 die "java-pkg_javac-args failed"
1406 fi
1407
1338 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} $(java-pkg_javac-args) "${@}" 1408 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}"
1339 ${compiler_executable} $(java-pkg_javac-args) "${@}" || die "ejavac failed" 1409 ${compiler_executable} ${javac_args} "${@}" || die "ejavac failed"
1340} 1410}
1341 1411
1342# ------------------------------------------------------------------------------ 1412# ------------------------------------------------------------------------------
1343# @ebuild-function java-pkg_filter-compiler 1413# @ebuild-function java-pkg_filter-compiler
1344# 1414#
1576# Writes the package.env out to disk. 1646# Writes the package.env out to disk.
1577# 1647#
1578# ------------------------------------------------------------------------------ 1648# ------------------------------------------------------------------------------
1579# TODO change to do-write, to match everything else 1649# TODO change to do-write, to match everything else
1580java-pkg_do_write_() { 1650java-pkg_do_write_() {
1651 java-pkg_init_paths_
1581 # Create directory for package.env 1652 # Create directory for package.env
1582 dodir "${JAVA_PKG_SHAREPATH}" 1653 dodir "${JAVA_PKG_SHAREPATH}"
1583 if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f "${JAVA_PKG_DEPEND}" ]]; then 1654 if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f "${JAVA_PKG_DEPEND}" ]]; then
1584 # Create package.env 1655 # Create package.env
1585 ( 1656 (
1613 # Strip unnecessary leading and trailing colons 1684 # Strip unnecessary leading and trailing colons
1614 # TODO try to cleanup if possible 1685 # TODO try to cleanup if possible
1615 sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?" 1686 sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?"
1616 fi 1687 fi
1617} 1688}
1618
1619 1689
1620# ------------------------------------------------------------------------------ 1690# ------------------------------------------------------------------------------
1621# @internal-function java-pkg_record-jar_ 1691# @internal-function java-pkg_record-jar_
1622# 1692#
1623# Record a dependency to the package.env 1693# Record a dependency to the package.env
1704# ------------------------------------------------------------------------------ 1774# ------------------------------------------------------------------------------
1705java-pkg_setup-vm() { 1775java-pkg_setup-vm() {
1706 debug-print-function ${FUNCNAME} $* 1776 debug-print-function ${FUNCNAME} $*
1707 1777
1708 local vendor="$(java-pkg_get-vm-vendor)" 1778 local vendor="$(java-pkg_get-vm-vendor)"
1709 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge 1 5; then 1779 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then
1710 addpredict "/dev/random" 1780 addpredict "/dev/random"
1711 elif [[ "${vendor}" == "ibm" ]]; then 1781 elif [[ "${vendor}" == "ibm" ]]; then
1712 addpredict "/proc/self/maps" 1782 addpredict "/proc/self/maps"
1713 addpredict "/proc/cpuinfo" 1783 addpredict "/proc/cpuinfo"
1714 export LANG="C" LC_ALL="C" 1784 export LANG="C" LC_ALL="C"
1763# @return - The version of the current VM 1833# @return - The version of the current VM
1764# ------------------------------------------------------------------------------ 1834# ------------------------------------------------------------------------------
1765java-pkg_get-vm-version() { 1835java-pkg_get-vm-version() {
1766 debug-print-function ${FUNCNAME} $* 1836 debug-print-function ${FUNCNAME} $*
1767 1837
1768 java-pkg_get-current-vm | sed -e "s/.*-\([0-9.]\+\).*/\1/" 1838 java-config -g PROVIDES_VERSION
1769} 1839}
1770 1840
1771# ------------------------------------------------------------------------------ 1841# ------------------------------------------------------------------------------
1772# @internal-function java-pkg_switch-vm 1842# @internal-function java-pkg_switch-vm
1773# 1843#
1783 export GENTOO_VM="${JAVA_PKG_FORCE_VM}" 1853 export GENTOO_VM="${JAVA_PKG_FORCE_VM}"
1784 # if we're allowed to switch the vm... 1854 # if we're allowed to switch the vm...
1785 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then 1855 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then
1786 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}} VNEED: ${JAVA_PKG_VNEED}" 1856 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}} VNEED: ${JAVA_PKG_VNEED}"
1787 if [[ -n ${JAVA_PKG_VNEED} ]]; then 1857 if [[ -n ${JAVA_PKG_VNEED} ]]; then
1788 export GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 1858 GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
1789 else 1859 else
1790 export GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 1860 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
1861 fi
1862 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
1863 eerror "Unable to determine VM for building from dependencies:"
1864 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
1865 echo "VNEED: ${JAVA_PKG_VNEED}"
1866 die "Failed to determine VM for building."
1867 else
1868 export GENTOO_VM
1791 fi 1869 fi
1792 # otherwise just make sure the current VM is sufficient 1870 # otherwise just make sure the current VM is sufficient
1793 else 1871 else
1794 java-pkg_ensure-vm-version-sufficient 1872 java-pkg_ensure-vm-version-sufficient
1795 fi 1873 fi
1797 1875
1798 java-pkg_setup-vm 1876 java-pkg_setup-vm
1799 1877
1800 export JAVA=$(java-config --java) 1878 export JAVA=$(java-config --java)
1801 export JAVAC=$(java-config --javac) 1879 export JAVAC=$(java-config --javac)
1802 export JAVACFLAGS="$(java-pkg_javac-args)" 1880 JAVACFLAGS="$(java-pkg_javac-args)"
1881 if [[ ${?} != 0 ]]; then
1882 eerror "There was a problem determining JAVACFLAGS: ${JAVACFLAGS}"
1883 die "java-pkg_javac-args failed"
1884 fi
1803 [[ -n ${JAVACFLAGS_EXTRA} ]] && export JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}" 1885 [[ -n ${JAVACFLAGS_EXTRA} ]] && JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}"
1886 export JAVACFLAGS
1804 1887
1805 export JAVA_HOME="$(java-config -g JAVA_HOME)" 1888 export JAVA_HOME="$(java-config -g JAVA_HOME)"
1806 export JDK_HOME=${JAVA_HOME} 1889 export JDK_HOME=${JAVA_HOME}
1807 1890
1808 #TODO If you know a better solution let us know. 1891 #TODO If you know a better solution let us know.
1870 ewarn "Possible problem" 1953 ewarn "Possible problem"
1871 die "Bad class files found" 1954 die "Bad class files found"
1872 fi 1955 fi
1873} 1956}
1874 1957
1875
1876# ------------------------------------------------------------------------------ 1958# ------------------------------------------------------------------------------
1877# @section-end internal 1959# @section-end internal
1878# ------------------------------------------------------------------------------ 1960# ------------------------------------------------------------------------------
1879 1961
1880java-pkg_check-phase() { 1962java-pkg_check-phase() {

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20