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"
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 )"
36 clang? ( sys-devel/clang )
37 java? ( >=virtual/jdk-1.8 )
41 if has_version dev-lang/rakudo || has_version dev-lang/nqp; then
42 ewarn "NQP is known to fail compilation/installation with Rakudo and/or NQP"
43 ewarn "already being installed. So if it fails, try uninstalling both"
44 ewarn "dev-lang/nqp and dev-lang/rakudo, then do a new installation."
45 ewarn "(see Bug #584394)"
50 # Don't clean stage0 jars.
51 einfo "Cleaning upstream jars"
52 java-pkg_clean 3rdparty/
54 # Don't use jars we just deleted.
55 sed -i -r 's/(:3rdparty[^:]*)+/:${THIRDPARTY_JARS}/g' \
56 src/vm/jvm/runners/nqp-j || die
60 MULTIBUILD_VARIANTS=()
61 use moar && MULTIBUILD_VARIANTS+=( moar )
62 use java && MULTIBUILD_VARIANTS+=( jvm )
64 multibuild_copy_sources
66 # This will pull in conditional java_prepare
71 pushd "${BUILD_DIR}" > /dev/null || die
73 "--backend=${MULTIBUILD_VARIANT}"
74 "--prefix=${EPREFIX}/usr" )
76 perl Configure.pl "${myconfargs[@]}" || die
81 if [[ "${MULTIBUILD_VARIANT}" = jvm ]]; then
84 THIRDPARTY_JARS=$(java-pkg_getjars --with-dependencies asm-4,jline,jna-4) \
85 JAVAC="$(java-pkg_get-javac) $(java-pkg_javac-args)"
86 elif [[ "${MULTIBUILD_VARIANT}" = moar ]]; then
99 # This is the actual reason we need multibuild.eclass.
100 # We need to distinguish the install procedure for MoarVM and JVM backends.
101 case "${MULTIBUILD_VARIANT}" in
109 pushd "${BUILD_DIR}" > /dev/null || die
110 # Set JAVA_PKG_JARDEST early.
113 # Upstream sets the classpath to this location. Perhaps it's
114 # used to locate the additional libraries?
115 java-pkg_addcp "${JAVA_PKG_JARDEST}"
117 insinto "${JAVA_PKG_JARDEST}"
121 if has ${jar} ${PN}.jar ${PN}-runtime.jar; then
122 # jars for NQP itself.
123 java-pkg_dojar ${jar}
130 # Upstream uses -Xbootclasspath/a, which is faster due to lack
131 # of verification, but gjl isn't flexible enough yet. :(
132 java-pkg_dolauncher ${PN}-j --main ${PN}
133 dosym ${PN}-j /usr/bin/${PN}
134 dobin tools/jvm/eval-client.pl
135 popd > /dev/null || die
138 die "Unknown MULTIBUILD_VARIANT ${MULTIBUILD_VARIANT}."
144 multibuild_foreach_variant nqp_configure
148 multibuild_foreach_variant nqp_compile
152 multibuild_foreach_variant nqp_test
156 multibuild_foreach_variant nqp_install
158 dodoc CREDITS README.pod
159 use doc && dodoc -r docs/*