/[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.115 Revision 1.127
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.115 2008/10/05 16:53:38 betelgeuse Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.127 2009/05/19 21:23:32 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
34# Summary of variables which control the behavior of building Java packges. 34# Summary of variables which control the behavior of building Java packges.
35# ----------------------------------------------------------------------------- 35# -----------------------------------------------------------------------------
36 36
37# Make sure we use java-config-2 37# Make sure we use java-config-2
38export WANT_JAVA_CONFIG="2" 38export WANT_JAVA_CONFIG="2"
39
40[[ "${EAPI:-0}" == "2" ]] && EXPORT_FUNCTIONS src_prepare
41 39
42# ----------------------------------------------------------------------------- 40# -----------------------------------------------------------------------------
43# @variable-external WANT_ANT_TASKS 41# @variable-external WANT_ANT_TASKS
44# @variable-default "" 42# @variable-default ""
45# 43#
61# ----------------------------------------------------------------------------- 59# -----------------------------------------------------------------------------
62# @variable-internal JAVA_PKG_PORTAGE_DEP 60# @variable-internal JAVA_PKG_PORTAGE_DEP
63# 61#
64# 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
65# 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
66# saving. 64# saving. For EAPI 2 we have new enough stuff so let's have cleaner deps.
67# ----------------------------------------------------------------------------- 65# -----------------------------------------------------------------------------
68JAVA_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"
69 67
70# ----------------------------------------------------------------------------- 68# -----------------------------------------------------------------------------
71# @variable-internal JAVA_PKG_E_DEPEND 69# @variable-internal JAVA_PKG_E_DEPEND
72# 70#
73# 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
74# 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
75# 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.
76# ----------------------------------------------------------------------------- 74# -----------------------------------------------------------------------------
77JAVA_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}"
78hasq 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 )"
79 77
80# ----------------------------------------------------------------------------- 78# -----------------------------------------------------------------------------
81# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 79# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
82# @variable-default yes 80# @variable-default yes
367 if [[ ${jar} = *\** ]]; then 365 if [[ ${jar} = *\** ]]; then
368 eerror "The argument ${jar} to ${FUNCNAME}" 366 eerror "The argument ${jar} to ${FUNCNAME}"
369 eerror "has * in it. If you want it to glob in" 367 eerror "has * in it. If you want it to glob in"
370 eerror '${D} add ${D} to the argument.' 368 eerror '${D} add ${D} to the argument.'
371 fi 369 fi
370 debug-print "${jar} or ${D}${jar} not found"
372 die "${jar} does not exist" 371 die "${jar} does not exist"
373 fi 372 fi
374 done 373 done
375 374
376 java-pkg_do_write_ 375 java-pkg_do_write_
431# @param $@ - JNI libraries to install 430# @param $@ - JNI libraries to install
432# ------------------------------------------------------------------------------ 431# ------------------------------------------------------------------------------
433java-pkg_doso() { 432java-pkg_doso() {
434 debug-print-function ${FUNCNAME} $* 433 debug-print-function ${FUNCNAME} $*
435 434
436 [[ ${#} -lt 1 ]] && "At least one argument required for ${FUNCNAME}"
437 java-pkg_check-phase install 435 java-pkg_check-phase install
438 436
439 [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}" 437 [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument"
440 438
441 java-pkg_init_paths_ 439 java-pkg_init_paths_
442 440
443 local lib 441 local lib
444 # for each lib 442 # for each lib
452 doins "${lib}" || die "failed to install ${lib}" 450 doins "${lib}" || die "failed to install ${lib}"
453 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}" 451 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
454 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}" 452 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
455 # otherwise make a symlink to the symlink's origin 453 # otherwise make a symlink to the symlink's origin
456 else 454 else
457 # TODO use dosym 455 dosym "$(readlink "${lib}")" "${JAVA_PKG_LIBDEST}/${lib##*/}"
458 ln -s "$(readlink "${lib}")" \
459 "${D}${JAVA_PKG_LIBDEST}/$(basename "${lib}")"
460 debug-print "${lib} is a symlink, linking accordanly" 456 debug-print "${lib} is a symlink, linking accordantly"
461 fi 457 fi
462 # otherwise die 458 # otherwise die
463 else 459 else
464 die "${lib} does not exist" 460 die "${lib} does not exist"
465 fi 461 fi
481java-pkg_regso() { 477java-pkg_regso() {
482 debug-print-function ${FUNCNAME} $* 478 debug-print-function ${FUNCNAME} $*
483 479
484 java-pkg_check-phase install 480 java-pkg_check-phase install
485 481
486 [[ ${#} -lt 1 ]] && "at least one argument needed" 482 [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument"
487 483
488 java-pkg_init_paths_ 484 java-pkg_init_paths_
489 485
490 local lib target_dir 486 local lib target_dir
491 for lib in "$@" ; do 487 for lib in "$@" ; do
1806 1802
1807# ------------------------------------------------------------------------------ 1803# ------------------------------------------------------------------------------
1808# @eclass-src_prepare 1804# @eclass-src_prepare
1809# 1805#
1810# src_prepare Searches for bundled jars 1806# src_prepare Searches for bundled jars
1807# Don't call directly, but via java-pkg-2_src_prepare!
1811# ------------------------------------------------------------------------------ 1808# ------------------------------------------------------------------------------
1812 1809
1813java-utils-2_src_prepare() { 1810java-utils-2_src_prepare() {
1811 [[ ${EBUILD_PHASE} == prepare ]] &&
1812 java-pkg_func-exists java_prepare && java_prepare
1813
1814 # Remember that eant will call this unless called via Portage 1814 # Remember that eant will call this unless called via Portage
1815 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then 1815 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1816 echo "Searching for bundled jars:" 1816 echo "Searching for bundled jars:"
1817 java-pkg_find-normal-jars || echo "None found." 1817 java-pkg_find-normal-jars || echo "None found."
1818 echo "Searching for bundled classes (no output if none found):" 1818 echo "Searching for bundled classes (no output if none found):"
1821 fi 1821 fi
1822 touch "${T}/java-utils-2_src_prepare-run" 1822 touch "${T}/java-utils-2_src_prepare-run"
1823} 1823}
1824 1824
1825# ------------------------------------------------------------------------------ 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# ------------------------------------------------------------------------------
1826# @section-begin build 1853# @section-begin build
1827# @section-summary Build functions 1854# @section-summary Build functions
1828# 1855#
1829# 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
1830# wrappers for javac and ant. 1857# wrappers for javac and ant.
1837# 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,
1838# variables: 1865# variables:
1839# 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
1840# gentoo.classpath property. Be sure to call 1867# gentoo.classpath property. Be sure to call
1841# 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!
1842# 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
1843# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1873# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1844# ------------------------------------------------------------------------------ 1874# ------------------------------------------------------------------------------
1845eant() { 1875eant() {
1846 debug-print-function ${FUNCNAME} $* 1876 debug-print-function ${FUNCNAME} $*
1941 1971
1942 for atom in ${gcp}; do 1972 for atom in ${gcp}; do
1943 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 1973 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1944 done 1974 done
1945 1975
1976 [[ -n "${EANT_NEEDS_TOOLS}" ]] && cp="${cp}:$(java-config --tools)"
1977
1946 if [[ ${cp} ]]; then 1978 if [[ ${cp} ]]; then
1947 # It seems ant does not like single quotes around ${cp} 1979 # It seems ant does not like single quotes around ${cp}
1948 cp=${cp#:} 1980 cp=${cp#:}
1949 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \ 1981 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
1950 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}" 1982 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
2059# ----------------------------------------------------------------------------- 2091# -----------------------------------------------------------------------------
2060java-pkg_init() { 2092java-pkg_init() {
2061 debug-print-function ${FUNCNAME} $* 2093 debug-print-function ${FUNCNAME} $*
2062 unset JAVAC 2094 unset JAVAC
2063 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 }
2064 2104
2065 # People do all kinds of weird things. 2105 # People do all kinds of weird things.
2066 # http://forums.gentoo.org/viewtopic-p-3943166.html 2106 # http://forums.gentoo.org/viewtopic-p-3943166.html
2067 local silence="${SILENCE_JAVA_OPTIONS_WARNING}" 2107 local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
2068 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}" 2108 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
2106 export CLASSPATH= 2146 export CLASSPATH=
2107 2147
2108 # Unset external ANT_ stuff 2148 # Unset external ANT_ stuff
2109 export ANT_TASKS= 2149 export ANT_TASKS=
2110 export ANT_OPTS= 2150 export ANT_OPTS=
2151 export ANT_RESPECT_JAVA_HOME=
2111} 2152}
2112 2153
2113# ------------------------------------------------------------------------------ 2154# ------------------------------------------------------------------------------
2114# @function-internal java-pkg-init-compiler_ 2155# @function-internal java-pkg-init-compiler_
2115# 2156#
2404# 2445#
2405# @return 0 - function is declared 2446# @return 0 - function is declared
2406# @return 1 - function is undeclared 2447# @return 1 - function is undeclared
2407# ------------------------------------------------------------------------------ 2448# ------------------------------------------------------------------------------
2408java-pkg_func-exists() { 2449java-pkg_func-exists() {
2409 if [[ -n "$(declare -f ${1})" ]]; then 2450 declare -F ${1} > /dev/null
2410 return 0
2411 else
2412 return 1
2413 fi
2414} 2451}
2415 2452
2416# ------------------------------------------------------------------------------ 2453# ------------------------------------------------------------------------------
2417# @internal-function java-pkg_setup-vm 2454# @internal-function java-pkg_setup-vm
2418# 2455#

Legend:
Removed from v.1.115  
changed lines
  Added in v.1.127

  ViewVC Help
Powered by ViewVC 1.1.20