/[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.106 Revision 1.128
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.106 2008/05/03 21:28:07 betelgeuse Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.128 2009/06/02 07:02:01 ali_bush Exp $
10 10
11# ----------------------------------------------------------------------------- 11# -----------------------------------------------------------------------------
12# @eclass-begin 12# @eclass-begin
13# @eclass-shortdesc Java Utility eclass 13# @eclass-shortdesc Java Utility eclass
14# @eclass-maintainer java@gentoo.org 14# @eclass-maintainer java@gentoo.org
59# ----------------------------------------------------------------------------- 59# -----------------------------------------------------------------------------
60# @variable-internal JAVA_PKG_PORTAGE_DEP 60# @variable-internal JAVA_PKG_PORTAGE_DEP
61# 61#
62# The version of portage we need to function properly. Previously it was 62# The version of portage we need to function properly. Previously it was
63# portage with phase hooks support but now we use a version with proper env 63# portage with phase hooks support but now we use a version with proper env
64# saving. 64# saving. For EAPI 2 we have new enough stuff so let's have cleaner deps.
65# ----------------------------------------------------------------------------- 65# -----------------------------------------------------------------------------
66JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7" 66hasq "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
67 67
68# ----------------------------------------------------------------------------- 68# -----------------------------------------------------------------------------
69# @variable-internal JAVA_PKG_E_DEPEND 69# @variable-internal JAVA_PKG_E_DEPEND
70# 70#
71# This is a convience variable to be used from the other java eclasses. This is 71# This is a convience variable to be used from the other java eclasses. This is
72# the version of java-config we want to use. Usually the latest stable version 72# the version of java-config we want to use. Usually the latest stable version
73# so that ebuilds can use new features without depending on specific versions. 73# so that ebuilds can use new features without depending on specific versions.
74# ----------------------------------------------------------------------------- 74# -----------------------------------------------------------------------------
75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.33-r1 ${JAVA_PKG_PORTAGE_DEP}" 75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.1.6 ${JAVA_PKG_PORTAGE_DEP}"
76hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )" 76hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
77 77
78# ----------------------------------------------------------------------------- 78# -----------------------------------------------------------------------------
79# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 79# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
80# @variable-default yes 80# @variable-default yes
365 if [[ ${jar} = *\** ]]; then 365 if [[ ${jar} = *\** ]]; then
366 eerror "The argument ${jar} to ${FUNCNAME}" 366 eerror "The argument ${jar} to ${FUNCNAME}"
367 eerror "has * in it. If you want it to glob in" 367 eerror "has * in it. If you want it to glob in"
368 eerror '${D} add ${D} to the argument.' 368 eerror '${D} add ${D} to the argument.'
369 fi 369 fi
370 debug-print "${jar} or ${D}${jar} not found"
370 die "${jar} does not exist" 371 die "${jar} does not exist"
371 fi 372 fi
372 done 373 done
373 374
374 java-pkg_do_write_ 375 java-pkg_do_write_
429# @param $@ - JNI libraries to install 430# @param $@ - JNI libraries to install
430# ------------------------------------------------------------------------------ 431# ------------------------------------------------------------------------------
431java-pkg_doso() { 432java-pkg_doso() {
432 debug-print-function ${FUNCNAME} $* 433 debug-print-function ${FUNCNAME} $*
433 434
434 [[ ${#} -lt 1 ]] && "At least one argument required for ${FUNCNAME}"
435 java-pkg_check-phase install 435 java-pkg_check-phase install
436 436
437 [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}" 437 [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument"
438 438
439 java-pkg_init_paths_ 439 java-pkg_init_paths_
440 440
441 local lib 441 local lib
442 # for each lib 442 # for each lib
445 if [[ -e "${lib}" ]] ; then 445 if [[ -e "${lib}" ]] ; then
446 # install if it isn't a symlink 446 # install if it isn't a symlink
447 if [[ ! -L "${lib}" ]] ; then 447 if [[ ! -L "${lib}" ]] ; then
448 INSDESTTREE="${JAVA_PKG_LIBDEST}" \ 448 INSDESTTREE="${JAVA_PKG_LIBDEST}" \
449 INSOPTIONS="${LIBOPTIONS}" \ 449 INSOPTIONS="${LIBOPTIONS}" \
450 doins "${lib}" || "failed to install ${lib}" 450 doins "${lib}" || die "failed to install ${lib}"
451 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}" 451 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
452 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}" 452 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
453 # otherwise make a symlink to the symlink's origin 453 # otherwise make a symlink to the symlink's origin
454 else 454 else
455 # TODO use dosym 455 dosym "$(readlink "${lib}")" "${JAVA_PKG_LIBDEST}/${lib##*/}"
456 ln -s "$(readlink "${lib}")" \
457 "${D}${JAVA_PKG_LIBDEST}/$(basename "${lib}")"
458 debug-print "${lib} is a symlink, linking accordanly" 456 debug-print "${lib} is a symlink, linking accordantly"
459 fi 457 fi
460 # otherwise die 458 # otherwise die
461 else 459 else
462 die "${lib} does not exist" 460 die "${lib} does not exist"
463 fi 461 fi
479java-pkg_regso() { 477java-pkg_regso() {
480 debug-print-function ${FUNCNAME} $* 478 debug-print-function ${FUNCNAME} $*
481 479
482 java-pkg_check-phase install 480 java-pkg_check-phase install
483 481
484 [[ ${#} -lt 1 ]] && "at least one argument needed" 482 [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument"
485 483
486 java-pkg_init_paths_ 484 java-pkg_init_paths_
487 485
488 local lib target_dir 486 local lib target_dir
489 for lib in "$@" ; do 487 for lib in "$@" ; do
1310# 1308#
1311# Various other functions to use from an ebuild 1309# Various other functions to use from an ebuild
1312# ------------------------------------------------------------------------------ 1310# ------------------------------------------------------------------------------
1313 1311
1314# ------------------------------------------------------------------------------ 1312# ------------------------------------------------------------------------------
1315# @ebuild-function java-pkg_need
1316#
1317# Adds virtual dependencies, which can optionally be controlled by a USE flag.
1318# Currently supported virtuals are:
1319# javamail
1320# jdbc-stdext
1321# jaf
1322# jdbc-rowset
1323# jms
1324#
1325# @param $1 - Optionally indicate that the dependencies are controlled by
1326# a use flag by specifying '--use' Requires $2.
1327# @param $2 - USE flag which will enable the dependencies.
1328# @param $@ - virtual packages to add depenedencies for
1329# ------------------------------------------------------------------------------
1330# TODO rewrite to parse a line based declaration file instead -- karltk
1331#java-pkg_need() {
1332# debug-print-function ${FUNCNAME} $*
1333# local useflag
1334# if [[ ${1} == "--use" ]]; then
1335# useflag="${2}"
1336# shift 2
1337# fi
1338#
1339# if [[ -z ${1} ]]; then
1340# die "Must specify at least one virtual package."
1341# fi
1342#
1343# local depstr newdepstr
1344#
1345# for virtual in ${@}; do
1346# if has ${virtual} ${JAVA_PKG_VNEED}; then
1347# debug-print "Already registered virtual ${virtual}"
1348# continue
1349# fi
1350# case ${virtual} in
1351# javamail)
1352# debug-print "java-pkg_need: adding javamail dependencies"
1353# newdepstr="|| ( dev-java/gnu-javamail dev-java/sun-javamail-bin )"
1354# ;;
1355# jdbc-stdext)
1356# debug-print "java-pkg_need: adding jdbc-stdext dependencies"
1357# newdepstr="|| ( >=virtual/jdk-1.4 dev-java/jdbc2-stdext )"
1358# ;;
1359# jaf)
1360# debug-print "java-pkg_need: adding jaf dependencies"
1361# newdepstr="|| ( dev-java/gnu-jaf dev-java/sun-jaf-bin )"
1362# ;;
1363# jdbc-rowset)
1364# debug-print "java-pkg_need: adding jdbc-rowset dependencies"
1365# newdepstr="|| ( >=virtual/jdk-1.5 dev-java/sun-jdbc-rowset )"
1366# ;;
1367# jms)
1368# debug-print "java-pkg_need: adding jms dependencies"
1369# newdepstr="|| ( dev-java/sun-jms dev-java/openjms )"
1370# ;;
1371# *)
1372# die "Invalid virtual: ${virtual}"
1373# esac
1374#
1375# export JAVA_PKG_VNEED="${JAVA_PKG_VNEED} ${virtual}"
1376#
1377# if [[ -n ${useflag} ]]; then
1378# depstr="${depstr} ${useflag}? ( ${newdepstr} )"
1379# else
1380# depstr="${depstr} ${newdepstr}"
1381# fi
1382# done
1383#
1384# [[ -z ${JAVA_PKG_NV_DEPEND} ]] && export JAVA_PKG_NV_DEPEND="${DEPEND}"
1385# [[ -z ${JAVA_PKG_NV_RDEPEND} ]] && export JAVA_PKG_NV_RDEPEND="${RDEPEND}"
1386#
1387# export DEPEND="${DEPEND} ${depstr}"
1388# export RDEPEND="${RDEPEND} ${depstr}"
1389#}
1390
1391# ------------------------------------------------------------------------------
1392# @ebuild-function java-pkg_find-normal-jars 1313# @ebuild-function java-pkg_find-normal-jars
1393# 1314#
1394# Find the files with suffix .jar file in the given directory or $WORKDIR 1315# Find the files with suffix .jar file in the given directory or $WORKDIR
1395# 1316#
1396# @param $1 - The directory to search for jar files (default: ${WORKDIR}) 1317# @param $1 - The directory to search for jar files (default: ${WORKDIR})
1743 1664
1744 if [[ -n "${WANT_ANT_TASKS}" ]]; then 1665 if [[ -n "${WANT_ANT_TASKS}" ]]; then
1745 local DEP="" 1666 local DEP=""
1746 for i in ${WANT_ANT_TASKS} 1667 for i in ${WANT_ANT_TASKS}
1747 do 1668 do
1748 if [[ ${i} != ant-* ]]; then 1669 if [[ ${i} = ant-* ]]; then
1670 DEP="${DEP}dev-java/${i} "
1671 elif [[ ${i} = */*:* ]]; then
1672 DEP="${DEP}${i} "
1673 else
1749 echo "Invalid atom in WANT_ANT_TASKS: ${i}" 1674 echo "Invalid atom in WANT_ANT_TASKS: ${i}"
1750 return 1 1675 return 1
1751 fi 1676 fi
1752 DEP="${DEP}dev-java/${i} "
1753 done 1677 done
1754 echo ${DEP} 1678 echo ${DEP}
1755 return 0 1679 return 0
1756 else 1680 else
1757 return 0 1681 return 0
1770# 1694#
1771# @param $1 - -cp or -classpath 1695# @param $1 - -cp or -classpath
1772# @param $2 - classpath; junit and recorded dependencies get appended 1696# @param $2 - classpath; junit and recorded dependencies get appended
1773# @param $@ - the rest of the parameters are passed to java 1697# @param $@ - the rest of the parameters are passed to java
1774# ------------------------------------------------------------------------------ 1698# ------------------------------------------------------------------------------
1775ejunit{ 1699ejunit() {
1776 debug-print-function ${FUNCNAME} $* 1700 debug-print-function ${FUNCNAME} $*
1777 1701
1778 local pkgs 1702 local pkgs
1779 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then 1703 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then
1780 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do 1704 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do
1798# ------------------------------------------------------------------------------ 1722# ------------------------------------------------------------------------------
1799# @section-end helper 1723# @section-end helper
1800# ------------------------------------------------------------------------------ 1724# ------------------------------------------------------------------------------
1801 1725
1802# ------------------------------------------------------------------------------ 1726# ------------------------------------------------------------------------------
1727# @eclass-src_prepare
1728#
1729# src_prepare Searches for bundled jars
1730# Don't call directly, but via java-pkg-2_src_prepare!
1731# ------------------------------------------------------------------------------
1732
1733java-utils-2_src_prepare() {
1734 [[ ${EBUILD_PHASE} == prepare ]] &&
1735 java-pkg_func-exists java_prepare && java_prepare
1736
1737 # Remember that eant will call this unless called via Portage
1738 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1739 echo "Searching for bundled jars:"
1740 java-pkg_find-normal-jars || echo "None found."
1741 echo "Searching for bundled classes (no output if none found):"
1742 find "${WORKDIR}" -name "*.class"
1743 echo "Search done."
1744 fi
1745 touch "${T}/java-utils-2_src_prepare-run"
1746}
1747
1748# ------------------------------------------------------------------------------
1749# @eclass-pkg_preinst
1750#
1751# pkg_preinst Searches for missing and unneeded dependencies
1752# Don't call directly, but via java-pkg-2_pkg_preinst!
1753# ------------------------------------------------------------------------------
1754
1755java-utils-2_pkg_preinst() {
1756 if is-java-strict; then
1757 if has_version dev-java/java-dep-check; then
1758 [[ -e "${JAVA_PKG_ENV}" ]] || return
1759 local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
1760 if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then
1761 ewarn "Possibly unneeded dependencies found in package.env:"
1762 for dep in ${output}; do
1763 ewarn "\t${dep}"
1764 done
1765 fi
1766 if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then
1767 ewarn "${output}"
1768 fi
1769 else
1770 eerror "Install dev-java/java-dep-check for dependency checking"
1771 fi
1772 fi
1773}
1774
1775# ------------------------------------------------------------------------------
1803# @section-begin build 1776# @section-begin build
1804# @section-summary Build functions 1777# @section-summary Build functions
1805# 1778#
1806# These are some functions for building a package. In particular, it consists of 1779# These are some functions for building a package. In particular, it consists of
1807# wrappers for javac and ant. 1780# wrappers for javac and ant.
1814# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS, 1787# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS,
1815# variables: 1788# variables:
1816# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the 1789# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
1817# gentoo.classpath property. Be sure to call 1790# gentoo.classpath property. Be sure to call
1818# java-ant_rewrite-classpath in src_unpack. 1791# java-ant_rewrite-classpath in src_unpack.
1792# EANT_NEEDS_TOOLS - add tools.jar to the gentoo.classpath. Should only be used
1793# for build-time purposes, the dependency is not recorded to
1794# package.env!
1819# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files 1795# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files
1820# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1796# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1821# ------------------------------------------------------------------------------ 1797# ------------------------------------------------------------------------------
1822eant() { 1798eant() {
1823 debug-print-function ${FUNCNAME} $* 1799 debug-print-function ${FUNCNAME} $*
1824 1800
1825 if [[ ${EBUILD_PHASE} = compile ]]; then 1801 if [[ ${EBUILD_PHASE} = compile ]]; then
1826 # Used to be done in hooks in java-ant-2.eclass but moved here so that we can 1802 java-ant-2_src_configure
1827 # finally get rid of the hooks without breaking stuff 1803 java-utils-2_src_prepare
1828
1829 [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" && "${JAVA_PKG_BSFIX}" ]] \
1830 && java-ant_ignore-system-classes "${S}/build.xml"
1831
1832 if hasq java-ant-2 ${INHERITED}; then
1833 java-ant_bsfix
1834 fi
1835
1836 # eant can be called multiple times
1837 JAVA_PKG_BSFIX="off"
1838
1839 if [[ -z ${JAVA_PKG_NO_BUNDLED_SEARCH} ]] && is-java-strict; then
1840 echo "Searching for bundled jars:"
1841 java-pkg_find-normal-jars || echo "None found."
1842 echo "Searching for bundled classes (no output if none found):"
1843 find "${WORKDIR}" -name "*.class"
1844 echo "Search done."
1845 JAVA_PKG_NO_BUNDLED_SEARCH=true # eant can be called many times
1846 fi
1847 fi 1804 fi
1848 1805
1849 if ! hasq java-ant-2 ${INHERITED}; then 1806 if ! hasq java-ant-2 ${INHERITED}; then
1850 local msg="You should inherit java-ant-2 when using eant" 1807 local msg="You should inherit java-ant-2 when using eant"
1851 java-pkg_announce-qa-violation "${msg}" 1808 java-pkg_announce-qa-violation "${msg}"
1888 echo "more info." 1845 echo "more info."
1889 fi 1846 fi
1890 fi 1847 fi
1891 done 1848 done
1892 1849
1850 # parse WANT_ANT_TASKS for atoms
1851 local want_ant_tasks
1852 for i in ${WANT_ANT_TASKS}; do
1853 if [[ ${i} = */*:* ]]; then
1854 i=${i#*/}
1855 i=${i%:0}
1856 want_ant_tasks+="${i/:/-} "
1857 else
1858 want_ant_tasks+="${i} "
1859 fi
1860 done
1893 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly 1861 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1894 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}" 1862 ANT_TASKS="${ANT_TASKS:-${want_ant_tasks% }}"
1895 1863
1896 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set 1864 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1897 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" 1865 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
1898 1866
1899 # if ant-tasks is not set by ebuild or forced, use none 1867 # if ant-tasks is not set by ebuild or forced, use none
1916 local gcp="${EANT_GENTOO_CLASSPATH}" 1884 local gcp="${EANT_GENTOO_CLASSPATH}"
1917 local getjarsarg="" 1885 local getjarsarg=""
1918 1886
1919 if [[ ${EBUILD_PHASE} = "test" ]]; then 1887 if [[ ${EBUILD_PHASE} = "test" ]]; then
1920 antflags="${antflags} -DJunit.present=true" 1888 antflags="${antflags} -DJunit.present=true"
1921 [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" 1889 [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
1922 getjarsarg="--with-dependencies" 1890 getjarsarg="--with-dependencies"
1923 fi 1891 fi
1924 1892
1925 local cp 1893 local cp
1926 1894
1927 for atom in ${gcp}; do 1895 for atom in ${gcp}; do
1928 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 1896 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1929 done 1897 done
1930 1898
1899 [[ -n "${EANT_NEEDS_TOOLS}" ]] && cp="${cp}:$(java-config --tools)"
1900
1931 if [[ ${cp} ]]; then 1901 if [[ ${cp} ]]; then
1932 # It seems ant does not like single quotes around ${cp} 1902 # It seems ant does not like single quotes around ${cp}
1903 cp=${cp#:}
1904 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
1905 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
1933 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\"" 1906 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
1934 fi 1907 fi
1935 1908
1936 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" 1909 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1937 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" 1910 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1938 ant ${antflags} "${@}" || die "eant failed" 1911 ant ${antflags} "${@}" || die "eant failed"
2041# ----------------------------------------------------------------------------- 2014# -----------------------------------------------------------------------------
2042java-pkg_init() { 2015java-pkg_init() {
2043 debug-print-function ${FUNCNAME} $* 2016 debug-print-function ${FUNCNAME} $*
2044 unset JAVAC 2017 unset JAVAC
2045 unset JAVA_HOME 2018 unset JAVA_HOME
2019
2020 java-config --help >/dev/null || {
2021 eerror ""
2022 eerror "Can't run java-config --help"
2023 eerror "Have you upgraded python recently but haven't"
2024 eerror "run python-updater yet?"
2025 die "Can't run java-config --help"
2026 }
2046 2027
2047 # People do all kinds of weird things. 2028 # People do all kinds of weird things.
2048 # http://forums.gentoo.org/viewtopic-p-3943166.html 2029 # http://forums.gentoo.org/viewtopic-p-3943166.html
2049 local silence="${SILENCE_JAVA_OPTIONS_WARNING}" 2030 local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
2050 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}" 2031 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
2088 export CLASSPATH= 2069 export CLASSPATH=
2089 2070
2090 # Unset external ANT_ stuff 2071 # Unset external ANT_ stuff
2091 export ANT_TASKS= 2072 export ANT_TASKS=
2092 export ANT_OPTS= 2073 export ANT_OPTS=
2074 export ANT_RESPECT_JAVA_HOME=
2093} 2075}
2094 2076
2095# ------------------------------------------------------------------------------ 2077# ------------------------------------------------------------------------------
2096# @function-internal java-pkg-init-compiler_ 2078# @function-internal java-pkg-init-compiler_
2097# 2079#
2386# 2368#
2387# @return 0 - function is declared 2369# @return 0 - function is declared
2388# @return 1 - function is undeclared 2370# @return 1 - function is undeclared
2389# ------------------------------------------------------------------------------ 2371# ------------------------------------------------------------------------------
2390java-pkg_func-exists() { 2372java-pkg_func-exists() {
2391 if [[ -n "$(declare -f ${1})" ]]; then 2373 declare -F ${1} > /dev/null
2392 return 0
2393 else
2394 return 1
2395 fi
2396} 2374}
2397 2375
2398# ------------------------------------------------------------------------------ 2376# ------------------------------------------------------------------------------
2399# @internal-function java-pkg_setup-vm 2377# @internal-function java-pkg_setup-vm
2400# 2378#
2484 # If you're forcing the VM, I hope you know what your doing... 2462 # If you're forcing the VM, I hope you know what your doing...
2485 debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}" 2463 debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}"
2486 export GENTOO_VM="${JAVA_PKG_FORCE_VM}" 2464 export GENTOO_VM="${JAVA_PKG_FORCE_VM}"
2487 # if we're allowed to switch the vm... 2465 # if we're allowed to switch the vm...
2488 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then 2466 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then
2489 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}} VNEED: ${JAVA_PKG_VNEED}" 2467 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2490 if [[ -n ${JAVA_PKG_VNEED} ]]; then
2491 GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
2492 else
2493 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 2468 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
2494 fi
2495 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then 2469 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
2496 eerror "Unable to determine VM for building from dependencies:" 2470 eerror "Unable to determine VM for building from dependencies:"
2497 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}" 2471 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2498 echo "VNEED: ${JAVA_PKG_VNEED}"
2499 die "Failed to determine VM for building." 2472 die "Failed to determine VM for building."
2500 else 2473 else
2501 export GENTOO_VM 2474 export GENTOO_VM
2502 fi 2475 fi
2503 # otherwise just make sure the current VM is sufficient 2476 # otherwise just make sure the current VM is sufficient
2576# not. 2549# not.
2577# @param $1 (optional) - the file to check, otherwise checks whole ${D} 2550# @param $1 (optional) - the file to check, otherwise checks whole ${D}
2578# ------------------------------------------------------------------------------ 2551# ------------------------------------------------------------------------------
2579java-pkg_verify-classes() { 2552java-pkg_verify-classes() {
2580 #$(find ${D} -type f -name '*.jar' -o -name '*.class') 2553 #$(find ${D} -type f -name '*.jar' -o -name '*.class')
2554
2555 local version_verify="/usr/bin/class-version-verify.py"
2556
2557 if [[ ! -x "${version_verify}" ]]; then
2558 version_verify="/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
2559 fi
2560
2561 if [[ ! -x "${version_verify}" ]]; then
2562 ewarn "Unable to perform class version checks as"
2563 ewarn "class-version-verify.py is unavailable"
2564 ewarn "Please install dev-java/javatoolkit."
2565 return
2566 fi
2567
2581 local target=$(java-pkg_get-target) 2568 local target=$(java-pkg_get-target)
2582 local result 2569 local result
2583 local log="${T}/class-version-verify.log" 2570 local log="${T}/class-version-verify.log"
2584 if [[ -n "${1}" ]]; then 2571 if [[ -n "${1}" ]]; then
2585 class-version-verify.py -v -t ${target} "${1}" > "${log}" 2572 ${version_verify} -v -t ${target} "${1}" > "${log}"
2586 result=$? 2573 result=$?
2587 else 2574 else
2588 ebegin "Verifying java class versions (target: ${target})" 2575 ebegin "Verifying java class versions (target: ${target})"
2589 class-version-verify.py -v -t ${target} -r "${D}" > "${log}" 2576 ${version_verify} -v -t ${target} -r "${D}" > "${log}"
2590 result=$? 2577 result=$?
2591 eend ${result} 2578 eend ${result}
2592 fi 2579 fi
2593 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}" 2580 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
2594 if [[ ${result} != 0 ]]; then 2581 if [[ ${result} != 0 ]]; then
2699is-java-strict() { 2686is-java-strict() {
2700 [[ -n ${JAVA_PKG_STRICT} ]] 2687 [[ -n ${JAVA_PKG_STRICT} ]]
2701 return $? 2688 return $?
2702} 2689}
2703 2690
2691
2704# ------------------------------------------------------------------------------ 2692# ------------------------------------------------------------------------------
2705# @eclass-end 2693# @eclass-end
2706# ------------------------------------------------------------------------------ 2694# ------------------------------------------------------------------------------

Legend:
Removed from v.1.106  
changed lines
  Added in v.1.128

  ViewVC Help
Powered by ViewVC 1.1.20