/[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.90 Revision 1.103
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.90 2007/06/19 21:08:57 caster Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.103 2008/01/12 15:08:47 caster 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
57#WANT_ANT_TASKS 57#WANT_ANT_TASKS
58 58
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. At this moment it's 62# The version of portage we need to function properly. Previously it was
63# portage with phase hooks support. 63# portage with phase hooks support but now we use a version with proper env
64# saving.
64# ----------------------------------------------------------------------------- 65# -----------------------------------------------------------------------------
65JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1_pre1" 66JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
66 67
67# ----------------------------------------------------------------------------- 68# -----------------------------------------------------------------------------
68# @variable-internal JAVA_PKG_E_DEPEND 69# @variable-internal JAVA_PKG_E_DEPEND
69# 70#
70# 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
71# the version of java-config we want to use. We also need a recent version 72# the version of java-config we want to use. Usually the latest stable version
72# portage, that includes phase hooks. 73# so that ebuilds can use new features without depending on specific versions.
73# ----------------------------------------------------------------------------- 74# -----------------------------------------------------------------------------
74JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.32 ${JAVA_PKG_PORTAGE_DEP}" 75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.33-r1 ${JAVA_PKG_PORTAGE_DEP}"
76hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
75 77
76# ----------------------------------------------------------------------------- 78# -----------------------------------------------------------------------------
77# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 79# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
78# @variable-default yes 80# @variable-default yes
79# 81#
194# 196#
195# @example 197# @example
196# java-pkg_doexamples demo 198# java-pkg_doexamples demo
197# java-pkg_doexamples demo/* examples/* 199# java-pkg_doexamples demo/* examples/*
198# 200#
201# @param --subdir - If the examples need a certain directory structure
199# @param $* - list of files to install 202# @param $* - list of files to install
200# ------------------------------------------------------------------------------ 203# ------------------------------------------------------------------------------
201java-pkg_doexamples() { 204java-pkg_doexamples() {
202 debug-print-function ${FUNCNAME} $* 205 debug-print-function ${FUNCNAME} $*
203 206
204 [[ ${#} -lt 1 ]] && die "At least one argument needed" 207 [[ ${#} -lt 1 ]] && die "At least one argument needed"
205 208
206 java-pkg_check-phase install 209 java-pkg_check-phase install
207 210
208 local dest=/usr/share/doc/${PF}/examples 211 local dest=/usr/share/doc/${PF}/examples
212 if [[ ${1} == --subdir ]]; then
213 local dest=${dest}/${2}
214 dodir ${dest}
215 shift 2
216 fi
217
209 if [[ ${#} = 1 && -d ${1} ]]; then 218 if [[ ${#} = 1 && -d ${1} ]]; then
210 ( # dont want to pollute calling env 219 ( # dont want to pollute calling env
211 insinto "${dest}" 220 insinto "${dest}"
212 doins -r ${1}/* 221 doins -r ${1}/*
213 ) || die "Installing examples failed" 222 ) || die "Installing examples failed"
548# ------------------------------------------------------------------------------ 557# ------------------------------------------------------------------------------
549# @ebuild-function java-pkg_dojavadoc 558# @ebuild-function java-pkg_dojavadoc
550# 559#
551# Installs javadoc documentation. This should be controlled by the doc use flag. 560# Installs javadoc documentation. This should be controlled by the doc use flag.
552# 561#
562# @param $1: optional --symlink creates to symlink like this for html
563# documentation bundles.
553# @param $1: - The javadoc root directory. 564# @param $2: - The javadoc root directory.
554# 565#
555# @example: 566# @example:
556# java-pkg_dojavadoc docs/api 567# java-pkg_dojavadoc docs/api
568# java-pkg_dojavadoc --symlink apidocs docs/api
557# 569#
558# ------------------------------------------------------------------------------ 570# ------------------------------------------------------------------------------
559java-pkg_dojavadoc() { 571java-pkg_dojavadoc() {
560 debug-print-function ${FUNCNAME} $* 572 debug-print-function ${FUNCNAME} $*
573
574 # For html documentation bundles that link to Javadoc
575 local symlink
576 if [[ ${1} = --symlink ]]; then
577 symlink=${2}
578 shift 2
579 fi
580
561 local dir="$1" 581 local dir="$1"
582 local dest=/usr/share/doc/${PF}/html
562 583
563 # QA checks 584 # QA checks
564 585
565 java-pkg_check-phase install 586 java-pkg_check-phase install
566 587
570 local msg="No index.html in javadoc directory" 591 local msg="No index.html in javadoc directory"
571 ewarn "${msg}" 592 ewarn "${msg}"
572 is-java-strict && die "${msg}" 593 is-java-strict && die "${msg}"
573 fi 594 fi
574 595
596 if [[ -e ${D}/${dest}/api ]]; then
597 eerror "${dest} already exists. Will not overwrite."
598 die "${dest}"
599 fi
600
575 # Renaming to match our directory layout 601 # Renaming to match our directory layout
576 602
577 local dir_to_install="${dir}" 603 local dir_to_install="${dir}"
578 if [[ "$(basename "${dir}")" != "api" ]]; then 604 if [[ "$(basename "${dir}")" != "api" ]]; then
579 dir_to_install="${T}/api" 605 dir_to_install="${T}/api"
581 cp -r "${dir}" "${dir_to_install}" || die "cp failed" 607 cp -r "${dir}" "${dir_to_install}" || die "cp failed"
582 fi 608 fi
583 609
584 # Actual installation 610 # Actual installation
585 611
586 java-pkg_dohtml -r ${dir_to_install} 612 java-pkg_dohtml -r "${dir_to_install}"
613
614 # Let's make a symlink to the directory we have everything else under
615 dosym ${dest}/api "${JAVA_PKG_SHAREPATH}/api" || die
616
617 if [[ ${symlink} ]]; then
618 dosym ${dest}/{api,${symlink}} || die
619 fi
587} 620}
588 621
589# ------------------------------------------------------------------------------ 622# ------------------------------------------------------------------------------
590# @ebuild-function java-pkg_dosrc 623# @ebuild-function java-pkg_dosrc
591# 624#
830# @param $opt 863# @param $opt
831# --build-only - makes the jar(s) not added into package.env DEPEND line. 864# --build-only - makes the jar(s) not added into package.env DEPEND line.
832# (assumed automatically when called inside src_test) 865# (assumed automatically when called inside src_test)
833# --with-dependencies - get jars also from requested package's dependencies 866# --with-dependencies - get jars also from requested package's dependencies
834# transitively. 867# transitively.
868# --virtual - Packages passed to this function are to be handled as virtuals
869# and will not have individual jar dependencies recorded.
835# --into $dir - symlink jar(s) into $dir (must exist) instead of . 870# --into $dir - symlink jar(s) into $dir (must exist) instead of .
836# @param $1 - Package to get jars from, or comma-separated list of packages in 871# @param $1 - Package to get jars from, or comma-separated list of packages in
837# case other parameters are not used. 872# case other parameters are not used.
838# @param $2 - jar from package. If not specified, all jars will be used. 873# @param $2 - jar from package. If not specified, all jars will be used.
839# @param $3 - When a single jar is specified, destination filename of the 874# @param $3 - When a single jar is specified, destination filename of the
844 debug-print-function ${FUNCNAME} $* 879 debug-print-function ${FUNCNAME} $*
845 880
846 local build_only="" 881 local build_only=""
847 local destdir="." 882 local destdir="."
848 local deep="" 883 local deep=""
884 local virtual=""
849 885
850 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 886 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
851 887
852 while [[ "${1}" == --* ]]; do 888 while [[ "${1}" == --* ]]; do
853 if [[ "${1}" = "--build-only" ]]; then 889 if [[ "${1}" = "--build-only" ]]; then
854 build_only="build" 890 build_only="build"
855 elif [[ "${1}" = "--with-dependencies" ]]; then 891 elif [[ "${1}" = "--with-dependencies" ]]; then
856 deep="--with-dependencies" 892 deep="--with-dependencies"
893 elif [[ "${1}" = "--virtual" ]]; then
894 virtual="true"
857 elif [[ "${1}" = "--into" ]]; then 895 elif [[ "${1}" = "--into" ]]; then
858 destdir="${2}" 896 destdir="${2}"
859 shift 897 shift
860 else 898 else
861 die "java-pkg_jar-from called with unknown parameter: ${1}" 899 die "java-pkg_jar-from called with unknown parameter: ${1}"
885 done 923 done
886 # setting this disables further record-jar_ calls later 924 # setting this disables further record-jar_ calls later
887 build_only="build" 925 build_only="build"
888 else 926 else
889 java-pkg_ensure-dep "${build_only}" "${target_pkg}" 927 java-pkg_ensure-dep "${build_only}" "${target_pkg}"
928 fi
929
930 # Record the entire virtual as a dependency so that
931 # no jars are missed.
932 if [[ -z "${build_only}" && -n "${virtual}" ]]; then
933 java-pkg_record-jar_ "${target_pkg}"
934 # setting this disables further record-jars_ calls later
935 build_only="build"
890 fi 936 fi
891 937
892 pushd ${destdir} > /dev/null \ 938 pushd ${destdir} > /dev/null \
893 || die "failed to change directory to ${destdir}" 939 || die "failed to change directory to ${destdir}"
894 940
1018# @example-return 1064# @example-return
1019# /usr/share/xerces-2/lib/xml-apis.jar 1065# /usr/share/xerces-2/lib/xml-apis.jar
1020# 1066#
1021# @param $opt 1067# @param $opt
1022# --build-only - makes the jar not added into package.env DEPEND line. 1068# --build-only - makes the jar not added into package.env DEPEND line.
1069# --virtual - Packages passed to this function are to be handled as virtuals
1070# and will not have individual jar dependencies recorded.
1023# @param $1 - package to use 1071# @param $1 - package to use
1024# @param $2 - jar to get 1072# @param $2 - jar to get
1025# ------------------------------------------------------------------------------ 1073# ------------------------------------------------------------------------------
1026java-pkg_getjar() { 1074java-pkg_getjar() {
1027 debug-print-function ${FUNCNAME} $* 1075 debug-print-function ${FUNCNAME} $*
1028 1076
1029 local build_only="" 1077 local build_only=""
1078 local virtual=""
1030 1079
1031 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 1080 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1032 1081
1033 while [[ "${1}" == --* ]]; do 1082 while [[ "${1}" == --* ]]; do
1034 if [[ "${1}" = "--build-only" ]]; then 1083 if [[ "${1}" = "--build-only" ]]; then
1035 build_only="build" 1084 build_only="build"
1085 elif [[ "${1}" == "--virtual" ]]; then
1086 virtual="true"
1036 else 1087 else
1037 die "java-pkg_jar-from called with unknown parameter: ${1}" 1088 die "java-pkg_getjar called with unknown parameter: ${1}"
1038 fi 1089 fi
1039 shift 1090 shift
1040 done 1091 done
1041 1092
1042 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*" 1093 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*"
1049 local classpath 1100 local classpath
1050 classpath=$(java-config --classpath=${pkg}) 1101 classpath=$(java-config --classpath=${pkg})
1051 [[ $? != 0 ]] && die ${error_msg} 1102 [[ $? != 0 ]] && die ${error_msg}
1052 1103
1053 java-pkg_ensure-dep "${build_only}" "${pkg}" 1104 java-pkg_ensure-dep "${build_only}" "${pkg}"
1105
1106 # Record the package(Virtual) as a dependency and then set build_only
1107 # So that individual jars are not recorded.
1108 if [[ -n "${virtual}" ]]; then
1109 java-pkg_record-jar_ "${pkg}"
1110 build_only="true"
1111 fi
1054 1112
1055 for jar in ${classpath//:/ }; do 1113 for jar in ${classpath//:/ }; do
1056 if [[ ! -f "${jar}" ]] ; then 1114 if [[ ! -f "${jar}" ]] ; then
1057 die "Installation problem with jar ${jar} in ${pkg} - is it installed?" 1115 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
1058 fi 1116 fi
1664 dodir /usr/share/ant/${TASKS_DIR} 1722 dodir /usr/share/ant/${TASKS_DIR}
1665 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}" 1723 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}"
1666} 1724}
1667 1725
1668# ------------------------------------------------------------------------------ 1726# ------------------------------------------------------------------------------
1669# @internal-function java-pkg_ant-tasks-from-deps
1670#
1671# Function to determine ANT_TASKS from DEPEND variable for backwards
1672# compatibility with ebuilds that don't set ANT_TASKS before calling eant() or
1673# WANT_ANT_TASKS before inheriting java-pkg-2. If the DEPEND string contains
1674# "dev-java/ant" or "dev-java/ant-tasks", then it returns "all", otherwise
1675# "none". It's not smart enough to cope with USE flag depends but that shouldn't
1676# be a problem, the worst it can do is activace all tasks when not needed.
1677# Note that this is called only with JAVA_PKG_STRICT=1, to find ebuilds with
1678# insufficient dependencies, otherwise all available tasks are used for
1679# backwards compatilbility.
1680#
1681# @return "all" or "none"
1682# ------------------------------------------------------------------------------
1683java-pkg_ant-tasks-from-deps() {
1684 local found_ant found_ant_tasks
1685
1686 for dep in ${DEPEND}
1687 do
1688 local ant="$(awk '/(dev-java\/ant)/ { if (match($1, "(dev-java/ant)((-[0-9])+|$)", m)) print m[1] }' <<< ${dep})"
1689 [[ "${ant}" == "dev-java/ant" ]] && found_ant=true
1690 [[ "${dep}" == *"ant-tasks"* ]] && found_ant_tasks=true
1691 done
1692
1693 if [[ -n "${found_ant}" || -n "${found_ant_tasks}" ]]; then
1694 java-pkg_announce-qa-violation --nodie "The ebuild DEPENDS on deprecated ant or ant-tasks"
1695 echo "all"
1696 else
1697 # ebuild doesn't set ANT_TASKS and doesn't depend on ant-tasks or ant
1698 # so we deactivate all tasks that may be installed
1699 echo "none"
1700 fi
1701}
1702
1703# ------------------------------------------------------------------------------
1704# @internal-function java-pkg_ant-tasks-depend 1727# @internal-function java-pkg_ant-tasks-depend
1705# 1728#
1706# Translates the WANT_ANT_TASKS variable into valid dependencies. 1729# Translates the WANT_ANT_TASKS variable into valid dependencies.
1707# ------------------------------------------------------------------------------ 1730# ------------------------------------------------------------------------------
1708java-pkg_ant-tasks-depend() { 1731java-pkg_ant-tasks-depend() {
1779# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS, 1802# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS,
1780# variables: 1803# variables:
1781# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the 1804# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
1782# gentoo.classpath property. Be sure to call 1805# gentoo.classpath property. Be sure to call
1783# java-ant_rewrite-classpath in src_unpack. 1806# java-ant_rewrite-classpath in src_unpack.
1807# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files
1784# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1808# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1785# ------------------------------------------------------------------------------ 1809# ------------------------------------------------------------------------------
1786eant() { 1810eant() {
1787 debug-print-function ${FUNCNAME} $* 1811 debug-print-function ${FUNCNAME} $*
1812
1813 if [[ ${EBUILD_PHASE} = compile ]]; then
1814 # Used to be done in hooks in java-ant-2.eclass but moved here so that we can
1815 # finally get rid of the hooks without breaking stuff
1816
1817 [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" && "${JAVA_PKG_BSFIX}" ]] \
1818 && java-ant_ignore-system-classes "${S}/build.xml"
1819
1820 if hasq java-ant-2 ${INHERITED}; then
1821 java-ant_bsfix
1822 fi
1823
1824 # eant can be called multiple times
1825 JAVA_PKG_BSFIX="off"
1826
1827 if [[ -z ${JAVA_PKG_NO_BUNDLED_SEARCH} ]] && is-java-strict; then
1828 echo "Searching for bundled jars:"
1829 java-pkg_find-normal-jars || echo "None found."
1830 echo "Searching for bundled classes (no output if none found):"
1831 find "${WORKDIR}" -name "*.class"
1832 echo "Search done."
1833 JAVA_PKG_NO_BUNDLED_SEARCH=true # eant can be called many times
1834 fi
1835 fi
1788 1836
1789 if ! hasq java-ant-2 ${INHERITED}; then 1837 if ! hasq java-ant-2 ${INHERITED}; then
1790 local msg="You should inherit java-ant-2 when using eant" 1838 local msg="You should inherit java-ant-2 when using eant"
1791 java-pkg_announce-qa-violation "${msg}" 1839 java-pkg_announce-qa-violation "${msg}"
1792 fi 1840 fi
1793 1841
1794 local antflags="-Dnoget=true -Dmaven.mode.offline=true" 1842 local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore"
1795 1843
1796 java-pkg_init-compiler_ 1844 java-pkg_init-compiler_
1797 local compiler="${GENTOO_COMPILER}" 1845 local compiler="${GENTOO_COMPILER}"
1798 1846
1799 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" 1847 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}"
1800
1801 local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})" 1848 local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})"
1802 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then 1849 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then
1803 die "ANT_BUILD_COMPILER undefined in ${compiler_env}" 1850 die "ANT_BUILD_COMPILER undefined in ${compiler_env}"
1804 fi 1851 fi
1805 1852
1811 # java-config -p 1858 # java-config -p
1812 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})" 1859 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})"
1813 if [[ -n ${build_compiler_deps} ]]; then 1860 if [[ -n ${build_compiler_deps} ]]; then
1814 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})" 1861 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})"
1815 fi 1862 fi
1816 fi
1817
1818 if is-java-strict; then
1819 einfo "Disabling system classpath for ant"
1820 antflags="${antflags} -Dbuild.sysclasspath=ignore"
1821 fi 1863 fi
1822 1864
1823 for arg in "${@}"; do 1865 for arg in "${@}"; do
1824 if [[ ${arg} = -lib ]]; then 1866 if [[ ${arg} = -lib ]]; then
1825 if is-java-strict; then 1867 if is-java-strict; then
1834 echo "more info." 1876 echo "more info."
1835 fi 1877 fi
1836 fi 1878 fi
1837 done 1879 done
1838 1880
1839 # we use this in src_* so we run ant from /
1840 if ROOT=/ has_version ">=dev-java/ant-core-1.7.0"; then
1841 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly 1881 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1842 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}" 1882 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}"
1843 1883
1844 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set 1884 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1845 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" 1885 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
1846 1886
1847 if is-java-strict; then
1848 # if ant-tasks were not set by ebuild or forced, try to determine them from depends
1849 if [[ -z "${ANT_TASKS}" ]]; then
1850 ANT_TASKS="$(java-pkg_ant-tasks-from-deps)"
1851 fi
1852 else
1853 # if ant-tasks is not set by ebuild or forced, activate all of them 1887 # if ant-tasks is not set by ebuild or forced, use none
1854 ANT_TASKS="${ANT_TASKS:-all}" 1888 ANT_TASKS="${ANT_TASKS:-none}"
1855 fi
1856 1889
1857 # at this point, ANT_TASKS should be "all", "none" or explicit list 1890 # at this point, ANT_TASKS should be "all", "none" or explicit list
1858 if [[ "${ANT_TASKS}" == "all" ]]; then 1891 if [[ "${ANT_TASKS}" == "all" ]]; then
1859 einfo "Using all available ANT_TASKS" 1892 einfo "Using all available ANT_TASKS"
1860 elif [[ "${ANT_TASKS}" == "none" ]]; then 1893 elif [[ "${ANT_TASKS}" == "none" ]]; then
1861 einfo "Disabling all optional ANT_TASKS" 1894 einfo "Disabling all optional ANT_TASKS"
1862 else 1895 else
1863 einfo "Using following ANT_TASKS: ${ANT_TASKS}" 1896 einfo "Using following ANT_TASKS: ${ANT_TASKS}"
1864 fi 1897 fi
1865 1898
1866 export ANT_TASKS 1899 export ANT_TASKS
1867 fi
1868 1900
1869 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug" 1901 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug"
1870 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q" 1902 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q"
1871 1903
1872 local gcp="${EANT_GENTOO_CLASSPATH}" 1904 local gcp="${EANT_GENTOO_CLASSPATH}"
1994# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will 2026# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will
1995# call it during each of the phases of the merge process. 2027# call it during each of the phases of the merge process.
1996# 2028#
1997# ----------------------------------------------------------------------------- 2029# -----------------------------------------------------------------------------
1998java-pkg_init() { 2030java-pkg_init() {
2031 debug-print-function ${FUNCNAME} $*
1999 unset JAVAC 2032 unset JAVAC
2000 unset JAVA_HOME 2033 unset JAVA_HOME
2001 2034
2002 # People do all kinds of weird things. 2035 # People do all kinds of weird things.
2003 # http://forums.gentoo.org/viewtopic-p-3943166.html 2036 # http://forums.gentoo.org/viewtopic-p-3943166.html
2011 ewarn "make.conf for example) to silence this warning or" 2044 ewarn "make.conf for example) to silence this warning or"
2012 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it." 2045 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it."
2013 fi 2046 fi
2014 2047
2015 if [[ -z ${accept} ]]; then 2048 if [[ -z ${accept} ]]; then
2049 # export _JAVA_OPTIONS= doesn't work because it will show up in java
2050 # -version output
2016 unset _JAVA_OPTIONS 2051 unset _JAVA_OPTIONS
2017 # phase hooks make this run many times without this 2052 # phase hooks make this run many times without this
2018 I_WANT_GLOBAL_JAVA_OPTIONS="true" 2053 I_WANT_GLOBAL_JAVA_OPTIONS="true"
2019 fi 2054 fi
2020 2055
2056 if java-pkg_func-exists ant_src_unpack; then
2057 java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be src_unpack"
2058 fi
2059
2021 java-pkg_init_paths_ 2060 java-pkg_init_paths_
2022 java-pkg_switch-vm 2061 java-pkg_switch-vm
2023 PATH=${JAVA_HOME}/bin:${PATH} 2062 PATH=${JAVA_HOME}/bin:${PATH}
2024 2063
2025 # TODO we will probably want to set JAVAC and JAVACFLAGS 2064 # TODO we will probably want to set JAVAC and JAVACFLAGS
2026 2065
2027 # Do some QA checks 2066 # Do some QA checks
2028 java-pkg_check-jikes 2067 java-pkg_check-jikes
2068
2069 # Can't use unset here because Portage does not save the unset
2070 # see https://bugs.gentoo.org/show_bug.cgi?id=189417#c11
2029 2071
2030 # When users have crazy classpaths some packages can fail to compile. 2072 # When users have crazy classpaths some packages can fail to compile.
2031 # and everything should work with empty CLASSPATH. 2073 # and everything should work with empty CLASSPATH.
2032 # This also helps prevent unexpected dependencies on random things 2074 # This also helps prevent unexpected dependencies on random things
2033 # from the CLASSPATH. 2075 # from the CLASSPATH.
2034 unset CLASSPATH 2076 export CLASSPATH=
2035 2077
2036 # Unset external ANT_ stuff 2078 # Unset external ANT_ stuff
2037 unset ANT_TASKS 2079 export ANT_TASKS=
2038 unset ANT_OPTS 2080 export ANT_OPTS=
2039} 2081}
2040 2082
2041# ------------------------------------------------------------------------------ 2083# ------------------------------------------------------------------------------
2042# @function-internal java-pkg-init-compiler_ 2084# @function-internal java-pkg-init-compiler_
2043# 2085#
2165 fi 2207 fi
2166 2208
2167 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}" 2209 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}"
2168 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/" 2210 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/"
2169 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env" 2211 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env"
2212 JAVA_PKG_VIRTUALS_PATH="${DESTTREE}/share/java-config-2/virtuals"
2213 JAVA_PKG_VIRTUAL_PROVIDER="${D}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}"
2170 2214
2171 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib" 2215 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib"
2172 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}" 2216 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}"
2173 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps" 2217 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps"
2174 2218
2462 2506
2463 #TODO If you know a better solution let us know. 2507 #TODO If you know a better solution let us know.
2464 java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)" 2508 java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)"
2465 2509
2466 local tann="${T}/announced-vm" 2510 local tann="${T}/announced-vm"
2511 # With the hooks we should only get here once from pkg_setup but better safe than sorry
2512 # if people have for example modified eclasses some where
2467 if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then 2513 if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then
2468 # Add a check for setup/preinst phase... to avoid duplicate outputs
2469 # for when FEATURES=buildpkg
2470 if [[ ${EBUILD_PHASE} != "setup" && ${EBUILD_PHASE} != "preinst" && ${EBUILD_PHASE} != "postinst" ]];
2471 then
2472 einfo "Using: $(java-config -f)" 2514 einfo "Using: $(java-config -f)"
2473 [[ ! -f "${tann}" ]] && touch "${tann}" 2515 [[ ! -f "${tann}" ]] && touch "${tann}"
2474 fi
2475 fi 2516 fi
2476 2517
2477 else 2518 else
2478 [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!" 2519 [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!"
2479 fi 2520 fi

Legend:
Removed from v.1.90  
changed lines
  Added in v.1.103

  ViewVC Help
Powered by ViewVC 1.1.20