/[gentoo-x86]/eclass/java-utils-2.eclass
Gentoo

Diff of /eclass/java-utils-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.28 Revision 1.33
4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> 4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
5# Copyright (c) 2004-2005, Gentoo Foundation 5# Copyright (c) 2004-2005, Gentoo Foundation
6# 6#
7# Licensed under the GNU General Public License, v2 7# Licensed under the GNU General Public License, v2
8# 8#
9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.33 2006/12/07 02:27:22 flameeyes Exp $
9 10
10 11
11# ----------------------------------------------------------------------------- 12# -----------------------------------------------------------------------------
12# @eclass-begin 13# @eclass-begin
13# @eclass-shortdesc Java Utility eclass 14# @eclass-shortdesc Java Utility eclass
22# Java packages, or java-pkg-opt for packages that have optional Java support. 23# Java packages, or java-pkg-opt for packages that have optional Java support.
23# 24#
24# ----------------------------------------------------------------------------- 25# -----------------------------------------------------------------------------
25 26
26inherit eutils versionator multilib 27inherit eutils versionator multilib
28
29IUSE="elibc_FreeBSD"
27 30
28# ----------------------------------------------------------------------------- 31# -----------------------------------------------------------------------------
29# @section-begin variables 32# @section-begin variables
30# @section-title Variables 33# @section-title Variables
31# 34#
287 cp "${original_jar}" "${new_jar_dest}" \ 290 cp "${original_jar}" "${new_jar_dest}" \
288 || die "Failed to copy ${original_jar} to ${new_jar_dest}" 291 || die "Failed to copy ${original_jar} to ${new_jar_dest}"
289 java-pkg_dojar "${new_jar_dest}" 292 java-pkg_dojar "${new_jar_dest}"
290} 293}
291 294
292
293# ------------------------------------------------------------------------------ 295# ------------------------------------------------------------------------------
294# @ebuild-function java-pkg_addcp 296# @ebuild-function java-pkg_addcp
295# 297#
296# Add something to the package's classpath. For jars, you should use dojar, 298# Add something to the package's classpath. For jars, you should use dojar,
297# newjar, or regjar. This is typically used to add directories to the classpath. 299# newjar, or regjar. This is typically used to add directories to the classpath.
301# ------------------------------------------------------------------------------ 303# ------------------------------------------------------------------------------
302java-pkg_addcp() { 304java-pkg_addcp() {
303 java-pkg_append_ JAVA_PKG_CLASSPATH "${@}" 305 java-pkg_append_ JAVA_PKG_CLASSPATH "${@}"
304 java-pkg_do_write_ 306 java-pkg_do_write_
305} 307}
306
307 308
308# ------------------------------------------------------------------------------ 309# ------------------------------------------------------------------------------
309# @ebuild-function java-pkg_doso 310# @ebuild-function java-pkg_doso
310# 311#
311# Installs any number of JNI libraries 312# Installs any number of JNI libraries
429java-pkg_dohtml() { 430java-pkg_dohtml() {
430 debug-print-function ${FUNCNAME} $* 431 debug-print-function ${FUNCNAME} $*
431 432
432 [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}" 433 [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}"
433 434
434 # TODO-nichoj find out what exactly -f package-list does 435 # from /usr/lib/portage/bin/dohtml -h
436 # -f Set list of allowed extensionless file names.
435 dohtml -f package-list "$@" 437 dohtml -f package-list "$@"
438
436 # this probably shouldn't be here but it provides 439 # this probably shouldn't be here but it provides
437 # a reasonable way to catch # docs for all of the 440 # a reasonable way to catch # docs for all of the
438 # old ebuilds. 441 # old ebuilds.
439 java-pkg_recordjavadoc 442 java-pkg_recordjavadoc
440} 443}
441 444
442# TODO document 445# ------------------------------------------------------------------------------
446# @ebuild-function java-pkg_dojavadoc
447#
448# Installs javadoc documentation. This should be controlled by the doc use flag.
449#
450# @param $1: - The javadoc root directory.
451#
452# @example:
453# java-pkg_dojavadoc docs/api
454#
455# ------------------------------------------------------------------------------
443java-pkg_dojavadoc() { 456java-pkg_dojavadoc() {
444 local dir="$1" 457 local dir="$1"
445 458
446 java-pkg_check-phase install 459 java-pkg_check-phase install
447 460
763# The providing packages are recorded as dependencies into package.env DEPEND 776# The providing packages are recorded as dependencies into package.env DEPEND
764# line, unless "--build-only" is passed as the very first argument, for jars 777# line, unless "--build-only" is passed as the very first argument, for jars
765# that have to be present only at build time and are not needed on runtime 778# that have to be present only at build time and are not needed on runtime
766# (junit testing etc). 779# (junit testing etc).
767# 780#
768# Example: Get the classpath for xerces-2, 781# Example: Get the classpath for xerces-2 and xalan,
769# java-pkg_getjars xerces-2 xalan 782# java-pkg_getjars xerces-2,xalan
770# Example Return: 783# Example Return:
771# /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar 784# /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar
772# 785#
773# @param $1 - (optional) "--build-only" makes the jar(s) not added into 786# @param $1 - (optional) "--build-only" makes the jar(s) not added into
774# package.env DEPEND line. 787# package.env DEPEND line.
775# @param $@ - list of packages to get jars from 788# @param $2 - list of packages to get jars from
789# (passed to java-config --classpath)
776# ------------------------------------------------------------------------------ 790# ------------------------------------------------------------------------------
777java-pkg_getjars() { 791java-pkg_getjars() {
778 debug-print-function ${FUNCNAME} $* 792 debug-print-function ${FUNCNAME} $*
779 793
780 local build_only="" 794 [[ ${#} -lt 1 || ${#} -gt 2 ]] && die "${FUNCNAME} takes only one or two arguments"
781 795
782 if [[ "${1}" = "--build-only" ]]; then 796 if [[ "${1}" = "--build-only" ]]; then
783 build_only="true" 797 local build_only="true"
784 shift 798 shift
785 fi 799 fi
786 800
787 [[ ${#} -lt 1 ]] && die "At least one argument needed"
788
789 # NOTE could probably just pass $@ to java-config --classpath. and return it
790 local classpath pkg 801 local classpath pkgs="${1}"
791 for pkg in ${@//,/ }; do
792 #for pkg in $(echo "$@" | tr ',' ' '); do
793 jars="$(java-config --classpath=${pkg})" 802 jars="$(java-config --classpath=${pkgs})"
794 [[ -z "${jars}" ]] && die "java-config --classpath=${pkg} failed" 803 [[ -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed"
795 debug-print "${pkg}:${jars}" 804 debug-print "${pkgs}:${jars}"
796 805
797 if [[ -z "${classpath}" ]]; then 806 if [[ -z "${classpath}" ]]; then
798 classpath="${jars}" 807 classpath="${jars}"
799 else 808 else
800 classpath="${classpath}:${jars}" 809 classpath="${classpath}:${jars}"
801 fi 810 fi
811
802 # Only record jars that aren't build-only 812 # Only record jars that aren't build-only
803 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" 813 if [[ -z "${build_only}" ]]; then
814 oldifs="${IFS}"
815 IFS=","
816 for pkg in ${pkgs}; do
817 java-pkg_record-jar_ "${pkg}"
804 done 818 done
819 IFS="${oldifs}"
820 fi
821
805 echo "${classpath}" 822 echo "${classpath}"
806} 823}
807 824
808# ------------------------------------------------------------------------------ 825# ------------------------------------------------------------------------------
809# @ebuild-function java-pkg_getjar 826# @ebuild-function java-pkg_getjar
1255 1272
1256# TODO document 1273# TODO document
1257java-pkg_get-jni-cflags() { 1274java-pkg_get-jni-cflags() {
1258 local flags="-I${JAVA_HOME}/include" 1275 local flags="-I${JAVA_HOME}/include"
1259 1276
1277 local platform="linux"
1278 use elibc_FreeBSD && platform="freebsd"
1279
1260 # TODO do a check that the directories are valid 1280 # TODO do a check that the directories are valid
1261 # TODO figure out how to cope with other things than linux...
1262 flags="${flags} -I${JAVA_HOME}/include/linux" 1281 flags="${flags} -I${JAVA_HOME}/include/${platform}"
1263 1282
1264 echo ${flags} 1283 echo ${flags}
1265} 1284}
1266 1285
1267java-pkg_ensure-gcj() { 1286java-pkg_ensure-gcj() {
1827 GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 1846 GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
1828 else 1847 else
1829 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 1848 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
1830 fi 1849 fi
1831 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then 1850 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
1832 eerror "Unable to determine VM for building from dependencies." 1851 eerror "Unable to determine VM for building from dependencies:"
1833 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}" 1852 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
1834 echo "VNEED: ${JAVA_PKG_VNEED}" 1853 echo "VNEED: ${JAVA_PKG_VNEED}"
1854 die "Failed to determine VM for building."
1835 else 1855 else
1836 export GENTOO_VM 1856 export GENTOO_VM
1837 fi 1857 fi
1838 # otherwise just make sure the current VM is sufficient 1858 # otherwise just make sure the current VM is sufficient
1839 else 1859 else

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.20