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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Fri Jan 12 13:48:12 2007 UTC (7 years, 7 months ago) by betelgeuse
Branch: MAIN
Changes since 1.10: +14 -2 lines
Added EANT_GENTOO_CLASSPATH and EANT_EXTRA_ARGUMENTS support to the general src_compile.

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.10 2007/01/10 09:59:21 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 # @depend
22 #
23 # Java packages need java-config, and a fairly new release of Portage.
24 #
25 # JAVA_PKG_E_DEPEND is defined in java-utils.eclass.
26 # ------------------------------------------------------------------------------
27 DEPEND="${JAVA_PKG_E_DEPEND}"
28
29 # ------------------------------------------------------------------------------
30 # @rdepend
31 #
32 # Nothing special for RDEPEND... just the same as DEPEND.
33 # ------------------------------------------------------------------------------
34 RDEPEND="${DEPEND}"
35
36 EXPORT_FUNCTIONS pkg_setup src_compile
37
38 # ------------------------------------------------------------------------------
39 # @eclass-pkg_setup
40 #
41 # pkg_setup initializes the Java environment
42 # ------------------------------------------------------------------------------
43 java-pkg-2_pkg_setup() {
44 java-pkg_init
45 java-pkg_ensure-test
46 }
47
48 # ------------------------------------------------------------------------------
49 # @eclass-src_compile
50 #
51 # Default src_compile for java packages
52 # variables:
53 # EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml)
54 # EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value
55 # EANT_BUILD_TARGET - the ant target/targets to execute (default: jar)
56 # EANT_DOC_TARGET - the target to build extra docs under the doc use flag
57 # (default: the one provided by use_doc in
58 # java-utils-2.eclass)
59 # EANT_GENTOO_CLASSPATH - class java-pkg_getjars for the value and adds to the
60 # gentoo.classpath property
61 # EANT_EXTRA_ARGUMENTS - extra arguments to pass to eant
62 # ------------------------------------------------------------------------------
63 java-pkg-2_src_compile() {
64 if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then
65 [[ "${EANT_FILTER_COMPILER}" ]] && \
66 java-pkg_filter-compiler ${EANT_FILTER_COMPILER}
67
68 local antflags="${EANT_BUILD_TARGET:=jar}"
69
70 local gcp="${EANT_GENTOO_CLASSPATH}"
71
72 if [[ "${gcp}" ]]; then
73 local cp="$(java-pkg_getjars ${gcp})"
74 # It seems ant does not like single quotes around ${cp}
75 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
76 fi
77
78 hasq doc ${IUSE} && antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})"
79 eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGUMENTS}
80 else
81 echo "${FUNCNAME}: No build.xml found so nothing to do."
82 fi
83 }
84
85 # ------------------------------------------------------------------------------
86 # @note
87 #
88 # We need to initialize the environment in every function because Portage
89 # will source /etc/profile between phases and trample all over the env.
90 # This is accomplished by phase hooks, which is available with newer versions of
91 # portage.
92 # ------------------------------------------------------------------------------
93
94 pre_pkg_setup() {
95 java-pkg-2_pkg_setup
96 }
97
98 pre_src_unpack() {
99 java-pkg-2_pkg_setup
100 }
101
102 pre_src_compile() {
103 if is-java-strict; then
104 echo "Searching for bundled jars:"
105 java-pkg_find-normal-jars || echo "None found."
106 fi
107 java-pkg-2_pkg_setup
108 }
109
110 pre_src_install() {
111 java-pkg-2_pkg_setup
112 }
113
114 pre_src_test() {
115 java-pkg-2_pkg_setup
116 }
117
118 pre_pkg_preinst() {
119 java-pkg-2_pkg_setup
120 }
121
122 pre_pkg_postinst() {
123 java-pkg-2_pkg_setup
124 }
125
126 # ------------------------------------------------------------------------------
127 # @eclass-end
128 # ------------------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.20