aboutsummaryrefslogtreecommitdiff
blob: 47c7906b98807fc77dca83436666b5d137405306 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit java-pkg-2

if [[ ${PV} == "9999" ]]; then
	EGIT_REPO_URI="https://github.com/perl6/${PN}.git"
	inherit git-r3
	KEYWORDS=""
else
	SRC_URI="https://github.com/perl6/${PN}/tarball/${PV} -> ${P}.tar.gz"
	KEYWORDS=""
fi

DESCRIPTION="Not Quite Perl, a Perl 6 bootstrapping compiler"
HOMEPAGE="http://rakudo.org/"

LICENSE="Artistic-2"
SLOT="0"
IUSE="doc clang java +moar +system-libs test"
REQUIRED_USE="|| ( java moar )"

RDEPEND="java? ( >=virtual/jre-1.7
		system-libs? (
			dev-java/asm:4
			dev-java/jline:0
		)
	)
	moar? ( ~dev-lang/moarvm-${PV}[clang=] )
	dev-libs/libffi"
DEPEND="${RDEPEND}
	clang? ( sys-devel/clang )
	java? ( >=virtual/jdk-1.7 )
	dev-lang/perl"
PATCHES=( "${FILESDIR}/enable-external-jars.patch" )

pkg_setup() {
	use java && java-pkg-2_pkg_setup
}

src_prepare() {
	eapply "${PATCHES[@]}"
	eapply_user
	use java && java-pkg-2_src_prepare
}

src_unpack() {
	if [[ ${PV} == "9999" ]]; then
		git-r3_src_unpack
	else
		unpack ${A}
		mv "${WORKDIR}/perl6-nqp-"* "${WORKDIR}/${P}" || die
	fi
}

src_configure() {
	local backends
	use java && backends+="jvm,"
	use moar && backends+="moar"
	local myconfargs=(
		"--backend=${backends}"
		"--prefix=/usr" )

	# 2016.04 doesn't like our jna-3.4.1 nor jna-4.1.0
	# keep testing against it
	if use system-libs; then
		if use java; then
			myconfargs+=(
				"--with-asm=$(echo $(java-pkg_getjars asm-4) | tr : '\n' | grep '/asm\.jar$')"
				"--with-asm-tree=$(echo $(java-pkg_getjars asm-4) | tr : '\n' | grep '/asm-tree\.jar$')"
				"--with-jline=$(echo $(java-pkg_getjars jline) | tr : '\n' | grep '/jline\.jar$')" )
		else
			einfo "USE=system-libs set, but this won't have any effect without USE=java."
		fi
	fi

	perl Configure.pl "${myconfargs[@]}" || die
}

src_compile() {
	emake -j1
}

src_test() {
	emake -j1 test
}

src_install() {
	emake DESTDIR="${ED}" install

	dodoc CREDITS README.pod

	if use doc; then
		dodoc -r docs/*
	fi
}