1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit java-pkg-opt-2 multibuild
8 if [[ ${PV} == "9999" ]]; then
9 EGIT_REPO_URI="https://github.com/perl6/${PN}.git"
13 SRC_URI="https://github.com/perl6/${PN}/releases/download/${PV}/${P}.tar.gz -> ${P}.official.tar.gz"
14 KEYWORDS="~amd64 ~x86"
17 DESCRIPTION="Not Quite Perl, a Perl 6 bootstrapping compiler"
18 HOMEPAGE="https://rakudo.org"
22 IUSE="doc clang java +moar test"
23 RESTRICT="!test? ( test )"
24 REQUIRED_USE="|| ( java moar )"
31 moar? ( ~dev-lang/moarvm-${PV}[clang=] )"
33 java? ( >=virtual/jre-1.8 )"
35 clang? ( sys-devel/clang )
36 java? ( >=virtual/jdk-1.8 )
40 if has_version dev-lang/rakudo || has_version dev-lang/nqp; then
41 ewarn "NQP is known to fail compilation/installation with Rakudo and/or NQP"
42 ewarn "already being installed. So if it fails, try uninstalling both"
43 ewarn "dev-lang/nqp and dev-lang/rakudo, then do a new installation."
44 ewarn "(see Bug #584394)"
49 # Don't clean stage0 jars.
50 einfo "Cleaning upstream jars"
51 java-pkg_clean 3rdparty/
53 # Don't use jars we just deleted.
54 sed -i -r 's/(:3rdparty[^:]*)+/:${THIRDPARTY_JARS}/g' \
55 src/vm/jvm/runners/nqp-j || die
59 MULTIBUILD_VARIANTS=()
60 use moar && MULTIBUILD_VARIANTS+=( moar )
61 use java && MULTIBUILD_VARIANTS+=( jvm )
63 multibuild_copy_sources
65 # This will pull in conditional java_prepare
70 pushd "${BUILD_DIR}" > /dev/null || die
72 "--backend=${MULTIBUILD_VARIANT}"
73 "--prefix=${EPREFIX}/usr" )
75 perl Configure.pl "${myconfargs[@]}" || die
80 if [[ "${MULTIBUILD_VARIANT}" = jvm ]]; then
83 THIRDPARTY_JARS=$(java-pkg_getjars --with-dependencies asm-4,jline,jna-4) \
84 JAVAC="$(java-pkg_get-javac) $(java-pkg_javac-args)"
85 elif [[ "${MULTIBUILD_VARIANT}" = moar ]]; then
98 # This is the actual reason we need multibuild.eclass.
99 # We need to distinguish the install procedure for MoarVM and JVM backends.
100 case "${MULTIBUILD_VARIANT}" in
108 pushd "${BUILD_DIR}" > /dev/null || die
109 # Set JAVA_PKG_JARDEST early.
112 # Upstream sets the classpath to this location. Perhaps it's
113 # used to locate the additional libraries?
114 java-pkg_addcp "${JAVA_PKG_JARDEST}"
116 insinto "${JAVA_PKG_JARDEST}"
120 if has ${jar} ${PN}.jar ${PN}-runtime.jar; then
121 # jars for NQP itself.
122 java-pkg_dojar ${jar}
129 # Upstream uses -Xbootclasspath/a, which is faster due to lack
130 # of verification, but gjl isn't flexible enough yet. :(
131 java-pkg_dolauncher ${PN}-j --main ${PN}
132 dosym ${PN}-j /usr/bin/${PN}
133 dobin tools/jvm/eval-client.pl
134 popd > /dev/null || die
137 die "Unknown MULTIBUILD_VARIANT ${MULTIBUILD_VARIANT}."
143 multibuild_foreach_variant nqp_configure
147 multibuild_foreach_variant nqp_compile
151 multibuild_foreach_variant nqp_test
155 multibuild_foreach_variant nqp_install
157 dodoc CREDITS README.pod
158 use doc && dodoc -r docs/*