dev-java/openjdk-jre-bin: bump to 11.0.7_p10
[gentoo.git] / dev-java / javacup / javacup-0.11b_p20151001.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 JAVA_PKG_IUSE="doc source"
7
8 inherit eutils java-pkg-2 java-ant-2
9
10 MY_PV=${PV/_beta/-}
11 MY_PV=${MY_PV/_p/-}
12 MY_PV=${MY_PV#0.}
13 MY_P=java-cup-${MY_PV%-*}
14
15 DESCRIPTION="CUP Parser Generator for Java"
16 HOMEPAGE="http://www2.cs.tum.edu/projects/cup/"
17 SRC_URI="http://www2.cs.tum.edu/projects/cup/releases/java-cup-src-${MY_PV}.tar.gz"
18 LICENSE="GPL-2"
19 SLOT="0"
20 KEYWORDS="amd64 ~arm arm64 ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
21
22 DEPEND=">=virtual/jdk-1.7
23         >=dev-java/ant-core-1.7.0:0
24         >=dev-java/jflex-1.6.1:0"
25
26 RDEPEND=">=virtual/jre-1.7"
27
28 JAVA_ANT_REWRITE_CLASSPATH="yes"
29 JAVA_ANT_CLASSPATH_TAGS+=" taskdef"
30
31 S="${WORKDIR}"
32
33 java_prepare() {
34         # Bizarrely, you can't build from the tarball without this patch.
35         epatch "${FILESDIR}"/${PN}-0.11b_beta20150326-build-xml-svn.patch
36
37         # The JFlex package name has changed to lower case.
38         sed -i "s/JFlex\./jflex./g" build.xml || die
39
40         # Remove the bundled JFlex.
41         rm -v bin/JFlex.jar || die
42 }
43
44 src_configure() {
45         EANT_GENTOO_CLASSPATH_EXTRA=$(java-pkg_getjars --build-only ant-core,jflex)
46         java-ant-2_src_configure
47 }
48
49 src_compile() {
50         # Annoyingly javacup bundles an older version of itself that will
51         # break jflex if that has already been built against this newer
52         # version beforehand. Even more annoyingly, the binary download is
53         # built with Java 8, which isn't much use to us. We therefore use
54         # any installed javacup that is newer than the bundled version where
55         # possible. If this approach turns out to be unworkable then we may
56         # just have to use the bundled jflex for bootstrapping.
57         if has_version \>=${CATEGORY}/${PN}-0.11b:${SLOT}; then
58                 # Use PORTAGE_QUIET to suppress a QA warning that is spurious
59                 # thanks to has_version above. This is Portage-specific but
60                 # showing the warning elsewhere isn't the end of the world.
61                 einfo "Bootstrapping with installed javacup ..."
62                 EANT_GENTOO_CLASSPATH_EXTRA+=":$(PORTAGE_QUIET=1 java-pkg_getjars --build-only javacup)" eant
63         else
64                 einfo "Bootstrapping with bundled javacup ..."
65                 EANT_GENTOO_CLASSPATH_EXTRA+=":${S}/bin/${MY_P:0:-1}.jar" eant
66         fi
67
68         # Clean everything except the new jar.
69         rm -rv java/ classes/ || die
70
71         einfo "Recompiling with newly built javacup ..."
72         EANT_GENTOO_CLASSPATH_EXTRA+=":${S}/dist/${MY_P}.jar" eant
73
74         use doc && ejavadoc -sourcepath src/ -d javadoc java_cup
75 }
76
77 src_install() {
78         java-pkg_newjar dist/${MY_P}.jar
79         java-pkg_newjar dist/${MY_P}-runtime.jar ${PN}-runtime.jar
80         java-pkg_dolauncher ${PN} --jar ${PN}.jar
81         java-pkg_register-ant-task
82
83         dodoc changelog.txt
84         docinto html
85         dodoc manual.html
86
87         use source && java-pkg_dosrc java/*
88         use doc && java-pkg_dojavadoc javadoc
89 }