/[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.26 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
428# ------------------------------------------------------------------------------ 429# ------------------------------------------------------------------------------
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 # TODO-nichoj find out what exactly -f package-list does 434
435 # from /usr/lib/portage/bin/dohtml -h
436 # -f Set list of allowed extensionless file names.
434 dohtml -f package-list "$@" 437 dohtml -f package-list "$@"
438
435 # this probably shouldn't be here but it provides 439 # this probably shouldn't be here but it provides
436 # a reasonable way to catch # docs for all of the 440 # a reasonable way to catch # docs for all of the
437 # old ebuilds. 441 # old ebuilds.
438 java-pkg_recordjavadoc 442 java-pkg_recordjavadoc
439} 443}
440 444
441# 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# ------------------------------------------------------------------------------
442java-pkg_dojavadoc() { 456java-pkg_dojavadoc() {
443 local dir="$1" 457 local dir="$1"
444 458
445 java-pkg_check-phase install 459 java-pkg_check-phase install
446 460
762# The providing packages are recorded as dependencies into package.env DEPEND 776# The providing packages are recorded as dependencies into package.env DEPEND
763# 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
764# 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
765# (junit testing etc). 779# (junit testing etc).
766# 780#
767# Example: Get the classpath for xerces-2, 781# Example: Get the classpath for xerces-2 and xalan,
768# java-pkg_getjars xerces-2 xalan 782# java-pkg_getjars xerces-2,xalan
769# Example Return: 783# Example Return:
770# /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
771# 785#
772# @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
773# package.env DEPEND line. 787# package.env DEPEND line.
774# @param $@ - list of packages to get jars from 788# @param $2 - list of packages to get jars from
789# (passed to java-config --classpath)
775# ------------------------------------------------------------------------------ 790# ------------------------------------------------------------------------------
776java-pkg_getjars() { 791java-pkg_getjars() {
777 debug-print-function ${FUNCNAME} $* 792 debug-print-function ${FUNCNAME} $*
778 793
779 local build_only="" 794 [[ ${#} -lt 1 || ${#} -gt 2 ]] && die "${FUNCNAME} takes only one or two arguments"
780 795
781 if [[ "${1}" = "--build-only" ]]; then 796 if [[ "${1}" = "--build-only" ]]; then
782 build_only="true" 797 local build_only="true"
783 shift 798 shift
784 fi 799 fi
785 800
786 [[ ${#} -lt 1 ]] && die "At least one argument needed"
787
788 # NOTE could probably just pass $@ to java-config --classpath. and return it
789 local classpath pkg 801 local classpath pkgs="${1}"
790 for pkg in ${@//,/ }; do
791 #for pkg in $(echo "$@" | tr ',' ' '); do
792 jars="$(java-config --classpath=${pkg})" 802 jars="$(java-config --classpath=${pkgs})"
793 [[ -z "${jars}" ]] && die "java-config --classpath=${pkg} failed" 803 [[ -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed"
794 debug-print "${pkg}:${jars}" 804 debug-print "${pkgs}:${jars}"
795 805
796 if [[ -z "${classpath}" ]]; then 806 if [[ -z "${classpath}" ]]; then
797 classpath="${jars}" 807 classpath="${jars}"
798 else 808 else
799 classpath="${classpath}:${jars}" 809 classpath="${classpath}:${jars}"
800 fi 810 fi
811
801 # Only record jars that aren't build-only 812 # Only record jars that aren't build-only
802 [[ -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}"
803 done 818 done
819 IFS="${oldifs}"
820 fi
821
804 echo "${classpath}" 822 echo "${classpath}"
805} 823}
806 824
807# ------------------------------------------------------------------------------ 825# ------------------------------------------------------------------------------
808# @ebuild-function java-pkg_getjar 826# @ebuild-function java-pkg_getjar
1254 1272
1255# TODO document 1273# TODO document
1256java-pkg_get-jni-cflags() { 1274java-pkg_get-jni-cflags() {
1257 local flags="-I${JAVA_HOME}/include" 1275 local flags="-I${JAVA_HOME}/include"
1258 1276
1277 local platform="linux"
1278 use elibc_FreeBSD && platform="freebsd"
1279
1259 # TODO do a check that the directories are valid 1280 # TODO do a check that the directories are valid
1260 # TODO figure out how to cope with other things than linux...
1261 flags="${flags} -I${JAVA_HOME}/include/linux" 1281 flags="${flags} -I${JAVA_HOME}/include/${platform}"
1262 1282
1263 echo ${flags} 1283 echo ${flags}
1264} 1284}
1265 1285
1266java-pkg_ensure-gcj() { 1286java-pkg_ensure-gcj() {
1614# Writes the package.env out to disk. 1634# Writes the package.env out to disk.
1615# 1635#
1616# ------------------------------------------------------------------------------ 1636# ------------------------------------------------------------------------------
1617# TODO change to do-write, to match everything else 1637# TODO change to do-write, to match everything else
1618java-pkg_do_write_() { 1638java-pkg_do_write_() {
1639 java-pkg_init_paths_
1619 # Create directory for package.env 1640 # Create directory for package.env
1620 dodir "${JAVA_PKG_SHAREPATH}" 1641 dodir "${JAVA_PKG_SHAREPATH}"
1621 if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f "${JAVA_PKG_DEPEND}" ]]; then 1642 if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f "${JAVA_PKG_DEPEND}" ]]; then
1622 # Create package.env 1643 # Create package.env
1623 ( 1644 (
1651 # Strip unnecessary leading and trailing colons 1672 # Strip unnecessary leading and trailing colons
1652 # TODO try to cleanup if possible 1673 # TODO try to cleanup if possible
1653 sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?" 1674 sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?"
1654 fi 1675 fi
1655} 1676}
1656
1657 1677
1658# ------------------------------------------------------------------------------ 1678# ------------------------------------------------------------------------------
1659# @internal-function java-pkg_record-jar_ 1679# @internal-function java-pkg_record-jar_
1660# 1680#
1661# Record a dependency to the package.env 1681# Record a dependency to the package.env
1826 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}}")"
1827 else 1847 else
1828 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}}")"
1829 fi 1849 fi
1830 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then 1850 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
1831 eerror "Unable to determine VM for building from dependencies." 1851 eerror "Unable to determine VM for building from dependencies:"
1832 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}" 1852 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
1833 echo "VNEED: ${JAVA_PKG_VNEED}" 1853 echo "VNEED: ${JAVA_PKG_VNEED}"
1854 die "Failed to determine VM for building."
1834 else 1855 else
1835 export GENTOO_VM 1856 export GENTOO_VM
1836 fi 1857 fi
1837 # otherwise just make sure the current VM is sufficient 1858 # otherwise just make sure the current VM is sufficient
1838 else 1859 else
1920 ewarn "Possible problem" 1941 ewarn "Possible problem"
1921 die "Bad class files found" 1942 die "Bad class files found"
1922 fi 1943 fi
1923} 1944}
1924 1945
1925
1926# ------------------------------------------------------------------------------ 1946# ------------------------------------------------------------------------------
1927# @section-end internal 1947# @section-end internal
1928# ------------------------------------------------------------------------------ 1948# ------------------------------------------------------------------------------
1929 1949
1930java-pkg_check-phase() { 1950java-pkg_check-phase() {

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

  ViewVC Help
Powered by ViewVC 1.1.20