/[gentoo-x86]/eclass/java-pkg-2.eclass
Gentoo

Diff of /eclass/java-pkg-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.18 Revision 1.31
3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org> 3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4# Copyright (c) 2004-2005, Gentoo Foundation 4# Copyright (c) 2004-2005, Gentoo Foundation
5# 5#
6# Licensed under the GNU General Public License, v2 6# Licensed under the GNU General Public License, v2
7# 7#
8# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.18 2007/01/28 19:53:17 betelgeuse Exp $ 8# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.31 2008/12/22 22:09:38 serkan Exp $
9 9
10inherit java-utils-2 10inherit java-utils-2
11 11
12# ----------------------------------------------------------------------------- 12# -----------------------------------------------------------------------------
13# @eclass-begin 13# @eclass-begin
18# ----------------------------------------------------------------------------- 18# -----------------------------------------------------------------------------
19 19
20# ------------------------------------------------------------------------------ 20# ------------------------------------------------------------------------------
21# @IUSE 21# @IUSE
22# 22#
23# ebuilds using this eclass can set JAVA_PKG_IUSE and then this eclass 23# Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that
24# will automatically add deps for them. 24# the eclass can automatically add the needed dependencies for the java-pkg_do*
25# functions.
25# 26#
26# ------------------------------------------------------------------------------ 27# ------------------------------------------------------------------------------
27IUSE="${JAVA_PKG_IUSE}" 28IUSE="${JAVA_PKG_IUSE}"
28 29
29# ------------------------------------------------------------------------------ 30# ------------------------------------------------------------------------------
33# 34#
34# JAVA_PKG_E_DEPEND is defined in java-utils.eclass. 35# JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
35# ------------------------------------------------------------------------------ 36# ------------------------------------------------------------------------------
36DEPEND="${JAVA_PKG_E_DEPEND}" 37DEPEND="${JAVA_PKG_E_DEPEND}"
37 38
38hasq source ${JAVA_PKG_IUSE} && DEPEND="${DEPEND} source? ( app-arch/zip )"
39
40# ------------------------------------------------------------------------------ 39# ------------------------------------------------------------------------------
41# @rdepend 40# @rdepend
42# 41#
43# Nothing special for RDEPEND... just the same as DEPEND. 42# Nothing special for RDEPEND... just the same as DEPEND.
44# ------------------------------------------------------------------------------ 43# ------------------------------------------------------------------------------
45RDEPEND="${DEPEND}" 44RDEPEND="${DEPEND}"
46 45
46# Commons packages follow the same rules so do it here
47if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then
48 HOMEPAGE="http://commons.apache.org/${PN#commons-}/"
49 SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz"
50fi
51
47EXPORT_FUNCTIONS pkg_setup src_compile 52EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst
53[[ "${EAPI:-0}" == "2" ]] && EXPORT_FUNCTIONS src_prepare
48 54
49# ------------------------------------------------------------------------------ 55# ------------------------------------------------------------------------------
50# @eclass-pkg_setup 56# @eclass-pkg_setup
51# 57#
52# pkg_setup initializes the Java environment 58# pkg_setup initializes the Java environment
55 java-pkg_init 61 java-pkg_init
56 java-pkg_ensure-test 62 java-pkg_ensure-test
57} 63}
58 64
59# ------------------------------------------------------------------------------ 65# ------------------------------------------------------------------------------
66# @eclass-src_prepare
67#
68# wrapper for java-utils-2_src_prepare
69# ------------------------------------------------------------------------------
70java-pkg-2_src_prepare() {
71 java-utils-2_src_prepare
72}
73
74# ------------------------------------------------------------------------------
60# @eclass-src_compile 75# @eclass-src_compile
61# 76#
62# Default src_compile for java packages 77# Default src_compile for java packages
63# variables: 78# variables:
64# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml) 79# EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
65# EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value 80# EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
66# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar) 81# EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
67# EANT_DOC_TARGET - the target to build extra docs under the doc use flag 82# EANT_DOC_TARGET - the target to build extra docs under the doc use flag
68# (default: the one provided by use_doc in 83# (default: javadoc; declare empty to disable completely)
69# java-utils-2.eclass)
70# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass 84# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass
71# EANT_EXTRA_ARGS - extra arguments to pass to eant 85# EANT_EXTRA_ARGS - extra arguments to pass to eant
72# EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment 86# EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment
73# param: Parameters are passed to ant verbatim 87# param: Parameters are passed to ant verbatim
74# ------------------------------------------------------------------------------ 88# ------------------------------------------------------------------------------
75java-pkg-2_src_compile() { 89java-pkg-2_src_compile() {
76 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then 90 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
77 if ! hasq java-ant-2 ${INHERITED}; then
78 msg="You should inherit java-ant-2 always when using eant"
79 ewarn ${msg}
80 is-java-strict && die ${msg}
81 fi
82 [[ "${EANT_FILTER_COMPILER}" ]] && \ 91 [[ "${EANT_FILTER_COMPILER}" ]] && \
83 java-pkg_filter-compiler ${EANT_FILTER_COMPILER} 92 java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
84
85 local antflags="${EANT_BUILD_TARGET:=jar}" 93 local antflags="${EANT_BUILD_TARGET:=jar}"
94 if hasq doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then
86 hasq doc ${IUSE} && antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})" 95 antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
96 fi
97 local tasks
87 ANT_TASKS="${ANT_TASKS} ${EANT_ANT_TASKS}" \ 98 [[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}"
99 ANT_TASKS="${tasks:-${ANT_TASKS}}" \
88 eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}" 100 eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}"
89 else 101 else
90 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do." 102 echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do."
91 fi 103 fi
92} 104}
93 105
94# ------------------------------------------------------------------------------
95# @note
96#
97# We need to initialize the environment in every function because Portage
98# will source /etc/profile between phases and trample all over the env.
99# This is accomplished by phase hooks, which is available with newer versions of
100# portage.
101# ------------------------------------------------------------------------------
102 106
103pre_pkg_setup() { 107java-pkg-2_pkg_preinst() {
104 java-pkg-2_pkg_setup
105}
106
107pre_src_unpack() {
108 java-pkg-2_pkg_setup
109}
110
111pre_src_compile() {
112 if is-java-strict; then 108 if is-java-strict; then
113 echo "Searching for bundled jars:" 109 if has_version dev-java/java-dep-check; then
114 java-pkg_find-normal-jars || echo "None found." 110 [[ -e "${JAVA_PKG_ENV}" ]] || return
111 local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
112 if [[ ${output} ]]; then
113 ewarn "Possibly unneeded dependencies found in package.env:"
114 for dep in ${output}; do
115 ewarn "\t${dep}"
116 done
117 fi
118 else
119 eerror "Install dev-java/java-dep-check for dependency checking"
120 fi
115 fi 121 fi
116 java-pkg-2_pkg_setup
117}
118
119pre_src_install() {
120 java-pkg-2_pkg_setup
121}
122
123pre_src_test() {
124 java-pkg-2_pkg_setup
125}
126
127pre_pkg_preinst() {
128 java-pkg-2_pkg_setup
129}
130
131pre_pkg_postinst() {
132 java-pkg-2_pkg_setup
133} 122}
134 123
135# ------------------------------------------------------------------------------ 124# ------------------------------------------------------------------------------
136# @eclass-end 125# @eclass-end
137# ------------------------------------------------------------------------------ 126# ------------------------------------------------------------------------------

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20