diff options
-rw-r--r-- | eclass/commons-jelly-tags-2.eclass | 99 | ||||
-rw-r--r-- | eclass/java-maven-2.eclass | 113 | ||||
-rw-r--r-- | eclass/java-maven-plugin-2.eclass | 47 | ||||
-rw-r--r-- | eclass/jboss-4-tmp.eclass | 96 |
4 files changed, 328 insertions, 27 deletions
diff --git a/eclass/commons-jelly-tags-2.eclass b/eclass/commons-jelly-tags-2.eclass new file mode 100644 index 00000000..815e455e --- /dev/null +++ b/eclass/commons-jelly-tags-2.eclass @@ -0,0 +1,99 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# Original Author: Joshua Nichols <nichoj@gentoo.org> +# Migrated to -2 by kiorky kiorky@¢ryptelium.net +# Purpose: facilitate packaging commons-jellyt-tags-* + +# Procedure for packaging common-jelly-tags: +# * Go to the SVN repository located at: +# http://svn.apache.org/repos/asf/jakarta/commons/proper/jelly/ +# You'll probably want to use things that are tagged, so: +# http://svn.apache.org/repos/asf/jakarta/commons/proper/jelly/tags/ +# * For whatever set to package, from the repository, figure out where the +# source actually lives in the repository. +# ie for log, it'd be http://svn.apache.org/repos/asf/jakarta/commons/proper/jelly/tags/COMMONS-JELLY-LOG-1_0/jelly-tags/log/ +# * Make a checkout of the source to ${P} +# * Make a patch to the build.xml to remove deps: 'get-deps' from compile, and 'test' from +# * Run 'ant get-deps', to figure out what it depends on. +# * For everything that isn't part of LDEPEND below, add it to RDEPEND of the +# ebuild +# * If there is anything isn't part of LDEPEND below, also declare a function +# commons-jelly-tags_src_unpack(), and make the appropriate java-pkg_jar-from +# calls +# * ant clean +# * Create a tarball of the checkout as ${P}.tar.bz2 + +WANT_ANT_TASKS="ant-junit" + +inherit java-pkg-2 java-ant-2 java-maven-2 + +DECRIPTION="An Executable XML Java Elements Framework" +HOMEPAGE="http://jakarta.apache.org/commons/jelly/" +SLOT=${SLOT:=${PV}} +SRC_URI="http://gentooexperimental.org/distfiles/${P}.tar.bz2" +COMMON_DEPS="dev-java/commons-jelly + =dev-java/commons-beanutils-1.6* + dev-java/commons-collections + =dev-java/commons-jexl-1.0* + dev-java/commons-logging + dev-java/commons-lang + =dev-java/dom4j-1* + =dev-java/jaxen-1.1* + >=dev-java/xerces-2.7 + dev-java/junit" +RDEPEND=">=virtual/jre-1.4 ${COMMON_DEPS} ${DEPEND}" +DEPEND=">=virtual/jdk-1.4 ${COMMON_DEPS} ${DEPEND} + source? ( app-arch/zip )" +IUSE="doc source test" +LICENSE="Apache-2.0" + +LEANT_GENTOO_CLASSPATH="commons-jelly-1 + commons-beanutils-1.6 + commons-cli-1 + commons-collections + commons-logging + commons-lang + commons-jexl-1.0 + dom4j-1 + jaxen-1.1 + junit + xerces-2" +EANT_DOC_TARGET="javadoc" +EANT_BUILD_TARGET="compile jar" +EANT_EXTRA_FLAGS="-Dfinal.name=${PN}" + +EXPORT_FUNCTIONS src_unpack src_compile src_install src_test + + +commons-jelly-tags-2_src_unpack() { + unpack ${A} + java-maven-2-rewrite_build_xml +} + +# Pull jars that will be used by all commons-jelly-tags packages +commons-jelly-tags-2_set_gcp() { + if [[ -n ${EANT_GENTOO_CLASSPATH} ]]; then + EANT_GENTOO_CLASSPATH="${EANT_GENTOO_CLASSPATH},${LEANT_GENTOO_CLASSPATH}" + else + EANT_GENTOO_CLASSPATH="${LEANT_GENTOO_CLASSPATH}" + fi +} + +commons-jelly-tags-2_src_compile() { + commons-jelly-tags-2_set_gcp + java-pkg-2_src_compile +} + +commons-jelly-tags-2_src_install() { + java-pkg_newjar target/*.jar ${PN}.jar + use doc && java-pkg_dojavadoc dist/docs/api + use source && java-pkg_dosrc src/java/* +} + +commons-jelly-tags-2_src_test() { + commons-jelly-tags-2_set_gcp + einfo $EANT_GENTOO_CLASSPATH + eant test || die "Tests failed" +} diff --git a/eclass/java-maven-2.eclass b/eclass/java-maven-2.eclass new file mode 100644 index 00000000..f4931605 --- /dev/null +++ b/eclass/java-maven-2.eclass @@ -0,0 +1,113 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit java-pkg-2 java-ant-2 + +JAVA_MAVEN_VERSION=${WANT_MAVEN_VERSION:=1} +SLOT="${JAVA_MAVEN_VERSION}" + +case "${JAVA_MAVEN_VERSION}" in + "1") + JAVA_MAVEN_EXEC="/usr/bin/maven-1" + ;; + "1.1") + JAVA_MAVEN_EXEC="/usr/bin/maven-1.1" + ;; + + "2") + JAVA_MAVEN_EXEC="/usr/bin/mvn" + ;; +esac + +JAVA_MAVEN_SYSTEM_HOME="/usr/share/maven-${SLOT}/maven_home" + +# maven 1 and 1.1 share the same repo +JAVA_MAVEN_SYSTEM_REPOSITORY="/usr/share/maven-${SLOT//1.1/1}/maven_home/gentoo-repo" +JAVA_MAVEN_SYSTEM_PLUGINS="${JAVA_MAVEN_SYSTEM_HOME}/plugins" +JAVA_MAVEN_SYSTEM_BIN="${JAVA_MAVEN_SYSTEM_HOME}/bin" +JAVA_MAVEN_SYSTEM_LIB="${JAVA_MAVEN_SYSTEM_HOME}/lib" + +JAVA_MAVEN_BUILD_HOME=${JAVA_MAVEN_BUILD_HOME:="${T}/.maven"} +JAVA_MAVEN_BUILD_REPO=${JAVA_MAVEN_BUILD_REPO:="${JAVA_MAVEN_BUILD_HOME}/repository"} +JAVA_MAVEN_BUILD_PLUGINS=${JAVA_MAVEN_BUILD_PLUGINS:="${JAVA_MAVEN_BUILD_HOME}/plugins"} + +JAVA_MAVEN_OPTS="${JAVA_MAVEN_OPTS} -Dmaven.home.local=${JAVA_MAVEN_BUILD_HOME}" +JAVA_MAVEN_OPTS="${JAVA_MAVEN_OPTS} -Dmaven.plugin.dir=${JAVA_MAVEN_BUILD_PLUGINS}" +JAVA_MAVEN_OPTS="${JAVA_MAVEN_OPTS} -Dmaven.repo.remote=file:/${JAVA_MAVEN_BUILD_REPO}" +JAVA_MAVEN_OPTS="${JAVA_MAVEN_OPTS} -Dmaven.repo.remote=file:/${JAVA_MAVEN_SYSTEM_REPOSITORY}" + +emaven() { + local gcp="${EMAVEN_GENTOO_CLASSPATH}" + local cp + + for atom in ${gcp}; do + cp="${cp}:$(java-pkg_getjars ${atom})" + done + + local maven_flags="${maven_flags} -Dmaven.plugin.dir=${JAVA_MAVEN_BUILD_PLUGINS}" + maven_flags="${maven_flags} -Dmaven.home.local=${JAVA_MAVEN_BUILD_HOME}" + maven_flags="${maven_flags} -Dmaven.repo.local=${JAVA_MAVEN_BUILD_REPO}" + maven_flags="${maven_flags} -DsystemClasspath${cp}" + + # TODO launch with scope system and systemClasspath set + # launching (offline mode, we dont get anything !) + ${JAVA_MAVEN_EXEC} ${maven_flags} "-o $@" || die "maven failed" +} + +# in case we re using maven1, we will need to generate +# a build.xml to apply our classpath +javava-maven-2-m1-gen_build_xml() { + # generate build.xml whereever there is a project.xml + for project in $(find "${WORKDIR}" -name project*xml);do + cd $(dirname ${project}) || die + emaven ant:ant + || die "Generation of build.xml failed for ${project}" + done +} + +# searching for maven style generated ant build files +# rewrite their classpath and prevent them to use bundled jars ! +# Separated from javava-maven-2-m1-gen_build_xml as we +# don't have always the ant plugin ! +java-maven-2-rewrite_build_xml() { + for build in $(find "${WORKDIR}" -name build*xml);do + java-ant_rewrite-classpath "$build" + # get out of classpath errors at build/test time + sed -i "${build}" -re\ + 's/pathelement\s*path="\$\{testclassesdir\}"/pathelement path="\$\{gentoo.classpath\}:\$\{testclassesdir\}"/'\ + || die + # separate compile and test time + sed -i "${build}" -re\ + 's/compile,test/compile/'\ + || die + # don't get bundled jars + sed -i "${build}" -re\ + 's/depends=\"get-deps\"//'\ + || die + # don't uset bundled jars + sed -i "${build}" -re\ + 's/refid=\"build.classpath\"/path=\"\$\{gentoo.classpath\}\"/'\ + || die + done +} + +java-maven-2_m1_src_unpack() { + base_src_unpack + java-maven-2-m1-gen_build_xml + java-maven-2-rewrite_build_xml +} + +java-maven-2_src_test() { + emaven test || die "Tests failed" +} + +# in most cases we re safe, there is one jar but it can be +# either versionnated or "SNAPSHOTED" +java-maven-2_src_install() { + java-pkg_newjar target/*.jar ${PN}.jar + use doc && java-pkg_dojavadoc dist/docs/api + use source && java-pkg_dosrc src/java/* +} + +EXPORT_FUNCTIONS src_test src_install diff --git a/eclass/java-maven-plugin-2.eclass b/eclass/java-maven-plugin-2.eclass new file mode 100644 index 00000000..455c25b7 --- /dev/null +++ b/eclass/java-maven-plugin-2.eclass @@ -0,0 +1,47 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit java-pkg-2 java-ant-2 java-maven-2 base + +HOMEPAGE="http://maven.apache.org" +SRC_URI="http://gentooexperimental.org/distfiles/${P}-gentoo.tar.bz2" +LICENSE="Apache-2.0" + +RDEPEND=">=virtual/jdk-1.4 dev-java/ant-core" +DEPEND="${RDEPEND}" +IUSE="source doc test" + +EXPORT_FUNCTIONS src_unpack src_compile src_install + +maven-plugin-2_src_unpack() { + # Use base, so we get some patching magic + base_src_unpack + if [[ ${JAVA_MAVEN_VERSION} == "*1*" ]]; then + java-maven-2_m1_src_unpack + fi + +} + +maven-plugin-2_src_compile() { + EMAVEN_TARGET="java:compile" emaven +} + +maven-plugin-2_src_install() { + maven_newplugin target/${P}.jar ${PN}.jar +} + +function maven_newplugin() { + local plugin_jar=${1} + local plugin_basename=$(basename ${1}) + local plugin_newjar="${2}" + + java-pkg_newjar ${plugin_jar} ${plugin_newjar} + + local jardir + if [[ ${SLOT} != "0" ]]; then + jardir="/usr/share/${PN}-${SLOT}/lib" + else + jardir="/usr/share/${PN}/lib" + fi +} diff --git a/eclass/jboss-4-tmp.eclass b/eclass/jboss-4-tmp.eclass index 2bba1f75..298e1fb5 100644 --- a/eclass/jboss-4-tmp.eclass +++ b/eclass/jboss-4-tmp.eclass @@ -10,15 +10,25 @@ inherit java-pkg-2 -DEPEND="${DEPEND} - dev-java/ant-core - dev-java/ant-tasks - =dev-java/bsf-2.3* - dev-java/buildmagic-tasks - dev-java/xml-commons-resolver - dev-java/xalan - =dev-java/xerces-2.6.2* - dev-java/xdoclet" +TOOLS_DEPEND="dev-java/ant-core + dev-java/ant-pretty + dev-java/ant-tasks + =dev-java/bsf-2.3* + dev-java/buildmagic-tasks + =dev-java/eclipse-ecj-3.1* + =dev-java/junit-3.8* + dev-java/xalan + =dev-java/xerces-2.6.2* + =dev-java/xml-commons-external-1.3* + dev-java/xml-commons-resolver" + +jboss-4_get-thirdparty-depend +DEPEND="${DEPEND} ${TOOLS_DEPEND} ${PN_THIRDPARTY_DEPEND} + dev-java/xdoclet + =dev-java/gnu-regexp-1* + dev-java/gnu-jaxp + =dev-java/jaxen-1.1* + " SLOT="4" @@ -30,7 +40,7 @@ S="${JBOSS_ROOT}/${MODULE}" THIRDPARTY_P="jboss-thirdparty-${PV}" TOOLS_P="jboss-tools-${PV}" -GENTOO_CONF="jboss-${PVR}.data" +GENTOO_CONF="jboss-${PVR}.mappings.sh" BASE_URL="http://dev.gentooexperimental.org/~kiorky/" BASE_URL_ORIG="http://gentooexperimental.org/distfiles" ECLASS_URI="${BASE_URL}/${TOOLS_P}.tar.bz2 ${BASE_URL}/${THIRDPARTY_P}.tar.bz2 @@ -76,12 +86,12 @@ jboss-4_fix-dir() { echo ${java_pkg_args} # remove spaces before beginning or after comma # so we can do multilines in the mapping file - # then replace all " " by __ and the "," by " " + # then replace all " " by __ and the "," by " " # for the for statement java_pkg_args=$(echo ${java_pkg_args}|\ - sed -re "s/(^|,)\s*/\1/g" |\ + sed -re "s/(^|,)\s*/\1/g"|\ sed -re "s/\s+/__/g" |\ - sed -re "s/,/ /g" \ + sed -re "s/,/ /g" \ || die "substitute failed") debug-print "value of ${temp}=${java_pkg_args}" @@ -92,9 +102,7 @@ jboss-4_fix-dir() { quiet_pushd "${full_dir}" for i in $(echo "${java_pkg_args}"); do - echo $i - java-pkg_jar-from "${i//__/ }" - echo java-pkg_jar-from "${i//__/ }" + java-pkg_jar-from ${i//__/ } done quiet_popd } @@ -115,13 +123,13 @@ jboss-4_get-dirs-to-fix() { debug-print-function ${FUNCNAME} $* local dirs_to_fix=$(jboss-4_get-dirs-to-fix-for-module ${MODULE}) - for module in $(jboss-4_get-modules-to-fix); do - dirs_to_fix="$(jboss-4_get-dirs-to-fix-for-module ${module}) ${dirs_to_fix}" + for dependency in $(jboss-4_get-modules-to-fix); do + dirs_to_fix="$(jboss-4_get-dirs-to-fix-for-module ${dependency}) ${dirs_to_fix}" done - # get unique dirs... behold bash voodoo magic! + # get unique dirs... behold bash voodoo magic ! dirs_to_fix=$(echo ${dirs_to_fix} | \ - sed -e 's/ /\n/g'|sort | uniq | sed -e 's/\n/ /g') + sed -e 's/ /\n/g'| sort | uniq | sed -e 's/\n/ /g') echo ${dirs_to_fix} } @@ -130,13 +138,43 @@ jboss-4_get-dirs-to-fix-for-module() { debug-print-function ${FUNCNAME} $* local varname=${1//-/_}_library_dirs - #echo "jboss-4_get-dirs-to-fix:varname=${varname}" 1>&2 - local dirs_to_fix=$(eval echo \$$varname) - #echo "jboss-4_get-dirs-to-fix:dirs_to_fix=${dirs_to_fix}" 1>&2 + echo "jboss-4_get-dirs-to-fix:varname=${varname}" 1>&2 + local dirs_to_fix=$(eval echo \$$varname|sed -re "s/\s\s+//g") + echo "jboss-4_get-dirs-to-fix:dirs_to_fix=${dirs_to_fix}" 1>&2 echo ${dirs_to_fix} } +# lookup which depends we must have to ensure third deps own dependencies +jboss-4_get-thirdparty-depend() { + debug-print-function ${FUNCNAME} $* + local depend="" + # getting dependencies + local dirs_to_fix=$(jboss-4_get-dirs-to-fix-for-module ${MODULE}) + # getting the third dep. according direcotries + for dependency in $(jboss-4_get-modules-to-fix); do + dirs_to_fix="$(jboss-4_get-dirs-to-fix-for-module ${dependency}) ${dirs_to_fix}" + done + + # get unique dirs... behold bash voodoo magic ! + dirs_to_fix=$(echo ${dirs_to_fix} | \ + sed -e 's/ /\n/g'| sort | uniq | sed -e 's/\n/ /g') + + # for each thirddep, getting the dependencies from the portage tree + # and apend them to DEPEND + for dir in $(jboss-4_get-dirs-to-fix); do + local temp=${relative_dir//\//_} # convert / to _ + temp="${temp//-/_}_depend" # convert - to _ + eval java_pkg_depend=\$$temp # get the contents of temp + java_pkg_depend=$(echo ${java_pkg_depend} | \ + sed -e 's/ /\n/g'| sort | uniq | sed -e 's/\n/ /g') + depend="${depend} ${java_pkg_depend}" + done + + echo ${depend} +} + + # lookup which modules should be fixed for the current module jboss-4_get-modules-to-fix() { debug-print-function ${FUNCNAME} $* @@ -192,16 +230,20 @@ jboss-4_src_unpack() { # NOTE: don't use java-ant's src_unpack! # it cases some funky issues with buildmagic unpack ${MY_A} - + cd "${S}" || die "cd failed" unpack "${TOOLS_P}.tar.bz2" - + # workaround because something depends on this being around mkdir -p "${JBOSS_THIRDPARTY}/sun-servlet/lib" || die "mkdir failed" - jboss-4_fix-dir tools/lib - #jboss-4_fix-thirdparty +# jboss-4_fix-dir tools/lib + jboss-4_fix-thirdparty + [[ -d ${JBOSS_THIRDPARTY}/apache-tomcat/lib ]] && + ln -s /usr/share/tomcat-5.5/server/webapps/manager/WEB-INF/lib/catalina-manager.jar \ + ${JBOSS_THIRDPARTY}/apache-tomcat/lib || die "ln catalina-manager.jar failed" + #jboss-4_fix-modules } |