net-im/ktp-text-ui: EAPI 6, pin slots
[gentoo.git] / dev-util / jay / jay-1.1.1-r2.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=4
6 inherit mono java-pkg-opt-2 toolchain-funcs
7
8 DESCRIPTION="A LALR(1) parser generator: Berkeley yacc retargeted to C# and Java"
9 HOMEPAGE="http://www.cs.rit.edu/~ats/projects/lp/doc/jay/package-summary.html"
10 SRC_URI="http://www.cs.rit.edu/~ats/projects/lp/doc/jay/doc-files/src.zip -> ${P}.zip
11         https://dev.gentoo.org/~ssuominen/${P}-mono.snk.bz2"
12
13 LICENSE="public-domain BSD"
14 SLOT="0"
15 KEYWORDS="amd64 ~ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
16 IUSE="java mono"
17
18 COMMON_DEPEND="!<=dev-lang/mono-2.4
19         mono? ( >dev-lang/mono-2.4 )"
20 RDEPEND="${COMMOND_DEPEND}
21         java? ( >=virtual/jre-1.4 )"
22 DEPEND="${COMMON_DEPEND}
23         java? ( >=virtual/jdk-1.4 )
24         app-arch/unzip"
25
26 S=${WORKDIR}/${PN}
27
28 RESTRICT="test"
29
30 java_prepare() {
31         sed -i -r \
32                 -e 's:^v4\s*=.*:v4 = ${JAVA_HOME}/bin:' \
33                 -e 's:JAVAC\s*=.*:\0 ${JAVACFLAGS}:' \
34                 yydebug/makefile || die
35 }
36
37 src_prepare() {
38         sed -i -r \
39                 -e "s:^CC\s*=.*:CC = `tc-getCC`:" \
40                 -e 's/^jay:.* \$e /\0$(LDFLAGS) /' \
41                 -e '/^CFLAGS\s*=/d' \
42                  src/makefile || die
43
44         java-utils-2_src_prepare
45 }
46
47 src_compile() {
48         emake -C src jay
49         use java && emake -C yydebug yydebug.jar
50
51         if use mono; then
52                 pushd cs >/dev/null
53                 "${EPREFIX}"/usr/bin/gmcs /target:library /out:yydebug.dll /keyfile:"${WORKDIR}"/${P}-mono.snk yyDebug.cs || die
54                 popd >/dev/null
55         fi
56 }
57
58 src_install() {
59         dobin src/jay
60
61         doman jay.1
62         dodoc README
63
64         if use java; then
65                 java-pkg_dojar yydebug/yydebug.jar
66                 insinto /usr/share/jay
67                 doins java/skeleton.{java,tables}
68         fi
69
70         if use mono; then
71                 egacinstall cs/yydebug.dll
72                 insinto /usr/share/jay
73                 doins cs/skeleton.cs
74         fi
75 }