| … | |
… | |
| 3 | # Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org> |
3 | # Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org> |
| 4 | # Copyright (c) 2004-2005, Gentoo Foundation |
4 | # Copyright (c) 2004-2005, Gentoo Foundation |
| 5 | # |
5 | # |
| 6 | # Licensed under the GNU General Public License, v2 |
6 | # Licensed under the GNU General Public License, v2 |
| 7 | # |
7 | # |
|
|
8 | # $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.30 2008/10/11 21:07:13 caster Exp $ |
| 8 | |
9 | |
| 9 | inherit java-utils-2 |
10 | inherit java-utils-2 |
| 10 | |
11 | |
| 11 | # ----------------------------------------------------------------------------- |
12 | # ----------------------------------------------------------------------------- |
| 12 | # @eclass-begin |
13 | # @eclass-begin |
| 13 | # @eclass-summary Eclass for Java Packages |
14 | # @eclass-summary Eclass for Java Packages |
| 14 | # |
15 | # |
| 15 | # This eclass should be inherited for pure Java packages, or by packages which |
16 | # This eclass should be inherited for pure Java packages, or by packages which |
| 16 | # need to use Java. |
17 | # need to use Java. |
| 17 | # ----------------------------------------------------------------------------- |
18 | # ----------------------------------------------------------------------------- |
|
|
19 | |
|
|
20 | # ------------------------------------------------------------------------------ |
|
|
21 | # @IUSE |
|
|
22 | # |
|
|
23 | # Use JAVA_PKG_IUSE instead of IUSE for doc, source and examples so that |
|
|
24 | # the eclass can automatically add the needed dependencies for the java-pkg_do* |
|
|
25 | # functions. |
|
|
26 | # |
|
|
27 | # ------------------------------------------------------------------------------ |
|
|
28 | IUSE="${JAVA_PKG_IUSE}" |
| 18 | |
29 | |
| 19 | # ------------------------------------------------------------------------------ |
30 | # ------------------------------------------------------------------------------ |
| 20 | # @depend |
31 | # @depend |
| 21 | # |
32 | # |
| 22 | # Java packages need java-config, and a fairly new release of Portage. |
33 | # Java packages need java-config, and a fairly new release of Portage. |
| … | |
… | |
| 30 | # |
41 | # |
| 31 | # Nothing special for RDEPEND... just the same as DEPEND. |
42 | # Nothing special for RDEPEND... just the same as DEPEND. |
| 32 | # ------------------------------------------------------------------------------ |
43 | # ------------------------------------------------------------------------------ |
| 33 | RDEPEND="${DEPEND}" |
44 | RDEPEND="${DEPEND}" |
| 34 | |
45 | |
| 35 | EXPORT_FUNCTIONS pkg_setup |
46 | # Commons packages follow the same rules so do it here |
|
|
47 | if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then |
|
|
48 | HOMEPAGE="http://commons.apache.org/${PN#commons-}/" |
|
|
49 | SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz" |
|
|
50 | fi |
|
|
51 | |
|
|
52 | EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst |
|
|
53 | [[ "${EAPI:-0}" == "2" ]] && EXPORT_FUNCTIONS src_prepare |
| 36 | |
54 | |
| 37 | # ------------------------------------------------------------------------------ |
55 | # ------------------------------------------------------------------------------ |
| 38 | # @eclass-pkg_setup |
56 | # @eclass-pkg_setup |
| 39 | # |
57 | # |
| 40 | # pkg_setup initializes the Java environment |
58 | # pkg_setup initializes the Java environment |
| 41 | # ------------------------------------------------------------------------------ |
59 | # ------------------------------------------------------------------------------ |
| 42 | java-pkg-2_pkg_setup() { |
60 | java-pkg-2_pkg_setup() { |
| 43 | java-pkg_init |
61 | java-pkg_init |
|
|
62 | java-pkg_ensure-test |
| 44 | } |
63 | } |
| 45 | |
64 | |
| 46 | # ------------------------------------------------------------------------------ |
65 | # ------------------------------------------------------------------------------ |
| 47 | # @note |
66 | # @eclass-src_prepare |
| 48 | # |
67 | # |
| 49 | # We need to initialize the environment in every function because Portage |
68 | # wrapper for java-utils-2_src_prepare |
| 50 | # will source /etc/profile between phases and trample all over the env. |
|
|
| 51 | # This is accomplished by phase hooks, which is available with newer versions of |
|
|
| 52 | # portage. |
|
|
| 53 | # ------------------------------------------------------------------------------ |
69 | # ------------------------------------------------------------------------------ |
| 54 | |
70 | java-pkg-2_src_prepare() { |
| 55 | pre_pkg_setup() { |
71 | java-utils-2_src_prepare |
| 56 | java-pkg-2_pkg_setup |
|
|
| 57 | } |
72 | } |
| 58 | |
73 | |
| 59 | pre_src_unpack() { |
74 | # ------------------------------------------------------------------------------ |
| 60 | java-pkg-2_pkg_setup |
75 | # @eclass-src_compile |
|
|
76 | # |
|
|
77 | # Default src_compile for java packages |
|
|
78 | # variables: |
|
|
79 | # EANT_BUILD_XML - controls the location of the build.xml (default: ./build.xml) |
|
|
80 | # EANT_FILTER_COMPILER - Calls java-pkg_filter-compiler with the value |
|
|
81 | # EANT_BUILD_TARGET - the ant target/targets to execute (default: jar) |
|
|
82 | # EANT_DOC_TARGET - the target to build extra docs under the doc use flag |
|
|
83 | # (default: javadoc; declare empty to disable completely) |
|
|
84 | # EANT_GENTOO_CLASSPATH - @see eant documention in java-utils-2.eclass |
|
|
85 | # EANT_EXTRA_ARGS - extra arguments to pass to eant |
|
|
86 | # EANT_ANT_TASKS - modifies the ANT_TASKS variable in the eant environment |
|
|
87 | # param: Parameters are passed to ant verbatim |
|
|
88 | # ------------------------------------------------------------------------------ |
|
|
89 | java-pkg-2_src_compile() { |
|
|
90 | if [[ -e "${EANT_BUILD_XML:=build.xml}" ]]; then |
|
|
91 | [[ "${EANT_FILTER_COMPILER}" ]] && \ |
|
|
92 | java-pkg_filter-compiler ${EANT_FILTER_COMPILER} |
|
|
93 | local antflags="${EANT_BUILD_TARGET:=jar}" |
|
|
94 | if hasq doc ${IUSE} && [[ -n "${EANT_DOC_TARGET=javadoc}" ]]; then |
|
|
95 | antflags="${antflags} $(use_doc ${EANT_DOC_TARGET})" |
|
|
96 | fi |
|
|
97 | local tasks |
|
|
98 | [[ ${EANT_ANT_TASKS} ]] && tasks="${ANT_TASKS} ${EANT_ANT_TASKS}" |
|
|
99 | ANT_TASKS="${tasks:-${ANT_TASKS}}" \ |
|
|
100 | eant ${antflags} -f "${EANT_BUILD_XML}" ${EANT_EXTRA_ARGS} "${@}" |
|
|
101 | else |
|
|
102 | echo "${FUNCNAME}: ${EANT_BUILD_XML} not found so nothing to do." |
|
|
103 | fi |
| 61 | } |
104 | } |
| 62 | |
105 | |
| 63 | pre_src_compile() { |
|
|
| 64 | java-pkg-2_pkg_setup |
|
|
| 65 | } |
|
|
| 66 | |
106 | |
| 67 | pre_src_install() { |
|
|
| 68 | java-pkg-2_pkg_setup |
|
|
| 69 | } |
|
|
| 70 | |
|
|
| 71 | pre_src_test() { |
|
|
| 72 | java-pkg-2_pkg_setup |
|
|
| 73 | } |
|
|
| 74 | |
|
|
| 75 | pre_pkg_preinst() { |
107 | java-pkg-2_pkg_preinst() { |
| 76 | java-pkg-2_pkg_setup |
108 | if is-java-strict; then |
| 77 | } |
109 | if has_version dev-java/java-dep-check; then |
| 78 | |
110 | local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}") |
| 79 | pre_pkg_postinst() { |
111 | if [[ ${output} ]]; then |
| 80 | java-pkg-2_pkg_setup |
112 | ewarn "Possibly unneeded dependencies found in package.env:" |
|
|
113 | for dep in ${output}; do |
|
|
114 | ewarn "\t${dep}" |
|
|
115 | done |
|
|
116 | fi |
|
|
117 | else |
|
|
118 | eerror "Install dev-java/java-dep-check for dependency checking" |
|
|
119 | fi |
|
|
120 | fi |
| 81 | } |
121 | } |
| 82 | |
122 | |
| 83 | # ------------------------------------------------------------------------------ |
123 | # ------------------------------------------------------------------------------ |
| 84 | # @eclass-end |
124 | # @eclass-end |
| 85 | # ------------------------------------------------------------------------------ |
125 | # ------------------------------------------------------------------------------ |