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

Contents of /eclass/ant-tasks.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download)
Wed Aug 28 21:28:33 2013 UTC (11 months ago) by tomwij
Branch: MAIN
Changes since 1.14: +3 -3 lines
Made ant-tasks.eclass support newer versions of the 1.9 branch.

1 caster 1.1 # Eclass for building dev-java/ant-* packages
2     #
3 tomwij 1.15 # Copyright 1999-2013 Gentoo Foundation
4 caster 1.1 # Distributed under the terms of the GNU General Public License, v2 or later
5     # Author Vlastimil Babka <caster@gentoo.org>
6 tomwij 1.15 # $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.14 2013/07/05 10:44:47 tomwij Exp $
7 caster 1.1
8 caster 1.4 # 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 caster 1.1
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 betelgeuse 1.2 #
24 caster 1.1 # -----------------------------------------------------------------------------
25    
26     # -----------------------------------------------------------------------------
27     # @variable-preinherit ANT_TASK_JDKVER
28 tomwij 1.14 # @variable-default 1.5
29 caster 1.1 #
30 tomwij 1.14 # Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.5, can
31 caster 1.1 # be overriden from ebuild BEFORE inheriting this eclass.
32     # -----------------------------------------------------------------------------
33 tomwij 1.14 ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.5}
34 caster 1.1
35     # -----------------------------------------------------------------------------
36     # @variable-preinherit ANT_TASK_JREVER
37 tomwij 1.14 # @variable-default 1.5
38 caster 1.1 #
39 tomwij 1.14 # Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.5, can
40 caster 1.1 # be overriden from ebuild BEFORE inheriting this eclass.
41     # -----------------------------------------------------------------------------
42 tomwij 1.14 ANT_TASK_JREVER=${ANT_TASK_JREVER-1.5}
43 caster 1.1
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 caster 1.11 # @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 caster 1.1 # @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 caster 1.6 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 caster 1.1 ANT_TASK_PV=$(get_version_component_range 1-3)
83     elif [[ ${PV} == *_rc* ]]; then
84     MY_PV=${PV/_rc/RC}
85 caster 1.6 UPSTREAM_PREFIX="http://dev.gentoo.org/~caster/distfiles"
86     GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
87 caster 1.1 ANT_TASK_PV=$(get_version_component_range 1-3)
88     else
89     # default for final releases
90     MY_PV=${PV}
91 caster 1.6 UPSTREAM_PREFIX="mirror://apache/ant/source"
92 sera 1.12 case ${PV} in
93 tomwij 1.15 1.9.*)
94 tomwij 1.14 GENTOO_PREFIX="http://dev.gentoo.org/~tomwij/files/dist"
95     ;;
96 sera 1.12 1.8.4)
97     GENTOO_PREFIX="http://dev.gentoo.org/~sera/distfiles"
98     ;;
99     *)
100     GENTOO_PREFIX="http://dev.gentoo.org/~caster/distfiles"
101     ;;
102     esac
103 caster 1.1 fi
104    
105     # source/workdir name
106     MY_P="apache-ant-${MY_PV}"
107    
108     # -----------------------------------------------------------------------------
109     # Default values for standard ebuild variables, can be overriden from ebuild.
110     # -----------------------------------------------------------------------------
111     DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
112     HOMEPAGE="http://ant.apache.org/"
113 caster 1.6 SRC_URI="${UPSTREAM_PREFIX}/${MY_P}-src.tar.bz2
114     ${GENTOO_PREFIX}/ant-${PV}-gentoo.tar.bz2"
115 caster 1.1 LICENSE="Apache-2.0"
116     SLOT="0"
117    
118 caster 1.11 RDEPEND="~dev-java/ant-core-${PV}"
119     DEPEND="${RDEPEND}"
120    
121     if [[ -z "${ANT_TASK_DISABLE_VM_DEPS}" ]]; then
122 sera 1.13 RDEPEND+=" >=virtual/jre-${ANT_TASK_JREVER}"
123     DEPEND+=" >=virtual/jdk-${ANT_TASK_JDKVER}"
124 caster 1.11 fi
125 caster 1.1
126 caster 1.7 # we need direct blockers with old ant-tasks for file collisions - bug #252324
127     if version_is_at_least 1.7.1 ; then
128 sera 1.13 DEPEND+=" !dev-java/ant-tasks"
129 caster 1.7 fi
130    
131 betelgeuse 1.5 # Would run the full ant test suite for every ant task
132     RESTRICT="test"
133    
134 caster 1.6 S="${WORKDIR}/${MY_P}"
135    
136 caster 1.1 # ------------------------------------------------------------------------------
137     # @eclass-src_unpack
138     #
139     # Is split into two parts, defaults to both of them ('all').
140     # base: performs the unpack, build.xml replacement and symlinks ant.jar from
141     # ant-core
142     # jar-dep: symlinks the jar file(s) from dependency package
143     # ------------------------------------------------------------------------------
144     ant-tasks_src_unpack() {
145     [[ -z "${1}" ]] && ant-tasks_src_unpack all
146    
147     while [[ -n "${1}" ]]; do
148     case ${1} in
149     base)
150     unpack ${A}
151     cd "${S}"
152    
153     # replace build.xml with our modified for split building
154 serkan 1.8 mv -f "${WORKDIR}"/build.xml .
155 caster 1.1
156     cd lib
157     # remove bundled xerces
158     rm -f *.jar
159    
160     # ant.jar to build against
161     java-pkg_jar-from --build-only ant-core ant.jar;;
162     jar-dep)
163     # get jar from the dependency package
164 caster 1.6 if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
165     java-pkg_jar-from ${ANT_TASK_DEPNAME}
166     fi;;
167 caster 1.1 all)
168     ant-tasks_src_unpack base jar-dep;;
169     esac
170     shift
171     done
172    
173     }
174    
175     # ------------------------------------------------------------------------------
176     # @eclass-src_compile
177     #
178     # Compiles the jar with installed ant-core.
179     # ------------------------------------------------------------------------------
180     ant-tasks_src_compile() {
181     ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
182     }
183    
184     # ------------------------------------------------------------------------------
185     # @eclass-src_install
186     #
187     # Installs the jar and registers its presence for the ant launcher script.
188     # Version param ensures it won't get loaded (thus break) when ant-core is
189     # updated to newer version.
190     # ------------------------------------------------------------------------------
191     ant-tasks_src_install() {
192     java-pkg_dojar build/lib/${PN}.jar
193     java-pkg_register-ant-task --version "${ANT_TASK_PV}"
194 caster 1.6
195     # create the compatibility symlink
196     if version_is_at_least 1.7.1_beta2; then
197     dodir /usr/share/ant/lib
198     dosym /usr/share/${PN}/lib/${PN}.jar /usr/share/ant/lib/${PN}.jar
199     fi
200 caster 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20