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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.104 - (hide annotations) (download)
Mon Mar 3 17:55:21 2008 UTC (6 years, 7 months ago) by betelgeuse
Branch: MAIN
Changes since 1.103: +9 -11 lines
Add the ability to get GENTOO_COMPILER from the JDK config. This enables things like jamvm to use ecj. Record SLOT in package.env.

1 nichoj 1.1 # Base eclass for Java packages
2     #
3     # Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4     # Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
5     # Copyright (c) 2004-2005, Gentoo Foundation
6     #
7     # Licensed under the GNU General Public License, v2
8     #
9 betelgeuse 1.104 # $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.103 2008/01/12 15:08:47 caster Exp $
10 nichoj 1.1
11     # -----------------------------------------------------------------------------
12     # @eclass-begin
13     # @eclass-shortdesc Java Utility eclass
14     # @eclass-maintainer java@gentoo.org
15     #
16 betelgeuse 1.19 # This eclass provides functionality which is used by
17 nichoj 1.1 # java-pkg.eclass and java-pkg-opt.eclass as well as from ebuilds.
18     #
19 betelgeuse 1.19 # @warning
20 nichoj 1.1 # You probably don't want to inherit this directly from an ebuild. Instead,
21 betelgeuse 1.19 # you should inherit java-ant for Ant-based Java packages, java-pkg for other
22 nichoj 1.1 # Java packages, or java-pkg-opt for packages that have optional Java support.
23     #
24     # -----------------------------------------------------------------------------
25    
26     inherit eutils versionator multilib
27    
28 flameeyes 1.33 IUSE="elibc_FreeBSD"
29    
30 nichoj 1.1 # -----------------------------------------------------------------------------
31     # @section-begin variables
32     # @section-title Variables
33     #
34     # Summary of variables which control the behavior of building Java packges.
35     # -----------------------------------------------------------------------------
36    
37     # Make sure we use java-config-2
38     export WANT_JAVA_CONFIG="2"
39    
40 caster 1.46 # -----------------------------------------------------------------------------
41     # @variable-external WANT_ANT_TASKS
42     # @variable-default ""
43     #
44     # An $IFS separated list of ant tasks.
45     # Ebuild can specify this variable before inheriting java-ant-2 eclass to
46     # determine ANT_TASKS it needs. They will be automatically translated to
47     # DEPEND variable and ANT_TASKS variable. JAVA_PKG_FORCE_ANT_TASKS can override
48     # ANT_TASKS set by WANT_ANT_TASKS, but not the DEPEND due to caching.
49     # Ebuilds that need to depend conditionally on certain tasks and specify them
50     # differently for different eant calls can't use this simplified approach.
51     # You also cannot specify version or anything else than ant-*.
52     #
53     # @example WANT_ANT_TASKS="ant-junit ant-trax"
54     #
55     # @seealso JAVA_PKG_FORCE_ANT_TASKS
56     # -----------------------------------------------------------------------------
57     #WANT_ANT_TASKS
58    
59 nichoj 1.67 # -----------------------------------------------------------------------------
60 caster 1.46 # @variable-internal JAVA_PKG_PORTAGE_DEP
61     #
62 betelgeuse 1.92 # The version of portage we need to function properly. Previously it was
63     # portage with phase hooks support but now we use a version with proper env
64     # saving.
65 caster 1.46 # -----------------------------------------------------------------------------
66 betelgeuse 1.92 JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
67 nichoj 1.7
68 nichoj 1.1 # -----------------------------------------------------------------------------
69     # @variable-internal JAVA_PKG_E_DEPEND
70     #
71     # This is a convience variable to be used from the other java eclasses. This is
72 betelgeuse 1.91 # the version of java-config we want to use. Usually the latest stable version
73     # so that ebuilds can use new features without depending on specific versions.
74 nichoj 1.1 # -----------------------------------------------------------------------------
75 betelgeuse 1.91 JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.33-r1 ${JAVA_PKG_PORTAGE_DEP}"
76 betelgeuse 1.95 hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
77 nichoj 1.1
78     # -----------------------------------------------------------------------------
79     # @variable-external JAVA_PKG_ALLOW_VM_CHANGE
80     # @variable-default yes
81     #
82     # Allow this eclass to change the active VM?
83     # If your system VM isn't sufficient for the package, the build will fail.
84     # @note This is useful for testing specific VMs.
85     # -----------------------------------------------------------------------------
86     JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
87    
88     # -----------------------------------------------------------------------------
89     # @variable-external JAVA_PKG_FORCE_VM
90     #
91     # Explicitly set a particular VM to use. If its not valid, it'll fall back to
92     # whatever /etc/java-config-2/build/jdk.conf would elect to use.
93     #
94     # Should only be used for testing and debugging.
95     #
96     # @example Use sun-jdk-1.5 to emerge foo
97     # JAVA_PKG_FORCE_VM=sun-jdk-1.5 emerge foo
98     #
99     # -----------------------------------------------------------------------------
100    
101     # -----------------------------------------------------------------------------
102     # @variable-external JAVA_PKG_WANT_SOURCE
103     #
104     # Specify a specific VM version to compile for to use for -source.
105     # Normally this is determined from DEPEND.
106     # See java-pkg_get-source function below.
107     #
108     # Should only be used for testing and debugging.
109     #
110     # @seealso java-pkg_get-source
111     #
112     # @example Use 1.4 source to emerge baz
113     # JAVA_PKG_WANT_SOURCE=1.4 emerge baz
114     # -----------------------------------------------------------------------------
115    
116     # -----------------------------------------------------------------------------
117     # @variable-external JAVA_PKG_WANT_TARGET
118     #
119     # Same as JAVA_PKG_WANT_SOURCE above but for -target.
120     # See java-pkg_get-target function below.
121     #
122     # Should only be used for testing and debugging.
123     #
124     # @seealso java-pkg_get-target
125     #
126     # @example emerge bar to be compatible with 1.3
127     # JAVA_PKG_WANT_TARGET=1.3 emerge bar
128     # -----------------------------------------------------------------------------
129    
130     # -----------------------------------------------------------------------------
131     # @variable-internal JAVA_PKG_COMPILER_DIR
132     # @default /usr/share/java-config-2/compiler
133 betelgeuse 1.19 #
134 nichoj 1.1 # Directory where compiler settings are saved, without trailing slash.
135     # Probably shouldn't touch this variable.
136     # -----------------------------------------------------------------------------
137     JAVA_PKG_COMPILER_DIR=${JAVA_PKG_COMPILER_DIR:="/usr/share/java-config-2/compiler"}
138    
139    
140     # -----------------------------------------------------------------------------
141     # @variable-internal JAVA_PKG_COMPILERS_CONF
142     # @variable-default /etc/java-config-2/build/compilers.conf
143     #
144     # Path to file containing information about which compiler to use.
145     # Can be overloaded, but it should be overloaded for testing.
146     # -----------------------------------------------------------------------------
147     JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="/etc/java-config-2/build/compilers.conf"}
148    
149     # -----------------------------------------------------------------------------
150     # @variable-external JAVA_PKG_FORCE_COMPILER
151     #
152     # Explicitly set a list of compilers to use. This is normally read from
153 betelgeuse 1.19 # JAVA_PKG_COMPILERS_CONF.
154 nichoj 1.1 #
155     # @note This should only be used internally or for testing.
156     # @example Use jikes and javac, in that order
157     # JAVA_PKG_FORCE_COMPILER="jikes javac"
158     # -----------------------------------------------------------------------------
159    
160 caster 1.46 # -----------------------------------------------------------------------------
161     # @variable-external JAVA_PKG_FORCE_ANT_TASKS
162     #
163     # An $IFS separated list of ant tasks. Can be set in environment before calling
164     # emerge/ebuild to override variables set in ebuild, mainly for testing before
165     # putting the resulting (WANT_)ANT_TASKS into ebuild. Affects only ANT_TASKS in
166     # eant() call, not the dependencies specified in WANT_ANT_TASKS.
167     #
168     # @example JAVA_PKG_FORCE_ANT_TASKS="ant-junit ant-trax" \
169     # ebuild foo.ebuild compile
170     #
171     # @seealso WANT_ANT_TASKS
172     # -----------------------------------------------------------------------------
173    
174 nichoj 1.1 # TODO document me
175     JAVA_PKG_QA_VIOLATIONS=0
176    
177     # -----------------------------------------------------------------------------
178     # @section-end variables
179     # -----------------------------------------------------------------------------
180    
181    
182     # -----------------------------------------------------------------------------
183     # @section-begin install
184     # @section-summary Install functions
185     #
186     # These are used to install Java-related things, such as jars, Javadocs, JNI
187     # libraries, etc.
188     # -----------------------------------------------------------------------------
189    
190 betelgeuse 1.63 # -----------------------------------------------------------------------------
191     # @ebuild-function java-pkg_doexamples
192     #
193     # Installs given arguments to /usr/share/doc/${PF}/examples
194     # If you give it only one parameter and it is a directory it will install
195     # everything in that directory to the examples directory.
196     #
197     # @example
198     # java-pkg_doexamples demo
199     # java-pkg_doexamples demo/* examples/*
200     #
201 betelgeuse 1.93 # @param --subdir - If the examples need a certain directory structure
202 betelgeuse 1.63 # @param $* - list of files to install
203     # ------------------------------------------------------------------------------
204     java-pkg_doexamples() {
205     debug-print-function ${FUNCNAME} $*
206    
207     [[ ${#} -lt 1 ]] && die "At least one argument needed"
208    
209     java-pkg_check-phase install
210    
211     local dest=/usr/share/doc/${PF}/examples
212 betelgeuse 1.93 if [[ ${1} == --subdir ]]; then
213     local dest=${dest}/${2}
214     dodir ${dest}
215     shift 2
216     fi
217    
218 betelgeuse 1.63 if [[ ${#} = 1 && -d ${1} ]]; then
219 vapier 1.69 ( # dont want to pollute calling env
220     insinto "${dest}"
221     doins -r ${1}/*
222     ) || die "Installing examples failed"
223 betelgeuse 1.63 else
224 vapier 1.69 ( # dont want to pollute calling env
225     insinto "${dest}"
226     doins -r "$@"
227     ) || die "Installing examples failed"
228 betelgeuse 1.63 fi
229     }
230 nichoj 1.1
231     # -----------------------------------------------------------------------------
232     # @ebuild-function java-pkg_dojar
233     #
234     # Installs any number of jars.
235     # Jar's will be installed into /usr/share/${PN}(-${SLOT})/lib/ by default.
236     # You can use java-pkg_jarinto to change this path.
237 betelgeuse 1.19 # You should never install a jar with a package version in the filename.
238 nichoj 1.1 # Instead, use java-pkg_newjar defined below.
239     #
240     # @example
241     # java-pkg_dojar dist/${PN}.jar dist/${PN}-core.jar
242     #
243     # @param $* - list of jars to install
244     # ------------------------------------------------------------------------------
245     java-pkg_dojar() {
246     debug-print-function ${FUNCNAME} $*
247    
248     [[ ${#} -lt 1 ]] && die "At least one argument needed"
249    
250     java-pkg_check-phase install
251     java-pkg_init_paths_
252    
253     # Create JARDEST if it doesn't exist
254     dodir ${JAVA_PKG_JARDEST}
255    
256     local jar
257     # for each jar
258 caster 1.50 for jar in "${@}"; do
259 nichoj 1.1 local jar_basename=$(basename "${jar}")
260    
261     java-pkg_check-versioned-jar ${jar_basename}
262    
263     # check if it exists
264     if [[ -e "${jar}" ]] ; then
265 betelgeuse 1.43 # Don't overwrite if jar has already been installed with the same
266     # name
267     local dest="${D}${JAVA_PKG_JARDEST}/${jar_basename}"
268     if [[ -e "${dest}" ]]; then
269     ewarn "Overwriting ${dest}"
270     fi
271    
272 nichoj 1.1 # install it into JARDEST if it's a non-symlink
273     if [[ ! -L "${jar}" ]] ; then
274 betelgeuse 1.55 #but first check class version when in strict mode.
275     is-java-strict && java-pkg_verify-classes "${jar}"
276    
277 nichoj 1.1 INSDESTTREE="${JAVA_PKG_JARDEST}" \
278     doins "${jar}" || die "failed to install ${jar}"
279     java-pkg_append_ JAVA_PKG_CLASSPATH "${JAVA_PKG_JARDEST}/${jar_basename}"
280     debug-print "installed ${jar} to ${D}${JAVA_PKG_JARDEST}"
281     # make a symlink to the original jar if it's symlink
282     else
283     # TODO use dosym, once we find something that could use it
284     # -nichoj
285     ln -s "$(readlink "${jar}")" "${D}${JAVA_PKG_JARDEST}/${jar_basename}"
286     debug-print "${jar} is a symlink, linking accordingly"
287     fi
288     else
289     die "${jar} does not exist"
290     fi
291     done
292    
293     java-pkg_do_write_
294     }
295    
296 betelgeuse 1.35 # ------------------------------------------------------------------------------
297     # @internal-function depend-java-query
298     #
299     # Wrapper for the depend-java-query binary to enable passing USE in env.
300     # Using env variables keeps this eclass working with java-config versions that
301     # do not handle use flags.
302     # ------------------------------------------------------------------------------
303    
304     depend-java-query() {
305 betelgeuse 1.61 # Used to have a which call here but it caused endless loops for some people
306 betelgeuse 1.62 # that had some weird bashrc voodoo for which.
307 betelgeuse 1.61 USE="${USE}" /usr/bin/depend-java-query "${@}"
308 betelgeuse 1.35 }
309 nichoj 1.1
310     # ------------------------------------------------------------------------------
311     # @ebuild-function java-pkg_regjar
312     #
313     # Records an already installed jar in the package.env
314     # This would mostly be used if the package has make or a custom script to
315     # install things.
316     #
317     # Example:
318 nelchael 1.5 # java-pkg_regjar ${D}/opt/foo/lib/foo.jar
319     #
320     # WARNING:
321     # if you want to use shell expansion, you have to use ${D}/... as the for in
322     # this function will not be able to expand the path, here's an example:
323     #
324     # java-pkg_regjar /opt/my-java/lib/*.jar
325     #
326     # will not work, because:
327     # * the `for jar in "$@"` can't expand the path to jar file names, as they
328     # don't exist yet
329     # * all `if ...` inside for will fail - the file '/opt/my-java/lib/*.jar'
330     # doesn't exist
331 betelgeuse 1.19 #
332 nelchael 1.5 # you have to use it as:
333     #
334     # java-pkg_regjar ${D}/opt/my-java/lib/*.jar
335 nichoj 1.1 #
336     # @param $@ - jars to record
337     # ------------------------------------------------------------------------------
338 nichoj 1.10 # TODO should we be making sure the jar is present on ${D} or wherever?
339 nichoj 1.1 java-pkg_regjar() {
340     debug-print-function ${FUNCNAME} $*
341    
342     java-pkg_check-phase install
343    
344     [[ ${#} -lt 1 ]] && die "at least one argument needed"
345    
346     java-pkg_init_paths_
347    
348     local jar jar_dir jar_file
349 caster 1.50 for jar in "${@}"; do
350 nichoj 1.1 # TODO use java-pkg_check-versioned-jar
351 betelgeuse 1.38 if [[ -e "${jar}" || -e "${D}${jar}" ]]; then
352     [[ -d "${jar}" || -d "${D}${jar}" ]] \
353     && die "Called ${FUNCNAME} on a directory $*"
354 betelgeuse 1.55
355     #check that class version correct when in strict mode
356     is-java-strict && java-pkg_verify-classes "${jar}"
357    
358 nelchael 1.5 # nelchael: we should strip ${D} in this case too, here's why:
359     # imagine such call:
360     # java-pkg_regjar ${D}/opt/java/*.jar
361     # such call will fall into this case (-e ${jar}) and will
362     # record paths with ${D} in package.env
363     java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}"
364 nichoj 1.1 else
365 betelgeuse 1.68 if [[ ${jar} = *\** ]]; then
366     eerror "The argument ${jar} to ${FUNCNAME}"
367     eerror "has * in it. If you want it to glob in"
368     eerror '${D} add ${D} to the argument.'
369     fi
370 nichoj 1.1 die "${jar} does not exist"
371     fi
372     done
373    
374     java-pkg_do_write_
375     }
376    
377     # ------------------------------------------------------------------------------
378     # @ebuild-function java-pkg_newjar
379     #
380     # Installs a jar with a new name
381     #
382     # @example: install a versioned jar without the version
383     # java-pkg_newjar dist/${P}.jar ${PN}.jar
384     #
385     # @param $1 - jar to install
386     # @param $2 - new name for jar - defaults to ${PN}.jar if not specified
387     # ------------------------------------------------------------------------------
388     java-pkg_newjar() {
389     debug-print-function ${FUNCNAME} $*
390    
391     local original_jar="${1}"
392     local new_jar="${2:-${PN}.jar}"
393     local new_jar_dest="${T}/${new_jar}"
394    
395     [[ -z ${original_jar} ]] && die "Must specify a jar to install"
396 betelgeuse 1.44 [[ ! -f ${original_jar} ]] \
397     && die "${original_jar} does not exist or is not a file!"
398 nichoj 1.1
399     rm -f "${new_jar_dest}" || die "Failed to remove ${new_jar_dest}"
400     cp "${original_jar}" "${new_jar_dest}" \
401     || die "Failed to copy ${original_jar} to ${new_jar_dest}"
402     java-pkg_dojar "${new_jar_dest}"
403     }
404    
405     # ------------------------------------------------------------------------------
406     # @ebuild-function java-pkg_addcp
407     #
408     # Add something to the package's classpath. For jars, you should use dojar,
409     # newjar, or regjar. This is typically used to add directories to the classpath.
410     #
411     # TODO add example
412     # @param $@ - value to append to JAVA_PKG_CLASSPATH
413     # ------------------------------------------------------------------------------
414     java-pkg_addcp() {
415     java-pkg_append_ JAVA_PKG_CLASSPATH "${@}"
416     java-pkg_do_write_
417     }
418    
419     # ------------------------------------------------------------------------------
420     # @ebuild-function java-pkg_doso
421 betelgeuse 1.19 #
422 nichoj 1.1 # Installs any number of JNI libraries
423     # They will be installed into /usr/lib by default, but java-pkg_sointo
424     # can be used change this path
425     #
426     # Example:
427     # java-pkg_doso *.so
428     #
429     # @param $@ - JNI libraries to install
430     # ------------------------------------------------------------------------------
431     java-pkg_doso() {
432     debug-print-function ${FUNCNAME} $*
433    
434     [[ ${#} -lt 1 ]] && "At least one argument required for ${FUNCNAME}"
435     java-pkg_check-phase install
436    
437     [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}"
438    
439     java-pkg_init_paths_
440    
441     local lib
442     # for each lib
443     for lib in "$@" ; do
444     # if the lib exists...
445     if [[ -e "${lib}" ]] ; then
446     # install if it isn't a symlink
447     if [[ ! -L "${lib}" ]] ; then
448     INSDESTTREE="${JAVA_PKG_LIBDEST}" \
449     INSOPTIONS="${LIBOPTIONS}" \
450     doins "${lib}" || "failed to install ${lib}"
451     java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
452     debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
453     # otherwise make a symlink to the symlink's origin
454     else
455     # TODO use dosym
456 betelgeuse 1.57 ln -s "$(readlink "${lib}")" \
457     "${D}${JAVA_PKG_LIBDEST}/$(basename "${lib}")"
458 nichoj 1.1 debug-print "${lib} is a symlink, linking accordanly"
459     fi
460     # otherwise die
461     else
462     die "${lib} does not exist"
463     fi
464     done
465    
466     java-pkg_do_write_
467     }
468    
469     # ------------------------------------------------------------------------------
470     # @ebuild-function java-pkg_regso
471     #
472     # Registers an already JNI library in package.env.
473     #
474     # Example:
475     # java-pkg_regso *.so /path/*.so
476     #
477     # @param $@ - JNI libraries to register
478     # ------------------------------------------------------------------------------
479     java-pkg_regso() {
480     debug-print-function ${FUNCNAME} $*
481    
482     java-pkg_check-phase install
483    
484     [[ ${#} -lt 1 ]] && "at least one argument needed"
485    
486     java-pkg_init_paths_
487 betelgeuse 1.19
488 nichoj 1.1 local lib target_dir
489     for lib in "$@" ; do
490     # Check the absolute path of the lib
491     if [[ -e "${lib}" ]] ; then
492     target_dir="$(java-pkg_expand_dir_ ${lib})"
493     java-pkg_append_ JAVA_PKG_LIBRARY "/${target_dir#${D}}"
494     # Check the path of the lib relative to ${D}
495     elif [[ -e "${D}${lib}" ]]; then
496     target_dir="$(java-pkg_expand_dir_ ${D}${lib})"
497     java-pkg_append_ JAVA_PKG_LIBRARY "${target_dir}"
498     else
499     die "${lib} does not exist"
500     fi
501     done
502    
503     java-pkg_do_write_
504     }
505    
506     # ------------------------------------------------------------------------------
507     # @ebuild-function java-pkg_jarinto
508     #
509     # Changes the path jars are installed into
510     #
511     # @param $1 - new location to install jars into.
512     # -----------------------------------------------------------------------------
513     java-pkg_jarinto() {
514     debug-print-function ${FUNCNAME} $*
515    
516     JAVA_PKG_JARDEST="${1}"
517     }
518    
519     # ------------------------------------------------------------------------------
520     # @ebuild-function java-pkg_sointo
521     #
522     # Changes the path that JNI libraries are installed into.
523     #
524     # @param $1 - new location to install JNI libraries into.
525     # ------------------------------------------------------------------------------
526     java-pkg_sointo() {
527     debug-print-function ${FUNCNAME} $*
528    
529     JAVA_PKG_LIBDEST="${1}"
530     }
531    
532     # ------------------------------------------------------------------------------
533     # @ebuild-function java-pkg_dohtml
534     #
535     # Install Javadoc HTML documentation
536     #
537     # @example
538     # java-pkg_dohtml dist/docs/
539     #
540     # ------------------------------------------------------------------------------
541     java-pkg_dohtml() {
542     debug-print-function ${FUNCNAME} $*
543    
544     [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}"
545 betelgeuse 1.27
546 betelgeuse 1.31 # from /usr/lib/portage/bin/dohtml -h
547     # -f Set list of allowed extensionless file names.
548 nichoj 1.1 dohtml -f package-list "$@"
549 betelgeuse 1.31
550 nichoj 1.1 # this probably shouldn't be here but it provides
551     # a reasonable way to catch # docs for all of the
552     # old ebuilds.
553     java-pkg_recordjavadoc
554     }
555    
556 betelgeuse 1.30 # ------------------------------------------------------------------------------
557     # @ebuild-function java-pkg_dojavadoc
558     #
559     # Installs javadoc documentation. This should be controlled by the doc use flag.
560     #
561 betelgeuse 1.99 # @param $1: optional --symlink creates to symlink like this for html
562     # documentation bundles.
563     # @param $2: - The javadoc root directory.
564 betelgeuse 1.30 #
565     # @example:
566     # java-pkg_dojavadoc docs/api
567 betelgeuse 1.99 # java-pkg_dojavadoc --symlink apidocs docs/api
568 betelgeuse 1.30 #
569     # ------------------------------------------------------------------------------
570 nichoj 1.1 java-pkg_dojavadoc() {
571 betelgeuse 1.74 debug-print-function ${FUNCNAME} $*
572 betelgeuse 1.99
573     # For html documentation bundles that link to Javadoc
574     local symlink
575     if [[ ${1} = --symlink ]]; then
576     symlink=${2}
577     shift 2
578     fi
579    
580 nichoj 1.1 local dir="$1"
581 betelgeuse 1.99 local dest=/usr/share/doc/${PF}/html
582 nichoj 1.1
583 betelgeuse 1.74 # QA checks
584    
585 nichoj 1.1 java-pkg_check-phase install
586    
587     [[ -z "${dir}" ]] && die "Must specify a directory!"
588     [[ ! -d "${dir}" ]] && die "${dir} does not exist, or isn't a directory!"
589 betelgeuse 1.74 if [[ ! -e "${dir}/index.html" ]]; then
590     local msg="No index.html in javadoc directory"
591     ewarn "${msg}"
592     is-java-strict && die "${msg}"
593     fi
594    
595 betelgeuse 1.99 if [[ -e ${D}/${dest}/api ]]; then
596     eerror "${dest} already exists. Will not overwrite."
597     die "${dest}"
598     fi
599    
600 betelgeuse 1.74 # Renaming to match our directory layout
601 nichoj 1.1
602     local dir_to_install="${dir}"
603     if [[ "$(basename "${dir}")" != "api" ]]; then
604     dir_to_install="${T}/api"
605     # TODO use doins
606     cp -r "${dir}" "${dir_to_install}" || die "cp failed"
607     fi
608    
609 betelgeuse 1.74 # Actual installation
610    
611 betelgeuse 1.99 java-pkg_dohtml -r "${dir_to_install}"
612    
613     # Let's make a symlink to the directory we have everything else under
614 betelgeuse 1.100 dosym ${dest}/api "${JAVA_PKG_SHAREPATH}/api" || die
615 betelgeuse 1.99
616     if [[ ${symlink} ]]; then
617     dosym ${dest}/{api,${symlink}} || die
618     fi
619 nichoj 1.1 }
620    
621     # ------------------------------------------------------------------------------
622     # @ebuild-function java-pkg_dosrc
623     #
624 betelgeuse 1.19 # Installs a zip containing the source for a package, so it can used in
625 nichoj 1.1 # from IDEs like eclipse and netbeans.
626     #
627     # Ebuild needs to DEPEND on app-arch/zip to use this.
628     #
629     # It also should be controlled by USE=source.
630     #
631     # @example:
632     # java-pkg_dosrc src/*
633     #
634     # ------------------------------------------------------------------------------
635 betelgeuse 1.19 # TODO change so it the arguments it takes are the base directories containing
636 nichoj 1.1 # source -nichoj
637     # TODO should we be able to handle multiple calls to dosrc? -nichoj
638     # TODO maybe we can take an existing zip/jar? -nichoj
639     # FIXME apparently this fails if you give it an empty directories
640     java-pkg_dosrc() {
641     debug-print-function ${FUNCNAME} $*
642    
643 betelgeuse 1.19 [ ${#} -lt 1 ] && die "At least one argument needed"
644 nichoj 1.1
645     java-pkg_check-phase install
646    
647 betelgeuse 1.19 [[ ${#} -lt 1 ]] && die "At least one argument needed"
648 nichoj 1.1
649 betelgeuse 1.66 if ! [[ ${DEPEND} = *app-arch/zip* ]]; then
650     local msg="${FUNCNAME} called without app-arch/zip in DEPEND"
651 betelgeuse 1.104 java-pkg_announce-qa-violation ${msg}
652 betelgeuse 1.66 fi
653    
654 nichoj 1.1 java-pkg_init_paths_
655    
656     local zip_name="${PN}-src.zip"
657     local zip_path="${T}/${zip_name}"
658     local dir
659 caster 1.50 for dir in "${@}"; do
660 nichoj 1.1 local dir_parent=$(dirname "${dir}")
661     local dir_name=$(basename "${dir}")
662     pushd ${dir_parent} > /dev/null || die "problem entering ${dir_parent}"
663     zip -q -r ${zip_path} ${dir_name} -i '*.java'
664     local result=$?
665     # 12 means zip has nothing to do
666     if [[ ${result} != 12 && ${result} != 0 ]]; then
667     die "failed to zip ${dir_name}"
668     fi
669     popd >/dev/null
670     done
671    
672     # Install the zip
673     INSDESTTREE=${JAVA_PKG_SOURCESPATH} \
674     doins ${zip_path} || die "Failed to install source"
675    
676     JAVA_SOURCES="${JAVA_PKG_SOURCESPATH}/${zip_name}"
677     java-pkg_do_write_
678     }
679    
680     # ------------------------------------------------------------------------------
681     # @ebuild-function java-pkg_dolauncher
682     #
683     # Make a wrapper script to lauch/start this package
684     # If necessary, the wrapper will switch to the appropriate VM.
685     #
686 betelgeuse 1.25 # Can be called without parameters if the package installs only one jar
687     # that has the Main-class attribute set. The wrapper will be named ${PN}.
688     #
689 nichoj 1.1 # @param $1 - filename of launcher to create
690     # @param $2 - options, as follows:
691     # --main the.main.class.too.start
692 betelgeuse 1.25 # --jar /the/jar/too/launch.jar or just <name>.jar
693 betelgeuse 1.20 # --java_args 'Extra arguments to pass to java'
694 caster 1.42 # --pkg_args 'Extra arguments to pass to the package'
695     # --pwd Directory the launcher changes to before executing java
696     # -into Directory to install the launcher to, instead of /usr/bin
697     # -pre Prepend contents of this file to the launcher
698 nichoj 1.1 # ------------------------------------------------------------------------------
699     java-pkg_dolauncher() {
700     debug-print-function ${FUNCNAME} $*
701    
702     java-pkg_check-phase install
703 betelgeuse 1.25 java-pkg_init_paths_
704 nichoj 1.1
705 betelgeuse 1.25 if [[ ${#} = 0 ]]; then
706     local name="${PN}"
707     else
708     local name="${1}"
709     shift
710     fi
711 nichoj 1.1
712     # TODO rename to launcher
713     local target="${T}/${name}"
714 betelgeuse 1.20 local var_tmp="${T}/launcher_variables_tmp"
715 nichoj 1.1 local target_dir pre
716    
717 betelgeuse 1.20 # Process the other the rest of the arguments
718 nichoj 1.1 while [[ -n "${1}" && -n "${2}" ]]; do
719 betelgeuse 1.38 local var="${1}" value="${2}"
720 betelgeuse 1.19 if [[ "${var:0:2}" == "--" ]]; then
721 betelgeuse 1.25 local var=${var:2}
722     echo "gjl_${var}=\"${value}\"" >> "${var_tmp}"
723 betelgeuse 1.26 local gjl_${var}="${value}"
724 nichoj 1.1 elif [[ "${var}" == "-into" ]]; then
725     target_dir="${value}"
726     elif [[ "${var}" == "-pre" ]]; then
727     pre="${value}"
728     fi
729     shift 2
730     done
731 betelgeuse 1.20
732 betelgeuse 1.25 # Test if no --jar and --main arguments were given and
733     # in that case check if the package only installs one jar
734     # and use that jar.
735     if [[ -z "${gjl_jar}" && -z "${gjl_main}" ]]; then
736     local cp="${JAVA_PKG_CLASSPATH}"
737     if [[ "${cp/:}" = "${cp}" && "${cp%.jar}" != "${cp}" ]]; then
738     echo "gjl_jar=\"${JAVA_PKG_CLASSPATH}\"" >> "${var_tmp}"
739     else
740     local msg="Not enough information to create a launcher given."
741     msg="${msg} Please give --jar or --main argument to ${FUNCNAME}."
742     die "${msg}"
743     fi
744     fi
745    
746 betelgeuse 1.20 # Write the actual script
747     echo "#!/bin/bash" > "${target}"
748 caster 1.42 if [[ -n "${pre}" ]]; then
749     if [[ -f "${pre}" ]]; then
750     cat "${pre}" >> "${target}"
751     else
752     die "-pre specified file '${pre}' does not exist"
753     fi
754     fi
755 nichoj 1.1 echo "gjl_package=${JAVA_PKG_NAME}" >> "${target}"
756 betelgeuse 1.20 cat "${var_tmp}" >> "${target}"
757 caster 1.21 rm -f "${var_tmp}"
758 nichoj 1.1 echo "source /usr/share/java-config-2/launcher/launcher.bash" >> "${target}"
759 betelgeuse 1.19
760 nichoj 1.17 if [[ -n "${target_dir}" ]]; then
761 nichoj 1.1 DESTTREE="${target_dir}" dobin "${target}"
762     local ret=$?
763     return ${ret}
764     else
765     dobin "${target}"
766     fi
767     }
768    
769     # ------------------------------------------------------------------------------
770     # Install war files.
771     # TODO document
772     # ------------------------------------------------------------------------------
773     java-pkg_dowar() {
774     debug-print-function ${FUNCNAME} $*
775    
776     # Check for arguments
777     [[ ${#} -lt 1 ]] && die "At least one argument needed"
778     java-pkg_check-phase install
779    
780     java-pkg_init_paths_
781    
782     local war
783     for war in $* ; do
784     local warpath
785     # TODO evaluate if we want to handle symlinks differently -nichoj
786     # Check for symlink
787     if [[ -L "${war}" ]] ; then
788     cp "${war}" "${T}"
789     warpath="${T}$(basename "${war}")"
790     # Check for directory
791     # TODO evaluate if we want to handle directories differently -nichoj
792     elif [[ -d "${war}" ]] ; then
793     echo "dowar: warning, skipping directory ${war}"
794     continue
795     else
796     warpath="${war}"
797     fi
798 betelgeuse 1.18
799 nichoj 1.1 # Install those files like you mean it
800     INSOPTIONS="-m 0644" \
801     INSDESTTREE=${JAVA_PKG_WARDEST} \
802     doins ${warpath}
803     done
804     }
805    
806     # ------------------------------------------------------------------------------
807     # @internal-function java-pkg_recordjavadoc
808     # Scan for JavaDocs, and record their existence in the package.env file
809     #
810     # TODO make sure this in the proper section
811     # ------------------------------------------------------------------------------
812     java-pkg_recordjavadoc()
813     {
814     debug-print-function ${FUNCNAME} $*
815     # the find statement is important
816     # as some packages include multiple trees of javadoc
817     JAVADOC_PATH="$(find ${D}/usr/share/doc/ -name allclasses-frame.html -printf '%h:')"
818     # remove $D - TODO: check this is ok with all cases of the above
819     JAVADOC_PATH="${JAVADOC_PATH//${D}}"
820     if [[ -n "${JAVADOC_PATH}" ]] ; then
821     debug-print "javadocs found in ${JAVADOC_PATH%:}"
822     java-pkg_do_write_
823     else
824     debug-print "No javadocs found"
825     fi
826     }
827    
828     # ------------------------------------------------------------------------------
829     # @section-end install
830     # ------------------------------------------------------------------------------
831    
832     # ------------------------------------------------------------------------------
833     # @begin-section query
834     # Use these to build the classpath for building a package.
835     # ------------------------------------------------------------------------------
836    
837     # ------------------------------------------------------------------------------
838     # @ebuild-function java-pkg_jar-from
839     #
840     # Makes a symlink to a jar from a certain package
841     # A lot of java packages include dependencies in a lib/ directory
842     # You can use this function to replace these bundled dependencies.
843 nichoj 1.16 # The dependency is recorded into package.env DEPEND line, unless "--build-only"
844     # is passed as the very first argument, for jars that have to be present only
845     # at build time and are not needed on runtime (junit testing etc).
846 nichoj 1.1 #
847     # Example: get all jars from xerces slot 2
848     # java-pkg_jar-from xerces-2
849     # Example: get a specific jar from xerces slot 2
850     # java-pkg_jar-from xerces-2 xml-apis.jar
851 nichoj 1.16 # Example: get a specific jar from xerces slot 2, and name it diffrently
852 nichoj 1.1 # java-pkg_jar-from xerces-2 xml-apis.jar xml.jar
853 nichoj 1.16 # Example: get junit.jar which is needed only for building
854     # java-pkg_jar-from --build-only junit junit.jar
855 nichoj 1.1 #
856 betelgeuse 1.59 # @param $opt
857 caster 1.49 # --build-only - makes the jar(s) not added into package.env DEPEND line.
858     # (assumed automatically when called inside src_test)
859     # --with-dependencies - get jars also from requested package's dependencies
860     # transitively.
861 ali_bush 1.94 # --virtual - Packages passed to this function are to be handled as virtuals
862     # and will not have individual jar dependencies recorded.
863 caster 1.49 # --into $dir - symlink jar(s) into $dir (must exist) instead of .
864 caster 1.79 # @param $1 - Package to get jars from, or comma-separated list of packages in
865     # case other parameters are not used.
866 nichoj 1.1 # @param $2 - jar from package. If not specified, all jars will be used.
867     # @param $3 - When a single jar is specified, destination filename of the
868     # symlink. Defaults to the name of the jar.
869     # ------------------------------------------------------------------------------
870     # TODO could probably be cleaned up a little
871     java-pkg_jar-from() {
872     debug-print-function ${FUNCNAME} $*
873    
874 nichoj 1.16 local build_only=""
875 caster 1.49 local destdir="."
876     local deep=""
877 ali_bush 1.94 local virtual=""
878 betelgeuse 1.59
879 caster 1.78 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
880 nichoj 1.16
881 caster 1.49 while [[ "${1}" == --* ]]; do
882     if [[ "${1}" = "--build-only" ]]; then
883 caster 1.77 build_only="build"
884 caster 1.49 elif [[ "${1}" = "--with-dependencies" ]]; then
885     deep="--with-dependencies"
886 ali_bush 1.94 elif [[ "${1}" = "--virtual" ]]; then
887     virtual="true"
888 caster 1.49 elif [[ "${1}" = "--into" ]]; then
889     destdir="${2}"
890     shift
891     else
892     die "java-pkg_jar-from called with unknown parameter: ${1}"
893     fi
894 nichoj 1.16 shift
895 caster 1.49 done
896 betelgeuse 1.43
897 betelgeuse 1.18 local target_pkg="${1}" target_jar="${2}" destjar="${3}"
898    
899 nichoj 1.1 [[ -z ${target_pkg} ]] && die "Must specify a package"
900    
901     # default destjar to the target jar
902     [[ -z "${destjar}" ]] && destjar="${target_jar}"
903    
904 betelgeuse 1.18 local error_msg="There was a problem getting the classpath for ${target_pkg}."
905     local classpath
906 betelgeuse 1.43 classpath="$(java-config ${deep} --classpath=${target_pkg})"
907 betelgeuse 1.18 [[ $? != 0 ]] && die ${error_msg}
908 nichoj 1.1
909 betelgeuse 1.60 # When we have commas this functions is called to bring jars from multiple
910 caster 1.79 # packages. This affects recording of dependencencies performed later
911     # which expects one package only, so we do it here.
912 betelgeuse 1.60 if [[ ${target_pkg} = *,* ]]; then
913 caster 1.79 for pkg in ${target_pkg//,/ }; do
914     java-pkg_ensure-dep "${build_only}" "${pkg}"
915     [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}"
916     done
917     # setting this disables further record-jar_ calls later
918 caster 1.78 build_only="build"
919 caster 1.79 else
920     java-pkg_ensure-dep "${build_only}" "${target_pkg}"
921 betelgeuse 1.60 fi
922    
923 ali_bush 1.94 # Record the entire virtual as a dependency so that
924     # no jars are missed.
925     if [[ -z "${build_only}" && -n "${virtual}" ]]; then
926     java-pkg_record-jar_ "${target_pkg}"
927     # setting this disables further record-jars_ calls later
928     build_only="build"
929     fi
930    
931 caster 1.79 pushd ${destdir} > /dev/null \
932     || die "failed to change directory to ${destdir}"
933    
934 nichoj 1.1 local jar
935     for jar in ${classpath//:/ }; do
936     local jar_name=$(basename "${jar}")
937     if [[ ! -f "${jar}" ]] ; then
938     debug-print "${jar} from ${target_pkg} does not exist"
939     die "Installation problems with jars in ${target_pkg} - is it installed?"
940     fi
941     # If no specific target jar was indicated, link it
942     if [[ -z "${target_jar}" ]] ; then
943     [[ -f "${target_jar}" ]] && rm "${target_jar}"
944     ln -snf "${jar}" \
945     || die "Failed to make symlink from ${jar} to ${jar_name}"
946 nichoj 1.16 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}"
947 nichoj 1.1 # otherwise, if the current jar is the target jar, link it
948     elif [[ "${jar_name}" == "${target_jar}" ]] ; then
949     [[ -f "${destjar}" ]] && rm "${destjar}"
950     ln -snf "${jar}" "${destjar}" \
951     || die "Failed to make symlink from ${jar} to ${destjar}"
952 nichoj 1.16 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}"
953 betelgeuse 1.54 popd > /dev/null
954 nichoj 1.1 return 0
955     fi
956     done
957 caster 1.49 popd > /dev/null
958 nichoj 1.1 # if no target was specified, we're ok
959     if [[ -z "${target_jar}" ]] ; then
960     return 0
961     # otherwise, die bitterly
962     else
963     die "Failed to find ${target_jar:-jar} in ${target_pkg}"
964     fi
965     }
966    
967     # ------------------------------------------------------------------------------
968     # @ebuild-function java-pkg_jarfrom
969     #
970     # See java-pkg_jar-from
971     # ------------------------------------------------------------------------------
972     java-pkg_jarfrom() {
973     java-pkg_jar-from "$@"
974     }
975    
976     # ------------------------------------------------------------------------------
977     # @ebuild-function java-pkg_getjars
978     #
979     # Get the classpath provided by any number of packages
980     # Among other things, this can be passed to 'javac -classpath' or 'ant -lib'.
981 nichoj 1.16 # The providing packages are recorded as dependencies into package.env DEPEND
982     # line, unless "--build-only" is passed as the very first argument, for jars
983     # that have to be present only at build time and are not needed on runtime
984     # (junit testing etc).
985 betelgeuse 1.19 #
986 betelgeuse 1.30 # Example: Get the classpath for xerces-2 and xalan,
987     # java-pkg_getjars xerces-2,xalan
988 nichoj 1.1 # Example Return:
989     # /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar
990 betelgeuse 1.19 #
991 betelgeuse 1.59 # @param $opt
992 caster 1.49 # --build-only - makes the jar(s) not added into package.env DEPEND line.
993     # (assumed automatically when called inside src_test)
994     # --with-dependencies - get jars also from requested package's dependencies
995     # transitively.
996     # @param $1 - list of packages to get jars from
997 betelgeuse 1.30 # (passed to java-config --classpath)
998 nichoj 1.1 # ------------------------------------------------------------------------------
999     java-pkg_getjars() {
1000     debug-print-function ${FUNCNAME} $*
1001    
1002 caster 1.49 local build_only=""
1003     local deep=""
1004 betelgeuse 1.59
1005 caster 1.78 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1006 nichoj 1.16
1007 caster 1.49 while [[ "${1}" == --* ]]; do
1008     if [[ "${1}" = "--build-only" ]]; then
1009 caster 1.77 build_only="build"
1010 caster 1.49 elif [[ "${1}" = "--with-dependencies" ]]; then
1011     deep="--with-dependencies"
1012     else
1013     die "java-pkg_jar-from called with unknown parameter: ${1}"
1014     fi
1015 betelgeuse 1.43 shift
1016 caster 1.49 done
1017 betelgeuse 1.43
1018 caster 1.49 [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*"
1019 betelgeuse 1.38
1020 ali_bush 1.70
1021 betelgeuse 1.30 local classpath pkgs="${1}"
1022 betelgeuse 1.43 jars="$(java-config ${deep} --classpath=${pkgs})"
1023 ali_bush 1.70 [[ $? != 0 || -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed"
1024 betelgeuse 1.30 debug-print "${pkgs}:${jars}"
1025    
1026 betelgeuse 1.73 for pkg in ${pkgs//,/ }; do
1027 ali_bush 1.70 java-pkg_ensure-dep "${build_only}" "${pkg}"
1028     done
1029    
1030 betelgeuse 1.30 if [[ -z "${classpath}" ]]; then
1031     classpath="${jars}"
1032     else
1033     classpath="${classpath}:${jars}"
1034     fi
1035 nichoj 1.1
1036 betelgeuse 1.30 # Only record jars that aren't build-only
1037     if [[ -z "${build_only}" ]]; then
1038 caster 1.81 for pkg in ${pkgs//,/ }; do
1039 betelgeuse 1.30 java-pkg_record-jar_ "${pkg}"
1040     done
1041     fi
1042 betelgeuse 1.18
1043 nichoj 1.1 echo "${classpath}"
1044     }
1045    
1046     # ------------------------------------------------------------------------------
1047     # @ebuild-function java-pkg_getjar
1048     #
1049     # Get the filename of a single jar from a package
1050 nichoj 1.16 # The providing package is recorded as runtime dependency into package.env
1051     # DEPEND line, unless "--build-only" is passed as the very first argument, for
1052     # jars that have to be present only at build time and are not needed on runtime
1053     # (junit testing etc).
1054 nichoj 1.1 #
1055     # @example
1056     # java-pkg_getjar xerces-2 xml-apis.jar
1057     # @example-return
1058     # /usr/share/xerces-2/lib/xml-apis.jar
1059 betelgeuse 1.19 #
1060 caster 1.49 # @param $opt
1061     # --build-only - makes the jar not added into package.env DEPEND line.
1062 ali_bush 1.94 # --virtual - Packages passed to this function are to be handled as virtuals
1063     # and will not have individual jar dependencies recorded.
1064 nichoj 1.1 # @param $1 - package to use
1065     # @param $2 - jar to get
1066     # ------------------------------------------------------------------------------
1067     java-pkg_getjar() {
1068     debug-print-function ${FUNCNAME} $*
1069    
1070 nichoj 1.16 local build_only=""
1071 ali_bush 1.94 local virtual=""
1072 betelgeuse 1.59
1073 caster 1.78 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1074 nichoj 1.16
1075 caster 1.49 while [[ "${1}" == --* ]]; do
1076     if [[ "${1}" = "--build-only" ]]; then
1077 caster 1.77 build_only="build"
1078 caster 1.101 elif [[ "${1}" == "--virtual" ]]; then
1079 ali_bush 1.94 virtual="true"
1080 caster 1.49 else
1081 caster 1.102 die "java-pkg_getjar called with unknown parameter: ${1}"
1082 caster 1.49 fi
1083 nichoj 1.16 shift
1084 caster 1.49 done
1085    
1086     [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*"
1087 nichoj 1.16
1088 nichoj 1.1 local pkg="${1}" target_jar="${2}" jar
1089     [[ -z ${pkg} ]] && die "Must specify package to get a jar from"
1090     [[ -z ${target_jar} ]] && die "Must specify jar to get"
1091    
1092 betelgeuse 1.18 local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?"
1093     local classpath
1094     classpath=$(java-config --classpath=${pkg})
1095     [[ $? != 0 ]] && die ${error_msg}
1096    
1097 ali_bush 1.70 java-pkg_ensure-dep "${build_only}" "${pkg}"
1098    
1099 ali_bush 1.94 # Record the package(Virtual) as a dependency and then set build_only
1100     # So that individual jars are not recorded.
1101     if [[ -n "${virtual}" ]]; then
1102     java-pkg_record-jar_ "${pkg}"
1103     build_only="true"
1104     fi
1105    
1106 nichoj 1.1 for jar in ${classpath//:/ }; do
1107     if [[ ! -f "${jar}" ]] ; then
1108 nichoj 1.16 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
1109 nichoj 1.1 fi
1110    
1111     if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then
1112 nichoj 1.16 # Only record jars that aren't build-only
1113     [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" "${jar}"
1114 nichoj 1.1 echo "${jar}"
1115     return 0
1116     fi
1117     done
1118 betelgeuse 1.19
1119 nichoj 1.1 die "Could not find ${target_jar} in ${pkg}"
1120     return 1
1121     }
1122    
1123 caster 1.77 # ------------------------------------------------------------------------------
1124     # @ebuild-function java-pkg_register-dependency
1125     #
1126     # Registers runtime dependency on a package, list of packages, or a single jar
1127     # from a package, into package.env DEPEND line. Can only be called in
1128     # src_install phase.
1129     # Intended for binary packages where you don't need to symlink the jars or get
1130     # their classpath during build. As such, the dependencies only need to be
1131     # specified in ebuild's RDEPEND, and should be omitted in DEPEND.
1132     #
1133     # @param $1 - comma-separated list of packages, or a single package
1134     # @param $2 - if param $1 is a single package, optionally specify the jar
1135     # to depend on
1136     #
1137     # Example: Record the dependency on whole xerces-2 and xalan,
1138     # java-pkg_register-dependency xerces-2,xalan
1139     # Example: Record the dependency on ant.jar from ant-core
1140     # java-pkg_register-dependency ant-core ant.jar
1141     #
1142     # Note: Passing both list of packages as the first parameter AND specifying the
1143     # jar as the second is not allowed and will cause the function to die. We assume
1144     # that there's more chance one passes such combination as a mistake, than that
1145     # there are more packages providing identically named jar without class
1146     # collisions.
1147     # ------------------------------------------------------------------------------
1148     java-pkg_register-dependency() {
1149     debug-print-function ${FUNCNAME} $*
1150    
1151     java-pkg_check-phase install
1152    
1153     [[ ${#} -gt 2 ]] && die "${FUNCNAME} takes at most two arguments"
1154    
1155     local pkgs="${1}"
1156     local jar="${2}"
1157    
1158     [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1159    
1160     if [[ -z "${jar}" ]]; then
1161     for pkg in ${pkgs//,/ }; do
1162     java-pkg_ensure-dep runtime "${pkg}"
1163     java-pkg_record-jar_ "${pkg}"
1164     done
1165     else
1166     [[ ${pkgs} == *,* ]] && \
1167     die "${FUNCNAME} called with both package list and jar name"
1168     java-pkg_ensure-dep runtime "${pkgs}"
1169     java-pkg_record-jar_ "${pkgs}" "${jar}"
1170     fi
1171    
1172 caster 1.85 java-pkg_do_write_
1173     }
1174    
1175     # ------------------------------------------------------------------------------
1176 caster 1.88 # @ebuild-function java-pkg_register-optional-dependency
1177     #
1178     # Registers optional runtime dependency on a package, list of packages, or a
1179     # single jar from a package, into package.env OPTIONAL_DEPEND line. Can only be
1180     # called in src_install phase.
1181     # Intended for packages that can use other packages when those are in classpath.
1182     # Will be put on classpath by launcher if they are installed. Typical case is
1183     # JDBC implementations for various databases. It's better than having USE flag
1184     # for each implementation triggering hard dependency.
1185     #
1186     # @param $1 - comma-separated list of packages, or a single package
1187     # @param $2 - if param $1 is a single package, optionally specify the jar
1188     # to depend on
1189     #
1190     # Example: Record the optional dependency on some jdbc providers
1191     # java-pkg_register-optional-dependency jdbc-jaybird,jtds-1.2,jdbc-mysql
1192     #
1193     # Note: Passing both list of packages as the first parameter AND specifying the
1194     # jar as the second is not allowed and will cause the function to die. We assume
1195     # that there's more chance one passes such combination as a mistake, than that
1196     # there are more packages providing identically named jar without class
1197     # collisions.
1198     # ------------------------------------------------------------------------------
1199     java-pkg_register-optional-dependency() {
1200     debug-print-function ${FUNCNAME} $*
1201    
1202     java-pkg_check-phase install
1203    
1204     [[ ${#} -gt 2 ]] && die "${FUNCNAME} takes at most two arguments"
1205    
1206     local pkgs="${1}"
1207     local jar="${2}"
1208    
1209     [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1210    
1211     if [[ -z "${jar}" ]]; then
1212     for pkg in ${pkgs//,/ }; do
1213     java-pkg_record-jar_ --optional "${pkg}"
1214     done
1215     else
1216     [[ ${pkgs} == *,* ]] && \
1217     die "${FUNCNAME} called with both package list and jar name"
1218     java-pkg_record-jar_ --optional "${pkgs}" "${jar}"
1219     fi
1220    
1221     java-pkg_do_write_
1222     }
1223    
1224     # ------------------------------------------------------------------------------
1225 caster 1.85 # @ebuild-function java-pkg_register-environment-variable
1226     #
1227     # Register an arbitrary environment variable into package.env. The gjl launcher
1228     # for this package or any package depending on this will export it into
1229     # environement before executing java command.
1230     # Must only be called in src_install phase.
1231     #
1232     # @param $1 - variable name
1233     # @param $2 - variable value
1234     # ------------------------------------------------------------------------------
1235     JAVA_PKG_EXTRA_ENV="${T}/java-pkg-extra-env"
1236     JAVA_PKG_EXTRA_ENV_VARS=""
1237     java-pkg_register-environment-variable() {
1238     debug-print-function ${FUNCNAME} $*
1239    
1240     java-pkg_check-phase install
1241    
1242     [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments"
1243    
1244     echo "${1}=\"${2}\"" >> ${JAVA_PKG_EXTRA_ENV}
1245     JAVA_PKG_EXTRA_ENV_VARS="${JAVA_PKG_EXTRA_ENV_VARS} ${1}"
1246    
1247     java-pkg_do_write_
1248 caster 1.77 }
1249    
1250 nichoj 1.1 # This function reads stdin, and based on that input, figures out how to
1251     # populate jars from the filesystem.
1252     # Need to figure out a good way of making use of this, ie be able to use a
1253     # string that was built instead of stdin
1254     # NOTE: this isn't quite ready for primetime.
1255     #java-pkg_populate-jars() {
1256     # local line
1257     #
1258     # read line
1259     # while [[ -n "${line}" ]]; do
1260     # # Ignore comments
1261     # [[ ${line%%#*} == "" ]] && continue
1262     #
1263     # # get rid of any spaces
1264     # line="${line// /}"
1265     #
1266     # # format: path=jarinfo
1267     # local path=${line%%=*}
1268     # local jarinfo=${line##*=}
1269 betelgeuse 1.19 #
1270 nichoj 1.1 # # format: jar@package
1271     # local jar=${jarinfo%%@*}.jar
1272     # local package=${jarinfo##*@}
1273     # if [[ -n ${replace_only} ]]; then
1274     # [[ ! -f $path ]] && die "No jar exists at ${path}"
1275     # fi
1276     # if [[ -n ${create_parent} ]]; then
1277     # local parent=$(dirname ${path})
1278     # mkdir -p "${parent}"
1279     # fi
1280     # java-pkg_jar-from "${package}" "${jar}" "${path}"
1281     #
1282     # read line
1283     # done
1284     #}
1285    
1286     # ------------------------------------------------------------------------------
1287     # @section-end query
1288     # ------------------------------------------------------------------------------
1289    
1290     # ------------------------------------------------------------------------------
1291     # @section-begin helper
1292 betelgeuse 1.19 # @section-summary Helper functions
1293 nichoj 1.1 #
1294     # Various other functions to use from an ebuild
1295     # ------------------------------------------------------------------------------
1296    
1297     # ------------------------------------------------------------------------------
1298     # @ebuild-function java-pkg_need
1299     #
1300     # Adds virtual dependencies, which can optionally be controlled by a USE flag.
1301     # Currently supported virtuals are:
1302     # javamail
1303     # jdbc-stdext
1304     # jaf
1305     # jdbc-rowset
1306     # jms
1307     #
1308 betelgeuse 1.19 # @param $1 - Optionally indicate that the dependencies are controlled by
1309 nichoj 1.1 # a use flag by specifying '--use' Requires $2.
1310     # @param $2 - USE flag which will enable the dependencies.
1311     # @param $@ - virtual packages to add depenedencies for
1312     # ------------------------------------------------------------------------------
1313     # TODO rewrite to parse a line based declaration file instead -- karltk
1314     #java-pkg_need() {
1315     # debug-print-function ${FUNCNAME} $*
1316     # local useflag
1317     # if [[ ${1} == "--use" ]]; then
1318     # useflag="${2}"
1319     # shift 2
1320     # fi
1321     #
1322     # if [[ -z ${1} ]]; then
1323     # die "Must specify at least one virtual package."
1324     # fi
1325     #
1326     # local depstr newdepstr
1327     #
1328     # for virtual in ${@}; do
1329     # if has ${virtual} ${JAVA_PKG_VNEED}; then
1330     # debug-print "Already registered virtual ${virtual}"
1331     # continue
1332     # fi
1333     # case ${virtual} in
1334     # javamail)
1335     # debug-print "java-pkg_need: adding javamail dependencies"
1336     # newdepstr="|| ( dev-java/gnu-javamail dev-java/sun-javamail-bin )"
1337     # ;;
1338     # jdbc-stdext)
1339     # debug-print "java-pkg_need: adding jdbc-stdext dependencies"
1340     # newdepstr="|| ( >=virtual/jdk-1.4 dev-java/jdbc2-stdext )"
1341     # ;;
1342     # jaf)
1343     # debug-print "java-pkg_need: adding jaf dependencies"
1344     # newdepstr="|| ( dev-java/gnu-jaf dev-java/sun-jaf-bin )"
1345     # ;;
1346     # jdbc-rowset)
1347     # debug-print "java-pkg_need: adding jdbc-rowset dependencies"
1348     # newdepstr="|| ( >=virtual/jdk-1.5 dev-java/sun-jdbc-rowset )"
1349     # ;;
1350     # jms)
1351     # debug-print "java-pkg_need: adding jms dependencies"
1352     # newdepstr="|| ( dev-java/sun-jms dev-java/openjms )"
1353     # ;;
1354     # *)
1355     # die "Invalid virtual: ${virtual}"
1356     # esac
1357     #
1358     # export JAVA_PKG_VNEED="${JAVA_PKG_VNEED} ${virtual}"
1359     #
1360     # if [[ -n ${useflag} ]]; then
1361     # depstr="${depstr} ${useflag}? ( ${newdepstr} )"
1362     # else
1363     # depstr="${depstr} ${newdepstr}"
1364     # fi
1365     # done
1366     #
1367     # [[ -z ${JAVA_PKG_NV_DEPEND} ]] && export JAVA_PKG_NV_DEPEND="${DEPEND}"
1368     # [[ -z ${JAVA_PKG_NV_RDEPEND} ]] && export JAVA_PKG_NV_RDEPEND="${RDEPEND}"
1369     #
1370     # export DEPEND="${DEPEND} ${depstr}"
1371     # export RDEPEND="${RDEPEND} ${depstr}"
1372     #}
1373    
1374 betelgeuse 1.40 # ------------------------------------------------------------------------------
1375     # @ebuild-function java-pkg_find-normal-jars
1376     #
1377     # Find the files with suffix .jar file in the given directory or $WORKDIR
1378     #
1379     # @param $1 - The directory to search for jar files (default: ${WORKDIR})
1380     # ------------------------------------------------------------------------------
1381     java-pkg_find-normal-jars() {
1382     local dir=$1
1383     [[ "${dir}" ]] || dir="${WORKDIR}"
1384     local found
1385     for jar in $(find "${dir}" -name "*.jar" -type f); do
1386     echo "${jar}"
1387     found="true"
1388     done
1389     [[ "${found}" ]]
1390     return $?
1391     }
1392    
1393     # ------------------------------------------------------------------------------
1394     # @ebuild-function java-pkg_ensure-no-bundled-jars
1395     #
1396     # Try to locate bundled jar files in ${WORKDIR} and die if found.
1397     # This function should be called after WORKDIR has been populated with symlink
1398     # to system jar files or bundled jars removed.
1399     # ------------------------------------------------------------------------------
1400 nichoj 1.1 java-pkg_ensure-no-bundled-jars() {
1401     debug-print-function ${FUNCNAME} $*
1402    
1403 betelgeuse 1.40 local bundled_jars=$(java-pkg_find-normal-jars)
1404 nichoj 1.1 if [[ -n ${bundled_jars} ]]; then
1405     echo "Bundled jars found:"
1406     local jar
1407     for jar in ${bundled_jars}; do
1408     echo $(pwd)${jar/./}
1409     done
1410     die "Bundled jars found!"
1411     fi
1412     }
1413    
1414     # ------------------------------------------------------------------------------
1415     # @internal-function java-pkg_ensure-vm-version-sufficient
1416     #
1417     # Checks if we have a sufficient VM and dies if we don't.
1418     #
1419     # ------------------------------------------------------------------------------
1420     java-pkg_ensure-vm-version-sufficient() {
1421     debug-print-function ${FUNCNAME} $*
1422    
1423     if ! java-pkg_is-vm-version-sufficient; then
1424     debug-print "VM is not suffient"
1425     eerror "Current Java VM cannot build this package"
1426     einfo "Please use java-config -S to set the correct one"
1427     die "Active Java VM cannot build this package"
1428     fi
1429     }
1430    
1431     # ------------------------------------------------------------------------------
1432     # @internal-function java-pkg_is-vm-version-sufficient
1433 betelgeuse 1.19 #
1434 nichoj 1.1 # @return zero - VM is sufficient
1435     # @return non-zero - VM is not sufficient
1436     # ------------------------------------------------------------------------------
1437     java-pkg_is-vm-version-sufficient() {
1438     debug-print-function ${FUNCNAME} $*
1439    
1440     depend-java-query --is-sufficient "${DEPEND}" > /dev/null
1441     return $?
1442     }
1443    
1444     # ------------------------------------------------------------------------------
1445     # @internal-function java-pkg_ensure-vm-version-eq
1446     #
1447     # Die if the current VM is not equal to the argument passed.
1448     #
1449     # @param $@ - Desired VM version to ensure
1450     # ------------------------------------------------------------------------------
1451     java-pkg_ensure-vm-version-eq() {
1452     debug-print-function ${FUNCNAME} $*
1453    
1454     if ! java-pkg_is-vm-version-eq $@ ; then
1455     debug-print "VM is not suffient"
1456     eerror "This package requires a Java VM version = $@"
1457     einfo "Please use java-config -S to set the correct one"
1458     die "Active Java VM too old"
1459     fi
1460     }
1461    
1462     # ------------------------------------------------------------------------------
1463 betelgeuse 1.19 # @internal-function java-pkg_is-vm-version-eq
1464     #
1465 nichoj 1.1 # @param $@ - VM version to compare current VM to
1466     # @return zero - VM versions are equal
1467     # @return non-zero - VM version are not equal
1468     # ------------------------------------------------------------------------------
1469     java-pkg_is-vm-version-eq() {
1470     debug-print-function ${FUNCNAME} $*
1471    
1472     local needed_version="$@"
1473    
1474     [[ -z "${needed_version}" ]] && die "need an argument"
1475    
1476     local vm_version="$(java-pkg_get-vm-version)"
1477    
1478     vm_version="$(get_version_component_range 1-2 "${vm_version}")"
1479     needed_version="$(get_version_component_range 1-2 "${needed_version}")"
1480    
1481     if [[ -z "${vm_version}" ]]; then
1482     debug-print "Could not get JDK version from DEPEND"
1483     return 1
1484     else
1485     if [[ "${vm_version}" == "${needed_version}" ]]; then
1486     debug-print "Detected a JDK(${vm_version}) = ${needed_version}"
1487     return 0
1488     else
1489     debug-print "Detected a JDK(${vm_version}) != ${needed_version}"
1490     return 1
1491     fi
1492     fi
1493     }
1494    
1495     # ------------------------------------------------------------------------------
1496     # @internal-function java-pkg_ensure-vm-version-ge
1497     #
1498     # Die if the current VM is not greater than the desired version
1499     #
1500     # @param $@ - VM version to compare current to
1501     # ------------------------------------------------------------------------------
1502     java-pkg_ensure-vm-version-ge() {
1503     debug-print-function ${FUNCNAME} $*
1504 betelgeuse 1.19
1505 nichoj 1.1 if ! java-pkg_is-vm-version-ge "$@" ; then
1506     debug-print "vm is not suffient"
1507     eerror "This package requires a Java VM version >= $@"
1508     einfo "Please use java-config -S to set the correct one"
1509     die "Active Java VM too old"
1510     fi
1511     }
1512    
1513     # ------------------------------------------------------------------------------
1514 betelgeuse 1.19 # @internal-function java-pkg_is-vm-version-ge
1515     #
1516 nichoj 1.1 # @param $@ - VM version to compare current VM to
1517     # @return zero - current VM version is greater than checked version
1518     # @return non-zero - current VM version is not greater than checked version
1519     # ------------------------------------------------------------------------------
1520     java-pkg_is-vm-version-ge() {
1521     debug-print-function ${FUNCNAME} $*
1522    
1523     local needed_version=$@
1524     local vm_version=$(java-pkg_get-vm-version)
1525     if [[ -z "${vm_version}" ]]; then
1526     debug-print "Could not get JDK version from DEPEND"
1527     return 1
1528     else
1529     if version_is_at_least "${needed_version}" "${vm_version}"; then
1530     debug-print "Detected a JDK(${vm_version}) >= ${needed_version}"
1531     return 0
1532     else
1533     debug-print "Detected a JDK(${vm_version}) < ${needed_version}"
1534     return 1
1535     fi
1536     fi
1537     }
1538    
1539 nichoj 1.12 java-pkg_set-current-vm() {
1540     export GENTOO_VM=${1}
1541     }
1542    
1543     java-pkg_get-current-vm() {
1544     echo ${GENTOO_VM}
1545     }
1546    
1547     java-pkg_current-vm-matches() {
1548 nichoj 1.15 hasq $(java-pkg_get-current-vm) ${@}
1549 nichoj 1.12 return $?
1550     }
1551    
1552 nichoj 1.1 # ------------------------------------------------------------------------------
1553     # @ebuild-function java-pkg_get-source
1554 betelgeuse 1.19 #
1555 nichoj 1.1 # Determines what source version should be used, for passing to -source.
1556     # Unless you want to break things you probably shouldn't set _WANT_SOURCE
1557     #
1558     # @return string - Either the lowest possible source, or JAVA_PKG_WANT_SOURCE
1559     # ------------------------------------------------------------------------------
1560     java-pkg_get-source() {
1561     echo ${JAVA_PKG_WANT_SOURCE:-$(depend-java-query --get-lowest "${DEPEND} ${RDEPEND}")}
1562     }
1563    
1564     # ------------------------------------------------------------------------------
1565     # @ebuild-function java-pkg_get-target
1566     #
1567     # Determines what target version should be used, for passing to -target.
1568     # If you don't care about lower versions, you can set _WANT_TARGET to the
1569 betelgeuse 1.19 # version of your JDK.
1570 nichoj 1.1 #
1571     # @return string - Either the lowest possible target, or JAVA_PKG_WANT_TARGET
1572     # ------------------------------------------------------------------------------
1573     java-pkg_get-target() {
1574 caster 1.37 echo ${JAVA_PKG_WANT_TARGET:-$(depend-java-query --get-lowest "${DEPEND} ${RDEPEND}")}
1575 nichoj 1.1 }
1576    
1577     java-pkg_get-javac() {
1578     debug-print-function ${FUNCNAME} $*
1579    
1580 caster 1.24
1581 nichoj 1.1 local compiler="${GENTOO_COMPILER}"
1582    
1583     local compiler_executable
1584     if [[ "${compiler}" = "javac" ]]; then
1585     # nothing fancy needs to be done for javac
1586     compiler_executable="javac"
1587     else
1588     # for everything else, try to determine from an env file
1589    
1590     local compiler_env="/usr/share/java-config-2/compiler/${compiler}"
1591     if [[ -f ${compiler_env} ]]; then
1592     local old_javac=${JAVAC}
1593     unset JAVAC
1594     # try to get value of JAVAC
1595     compiler_executable="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${JAVAC})"
1596     export JAVAC=${old_javac}
1597    
1598 caster 1.24 if [[ -z ${compiler_executable} ]]; then
1599     echo "JAVAC is empty or undefined in ${compiler_env}"
1600     return 1
1601     fi
1602 betelgeuse 1.19
1603 nichoj 1.1 # check that it's executable
1604     if [[ ! -x ${compiler_executable} ]]; then
1605 caster 1.24 echo "${compiler_executable} doesn't exist, or isn't executable"
1606     return 1
1607 nichoj 1.1 fi
1608     else
1609 caster 1.24 echo "Could not find environment file for ${compiler}"
1610     return 1
1611 nichoj 1.1 fi
1612     fi
1613     echo ${compiler_executable}
1614     }
1615    
1616     # ------------------------------------------------------------------------------
1617 betelgeuse 1.19 # @ebuild-function java-pkg_javac-args
1618 nichoj 1.1 #
1619     # If an ebuild uses javac directly, instead of using ejavac, it should call this
1620     # to know what -source/-target to use.
1621     #
1622     # @return string - arguments to pass to javac, complete with -target and -source
1623     # ------------------------------------------------------------------------------
1624     java-pkg_javac-args() {
1625     debug-print-function ${FUNCNAME} $*
1626    
1627     local want_source="$(java-pkg_get-source)"
1628     local want_target="$(java-pkg_get-target)"
1629    
1630 betelgeuse 1.19 local source_str="-source ${want_source}"
1631 nichoj 1.1 local target_str="-target ${want_target}"
1632    
1633     debug-print "want source: ${want_source}"
1634     debug-print "want target: ${want_target}"
1635    
1636     if [[ -z "${want_source}" || -z "${want_target}" ]]; then
1637 caster 1.24 debug-print "could not find valid -source/-target values for javac"
1638     echo "Could not find valid -source/-target values for javac"
1639     return 1
1640 nichoj 1.1 else
1641     if java-pkg_is-vm-version-ge "1.4"; then
1642     echo "${source_str} ${target_str}"
1643     else
1644     echo "${target_str}"
1645     fi
1646     fi
1647     }
1648    
1649     # TODO document
1650     java-pkg_get-jni-cflags() {
1651     local flags="-I${JAVA_HOME}/include"
1652    
1653 flameeyes 1.33 local platform="linux"
1654     use elibc_FreeBSD && platform="freebsd"
1655    
1656 nichoj 1.10 # TODO do a check that the directories are valid
1657 flameeyes 1.33 flags="${flags} -I${JAVA_HOME}/include/${platform}"
1658 nichoj 1.1
1659     echo ${flags}
1660     }
1661    
1662 nichoj 1.10 java-pkg_ensure-gcj() {
1663     if ! built_with_use sys-devel/gcc gcj ; then
1664     ewarn
1665     ewarn "You must build gcc with the gcj support to build with gcj"
1666     ewarn
1667     ebeep 5
1668     die "No GCJ support found!"
1669     fi
1670     }
1671    
1672 nichoj 1.13 java-pkg_ensure-test() {
1673 betelgeuse 1.34 if hasq test ${FEATURES} && ! hasq -test ${FEATURES} \
1674     && hasq test ${IUSE} && ! use test;
1675     then
1676 nichoj 1.13 eerror "You specified FEATURES=test, but USE=test is needed"
1677     eerror "to pull in the additional dependencies for testing"
1678     die "Need USE=test enabled"
1679     fi
1680     }
1681    
1682 nichoj 1.1 # ------------------------------------------------------------------------------
1683 caster 1.46 # @ebuild-function java-pkg_register-ant-task
1684     #
1685     # Register this package as ant task, so that ant will load it when no specific
1686     # ANT_TASKS are specified. Note that even without this registering, all packages
1687     # specified in ANT_TASKS will be loaded. Mostly used by the actual ant tasks
1688     # packages, but can be also used by other ebuilds that used to symlink their
1689     # .jar into /usr/share/ant-core/lib to get autoloaded, for backwards
1690     # compatibility.
1691     #
1692     # @param --version x.y Register only for ant version x.y (otherwise for any ant
1693     # version). Used by the ant-* packages to prevent loading of mismatched
1694     # ant-core ant tasks after core was updated, before the tasks are updated,
1695     # without a need for blockers.
1696     # @param $1 Name to register as. Defaults to JAVA_PKG_NAME ($PN[-$SLOT])
1697     # ------------------------------------------------------------------------------
1698     java-pkg_register-ant-task() {
1699     local TASKS_DIR="tasks"
1700    
1701     # check for --version x.y parameters
1702     while [[ -n "${1}" && -n "${2}" ]]; do
1703     local var="${1#--}"
1704     local val="${2}"
1705     if [[ "${var}" == "version" ]]; then
1706     TASKS_DIR="tasks-${val}"
1707     else
1708     die "Unknown parameter passed to java-pkg_register-ant-tasks: ${1} ${2}"
1709     fi
1710     shift 2
1711     done
1712    
1713     local TASK_NAME="${1:-${JAVA_PKG_NAME}}"
1714    
1715     dodir /usr/share/ant/${TASKS_DIR}
1716     touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}"
1717     }
1718    
1719     # ------------------------------------------------------------------------------
1720     # @internal-function java-pkg_ant-tasks-depend
1721     #
1722     # Translates the WANT_ANT_TASKS variable into valid dependencies.
1723     # ------------------------------------------------------------------------------
1724     java-pkg_ant-tasks-depend() {
1725     debug-print-function ${FUNCNAME} ${WANT_ANT_TASKS}
1726    
1727     if [[ -n "${WANT_ANT_TASKS}" ]]; then
1728     local DEP=""
1729     for i in ${WANT_ANT_TASKS}
1730     do
1731     if [[ ${i} != ant-* ]]; then
1732     echo "Invalid atom in WANT_ANT_TASKS: ${i}"
1733     return 1
1734     fi
1735     DEP="${DEP}dev-java/${i} "
1736     done
1737     echo ${DEP}
1738     return 0
1739     else
1740     return 0
1741     fi
1742     }
1743    
1744     # ------------------------------------------------------------------------------
1745 betelgeuse 1.84 # @ebuild-function ejunit
1746     #
1747     # Junit wrapper function. Makes it easier to run the tests and checks for
1748     # dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner.
1749     #
1750     # Examples:
1751     # ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1752     # ejunit org.blinkenlights.jid3.test.AllTests
1753     #
1754     # @param $1 - -cp or -classpath
1755 betelgeuse 1.87 # @param $2 - classpath; junit and recorded dependencies get appended
1756 betelgeuse 1.84 # @param $@ - the rest of the parameters are passed to java
1757     # ------------------------------------------------------------------------------
1758     ejunit() {
1759     debug-print-function ${FUNCNAME} $*
1760    
1761 betelgeuse 1.87 local pkgs
1762     for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do
1763     pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//")
1764     done
1765    
1766     local cp=$(java-pkg_getjars --with-dependencies junit${pkgs})
1767 betelgeuse 1.84 if [[ ${1} = -cp || ${1} = -classpath ]]; then
1768 betelgeuse 1.87 cp="${2}:${cp}"
1769 betelgeuse 1.84 shift 2
1770     else
1771 betelgeuse 1.87 cp=".:${cp}"
1772 betelgeuse 1.84 fi
1773    
1774     local runner=junit.textui.TestRunner
1775     debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}"
1776     java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
1777     }
1778    
1779     # ------------------------------------------------------------------------------
1780 nichoj 1.1 # @section-end helper
1781     # ------------------------------------------------------------------------------
1782    
1783     # ------------------------------------------------------------------------------
1784     # @section-begin build
1785     # @section-summary Build functions
1786     #
1787     # These are some functions for building a package. In particular, it consists of
1788     # wrappers for javac and ant.
1789     # ------------------------------------------------------------------------------
1790    
1791     # ------------------------------------------------------------------------------
1792     # @ebuild-function eant
1793     #
1794     # Ant wrapper function. Will use the appropriate compiler, based on user-defined
1795 caster 1.46 # compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS,
1796 betelgeuse 1.41 # variables:
1797     # EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
1798     # gentoo.classpath property. Be sure to call
1799     # java-ant_rewrite-classpath in src_unpack.
1800 betelgeuse 1.92 # JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files
1801 caster 1.46 # *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1802 nichoj 1.1 # ------------------------------------------------------------------------------
1803     eant() {
1804     debug-print-function ${FUNCNAME} $*
1805    
1806 betelgeuse 1.92 if [[ ${EBUILD_PHASE} = compile ]]; then
1807     # Used to be done in hooks in java-ant-2.eclass but moved here so that we can
1808     # finally get rid of the hooks without breaking stuff
1809    
1810     [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" && "${JAVA_PKG_BSFIX}" ]] \
1811     && java-ant_ignore-system-classes "${S}/build.xml"
1812    
1813     if hasq java-ant-2 ${INHERITED}; then
1814     java-ant_bsfix
1815     fi
1816    
1817     # eant can be called multiple times
1818     JAVA_PKG_BSFIX="off"
1819    
1820     if [[ -z ${JAVA_PKG_NO_BUNDLED_SEARCH} ]] && is-java-strict; then
1821     echo "Searching for bundled jars:"
1822     java-pkg_find-normal-jars || echo "None found."
1823     echo "Searching for bundled classes (no output if none found):"
1824     find "${WORKDIR}" -name "*.class"
1825     echo "Search done."
1826     JAVA_PKG_NO_BUNDLED_SEARCH=true # eant can be called many times
1827     fi
1828     fi
1829    
1830 caster 1.82 if ! hasq java-ant-2 ${INHERITED}; then
1831 betelgeuse 1.52 local msg="You should inherit java-ant-2 when using eant"
1832 caster 1.82 java-pkg_announce-qa-violation "${msg}"
1833 betelgeuse 1.51 fi
1834    
1835 caster 1.96 local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore"
1836 betelgeuse 1.57
1837 nichoj 1.1 java-pkg_init-compiler_
1838     local compiler="${GENTOO_COMPILER}"
1839    
1840     local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}"
1841     local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})"
1842     if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then
1843     die "ANT_BUILD_COMPILER undefined in ${compiler_env}"
1844     fi
1845    
1846     if [[ ${compiler} != "javac" ]]; then
1847 caster 1.36 antflags="${antflags} -Dbuild.compiler=${build_compiler}"
1848 nichoj 1.1 # Figure out any extra stuff to put on the classpath for compilers aside
1849     # from javac
1850     # ANT_BUILD_COMPILER_DEPS should be something that could be passed to
1851     # java-config -p
1852     local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})"
1853     if [[ -n ${build_compiler_deps} ]]; then
1854     antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})"
1855     fi
1856     fi
1857 nichoj 1.9
1858 betelgeuse 1.52 for arg in "${@}"; do
1859     if [[ ${arg} = -lib ]]; then
1860     if is-java-strict; then
1861     eerror "You should not use the -lib argument to eant because it will fail"
1862 betelgeuse 1.53 eerror "with JAVA_PKG_STRICT. Please use for example java-pkg_jar-from"
1863 betelgeuse 1.52 eerror "or ant properties to make dependencies available."
1864     eerror "For ant tasks use WANT_ANT_TASKS or ANT_TASKS from."
1865     eerror "split ant (>=dev-java/ant-core-1.7)."
1866     die "eant -lib is deprecated/forbidden"
1867     else
1868     echo "eant -lib is deprecated. Turn JAVA_PKG_STRICT on for"
1869     echo "more info."
1870     fi
1871     fi
1872     done
1873    
1874 caster 1.103 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1875     ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}"
1876 caster 1.46
1877 caster 1.103 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1878     ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
1879 caster 1.46
1880 caster 1.103 # if ant-tasks is not set by ebuild or forced, use none
1881     ANT_TASKS="${ANT_TASKS:-none}"
1882 betelgeuse 1.52
1883 caster 1.103 # at this point, ANT_TASKS should be "all", "none" or explicit list
1884     if [[ "${ANT_TASKS}" == "all" ]]; then
1885     einfo "Using all available ANT_TASKS"
1886     elif [[ "${ANT_TASKS}" == "none" ]]; then
1887     einfo "Disabling all optional ANT_TASKS"
1888     else
1889     einfo "Using following ANT_TASKS: ${ANT_TASKS}"
1890 caster 1.46 fi
1891    
1892 caster 1.103 export ANT_TASKS
1893    
1894 caster 1.46 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug"
1895 betelgeuse 1.45 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q"
1896 betelgeuse 1.19
1897 betelgeuse 1.41 local gcp="${EANT_GENTOO_CLASSPATH}"
1898 caster 1.76 local getjarsarg=""
1899 betelgeuse 1.41
1900 betelgeuse 1.57 if [[ ${EBUILD_PHASE} = "test" ]]; then
1901     antflags="${antflags} -DJunit.present=true"
1902     [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
1903 caster 1.76 getjarsarg="--with-dependencies"
1904 betelgeuse 1.57 fi
1905    
1906     local cp
1907    
1908     for atom in ${gcp}; do
1909 betelgeuse 1.75 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1910 betelgeuse 1.57 done
1911    
1912     if [[ ${cp} ]]; then
1913 betelgeuse 1.41 # It seems ant does not like single quotes around ${cp}
1914 betelgeuse 1.57 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\""
1915 betelgeuse 1.41 fi
1916    
1917 nichoj 1.1 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1918 betelgeuse 1.75 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1919 nichoj 1.1 ant ${antflags} "${@}" || die "eant failed"
1920     }
1921    
1922     # ------------------------------------------------------------------------------
1923     # @ebuild-function ejavac
1924     #
1925 betelgeuse 1.19 # Javac wrapper function. Will use the appropriate compiler, based on
1926 nichoj 1.1 # /etc/java-config/compilers.conf
1927     #
1928     # @param $@ - Arguments to be passed to the compiler
1929     # ------------------------------------------------------------------------------
1930     ejavac() {
1931     debug-print-function ${FUNCNAME} $*
1932    
1933 caster 1.24 java-pkg_init-compiler_
1934 nichoj 1.1
1935 caster 1.24 local compiler_executable
1936     compiler_executable=$(java-pkg_get-javac)
1937     if [[ ${?} != 0 ]]; then
1938     eerror "There was a problem determining compiler: ${compiler_executable}"
1939     die "get-javac failed"
1940     fi
1941    
1942     local javac_args
1943     javac_args="$(java-pkg_javac-args)"
1944     if [[ ${?} != 0 ]]; then
1945     eerror "There was a problem determining JAVACFLAGS: ${javac_args}"
1946     die "java-pkg_javac-args failed"
1947     fi
1948    
1949     [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}"
1950     ${compiler_executable} ${javac_args} "${@}" || die "ejavac failed"
1951 nichoj 1.1 }
1952    
1953     # ------------------------------------------------------------------------------
1954     # @ebuild-function java-pkg_filter-compiler
1955 betelgeuse 1.19 #
1956 nichoj 1.1 # Used to prevent the use of some compilers. Should be used in src_compile.
1957     # Basically, it just appends onto JAVA_PKG_FILTER_COMPILER
1958     #
1959     # @param $@ - compilers to filter
1960     # ------------------------------------------------------------------------------
1961     java-pkg_filter-compiler() {
1962     JAVA_PKG_FILTER_COMPILER="${JAVA_PKG_FILTER_COMPILER} $@"
1963     }
1964    
1965     # ------------------------------------------------------------------------------
1966 nichoj 1.8 # @ebuild-function java-pkg_force-compiler
1967     #
1968     # Used to force the use of particular compilers. Should be used in src_compile.
1969     # A common use of this would be to force ecj-3.1 to be used on amd64, to avoid
1970     # OutOfMemoryErrors that may come up.
1971     #
1972     # @param $@ - compilers to force
1973     # ------------------------------------------------------------------------------
1974     java-pkg_force-compiler() {
1975     JAVA_PKG_FORCE_COMPILER="$@"
1976     }
1977    
1978     # ------------------------------------------------------------------------------
1979 nichoj 1.1 # @ebuild-function use_doc
1980     #
1981     # Helper function for getting ant to build javadocs. If the user has USE=doc,
1982     # then 'javadoc' or the argument are returned. Otherwise, there is no return.
1983 betelgeuse 1.19 #
1984 nichoj 1.1 # The output of this should be passed to ant.
1985     #
1986     # Example: build javadocs by calling 'javadoc' target
1987     # eant $(use_doc)
1988     # Example: build javadocs by calling 'apidoc' target
1989     # eant $(use_doc apidoc)
1990     #
1991     # @param $@ - Option value to return. Defaults to 'javadoc'
1992     # @return string - Name of the target to create javadocs
1993     # ------------------------------------------------------------------------------
1994     use_doc() {
1995     use doc && echo ${@:-javadoc}
1996     }
1997    
1998 betelgeuse 1.38
1999 nichoj 1.1 # ------------------------------------------------------------------------------
2000     # @section-end build
2001     # ------------------------------------------------------------------------------
2002 betelgeuse 1.19
2003 nichoj 1.1 # ------------------------------------------------------------------------------
2004     # @section-begin internal
2005 betelgeuse 1.19 # @section-summary Internal functions
2006 nichoj 1.1 #
2007     # Do __NOT__ use any of these from an ebuild! These are only to be used from
2008     # within the java eclasses.
2009     # ------------------------------------------------------------------------------
2010    
2011     # -----------------------------------------------------------------------------
2012     # @function-internal java-pkg_init
2013 betelgeuse 1.19 #
2014 nichoj 1.1 # The purpose of this function, as the name might imply, is to initialize the
2015     # Java environment. It ensures that that there aren't any environment variables
2016     # that'll muss things up. It initializes some variables, which are used
2017     # internally. And most importantly, it'll switch the VM if necessary.
2018     #
2019     # This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will
2020     # call it during each of the phases of the merge process.
2021     #
2022     # -----------------------------------------------------------------------------
2023     java-pkg_init() {
2024 betelgeuse 1.97 debug-print-function ${FUNCNAME} $*
2025 nichoj 1.1 unset JAVAC
2026     unset JAVA_HOME
2027 betelgeuse 1.64
2028     # People do all kinds of weird things.
2029     # http://forums.gentoo.org/viewtopic-p-3943166.html
2030 betelgeuse 1.65 local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
2031 betelgeuse 1.64 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
2032 betelgeuse 1.65 if [[ -n ${_JAVA_OPTIONS} && -z ${accept} && -z ${silence} ]]; then
2033 betelgeuse 1.64 ewarn "_JAVA_OPTIONS changes what java -version outputs at least for"
2034     ewarn "sun-jdk vms and and as such break configure scripts that"
2035     ewarn "use it (for example app-office/openoffice) so we filter it out."
2036     ewarn "Use SILENCE_JAVA_OPTIONS_WARNING=true in the environment (use"
2037     ewarn "make.conf for example) to silence this warning or"
2038     ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it."
2039     fi
2040    
2041     if [[ -z ${accept} ]]; then
2042 betelgeuse 1.98 # export _JAVA_OPTIONS= doesn't work because it will show up in java
2043     # -version output
2044     unset _JAVA_OPTIONS
2045 betelgeuse 1.64 # phase hooks make this run many times without this
2046     I_WANT_GLOBAL_JAVA_OPTIONS="true"
2047     fi
2048    
2049 betelgeuse 1.92 if java-pkg_func-exists ant_src_unpack; then
2050     java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be src_unpack"
2051     fi
2052    
2053 nichoj 1.1 java-pkg_init_paths_
2054     java-pkg_switch-vm
2055     PATH=${JAVA_HOME}/bin:${PATH}
2056    
2057     # TODO we will probably want to set JAVAC and JAVACFLAGS
2058    
2059     # Do some QA checks
2060     java-pkg_check-jikes
2061    
2062 betelgeuse 1.97 # Can't use unset here because Portage does not save the unset
2063     # see https://bugs.gentoo.org/show_bug.cgi?id=189417#c11
2064    
2065 betelgeuse 1.19 # When users have crazy classpaths some packages can fail to compile.
2066 nichoj 1.1 # and everything should work with empty CLASSPATH.
2067     # This also helps prevent unexpected dependencies on random things
2068     # from the CLASSPATH.
2069 betelgeuse 1.97 export CLASSPATH=
2070 betelgeuse 1.59
2071 caster 1.46 # Unset external ANT_ stuff
2072 betelgeuse 1.97 export ANT_TASKS=
2073     export ANT_OPTS=
2074 nichoj 1.1 }
2075    
2076     # ------------------------------------------------------------------------------
2077     # @function-internal java-pkg-init-compiler_
2078     #
2079     # This function attempts to figure out what compiler should be used. It does
2080 betelgeuse 1.19 # this by reading the file at JAVA_PKG_COMPILERS_CONF, and checking the
2081 nichoj 1.1 # COMPILERS variable defined there.
2082     # This can be overridden by a list in JAVA_PKG_FORCE_COMPILER
2083 betelgeuse 1.19 #
2084 nichoj 1.1 # It will go through the list of compilers, and verify that it supports the
2085     # target and source that are needed. If it is not suitable, then the next
2086     # compiler is checked. When JAVA_PKG_FORCE_COMPILER is defined, this checking
2087     # isn't done.
2088     #
2089     # Once the which compiler to use has been figured out, it is set to
2090     # GENTOO_COMPILER.
2091     #
2092     # If you hadn't guessed, JAVA_PKG_FORCE_COMPILER is for testing only.
2093     #
2094     # If the user doesn't defined anything in JAVA_PKG_COMPILERS_CONF, or no
2095     # suitable compiler was found there, then the default is to use javac provided
2096     # by the current VM.
2097     #
2098     #
2099     # @return name of the compiler to use
2100     # ------------------------------------------------------------------------------
2101     java-pkg_init-compiler_() {
2102     debug-print-function ${FUNCNAME} $*
2103    
2104     if [[ -n ${GENTOO_COMPILER} ]]; then
2105     debug-print "GENTOO_COMPILER already set"
2106     return
2107     fi
2108    
2109 nichoj 1.3 local compilers;
2110     if [[ -z ${JAVA_PKG_FORCE_COMPILER} ]]; then
2111     compilers="$(source ${JAVA_PKG_COMPILERS_CONF} 1>/dev/null 2>&1; echo ${COMPILERS})"
2112     else
2113     compilers=${JAVA_PKG_FORCE_COMPILER}
2114     fi
2115 betelgeuse 1.19
2116 nichoj 1.1 debug-print "Read \"${compilers}\" from ${JAVA_PKG_COMPILERS_CONF}"
2117    
2118     # Figure out if we should announce what compiler we're using
2119     local compiler
2120     for compiler in ${compilers}; do
2121     debug-print "Checking ${compiler}..."
2122     # javac should always be alright
2123     if [[ ${compiler} = "javac" ]]; then
2124     debug-print "Found javac... breaking"
2125     export GENTOO_COMPILER="javac"
2126     break
2127     fi
2128 betelgeuse 1.19
2129 nichoj 1.1 if has ${compiler} ${JAVA_PKG_FILTER_COMPILER}; then
2130     if [[ -z ${JAVA_PKG_FORCE_COMPILER} ]]; then
2131     einfo "Filtering ${compiler}"
2132     continue
2133     fi
2134     fi
2135 betelgeuse 1.19
2136 nichoj 1.1 # for non-javac, we need to make sure it supports the right target and
2137     # source
2138     local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}"
2139     if [[ -f ${compiler_env} ]]; then
2140     local desired_target="$(java-pkg_get-target)"
2141     local desired_source="$(java-pkg_get-source)"
2142    
2143    
2144     # Verify that the compiler supports target
2145     local supported_target=$(source ${compiler_env} 1>/dev/null 2>&1; echo ${SUPPORTED_TARGET})
2146     if ! has ${desired_target} ${supported_target}; then
2147     ewarn "${compiler} does not support -target ${desired_target}, skipping"
2148     continue
2149     fi
2150    
2151     # -source was introduced in 1.3, so only check 1.3 and on
2152     if version_is_at_least "${desired_soure}" "1.3"; then
2153     # Verify that the compiler supports source
2154     local supported_source=$(source ${compiler_env} 1>/dev/null 2>&1; echo ${SUPPORTED_SOURCE})
2155     if ! has ${desired_source} ${supported_source}; then
2156     ewarn "${compiler} does not support -source ${desired_source}, skipping"
2157     continue
2158     fi
2159     fi
2160    
2161     # if you get here, then the compiler should be good to go
2162     export GENTOO_COMPILER="${compiler}"
2163     break
2164     else
2165     ewarn "Could not find configuration for ${compiler}, skipping"
2166     ewarn "Perhaps it is not installed?"
2167     continue
2168     fi
2169     done
2170    
2171     # If it hasn't been defined already, default to javac
2172     if [[ -z ${GENTOO_COMPILER} ]]; then
2173     if [[ -n ${compilers} ]]; then
2174 betelgeuse 1.104 einfo "No suitable compiler found: defaulting to JDK default for compilation"
2175 nichoj 1.1 else
2176     # probably don't need to notify users about the default.
2177     :;#einfo "Defaulting to javac for compilation"
2178     fi
2179 betelgeuse 1.104 if java-config -g GENTOO_COMPILER 2> /dev/null; then
2180     export GENTOO_COMPILER=$(java-config -g GENTOO_COMPILER)
2181     else
2182     export GENTOO_COMPILER=javac
2183     fi
2184 nichoj 1.1 else
2185     einfo "Using ${GENTOO_COMPILER} for compilation"
2186     fi
2187    
2188     }
2189    
2190     # ------------------------------------------------------------------------------
2191     # @internal-function init_paths_
2192     #
2193     # Initializes some variables that will be used. These variables are mostly used
2194     # to determine where things will eventually get installed.
2195     # ------------------------------------------------------------------------------
2196     java-pkg_init_paths_() {
2197     debug-print-function ${FUNCNAME} $*
2198    
2199     local pkg_name
2200     if [[ "$SLOT" == "0" ]] ; then
2201     JAVA_PKG_NAME="${PN}"
2202     else
2203     JAVA_PKG_NAME="${PN}-${SLOT}"
2204     fi
2205    
2206     JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}"
2207     JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/"
2208     JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env"
2209 ali_bush 1.94 JAVA_PKG_VIRTUALS_PATH="${DESTTREE}/share/java-config-2/virtuals"
2210     JAVA_PKG_VIRTUAL_PROVIDER="${D}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}"
2211 nichoj 1.1
2212     [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib"
2213     [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}"
2214     [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps"
2215    
2216    
2217     # TODO maybe only print once?
2218     debug-print "JAVA_PKG_SHAREPATH: ${JAVA_PKG_SHAREPATH}"
2219     debug-print "JAVA_PKG_ENV: ${JAVA_PKG_ENV}"
2220     debug-print "JAVA_PKG_JARDEST: ${JAVA_PKG_JARDEST}"
2221     debug-print "JAVA_PKG_LIBDEST: ${JAVA_PKG_LIBDEST}"
2222     debug-print "JAVA_PKG_WARDEST: ${JAVA_PKG_WARDEST}"
2223     }
2224    
2225     # ------------------------------------------------------------------------------
2226     # @internal-function java-pkg_do_write_
2227     #
2228     # Writes the package.env out to disk.
2229     #
2230     # ------------------------------------------------------------------------------
2231     # TODO change to do-write, to match everything else
2232     java-pkg_do_write_() {
2233 betelgeuse 1.87 debug-print-function ${FUNCNAME} $*
2234 betelgeuse 1.28 java-pkg_init_paths_
2235 nichoj 1.1 # Create directory for package.env
2236     dodir "${JAVA_PKG_SHAREPATH}"
2237 betelgeuse 1.87 if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f \
2238 caster 1.88 "${JAVA_PKG_DEPEND_FILE}" || -f \
2239     "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then
2240 nichoj 1.1 # Create package.env
2241     (
2242     echo "DESCRIPTION=\"${DESCRIPTION}\""
2243     echo "GENERATION=\"2\""
2244 betelgeuse 1.104 echo "SLOT=\"${SLOT}\""
2245 nichoj 1.1
2246     [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
2247     [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
2248     [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
2249 betelgeuse 1.87 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
2250 caster 1.88 && echo "DEPEND=\"$(cat "${JAVA_PKG_DEPEND_FILE}" | uniq | tr '\n' ':')\""
2251     [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
2252     && echo "OPTIONAL_DEPEND=\"$(cat "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | uniq | tr '\n' ':')\""
2253 nichoj 1.1 echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
2254     ) > "${JAVA_PKG_ENV}"
2255 betelgeuse 1.19
2256 nichoj 1.1 # register target/source
2257     local target="$(java-pkg_get-target)"
2258     local source="$(java-pkg_get-source)"
2259     [[ -n ${target} ]] && echo "TARGET=\"${target}\"" >> "${JAVA_PKG_ENV}"
2260     [[ -n ${source} ]] && echo "SOURCE=\"${source}\"" >> "${JAVA_PKG_ENV}"
2261    
2262     # register javadoc info
2263     [[ -n ${JAVADOC_PATH} ]] && echo "JAVADOC_PATH=\"${JAVADOC_PATH}\"" \
2264     >> ${JAVA_PKG_ENV}
2265     # register source archives
2266     [[ -n ${JAVA_SOURCES} ]] && echo "JAVA_SOURCES=\"${JAVA_SOURCES}\"" \
2267     >> ${JAVA_PKG_ENV}
2268    
2269    
2270     echo "MERGE_VM=\"${GENTOO_VM}\"" >> "${JAVA_PKG_ENV}"
2271     [[ -n ${GENTOO_COMPILER} ]] && echo "MERGE_COMPILER=\"${GENTOO_COMPILER}\"" >> "${JAVA_PKG_ENV}"
2272    
2273 caster 1.85 # extra env variables
2274     if [[ -n "${JAVA_PKG_EXTRA_ENV_VARS}" ]]; then
2275     cat "${JAVA_PKG_EXTRA_ENV}" >> "${JAVA_PKG_ENV}" || die
2276     # nested echo to remove leading/trailing spaces
2277     echo "ENV_VARS=\"$(echo ${JAVA_PKG_EXTRA_ENV_VARS})\"" \
2278     >> "${JAVA_PKG_ENV}" || die
2279     fi
2280    
2281 nichoj 1.1 # Strip unnecessary leading and trailing colons
2282     # TODO try to cleanup if possible
2283     sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?"
2284 betelgeuse 1.87 else
2285 caster 1.88 debug-print "JAVA_PKG_CLASSPATH, JAVA_PKG_LIBRARY, JAVA_PKG_DEPEND_FILE"
2286     debug-print "or JAVA_PKG_OPTIONAL_DEPEND_FILE not defined so can't"
2287 betelgeuse 1.87 debug-print "write package.env."
2288 nichoj 1.1 fi
2289     }
2290    
2291     # ------------------------------------------------------------------------------
2292     # @internal-function java-pkg_record-jar_
2293     #
2294 caster 1.88 # Record an (optional) dependency to the package.env
2295     # @param --optional - record dependency as optional
2296     # @param $1 - package to record
2297     # @param $2 - (optional) jar of package to record
2298 nichoj 1.1 # ------------------------------------------------------------------------------
2299 betelgeuse 1.87 JAVA_PKG_DEPEND_FILE="${T}/java-pkg-depend"
2300 caster 1.88 JAVA_PKG_OPTIONAL_DEPEND_FILE="${T}/java-pkg-optional-depend"
2301 nichoj 1.1
2302     java-pkg_record-jar_() {
2303     debug-print-function ${FUNCNAME} $*
2304    
2305 caster 1.88 local depend_file="${JAVA_PKG_DEPEND_FILE}"
2306     if [[ "${1}" == "--optional" ]]; then
2307     depend_file="${JAVA_PKG_OPTIONAL_DEPEND_FILE}"
2308     shift
2309     fi
2310    
2311 nichoj 1.1 local pkg=${1} jar=${2} append
2312     if [[ -z "${jar}" ]]; then
2313     append="${pkg}"
2314     else
2315     append="$(basename ${jar})@${pkg}"
2316     fi
2317    
2318 caster 1.88 echo "${append}" >> "${depend_file}"
2319 nichoj 1.1 }
2320    
2321     # ------------------------------------------------------------------------------
2322     # @internal-function java-pkg_append_
2323     #
2324     # Appends a value to a variable
2325     #
2326     # Example: java-pkg_append_ CLASSPATH foo.jar
2327     # @param $1 variable name to modify
2328     # @param $2 value to append
2329     # ------------------------------------------------------------------------------
2330     java-pkg_append_() {
2331     debug-print-function ${FUNCNAME} $*
2332    
2333     local var="${1}" value="${2}"
2334     if [[ -z "${!var}" ]] ; then
2335     export ${var}="${value}"
2336     else
2337     local oldIFS=${IFS} cur haveit
2338     IFS=':'
2339     for cur in ${!var}; do
2340     if [[ ${cur} == ${value} ]]; then
2341     haveit="yes"
2342     break
2343     fi
2344     done
2345     [[ -z ${haveit} ]] && export ${var}="${!var}:${value}"
2346     IFS=${oldIFS}
2347     fi
2348     }
2349    
2350     # ------------------------------------------------------------------------------
2351     # @internal-function java-pkg_expand_dir_
2352 betelgeuse 1.19 #
2353 nichoj 1.1 # Gets the full path of the file/directory's parent.
2354     # @param $1 - file/directory to find parent directory for
2355     # @return - path to $1's parent directory
2356     # ------------------------------------------------------------------------------
2357     java-pkg_expand_dir_() {
2358     pushd "$(dirname "${1}")" >/dev/null 2>&1
2359     pwd
2360     popd >/dev/null 2>&1
2361     }
2362    
2363     # ------------------------------------------------------------------------------
2364     # @internal-function java-pkg_func-exists
2365     #
2366     # Does the indicated function exist?
2367     #
2368     # @return 0 - function is declared
2369     # @return 1 - function is undeclared
2370     # ------------------------------------------------------------------------------
2371     java-pkg_func-exists() {
2372     if [[ -n "$(declare -f ${1})" ]]; then
2373     return 0
2374     else
2375     return 1
2376     fi
2377     }
2378    
2379     # ------------------------------------------------------------------------------
2380     # @internal-function java-pkg_setup-vm
2381     #
2382     # Sets up the environment for a specific VM
2383     #
2384     # ------------------------------------------------------------------------------
2385     java-pkg_setup-vm() {
2386     debug-print-function ${FUNCNAME} $*
2387    
2388 caster 1.83 export LANG="C" LC_ALL="C"
2389    
2390 nichoj 1.1 local vendor="$(java-pkg_get-vm-vendor)"
2391 caster 1.23 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then
2392 nichoj 1.1 addpredict "/dev/random"
2393     elif [[ "${vendor}" == "ibm" ]]; then
2394     addpredict "/proc/self/maps"
2395     addpredict "/proc/cpuinfo"
2396     elif [[ "${vendor}" == "jrockit" ]]; then
2397     addpredict "/proc/cpuinfo"
2398     fi
2399     }
2400    
2401     # ------------------------------------------------------------------------------
2402     # @internal-function java-pkg_needs-vm
2403     #
2404     # Does the current package depend on virtual/jdk?
2405     #
2406     # @return 0 - Package depends on virtual/jdk
2407     # @return 1 - Package does not depend on virtual/jdk
2408     # ------------------------------------------------------------------------------
2409     java-pkg_needs-vm() {
2410     debug-print-function ${FUNCNAME} $*
2411    
2412     if [[ -n "$(echo ${DEPEND} | sed -e '\:virtual/jdk:!d')" ]]; then
2413     return 0
2414     fi
2415    
2416     return 1
2417     }
2418    
2419     # ------------------------------------------------------------------------------
2420     # @internal-function java-pkg_get-current-vm
2421     #
2422     # @return - The current VM being used
2423     # ------------------------------------------------------------------------------
2424     java-pkg_get-current-vm() {
2425     java-config -f
2426     }
2427    
2428     # ------------------------------------------------------------------------------
2429     # @internal-function java-pkg_get-vm-vendor
2430     #
2431     # @return - The vendor of the current VM
2432     # ------------------------------------------------------------------------------
2433     java-pkg_get-vm-vendor() {
2434     debug-print-function ${FUNCNAME} $*
2435    
2436     local vm="$(java-pkg_get-current-vm)"
2437     vm="${vm/-*/}"
2438     echo "${vm}"
2439     }
2440    
2441     # ------------------------------------------------------------------------------
2442     # @internal-function java-pkg_get-vm-version
2443     #
2444     # @return - The version of the current VM
2445     # ------------------------------------------------------------------------------
2446     java-pkg_get-vm-version() {
2447     debug-print-function ${FUNCNAME} $*
2448    
2449 caster 1.22 java-config -g PROVIDES_VERSION
2450 nichoj 1.1 }
2451    
2452     # ------------------------------------------------------------------------------
2453     # @internal-function java-pkg_switch-vm
2454     #
2455 betelgeuse 1.19 # Switch VM if we're allowed to (controlled by JAVA_PKG_ALLOW_VM_CHANGE), and
2456 nichoj 1.1 # verify that the current VM is sufficient.
2457     # Setup the environment for the VM being used.
2458     # ------------------------------------------------------------------------------
2459     java-pkg_switch-vm() {
2460 betelgeuse 1.38 debug-print-function ${FUNCNAME} $*
2461    
2462 nichoj 1.1 if java-pkg_needs-vm; then
2463     # Use the VM specified by JAVA_PKG_FORCE_VM
2464 betelgeuse 1.38 if [[ -n "${JAVA_PKG_FORCE_VM}" ]]; then
2465 nichoj 1.1 # If you're forcing the VM, I hope you know what your doing...
2466 betelgeuse 1.38 debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}"
2467 nichoj 1.1 export GENTOO_VM="${JAVA_PKG_FORCE_VM}"
2468     # if we're allowed to switch the vm...
2469     elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then
2470     debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}} VNEED: ${JAVA_PKG_VNEED}"
2471     if [[ -n ${JAVA_PKG_VNEED} ]]; then
2472 caster 1.24 GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
2473 nichoj 1.1 else
2474 caster 1.24 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
2475     fi
2476     if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
2477 caster 1.32 eerror "Unable to determine VM for building from dependencies:"
2478 caster 1.24 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2479     echo "VNEED: ${JAVA_PKG_VNEED}"
2480 caster 1.32 die "Failed to determine VM for building."
2481 caster 1.24 else
2482     export GENTOO_VM
2483 nichoj 1.1 fi
2484     # otherwise just make sure the current VM is sufficient
2485     else
2486     java-pkg_ensure-vm-version-sufficient
2487     fi
2488     debug-print "Using: $(java-config -f)"
2489 betelgeuse 1.19
2490 nichoj 1.1 java-pkg_setup-vm
2491    
2492 nichoj 1.4 export JAVA=$(java-config --java)
2493     export JAVAC=$(java-config --javac)
2494 caster 1.24 JAVACFLAGS="$(java-pkg_javac-args)"
2495     if [[ ${?} != 0 ]]; then
2496     eerror "There was a problem determining JAVACFLAGS: ${JAVACFLAGS}"
2497     die "java-pkg_javac-args failed"
2498     fi
2499     [[ -n ${JAVACFLAGS_EXTRA} ]] && JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}"
2500     export JAVACFLAGS
2501 nichoj 1.1
2502     export JAVA_HOME="$(java-config -g JAVA_HOME)"
2503     export JDK_HOME=${JAVA_HOME}
2504    
2505     #TODO If you know a better solution let us know.
2506     java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)"
2507 betelgeuse 1.19
2508 nichoj 1.1 local tann="${T}/announced-vm"
2509 betelgeuse 1.92 # With the hooks we should only get here once from pkg_setup but better safe than sorry
2510     # if people have for example modified eclasses some where
2511 nichoj 1.1 if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then
2512 betelgeuse 1.92 einfo "Using: $(java-config -f)"
2513     [[ ! -f "${tann}" ]] && touch "${tann}"
2514 nichoj 1.1 fi
2515    
2516     else
2517     [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!"
2518     fi
2519     }
2520    
2521     # ------------------------------------------------------------------------------
2522     # @internal-function java-pkg_die
2523     #
2524     # Enhanced die for Java packages, which displays some information that may be
2525     # useful for debugging bugs on bugzilla.
2526     # ------------------------------------------------------------------------------
2527     #register_die_hook java-pkg_die
2528     if ! hasq java-pkg_die ${EBUILD_DEATH_HOOKS}; then
2529     EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} java-pkg_die"
2530     fi
2531    
2532     java-pkg_die() {
2533     echo "!!! When you file a bug report, please include the following information:" >&2
2534     echo "GENTOO_VM=${GENTOO_VM} CLASSPATH=\"${CLASSPATH}\" JAVA_HOME=\"${JAVA_HOME}\"" >&2
2535     echo "JAVACFLAGS=\"${JAVACFLAGS}\" COMPILER=\"${GENTOO_COMPILER}\"" >&2
2536     echo "and of course, the output of emerge --info" >&2
2537     }
2538    
2539 nichoj 1.7
2540     # TODO document
2541     # List jars in the source directory, ${S}
2542     java-pkg_jar-list() {
2543     if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
2544     einfo "Linked Jars"
2545     find "${S}" -type l -name '*.jar' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR},"
2546     einfo "Jars"
2547     find "${S}" -type f -name '*.jar' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR},"
2548     einfo "Classes"
2549     find "${S}" -type f -name '*.class' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR},"
2550     fi
2551     }
2552    
2553 caster 1.56 # ------------------------------------------------------------------------------
2554     # @internal-function java-pkg_verify-classes
2555     #
2556     # Verify that the classes were compiled for the right source / target. Dies if
2557     # not.
2558     # @param $1 (optional) - the file to check, otherwise checks whole ${D}
2559     # ------------------------------------------------------------------------------
2560 nichoj 1.7 java-pkg_verify-classes() {
2561     #$(find ${D} -type f -name '*.jar' -o -name '*.class')
2562 betelgeuse 1.55 local target=$(java-pkg_get-target)
2563 caster 1.56 local result
2564     local log="${T}/class-version-verify.log"
2565 betelgeuse 1.55 if [[ -n "${1}" ]]; then
2566 caster 1.56 class-version-verify.py -v -t ${target} "${1}" > "${log}"
2567     result=$?
2568 betelgeuse 1.55 else
2569 caster 1.56 ebegin "Verifying java class versions (target: ${target})"
2570     class-version-verify.py -v -t ${target} -r "${D}" > "${log}"
2571     result=$?
2572     eend ${result}
2573 betelgeuse 1.55 fi
2574 caster 1.56 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
2575 betelgeuse 1.55 if [[ ${result} != 0 ]]; then
2576 caster 1.56 eerror "Incorrect bytecode version found"
2577     [[ -n "${1}" ]] && eerror "in file: ${1}"
2578     eerror "See ${log} for more details."
2579     die "Incorrect bytecode found"
2580 nichoj 1.7 fi
2581     }
2582    
2583 ali_bush 1.70 # ----------------------------------------------------------------------------
2584     # @internal-function java-pkg_ensure-dep
2585     # Check that a package being used in jarfrom, getjars and getjar is contained
2586     # within DEPEND or RDEPEND.
2587 caster 1.77 # @param $1 - empty - check both vars; "runtime" or "build" - check only
2588     # RDEPEND, resp. DEPEND
2589 ali_bush 1.70 # @param $2 - Package name and slot.
2590 betelgeuse 1.87
2591 ali_bush 1.70 java-pkg_ensure-dep() {
2592     debug-print-function ${FUNCNAME} $*
2593    
2594 caster 1.77 local limit_to="${1}"
2595 ali_bush 1.70 local target_pkg="${2}"
2596     local dev_error=""
2597    
2598     local stripped_pkg=$(echo "${target_pkg}" | sed \
2599     's/-[0-9]*\(\.[0-9]\)*$//')
2600    
2601 betelgeuse 1.87 debug-print "Matching against: ${stripped_pkg}"
2602    
2603 caster 1.77 if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then
2604 ali_bush 1.70 dev_error="The ebuild is attempting to use ${target_pkg} that is not"
2605     dev_error="${dev_error} declared in DEPEND."
2606     if is-java-strict; then
2607 betelgeuse 1.87 eerror "${dev_error}"
2608 ali_bush 1.70 die "${dev_error}"
2609 betelgeuse 1.71 elif [[ ${BASH_SUBSHELL} = 0 ]]; then
2610 ali_bush 1.70 eerror "${dev_error}"
2611 betelgeuse 1.72 elog "Because you have this package installed the package will"
2612     elog "build without problems, but please report this to"
2613     elog "http://bugs.gentoo.org"
2614 ali_bush 1.70 fi
2615     fi
2616    
2617 ali_bush 1.86 if [[ ${limit_to} != build ]]; then
2618     if [[ ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then
2619     if [[ ! ( ${PDEPEND} =~ "${stripped_pkg}" ) ]]; then
2620     dev_error="The ebuild is attempting to use ${target_pkg},"
2621     dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND"
2622     dev_error="${dev_error} or PDEPEND."
2623     if is-java-strict; then
2624 betelgeuse 1.87 eerror "${dev_error}"
2625 ali_bush 1.86 die "${dev_error}"
2626     elif [[ ${BASH_SUBSHELL} = 0 ]]; then
2627     eerror "${dev_error}"
2628     elog "The package will build without problems, but may fail to run"
2629     elog "if you don't have ${target_pkg} installed, so please report"
2630     elog "this to http://bugs.gentoo.org"
2631     fi
2632     fi
2633 ali_bush 1.70 fi
2634     fi
2635     }
2636    
2637 nichoj 1.1 # ------------------------------------------------------------------------------
2638     # @section-end internal
2639     # ------------------------------------------------------------------------------
2640    
2641     java-pkg_check-phase() {
2642     local phase=${1}
2643 caster 1.82 local funcname=${FUNCNAME[1]}
2644     if [[ ${EBUILD_PHASE} != ${phase} ]]; then
2645     local msg="${funcname} used outside of src_${phase}"
2646     java-pkg_announce-qa-violation "${msg}"
2647 nichoj 1.1 fi
2648     }
2649    
2650     java-pkg_check-versioned-jar() {
2651     local jar=${1}
2652    
2653     if [[ ${jar} =~ ${PV} ]]; then
2654     java-pkg_announce-qa-violation "installing versioned jar '${jar}'"
2655     fi
2656     }
2657    
2658     java-pkg_check-jikes() {
2659     if hasq jikes ${IUSE}; then
2660     java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE"
2661     fi
2662     }
2663    
2664     java-pkg_announce-qa-violation() {
2665 caster 1.82 local nodie
2666     if [[ ${1} == "--nodie" ]]; then
2667     nodie="true"
2668     shift
2669 nichoj 1.1 fi
2670 caster 1.82 echo "Java QA Notice: $@" >&2
2671     increment-qa-violations
2672     [[ -z "${nodie}" ]] && is-java-strict && die "${@}"
2673 nichoj 1.1 }
2674    
2675     increment-qa-violations() {
2676     let "JAVA_PKG_QA_VIOLATIONS+=1"
2677     export JAVA_PKG_QA_VIOLATIONS
2678     }
2679    
2680 nichoj 1.9 is-java-strict() {
2681 nichoj 1.14 [[ -n ${JAVA_PKG_STRICT} ]]
2682 nichoj 1.9 return $?
2683     }
2684    
2685 nichoj 1.1 # ------------------------------------------------------------------------------
2686     # @eclass-end
2687     # ------------------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.20