/[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.13 - (show annotations) (download)
Tue Jan 16 21:11:29 2007 UTC (7 years, 8 months ago) by betelgeuse
Branch: MAIN
Changes since 1.12: +15 -1 lines
Added support for JAVA_PKG_IUSE and the mandatory ECLASS and INHERITED variables.

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

  ViewVC Help
Powered by ViewVC 1.1.20