/[gentoo-x86]/eclass/ant-tasks.eclass
Gentoo

Contents of /eclass/ant-tasks.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download)
Fri Jun 1 12:19:42 2012 UTC (2 years, 2 months ago) by sera
Branch: MAIN
Changes since 1.12: +4 -7 lines
Don't assinging RDEPEND to DEPEND and vise versa. JRE in DEPEND confuses VM switching code.

1 # Eclass for building dev-java/ant-* packages
2 #
3 # Copyright 1999-2012 Gentoo Foundation
4 # Distributed under the terms of the GNU General Public License, v2 or later
5 # Author Vlastimil Babka <caster@gentoo.org>
6 # $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.12 2012/05/30 08:21:18 sera Exp $
7
8 # we set ant-core dep ourselves, restricted
9 JAVA_ANT_DISABLE_ANT_CORE_DEP=true
10 # rewriting build.xml for are the testcases has no reason atm
11 JAVA_PKG_BSFIX_ALL=no
12 inherit versionator java-pkg-2 java-ant-2
13
14 EXPORT_FUNCTIONS src_unpack src_compile src_install
15
16 # -----------------------------------------------------------------------------
17 # @eclass-begin
18 # @eclass-shortdesc Eclass for building dev-java/ant-* packages
19 # @eclass-maintainer java@gentoo.org
20 #
21 # This eclass provides functionality and default ebuild variables for building
22 # dev-java/ant-* packages easily.
23 #
24 # -----------------------------------------------------------------------------
25
26 # -----------------------------------------------------------------------------
27 # @variable-preinherit ANT_TASK_JDKVER
28 # @variable-default 1.4
29 #
30 # Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.4, can
31 # be overriden from ebuild BEFORE inheriting this eclass.
32 # -----------------------------------------------------------------------------
33 ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.4}
34
35 # -----------------------------------------------------------------------------
36 # @variable-preinherit ANT_TASK_JREVER
37 # @variable-default 1.4
38 #
39 # Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.4, can
40 # be overriden from ebuild BEFORE inheriting this eclass.
41 # -----------------------------------------------------------------------------
42 ANT_TASK_JREVER=${ANT_TASK_JREVER-1.4}
43
44 # -----------------------------------------------------------------------------
45 # @variable-internal ANT_TASK_NAME
46 # @variable-default the rest of $PN after "ant-"
47 #
48 # The name of this ant task as recognized by ant's build.xml, derived from $PN.
49 # -----------------------------------------------------------------------------
50 ANT_TASK_NAME="${PN#ant-}"
51
52 # -----------------------------------------------------------------------------
53 # @variable-preinherit ANT_TASK_DEPNAME
54 # @variable-default $ANT_TASK_NAME
55 #
56 # Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
57 # that this one depends on. Defaults to the name of ant task, ebuild can
58 # override it before inheriting this eclass.
59 # -----------------------------------------------------------------------------
60 ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
61
62 # -----------------------------------------------------------------------------
63 # @variable-preinherit ANT_TASK_DISABLE_VM_DEPS
64 # @variable-default unset
65 #
66 # If set, no JDK/JRE deps are added.
67 # -----------------------------------------------------------------------------
68
69 # -----------------------------------------------------------------------------
70 # @variable-internal ANT_TASK_PV
71 # @variable-default Just the number in $PV without any beta/RC suffixes
72 #
73 # Version of ant-core this task is intended to register and thus load with.
74 # -----------------------------------------------------------------------------
75 ANT_TASK_PV="${PV}"
76
77 # special care for beta/RC releases
78 if [[ ${PV} == *beta2* ]]; then
79 MY_PV=${PV/_beta2/beta}
80 UPSTREAM_PREFIX="http://people.apache.org/dist/ant/v1.7.1beta2/src"
81 GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
82 ANT_TASK_PV=$(get_version_component_range 1-3)
83 elif [[ ${PV} == *_rc* ]]; then
84 MY_PV=${PV/_rc/RC}
85 UPSTREAM_PREFIX="http://dev.gentoo.org/~caster/distfiles"
86 GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
87 ANT_TASK_PV=$(get_version_component_range 1-3)
88 else
89 # default for final releases
90 MY_PV=${PV}
91 UPSTREAM_PREFIX="mirror://apache/ant/source"
92 case ${PV} in
93 1.8.4)
94 GENTOO_PREFIX="http://dev.gentoo.org/~sera/distfiles"
95 ;;
96 *)
97 GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
98 ;;
99 esac
100 fi
101
102 # source/workdir name
103 MY_P="apache-ant-${MY_PV}"
104
105 # -----------------------------------------------------------------------------
106 # Default values for standard ebuild variables, can be overriden from ebuild.
107 # -----------------------------------------------------------------------------
108 DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
109 HOMEPAGE="http://ant.apache.org/"
110 SRC_URI="${UPSTREAM_PREFIX}/${MY_P}-src.tar.bz2
111 ${GENTOO_PREFIX}/ant-${PV}-gentoo.tar.bz2"
112 LICENSE="Apache-2.0"
113 SLOT="0"
114 IUSE=""
115
116 RDEPEND="~dev-java/ant-core-${PV}"
117 DEPEND="${RDEPEND}"
118
119 if [[ -z "${ANT_TASK_DISABLE_VM_DEPS}" ]]; then
120 RDEPEND+=" >=virtual/jre-${ANT_TASK_JREVER}"
121 DEPEND+=" >=virtual/jdk-${ANT_TASK_JDKVER}"
122 fi
123
124 # we need direct blockers with old ant-tasks for file collisions - bug #252324
125 if version_is_at_least 1.7.1 ; then
126 DEPEND+=" !dev-java/ant-tasks"
127 fi
128
129 # Would run the full ant test suite for every ant task
130 RESTRICT="test"
131
132 S="${WORKDIR}/${MY_P}"
133
134 # ------------------------------------------------------------------------------
135 # @eclass-src_unpack
136 #
137 # Is split into two parts, defaults to both of them ('all').
138 # base: performs the unpack, build.xml replacement and symlinks ant.jar from
139 # ant-core
140 # jar-dep: symlinks the jar file(s) from dependency package
141 # ------------------------------------------------------------------------------
142 ant-tasks_src_unpack() {
143 [[ -z "${1}" ]] && ant-tasks_src_unpack all
144
145 while [[ -n "${1}" ]]; do
146 case ${1} in
147 base)
148 unpack ${A}
149 cd "${S}"
150
151 # replace build.xml with our modified for split building
152 mv -f "${WORKDIR}"/build.xml .
153
154 cd lib
155 # remove bundled xerces
156 rm -f *.jar
157
158 # ant.jar to build against
159 java-pkg_jar-from --build-only ant-core ant.jar;;
160 jar-dep)
161 # get jar from the dependency package
162 if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
163 java-pkg_jar-from ${ANT_TASK_DEPNAME}
164 fi;;
165 all)
166 ant-tasks_src_unpack base jar-dep;;
167 esac
168 shift
169 done
170
171 }
172
173 # ------------------------------------------------------------------------------
174 # @eclass-src_compile
175 #
176 # Compiles the jar with installed ant-core.
177 # ------------------------------------------------------------------------------
178 ant-tasks_src_compile() {
179 ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
180 }
181
182 # ------------------------------------------------------------------------------
183 # @eclass-src_install
184 #
185 # Installs the jar and registers its presence for the ant launcher script.
186 # Version param ensures it won't get loaded (thus break) when ant-core is
187 # updated to newer version.
188 # ------------------------------------------------------------------------------
189 ant-tasks_src_install() {
190 java-pkg_dojar build/lib/${PN}.jar
191 java-pkg_register-ant-task --version "${ANT_TASK_PV}"
192
193 # create the compatibility symlink
194 if version_is_at_least 1.7.1_beta2; then
195 dodir /usr/share/ant/lib
196 dosym /usr/share/${PN}/lib/${PN}.jar /usr/share/ant/lib/${PN}.jar
197 fi
198 }

  ViewVC Help
Powered by ViewVC 1.1.20