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

Contents of /eclass/ant-tasks.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sun Jan 21 01:11:47 2007 UTC (7 years, 6 months ago) by caster
Branch: MAIN
Adding ant-tasks.eclass for building of dev-java/ant-* packages.

1 # Eclass for building dev-java/ant-* packages
2 #
3 # Copyright 2007 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: $
7
8 inherit java-pkg-2 versionator
9
10 ECLASS="ant-tasks"
11 INHERITED="$INHERITED $ECLASS"
12
13 EXPORT_FUNCTIONS src_unpack src_compile src_install
14
15 # -----------------------------------------------------------------------------
16 # @eclass-begin
17 # @eclass-shortdesc Eclass for building dev-java/ant-* packages
18 # @eclass-maintainer java@gentoo.org
19 #
20 # This eclass provides functionality and default ebuild variables for building
21 # dev-java/ant-* packages easily.
22 #
23 # -----------------------------------------------------------------------------
24
25 # -----------------------------------------------------------------------------
26 # @variable-preinherit ANT_TASK_JDKVER
27 # @variable-default 1.4
28 #
29 # Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.4, can
30 # be overriden from ebuild BEFORE inheriting this eclass.
31 # -----------------------------------------------------------------------------
32 ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.4}
33
34 # -----------------------------------------------------------------------------
35 # @variable-preinherit ANT_TASK_JREVER
36 # @variable-default 1.4
37 #
38 # Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.4, can
39 # be overriden from ebuild BEFORE inheriting this eclass.
40 # -----------------------------------------------------------------------------
41 ANT_TASK_JREVER=${ANT_TASK_JREVER-1.4}
42
43 # -----------------------------------------------------------------------------
44 # @variable-internal ANT_TASK_NAME
45 # @variable-default the rest of $PN after "ant-"
46 #
47 # The name of this ant task as recognized by ant's build.xml, derived from $PN.
48 # -----------------------------------------------------------------------------
49 ANT_TASK_NAME="${PN#ant-}"
50
51 # -----------------------------------------------------------------------------
52 # @variable-preinherit ANT_TASK_DEPNAME
53 # @variable-default $ANT_TASK_NAME
54 #
55 # Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
56 # that this one depends on. Defaults to the name of ant task, ebuild can
57 # override it before inheriting this eclass.
58 # -----------------------------------------------------------------------------
59 ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
60
61 # -----------------------------------------------------------------------------
62 # @variable-internal ANT_TASK_PV
63 # @variable-default Just the number in $PV without any beta/RC suffixes
64 #
65 # Version of ant-core this task is intended to register and thus load with.
66 # -----------------------------------------------------------------------------
67 ANT_TASK_PV="${PV}"
68
69 # special care for beta/RC releases
70 if [[ ${PV} == *beta* ]]; then
71 MY_PV=${PV/_beta/Beta}
72 SRC_URI_PREFIX="http://dev.gentoo.org/~caster/distfiles"
73 ANT_TASK_PV=$(get_version_component_range 1-3)
74 elif [[ ${PV} == *_rc* ]]; then
75 MY_PV=${PV/_rc/RC}
76 SRC_URI_PREFIX="http://dev.gentoo.org/~caster/distfiles"
77 ANT_TASK_PV=$(get_version_component_range 1-3)
78 else
79 # default for final releases
80 MY_PV=${PV}
81 SRC_URI_PREFIX="mirror://apache/ant/source"
82 fi
83
84 # source/workdir name
85 MY_P="apache-ant-${MY_PV}"
86
87 # -----------------------------------------------------------------------------
88 # Default values for standard ebuild variables, can be overriden from ebuild.
89 # -----------------------------------------------------------------------------
90 DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
91 HOMEPAGE="http://ant.apache.org/"
92 SRC_URI="${SRC_URI_PREFIX}/${MY_P}-src.tar.bz2
93 http://dev.gentoo.org/~caster/distfiles/ant-${PV}-gentoo.tar.bz2"
94 LICENSE="Apache-2.0"
95 SLOT="0"
96 IUSE=""
97
98 RDEPEND=">=virtual/jre-${ANT_TASK_JREVER}
99 ~dev-java/ant-core-${PV}"
100 DEPEND=">=virtual/jdk-${ANT_TASK_JDKVER}
101 ${RDEPEND}"
102
103 S="${WORKDIR}/${MY_P}"
104
105 # ------------------------------------------------------------------------------
106 # @eclass-src_unpack
107 #
108 # Is split into two parts, defaults to both of them ('all').
109 # base: performs the unpack, build.xml replacement and symlinks ant.jar from
110 # ant-core
111 # jar-dep: symlinks the jar file(s) from dependency package
112 # ------------------------------------------------------------------------------
113 ant-tasks_src_unpack() {
114 [[ -z "${1}" ]] && ant-tasks_src_unpack all
115
116 while [[ -n "${1}" ]]; do
117 case ${1} in
118 base)
119 unpack ${A}
120 cd "${S}"
121
122 # replace build.xml with our modified for split building
123 mv -f ${WORKDIR}/build.xml .
124
125 cd lib
126 # remove bundled xerces
127 rm -f *.jar
128
129 # ant.jar to build against
130 java-pkg_jar-from --build-only ant-core ant.jar;;
131 jar-dep)
132 # get jar from the dependency package
133 java-pkg_jar-from ${ANT_TASK_DEPNAME};;
134 all)
135 ant-tasks_src_unpack base jar-dep;;
136 esac
137 shift
138 done
139
140 }
141
142 # ------------------------------------------------------------------------------
143 # @eclass-src_compile
144 #
145 # Compiles the jar with installed ant-core.
146 # ------------------------------------------------------------------------------
147 ant-tasks_src_compile() {
148 ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
149 }
150
151 # ------------------------------------------------------------------------------
152 # @eclass-src_install
153 #
154 # Installs the jar and registers its presence for the ant launcher script.
155 # Version param ensures it won't get loaded (thus break) when ant-core is
156 # updated to newer version.
157 # ------------------------------------------------------------------------------
158 ant-tasks_src_install() {
159 java-pkg_dojar build/lib/${PN}.jar
160 java-pkg_register-ant-task --version "${ANT_TASK_PV}"
161 }

  ViewVC Help
Powered by ViewVC 1.1.20