1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 JAVA_PKG_IUSE="doc source examples"
9 inherit java-pkg-2 java-ant-2
11 DESCRIPTION="JFlex is a lexical analyzer generator for Java"
12 HOMEPAGE="http://www.jflex.de/"
13 SRC_URI="http://${PN}.de/${P}.tar.gz"
17 KEYWORDS="amd64 ~ppc ppc64 x86 ~amd64-fbsd ~ppc-macos ~x64-macos ~x86-macos"
19 CDEPEND="dev-java/ant-core:0
20 >=dev-java/javacup-0.11a_beta20060608:0
23 RDEPEND=">=virtual/jre-1.5
24 vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
27 DEPEND=">=virtual/jdk-1.5
30 IUSE="${JAVA_PKG_IUSE} source vim-syntax"
33 # use a more convenient version number
34 sed -i s:"\(name=\"version\" value=\"\)[^\"]*\"":"\1${PV}\"":g build.xml
36 sed -i s:"\(name=\"bootstrap.version\" value=\"\)[^\"]*\"":"\1${PV}\"":g \
38 # add javadoc capability to build.xml
39 sed -i s,"\(</project>\)",\
40 "\n <target depends=\"compile\" name=\"javadoc\">\n <javadoc \
41 packagenames=\"jflex\" sourcepath=\"src/main/java:build/generated-\
42 sources\" destdir=\"javadoc\" version=\"true\" />\n </target>\n\1",g \
46 # TODO: Try to avoid using bundled jar (See bug #498874)
48 # Currently, this package uses an included JFlex.jar file to bootstrap.
49 # Upstream was contacted and this bootstrap is really needed. The only way to
50 # avoid it would be to use a supplied pre-compiled .scanner file.
52 EANT_GENTOO_CLASSPATH="ant-core"
53 EANT_GENTOO_CLASSPATH_EXTRA="lib/${P}.jar"
54 JAVA_ANT_REWRITE_CLASSPATH="true"
55 WANT_ANT_TASKS="javacup"
58 java-pkg-2_src_compile
60 # Compile another time, using our generated jar; for sanity.
61 cp build/${P}.jar ${EANT_GENTOO_CLASSPATH_EXTRA}
62 java-pkg-2_src_compile
65 # EANT_TEST_GENTOO_CLASSPATH doesn't support EANT_GENTOO_CLASSPATH_EXTRA yet.
73 java-pkg_newjar build/${P}.jar ${PN}.jar
74 java-pkg_dolauncher "${PN}-${SLOT}" --main jflex.Main
75 java-pkg_register-ant-task
78 dodoc doc/manual.pdf changelog.md
80 java-pkg_dojavadoc javadoc
83 use examples && java-pkg_doexamples examples
84 use source && java-pkg_dosrc src/main
86 if use vim-syntax; then
87 insinto /usr/share/vim/vimfiles/syntax
88 doins "${S}/lib/jflex.vim"