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

Contents of /eclass/ant-tasks.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sun Jan 21 21:37:02 2007 UTC (7 years, 7 months ago) by caster
Branch: MAIN
Changes since 1.2: +2 -2 lines
Change distfile location from my devspace to mirror://gentoo
----------------------------------------------------------------------

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

  ViewVC Help
Powered by ViewVC 1.1.20