/[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.110 Revision 1.123
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.110 2008/07/09 21:16:40 betelgeuse Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.123 2009/03/27 18:52:27 betelgeuse 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
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 # TODO use dosym
1801# ------------------------------------------------------------------------------ 1801# ------------------------------------------------------------------------------
1802# @section-end helper 1802# @section-end helper
1803# ------------------------------------------------------------------------------ 1803# ------------------------------------------------------------------------------
1804 1804
1805# ------------------------------------------------------------------------------ 1805# ------------------------------------------------------------------------------
1806# @eclass-src_prepare
1807#
1808# src_prepare Searches for bundled jars
1809# Don't call directly, but via java-pkg-2_src_prepare!
1810# ------------------------------------------------------------------------------
1811
1812java-utils-2_src_prepare() {
1813 # Remember that eant will call this unless called via Portage
1814 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1815 echo "Searching for bundled jars:"
1816 java-pkg_find-normal-jars || echo "None found."
1817 echo "Searching for bundled classes (no output if none found):"
1818 find "${WORKDIR}" -name "*.class"
1819 echo "Search done."
1820 fi
1821 touch "${T}/java-utils-2_src_prepare-run"
1822 java-pkg_func-exists "java_prepare" && java_prepare
1823}
1824
1825# ------------------------------------------------------------------------------
1826# @eclass-pkg_preinst
1827#
1828# pkg_preinst Searches for missing and unneeded dependencies
1829# Don't call directly, but via java-pkg-2_pkg_preinst!
1830# ------------------------------------------------------------------------------
1831
1832java-utils-2_pkg_preinst() {
1833 if is-java-strict; then
1834 if has_version dev-java/java-dep-check; then
1835 [[ -e "${JAVA_PKG_ENV}" ]] || return
1836 local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
1837 if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then
1838 ewarn "Possibly unneeded dependencies found in package.env:"
1839 for dep in ${output}; do
1840 ewarn "\t${dep}"
1841 done
1842 fi
1843 if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then
1844 ewarn "${output}"
1845 fi
1846 else
1847 eerror "Install dev-java/java-dep-check for dependency checking"
1848 fi
1849 fi
1850}
1851
1852# ------------------------------------------------------------------------------
1806# @section-begin build 1853# @section-begin build
1807# @section-summary Build functions 1854# @section-summary Build functions
1808# 1855#
1809# These are some functions for building a package. In particular, it consists of 1856# These are some functions for building a package. In particular, it consists of
1810# wrappers for javac and ant. 1857# wrappers for javac and ant.
1817# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS, 1864# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS,
1818# variables: 1865# variables:
1819# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the 1866# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
1820# gentoo.classpath property. Be sure to call 1867# gentoo.classpath property. Be sure to call
1821# java-ant_rewrite-classpath in src_unpack. 1868# java-ant_rewrite-classpath in src_unpack.
1869# EANT_NEEDS_TOOLS - add tools.jar to the gentoo.classpath. Should only be used
1870# for build-time purposes, the dependency is not recorded to
1871# package.env!
1822# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files 1872# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files
1823# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1873# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1824# ------------------------------------------------------------------------------ 1874# ------------------------------------------------------------------------------
1825eant() { 1875eant() {
1826 debug-print-function ${FUNCNAME} $* 1876 debug-print-function ${FUNCNAME} $*
1827 1877
1828 if [[ ${EBUILD_PHASE} = compile ]]; then 1878 if [[ ${EBUILD_PHASE} = compile ]]; then
1829 # Used to be done in hooks in java-ant-2.eclass but moved here so that we can 1879 java-ant-2_src_configure
1830 # finally get rid of the hooks without breaking stuff 1880 java-utils-2_src_prepare
1831
1832 [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" && "${JAVA_PKG_BSFIX}" ]] \
1833 && java-ant_ignore-system-classes "${S}/build.xml"
1834
1835 if hasq java-ant-2 ${INHERITED}; then
1836 java-ant_bsfix
1837 fi
1838
1839 # eant can be called multiple times
1840 JAVA_PKG_BSFIX="off"
1841
1842 if [[ -z ${JAVA_PKG_NO_BUNDLED_SEARCH} ]] && is-java-strict; then
1843 echo "Searching for bundled jars:"
1844 java-pkg_find-normal-jars || echo "None found."
1845 echo "Searching for bundled classes (no output if none found):"
1846 find "${WORKDIR}" -name "*.class"
1847 echo "Search done."
1848 JAVA_PKG_NO_BUNDLED_SEARCH=true # eant can be called many times
1849 fi
1850 fi 1881 fi
1851 1882
1852 if ! hasq java-ant-2 ${INHERITED}; then 1883 if ! hasq java-ant-2 ${INHERITED}; then
1853 local msg="You should inherit java-ant-2 when using eant" 1884 local msg="You should inherit java-ant-2 when using eant"
1854 java-pkg_announce-qa-violation "${msg}" 1885 java-pkg_announce-qa-violation "${msg}"
1940 1971
1941 for atom in ${gcp}; do 1972 for atom in ${gcp}; do
1942 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 1973 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1943 done 1974 done
1944 1975
1976 [[ -n "${EANT_NEEDS_TOOLS}" ]] && cp="${cp}:$(java-config --tools)"
1977
1945 if [[ ${cp} ]]; then 1978 if [[ ${cp} ]]; then
1946 # It seems ant does not like single quotes around ${cp} 1979 # It seems ant does not like single quotes around ${cp}
1980 cp=${cp#:}
1981 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
1982 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
1947 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\"" 1983 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
1948 fi 1984 fi
1949 1985
1950 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" 1986 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1951 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" 1987 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1952 ant ${antflags} "${@}" || die "eant failed" 1988 ant ${antflags} "${@}" || die "eant failed"
2055# ----------------------------------------------------------------------------- 2091# -----------------------------------------------------------------------------
2056java-pkg_init() { 2092java-pkg_init() {
2057 debug-print-function ${FUNCNAME} $* 2093 debug-print-function ${FUNCNAME} $*
2058 unset JAVAC 2094 unset JAVAC
2059 unset JAVA_HOME 2095 unset JAVA_HOME
2096
2097 java-config --help >/dev/null || {
2098 eerror ""
2099 eerror "Can't run java-config --help"
2100 eerror "Have you upgraded python recently but haven't"
2101 eerror "run python-updater yet?"
2102 die "Can't run java-config --help"
2103 }
2060 2104
2061 # People do all kinds of weird things. 2105 # People do all kinds of weird things.
2062 # http://forums.gentoo.org/viewtopic-p-3943166.html 2106 # http://forums.gentoo.org/viewtopic-p-3943166.html
2063 local silence="${SILENCE_JAVA_OPTIONS_WARNING}" 2107 local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
2064 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}" 2108 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
2102 export CLASSPATH= 2146 export CLASSPATH=
2103 2147
2104 # Unset external ANT_ stuff 2148 # Unset external ANT_ stuff
2105 export ANT_TASKS= 2149 export ANT_TASKS=
2106 export ANT_OPTS= 2150 export ANT_OPTS=
2151 export ANT_RESPECT_JAVA_HOME=
2107} 2152}
2108 2153
2109# ------------------------------------------------------------------------------ 2154# ------------------------------------------------------------------------------
2110# @function-internal java-pkg-init-compiler_ 2155# @function-internal java-pkg-init-compiler_
2111# 2156#
2727is-java-strict() { 2772is-java-strict() {
2728 [[ -n ${JAVA_PKG_STRICT} ]] 2773 [[ -n ${JAVA_PKG_STRICT} ]]
2729 return $? 2774 return $?
2730} 2775}
2731 2776
2777
2732# ------------------------------------------------------------------------------ 2778# ------------------------------------------------------------------------------
2733# @eclass-end 2779# @eclass-end
2734# ------------------------------------------------------------------------------ 2780# ------------------------------------------------------------------------------

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.123

  ViewVC Help
Powered by ViewVC 1.1.20