/[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.93 Revision 1.101
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.93 2007/09/27 19:47:08 betelgeuse Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.101 2008/01/12 15:03:13 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
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.0.33-r1 ${JAVA_PKG_PORTAGE_DEP}"
76hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
76 77
77# ----------------------------------------------------------------------------- 78# -----------------------------------------------------------------------------
78# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 79# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
79# @variable-default yes 80# @variable-default yes
80# 81#
556# ------------------------------------------------------------------------------ 557# ------------------------------------------------------------------------------
557# @ebuild-function java-pkg_dojavadoc 558# @ebuild-function java-pkg_dojavadoc
558# 559#
559# 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.
560# 561#
562# @param $1: optional --symlink creates to symlink like this for html
563# documentation bundles.
561# @param $1: - The javadoc root directory. 564# @param $2: - The javadoc root directory.
562# 565#
563# @example: 566# @example:
564# java-pkg_dojavadoc docs/api 567# java-pkg_dojavadoc docs/api
568# java-pkg_dojavadoc --symlink apidocs docs/api
565# 569#
566# ------------------------------------------------------------------------------ 570# ------------------------------------------------------------------------------
567java-pkg_dojavadoc() { 571java-pkg_dojavadoc() {
568 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
569 local dir="$1" 581 local dir="$1"
582 local dest=/usr/share/doc/${PF}/html
570 583
571 # QA checks 584 # QA checks
572 585
573 java-pkg_check-phase install 586 java-pkg_check-phase install
574 587
578 local msg="No index.html in javadoc directory" 591 local msg="No index.html in javadoc directory"
579 ewarn "${msg}" 592 ewarn "${msg}"
580 is-java-strict && die "${msg}" 593 is-java-strict && die "${msg}"
581 fi 594 fi
582 595
596 if [[ -e ${D}/${dest}/api ]]; then
597 eerror "${dest} already exists. Will not overwrite."
598 die "${dest}"
599 fi
600
583 # Renaming to match our directory layout 601 # Renaming to match our directory layout
584 602
585 local dir_to_install="${dir}" 603 local dir_to_install="${dir}"
586 if [[ "$(basename "${dir}")" != "api" ]]; then 604 if [[ "$(basename "${dir}")" != "api" ]]; then
587 dir_to_install="${T}/api" 605 dir_to_install="${T}/api"
589 cp -r "${dir}" "${dir_to_install}" || die "cp failed" 607 cp -r "${dir}" "${dir_to_install}" || die "cp failed"
590 fi 608 fi
591 609
592 # Actual installation 610 # Actual installation
593 611
594 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
595} 620}
596 621
597# ------------------------------------------------------------------------------ 622# ------------------------------------------------------------------------------
598# @ebuild-function java-pkg_dosrc 623# @ebuild-function java-pkg_dosrc
599# 624#
838# @param $opt 863# @param $opt
839# --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.
840# (assumed automatically when called inside src_test) 865# (assumed automatically when called inside src_test)
841# --with-dependencies - get jars also from requested package's dependencies 866# --with-dependencies - get jars also from requested package's dependencies
842# 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.
843# --into $dir - symlink jar(s) into $dir (must exist) instead of . 870# --into $dir - symlink jar(s) into $dir (must exist) instead of .
844# @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
845# case other parameters are not used. 872# case other parameters are not used.
846# @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.
847# @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
852 debug-print-function ${FUNCNAME} $* 879 debug-print-function ${FUNCNAME} $*
853 880
854 local build_only="" 881 local build_only=""
855 local destdir="." 882 local destdir="."
856 local deep="" 883 local deep=""
884 local virtual=""
857 885
858 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 886 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
859 887
860 while [[ "${1}" == --* ]]; do 888 while [[ "${1}" == --* ]]; do
861 if [[ "${1}" = "--build-only" ]]; then 889 if [[ "${1}" = "--build-only" ]]; then
862 build_only="build" 890 build_only="build"
863 elif [[ "${1}" = "--with-dependencies" ]]; then 891 elif [[ "${1}" = "--with-dependencies" ]]; then
864 deep="--with-dependencies" 892 deep="--with-dependencies"
893 elif [[ "${1}" = "--virtual" ]]; then
894 virtual="true"
865 elif [[ "${1}" = "--into" ]]; then 895 elif [[ "${1}" = "--into" ]]; then
866 destdir="${2}" 896 destdir="${2}"
867 shift 897 shift
868 else 898 else
869 die "java-pkg_jar-from called with unknown parameter: ${1}" 899 die "java-pkg_jar-from called with unknown parameter: ${1}"
893 done 923 done
894 # setting this disables further record-jar_ calls later 924 # setting this disables further record-jar_ calls later
895 build_only="build" 925 build_only="build"
896 else 926 else
897 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"
898 fi 936 fi
899 937
900 pushd ${destdir} > /dev/null \ 938 pushd ${destdir} > /dev/null \
901 || die "failed to change directory to ${destdir}" 939 || die "failed to change directory to ${destdir}"
902 940
1026# @example-return 1064# @example-return
1027# /usr/share/xerces-2/lib/xml-apis.jar 1065# /usr/share/xerces-2/lib/xml-apis.jar
1028# 1066#
1029# @param $opt 1067# @param $opt
1030# --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.
1031# @param $1 - package to use 1071# @param $1 - package to use
1032# @param $2 - jar to get 1072# @param $2 - jar to get
1033# ------------------------------------------------------------------------------ 1073# ------------------------------------------------------------------------------
1034java-pkg_getjar() { 1074java-pkg_getjar() {
1035 debug-print-function ${FUNCNAME} $* 1075 debug-print-function ${FUNCNAME} $*
1036 1076
1037 local build_only="" 1077 local build_only=""
1078 local virtual=""
1038 1079
1039 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 1080 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1040 1081
1041 while [[ "${1}" == --* ]]; do 1082 while [[ "${1}" == --* ]]; do
1042 if [[ "${1}" = "--build-only" ]]; then 1083 if [[ "${1}" = "--build-only" ]]; then
1043 build_only="build" 1084 build_only="build"
1085 elif [[ "${1}" == "--virtual" ]]; then
1086 virtual="true"
1044 else 1087 else
1045 die "java-pkg_jar-from called with unknown parameter: ${1}" 1088 die "java-pkg_jar-from called with unknown parameter: ${1}"
1046 fi 1089 fi
1047 shift 1090 shift
1048 done 1091 done
1057 local classpath 1100 local classpath
1058 classpath=$(java-config --classpath=${pkg}) 1101 classpath=$(java-config --classpath=${pkg})
1059 [[ $? != 0 ]] && die ${error_msg} 1102 [[ $? != 0 ]] && die ${error_msg}
1060 1103
1061 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
1062 1112
1063 for jar in ${classpath//:/ }; do 1113 for jar in ${classpath//:/ }; do
1064 if [[ ! -f "${jar}" ]] ; then 1114 if [[ ! -f "${jar}" ]] ; then
1065 die "Installation problem with jar ${jar} in ${pkg} - is it installed?" 1115 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
1066 fi 1116 fi
1822 if ! hasq java-ant-2 ${INHERITED}; then 1872 if ! hasq java-ant-2 ${INHERITED}; then
1823 local msg="You should inherit java-ant-2 when using eant" 1873 local msg="You should inherit java-ant-2 when using eant"
1824 java-pkg_announce-qa-violation "${msg}" 1874 java-pkg_announce-qa-violation "${msg}"
1825 fi 1875 fi
1826 1876
1827 local antflags="-Dnoget=true -Dmaven.mode.offline=true" 1877 local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore"
1828 1878
1829 java-pkg_init-compiler_ 1879 java-pkg_init-compiler_
1830 local compiler="${GENTOO_COMPILER}" 1880 local compiler="${GENTOO_COMPILER}"
1831 1881
1832 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" 1882 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}"
1843 # java-config -p 1893 # java-config -p
1844 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})" 1894 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})"
1845 if [[ -n ${build_compiler_deps} ]]; then 1895 if [[ -n ${build_compiler_deps} ]]; then
1846 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})" 1896 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})"
1847 fi 1897 fi
1848 fi
1849
1850 if is-java-strict; then
1851 einfo "Disabling system classpath for ant"
1852 antflags="${antflags} -Dbuild.sysclasspath=ignore"
1853 fi 1898 fi
1854 1899
1855 for arg in "${@}"; do 1900 for arg in "${@}"; do
1856 if [[ ${arg} = -lib ]]; then 1901 if [[ ${arg} = -lib ]]; then
1857 if is-java-strict; then 1902 if is-java-strict; then
2026# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will 2071# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will
2027# call it during each of the phases of the merge process. 2072# call it during each of the phases of the merge process.
2028# 2073#
2029# ----------------------------------------------------------------------------- 2074# -----------------------------------------------------------------------------
2030java-pkg_init() { 2075java-pkg_init() {
2076 debug-print-function ${FUNCNAME} $*
2031 unset JAVAC 2077 unset JAVAC
2032 unset JAVA_HOME 2078 unset JAVA_HOME
2033 2079
2034 # People do all kinds of weird things. 2080 # People do all kinds of weird things.
2035 # http://forums.gentoo.org/viewtopic-p-3943166.html 2081 # http://forums.gentoo.org/viewtopic-p-3943166.html
2043 ewarn "make.conf for example) to silence this warning or" 2089 ewarn "make.conf for example) to silence this warning or"
2044 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it." 2090 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it."
2045 fi 2091 fi
2046 2092
2047 if [[ -z ${accept} ]]; then 2093 if [[ -z ${accept} ]]; then
2094 # export _JAVA_OPTIONS= doesn't work because it will show up in java
2095 # -version output
2048 unset _JAVA_OPTIONS 2096 unset _JAVA_OPTIONS
2049 # phase hooks make this run many times without this 2097 # phase hooks make this run many times without this
2050 I_WANT_GLOBAL_JAVA_OPTIONS="true" 2098 I_WANT_GLOBAL_JAVA_OPTIONS="true"
2051 fi 2099 fi
2052 2100
2060 2108
2061 # TODO we will probably want to set JAVAC and JAVACFLAGS 2109 # TODO we will probably want to set JAVAC and JAVACFLAGS
2062 2110
2063 # Do some QA checks 2111 # Do some QA checks
2064 java-pkg_check-jikes 2112 java-pkg_check-jikes
2113
2114 # Can't use unset here because Portage does not save the unset
2115 # see https://bugs.gentoo.org/show_bug.cgi?id=189417#c11
2065 2116
2066 # When users have crazy classpaths some packages can fail to compile. 2117 # When users have crazy classpaths some packages can fail to compile.
2067 # and everything should work with empty CLASSPATH. 2118 # and everything should work with empty CLASSPATH.
2068 # This also helps prevent unexpected dependencies on random things 2119 # This also helps prevent unexpected dependencies on random things
2069 # from the CLASSPATH. 2120 # from the CLASSPATH.
2070 unset CLASSPATH 2121 export CLASSPATH=
2071 2122
2072 # Unset external ANT_ stuff 2123 # Unset external ANT_ stuff
2073 unset ANT_TASKS 2124 export ANT_TASKS=
2074 unset ANT_OPTS 2125 export ANT_OPTS=
2075} 2126}
2076 2127
2077# ------------------------------------------------------------------------------ 2128# ------------------------------------------------------------------------------
2078# @function-internal java-pkg-init-compiler_ 2129# @function-internal java-pkg-init-compiler_
2079# 2130#
2201 fi 2252 fi
2202 2253
2203 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}" 2254 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}"
2204 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/" 2255 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/"
2205 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env" 2256 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env"
2257 JAVA_PKG_VIRTUALS_PATH="${DESTTREE}/share/java-config-2/virtuals"
2258 JAVA_PKG_VIRTUAL_PROVIDER="${D}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}"
2206 2259
2207 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib" 2260 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib"
2208 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}" 2261 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}"
2209 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps" 2262 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps"
2210 2263

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.101

  ViewVC Help
Powered by ViewVC 1.1.20