Merge remote-tracking branch 'github/pr/626'.
[gentoo.git] / dev-java / gnu-classpath / gnu-classpath-0.98-r4.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit eutils java-pkg-2 multilib
8
9 MY_P=${P/gnu-/}
10 DESCRIPTION="Free core class libraries for use with virtual machines and compilers for the Java language"
11 SRC_URI="mirror://gnu/classpath/${MY_P}.tar.gz"
12 HOMEPAGE="https://www.gnu.org/software/classpath"
13
14 LICENSE="GPL-2-with-linking-exception"
15 SLOT="0.98"
16 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x86-macos"
17
18 IUSE="alsa debug doc dssi examples gconf +gjdoc gmp gtk gstreamer qt4 xml"
19 REQUIRED_USE="doc? ( gjdoc )"
20
21 RDEPEND="alsa? ( media-libs/alsa-lib )
22                 dssi? ( >=media-libs/dssi-0.9 )
23                 gconf? ( gnome-base/gconf:2= )
24                 gjdoc? ( >=dev-java/antlr-2.7.7-r7:0 )
25                 gmp? ( >=dev-libs/gmp-4.2.4:0= )
26                 gstreamer? (
27                         >=media-libs/gstreamer-0.10.10:0.10=
28                         >=media-libs/gst-plugins-base-0.10.10:0.10=
29                         x11-libs/gtk+:2=
30                 )
31                 gtk? (
32                                 >=x11-libs/gtk+-2.8:2=
33                                 dev-libs/glib:2=
34                                 media-libs/freetype:2=
35                                 >=x11-libs/cairo-1.1.9:=
36                                 x11-libs/libICE
37                                 x11-libs/libSM
38                                 x11-libs/libX11
39                                 x11-libs/libXrandr
40                                 x11-libs/libXrender
41                                 x11-libs/libXtst
42                                 x11-libs/pango
43                 )
44                 qt4? ( dev-qt/qtgui:4= )
45                 xml? ( >=dev-libs/libxml2-2.6.8:2= >=dev-libs/libxslt-1.1.11 )"
46
47 DEPEND="app-arch/zip
48                 dev-java/eclipse-ecj
49                 gtk? (
50                         x11-libs/libXrender
51                         >=x11-libs/libXtst-1.1.0
52                         x11-proto/xproto
53                 )
54                 >=virtual/jdk-1.5
55                 ${RDEPEND}"
56
57 RDEPEND=">=virtual/jre-1.5
58         ${RDEPEND}"
59
60 S=${WORKDIR}/${MY_P}
61
62 java_prepare() {
63         epatch "${FILESDIR}"/${P}-freetype-2.5.3-support.patch
64 }
65
66 src_configure() {
67         # We require ecj anyway, so force it to avoid problems with bad versions of javac
68         export JAVAC="${EPREFIX}/usr/bin/ecj"
69         export JAVA="${EPREFIX}/usr/bin/java"
70         # build takes care of them itself, duplicate -source -target kills ecj
71         export JAVACFLAGS="-nowarn"
72         # build system is passing -J-Xmx768M which ecj however ignores
73         # this will make the ecj launcher do it (seen case where default was not enough heap)
74         export gjl_java_args="-Xmx768M"
75
76         # don't use econf, because it ends up putting things under /usr, which may
77         # collide with other slots of classpath
78         local myconf
79         if use gjdoc; then
80                 local antlr=$(java-pkg_getjar antlr antlr.jar)
81                 myconf="--with-antlr-jar=${antlr}"
82         fi
83
84         if use doc; then
85                 # Avoid a cyclic dependency on gjdoc by building gjdoc before
86                 # the docs. First we need to trick configure. Hack alert!
87                 echo -e "#!/bin/sh\necho gjdoc 0.8" > tools/gjdoc.build || die
88                 chmod 755 tools/gjdoc.build || die
89         fi
90
91         ANTLR= ./configure \
92                 $(use_enable alsa) \
93                 $(use_enable debug ) \
94                 $(use_enable examples) \
95                 $(use_enable gconf gconf-peer) \
96                 $(use_enable gjdoc) \
97                 $(use_enable gmp) \
98                 $(use_enable gtk gtk-peer) \
99                 $(use_enable gstreamer gstreamer-peer) \
100                 $(use_enable qt4 qt-peer) \
101                 $(use_enable xml xmlj) \
102                 $(use_enable dssi ) \
103                 $(use_with doc gjdoc "${S}/tools/gjdoc.build") \
104                 --enable-jni \
105                 --disable-dependency-tracking \
106                 --disable-plugin \
107                 --host=${CHOST} \
108                 --prefix="${EPREFIX}"/usr/${PN}-${SLOT} \
109                 --with-ecj-jar=$(java-pkg_getjar --build-only eclipse-ecj-* ecj.jar) \
110                 --disable-Werror \
111                 ${myconf} || die "configure failed"
112 }
113
114 src_compile() {
115         if use doc; then
116                 # Build gjdoc before the docs. We need to hack the real gjdoc
117                 # script to run from the build directory instead.
118                 sed -r "s:^(tools_dir=).*:\1${S}/tools:" tools/gjdoc > tools/gjdoc.build || die
119                 emake -C lib
120                 emake -C tools
121         fi
122
123         default
124 }
125
126 src_install() {
127         emake DESTDIR="${D}" install
128         dodoc AUTHORS BUGS ChangeLog* HACKING NEWS README THANKYOU TODO
129         java-pkg_regjar /usr/${P}/share/classpath/glibj.zip
130
131         if use doc; then
132                 # Strangely the Makefile doesn't install these.
133                 insinto "/usr/${PN}-${SLOT}/share/classpath/api"
134                 doins -r doc/api/html/*
135         fi
136 }