summaryrefslogtreecommitdiff
path: root/dev-util/jay/jay-1.1.1-r2.ebuild
blob: 8a5b980d446628c971084079c57a9af4270422ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=4
inherit mono java-pkg-opt-2 toolchain-funcs

DESCRIPTION="A LALR(1) parser generator: Berkeley yacc retargeted to C# and Java"
HOMEPAGE="http://www.cs.rit.edu/~ats/projects/lp/doc/jay/package-summary.html"
SRC_URI="http://www.cs.rit.edu/~ats/projects/lp/doc/jay/doc-files/src.zip -> ${P}.zip
	https://dev.gentoo.org/~ssuominen/${P}-mono.snk.bz2"

LICENSE="public-domain BSD"
SLOT="0"
KEYWORDS="amd64 ~ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
IUSE="java mono"

COMMON_DEPEND="!<=dev-lang/mono-2.4
	mono? ( >dev-lang/mono-2.4 )"
RDEPEND="${COMMOND_DEPEND}
	java? (	>=virtual/jre-1.4 )"
DEPEND="${COMMON_DEPEND}
	java? ( >=virtual/jdk-1.4 )
	app-arch/unzip"

S=${WORKDIR}/${PN}

RESTRICT="test"

java_prepare() {
	sed -i -r \
		-e 's:^v4\s*=.*:v4 = ${JAVA_HOME}/bin:' \
		-e 's:JAVAC\s*=.*:\0 ${JAVACFLAGS}:' \
		yydebug/makefile || die
}

src_prepare() {
	sed -i -r \
		-e "s:^CC\s*=.*:CC = `tc-getCC`:" \
		-e 's/^jay:.* \$e /\0$(LDFLAGS) /' \
		-e '/^CFLAGS\s*=/d' \
		 src/makefile || die

	java-utils-2_src_prepare
}

src_compile() {
	emake -C src jay
	use java && emake -C yydebug yydebug.jar

	if use mono; then
		pushd cs >/dev/null
		"${EPREFIX}"/usr/bin/gmcs /target:library /out:yydebug.dll /keyfile:"${WORKDIR}"/${P}-mono.snk yyDebug.cs || die
		popd >/dev/null
	fi
}

src_install() {
	dobin src/jay

	doman jay.1
	dodoc README

	if use java; then
		java-pkg_dojar yydebug/yydebug.jar
		insinto /usr/share/jay
		doins java/skeleton.{java,tables}
	fi

	if use mono; then
		egacinstall cs/yydebug.dll
		insinto /usr/share/jay
		doins cs/skeleton.cs
	fi
}