1 |
# Eclass for Java packages |
2 |
# |
3 |
# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org> |
4 |
# Copyright (c) 2004-2005, Gentoo Foundation |
5 |
# |
6 |
# Licensed under the GNU General Public License, v2 |
7 |
# |
8 |
# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.15 2007/01/21 19:30:26 betelgeuse Exp $ |
9 |
|
10 |
inherit java-utils-2 |
11 |
|
12 |
# ----------------------------------------------------------------------------- |
13 |
# @eclass-begin |
14 |
# @eclass-summary Eclass for Java Packages |
15 |
# |
16 |
# This eclass should be inherited for pure Java packages, or by packages which |
17 |
# need to use Java. |
18 |
# ----------------------------------------------------------------------------- |
19 |
|
20 |
# ------------------------------------------------------------------------------ |
21 |
# @IUSE |
22 |
# |
23 |
# ebuilds using this eclass can set JAVA_PKG_IUSE and then this eclass |
24 |
# will automatically add deps for them. |
25 |
# |
26 |
# ------------------------------------------------------------------------------ |
27 |
IUSE="${JAVA_PKG_IUSE}" |
28 |
|
29 |
# ------------------------------------------------------------------------------ |
30 |
# @depend |
31 |
# |
32 |
# Java packages need java-config, and a fairly new release of Portage. |
33 |
# |
34 |
# JAVA_PKG_E_DEPEND is defined in java-utils.eclass. |
35 |
# ------------------------------------------------------------------------------ |
36 |
DEPEND="${JAVA_PKG_E_DEPEND}" |
37 |
|
38 |
hasq source ${JAVA_PKG_IUSE} && DEPEND="${DEPEND} source? ( app-arch/zip )" |
39 |
|
40 |
# ------------------------------------------------------------------------------ |
41 |
# @rdepend |
42 |
# |
43 |
# Nothing special for RDEPEND... just the same as DEPEND. |
44 |
# ------------------------------------------------------------------------------ |
45 |
RDEPEND="${DEPEND}" |
46 |
|
47 |
EXPORT_FUNCTIONS pkg_setup src_compile |
48 |
|
49 |
# ------------------------------------------------------------------------------ |
50 |
# @eclass-pkg_setup |
51 |
# |
52 |
# pkg_setup initializes the Java environment |
53 |
# ------------------------------------------------------------------------------ |
54 |
java-pkg-2_pkg_setup() { |
55 |
java-pkg_init |
56 |
java-pkg_ensure-test |
57 |
} |
58 |
|
59 |
# ------------------------------------------------------------------------------ |
60 |
# @eclass-src_compile |
61 |
# |
62 |
# Default src_compile for java packages |
63 |
# variables: |
64 |
# 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 |
66 |
# 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 |
68 |
# (default: the one provided by use_doc in |
69 |
# java-utils-2.eclass) |
70 |
# EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass |
71 |
# EANT_EXTRA_ARGS - extra arguments to pass to eant |
72 |
# param: Parameters are passed to ant verbatim |
73 |
# ------------------------------------------------------------------------------ |
74 |
java-pkg-2_src_compile() { |
75 |
if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then |
76 |
[[ "${EANT_FILTER_COMPILER}" ]] && \ |
77 |
java-pkg_filter-compiler ${EANT_FILTER_COMPILER} |
78 |
|
79 |
local antflags="${EANT_BUILD_TARGET:=jar}" |
80 |
hasq doc ${IUSE} && antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})" |
81 |
eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}" |
82 |
else |
83 |
echo "${FUNCNAME}: No build.xml found so nothing to do." |
84 |
fi |
85 |
} |
86 |
|
87 |
# ------------------------------------------------------------------------------ |
88 |
# @note |
89 |
# |
90 |
# We need to initialize the environment in every function because Portage |
91 |
# will source /etc/profile between phases and trample all over the env. |
92 |
# This is accomplished by phase hooks, which is available with newer versions of |
93 |
# portage. |
94 |
# ------------------------------------------------------------------------------ |
95 |
|
96 |
pre_pkg_setup() { |
97 |
java-pkg-2_pkg_setup |
98 |
} |
99 |
|
100 |
pre_src_unpack() { |
101 |
java-pkg-2_pkg_setup |
102 |
} |
103 |
|
104 |
pre_src_compile() { |
105 |
if is-java-strict; then |
106 |
echo "Searching for bundled jars:" |
107 |
java-pkg_find-normal-jars || echo "None found." |
108 |
fi |
109 |
java-pkg-2_pkg_setup |
110 |
} |
111 |
|
112 |
pre_src_install() { |
113 |
java-pkg-2_pkg_setup |
114 |
} |
115 |
|
116 |
pre_src_test() { |
117 |
java-pkg-2_pkg_setup |
118 |
} |
119 |
|
120 |
pre_pkg_preinst() { |
121 |
java-pkg-2_pkg_setup |
122 |
} |
123 |
|
124 |
pre_pkg_postinst() { |
125 |
java-pkg-2_pkg_setup |
126 |
} |
127 |
|
128 |
# ------------------------------------------------------------------------------ |
129 |
# @eclass-end |
130 |
# ------------------------------------------------------------------------------ |