summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlastimil Babka <caster@gentoo.org>2007-01-21 01:11:47 +0000
committerVlastimil Babka <caster@gentoo.org>2007-01-21 01:11:47 +0000
commit99c55c1aac814c9381f9c38fd702da1c0e717ae5 (patch)
tree7594234290555957a7f3cb65d2fbed682e9942cc /eclass/ant-tasks.eclass
parentVersion bump, bug #162835. (diff)
downloadgentoo-2-99c55c1aac814c9381f9c38fd702da1c0e717ae5.tar.gz
gentoo-2-99c55c1aac814c9381f9c38fd702da1c0e717ae5.tar.bz2
gentoo-2-99c55c1aac814c9381f9c38fd702da1c0e717ae5.zip
Adding ant-tasks.eclass for building of dev-java/ant-* packages.
Diffstat (limited to 'eclass/ant-tasks.eclass')
-rw-r--r--eclass/ant-tasks.eclass161
1 files changed, 161 insertions, 0 deletions
diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass
new file mode 100644
index 000000000000..1f25d98efe8f
--- /dev/null
+++ b/eclass/ant-tasks.eclass
@@ -0,0 +1,161 @@
+# Eclass for building dev-java/ant-* packages
+#
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Author Vlastimil Babka <caster@gentoo.org>
+# $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.1 2007/01/21 01:11:47 caster Exp $
+
+inherit java-pkg-2 versionator
+
+ECLASS="ant-tasks"
+INHERITED="$INHERITED $ECLASS"
+
+EXPORT_FUNCTIONS src_unpack src_compile src_install
+
+# -----------------------------------------------------------------------------
+# @eclass-begin
+# @eclass-shortdesc Eclass for building dev-java/ant-* packages
+# @eclass-maintainer java@gentoo.org
+#
+# This eclass provides functionality and default ebuild variables for building
+# dev-java/ant-* packages easily.
+#
+# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# @variable-preinherit ANT_TASK_JDKVER
+# @variable-default 1.4
+#
+# Affects the >=virtual/jdk version set in DEPEND string. Defaults to 1.4, can
+# be overriden from ebuild BEFORE inheriting this eclass.
+# -----------------------------------------------------------------------------
+ANT_TASK_JDKVER=${ANT_TASK_JDKVER-1.4}
+
+# -----------------------------------------------------------------------------
+# @variable-preinherit ANT_TASK_JREVER
+# @variable-default 1.4
+#
+# Affects the >=virtual/jre version set in DEPEND string. Defaults to 1.4, can
+# be overriden from ebuild BEFORE inheriting this eclass.
+# -----------------------------------------------------------------------------
+ANT_TASK_JREVER=${ANT_TASK_JREVER-1.4}
+
+# -----------------------------------------------------------------------------
+# @variable-internal ANT_TASK_NAME
+# @variable-default the rest of $PN after "ant-"
+#
+# The name of this ant task as recognized by ant's build.xml, derived from $PN.
+# -----------------------------------------------------------------------------
+ANT_TASK_NAME="${PN#ant-}"
+
+# -----------------------------------------------------------------------------
+# @variable-preinherit ANT_TASK_DEPNAME
+# @variable-default $ANT_TASK_NAME
+#
+# Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
+# that this one depends on. Defaults to the name of ant task, ebuild can
+# override it before inheriting this eclass.
+# -----------------------------------------------------------------------------
+ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
+
+# -----------------------------------------------------------------------------
+# @variable-internal ANT_TASK_PV
+# @variable-default Just the number in $PV without any beta/RC suffixes
+#
+# Version of ant-core this task is intended to register and thus load with.
+# -----------------------------------------------------------------------------
+ANT_TASK_PV="${PV}"
+
+# special care for beta/RC releases
+if [[ ${PV} == *beta* ]]; then
+ MY_PV=${PV/_beta/Beta}
+ SRC_URI_PREFIX="http://dev.gentoo.org/~caster/distfiles"
+ ANT_TASK_PV=$(get_version_component_range 1-3)
+elif [[ ${PV} == *_rc* ]]; then
+ MY_PV=${PV/_rc/RC}
+ SRC_URI_PREFIX="http://dev.gentoo.org/~caster/distfiles"
+ ANT_TASK_PV=$(get_version_component_range 1-3)
+else
+ # default for final releases
+ MY_PV=${PV}
+ SRC_URI_PREFIX="mirror://apache/ant/source"
+fi
+
+# source/workdir name
+MY_P="apache-ant-${MY_PV}"
+
+# -----------------------------------------------------------------------------
+# Default values for standard ebuild variables, can be overriden from ebuild.
+# -----------------------------------------------------------------------------
+DESCRIPTION="Apache Ant's optional tasks depending on ${ANT_TASK_DEPNAME}"
+HOMEPAGE="http://ant.apache.org/"
+SRC_URI="${SRC_URI_PREFIX}/${MY_P}-src.tar.bz2
+ http://dev.gentoo.org/~caster/distfiles/ant-${PV}-gentoo.tar.bz2"
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE=""
+
+RDEPEND=">=virtual/jre-${ANT_TASK_JREVER}
+ ~dev-java/ant-core-${PV}"
+DEPEND=">=virtual/jdk-${ANT_TASK_JDKVER}
+ ${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+# ------------------------------------------------------------------------------
+# @eclass-src_unpack
+#
+# Is split into two parts, defaults to both of them ('all').
+# base: performs the unpack, build.xml replacement and symlinks ant.jar from
+# ant-core
+# jar-dep: symlinks the jar file(s) from dependency package
+# ------------------------------------------------------------------------------
+ant-tasks_src_unpack() {
+ [[ -z "${1}" ]] && ant-tasks_src_unpack all
+
+ while [[ -n "${1}" ]]; do
+ case ${1} in
+ base)
+ unpack ${A}
+ cd "${S}"
+
+ # replace build.xml with our modified for split building
+ mv -f ${WORKDIR}/build.xml .
+
+ cd lib
+ # remove bundled xerces
+ rm -f *.jar
+
+ # ant.jar to build against
+ java-pkg_jar-from --build-only ant-core ant.jar;;
+ jar-dep)
+ # get jar from the dependency package
+ java-pkg_jar-from ${ANT_TASK_DEPNAME};;
+ all)
+ ant-tasks_src_unpack base jar-dep;;
+ esac
+ shift
+ done
+
+}
+
+# ------------------------------------------------------------------------------
+# @eclass-src_compile
+#
+# Compiles the jar with installed ant-core.
+# ------------------------------------------------------------------------------
+ant-tasks_src_compile() {
+ ANT_TASKS="none" eant -Dbuild.dep=${ANT_TASK_NAME} jar-dep
+}
+
+# ------------------------------------------------------------------------------
+# @eclass-src_install
+#
+# Installs the jar and registers its presence for the ant launcher script.
+# Version param ensures it won't get loaded (thus break) when ant-core is
+# updated to newer version.
+# ------------------------------------------------------------------------------
+ant-tasks_src_install() {
+ java-pkg_dojar build/lib/${PN}.jar
+ java-pkg_register-ant-task --version "${ANT_TASK_PV}"
+}