aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang/nqp/nqp-2016.04-r3.ebuild')
-rw-r--r--dev-lang/nqp/nqp-2016.04-r3.ebuild159
1 files changed, 110 insertions, 49 deletions
diff --git a/dev-lang/nqp/nqp-2016.04-r3.ebuild b/dev-lang/nqp/nqp-2016.04-r3.ebuild
index 47c7906..3d3e1b3 100644
--- a/dev-lang/nqp/nqp-2016.04-r3.ebuild
+++ b/dev-lang/nqp/nqp-2016.04-r3.ebuild
@@ -2,9 +2,9 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
-EAPI=6
+EAPI=5
-inherit java-pkg-2
+inherit java-pkg-opt-2 multibuild
if [[ ${PV} == "9999" ]]; then
EGIT_REPO_URI="https://github.com/perl6/${PN}.git"
@@ -12,7 +12,8 @@ if [[ ${PV} == "9999" ]]; then
KEYWORDS=""
else
SRC_URI="https://github.com/perl6/${PN}/tarball/${PV} -> ${P}.tar.gz"
- KEYWORDS=""
+ inherit vcs-snapshot
+ KEYWORDS="~amd64 ~x86"
fi
DESCRIPTION="Not Quite Perl, a Perl 6 bootstrapping compiler"
@@ -20,80 +21,140 @@ HOMEPAGE="http://rakudo.org/"
LICENSE="Artistic-2"
SLOT="0"
-IUSE="doc clang java +moar +system-libs test"
+IUSE="doc clang java +moar test"
REQUIRED_USE="|| ( java moar )"
-RDEPEND="java? ( >=virtual/jre-1.7
- system-libs? (
- dev-java/asm:4
- dev-java/jline:0
- )
+CDEPEND="java? (
+ dev-java/asm:4
+ dev-java/jline:0
+ dev-java/jna:4
)
- moar? ( ~dev-lang/moarvm-${PV}[clang=] )
- dev-libs/libffi"
-DEPEND="${RDEPEND}
+ moar? ( ~dev-lang/moarvm-${PV}[clang=] )"
+RDEPEND="${CDEPEND}
+ java? ( >=virtual/jre-1.7 )"
+DEPEND="${CDEPEND}
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
+pkg_pretend() {
+ if has_version dev-lang/rakudo || has_version dev-lang/nqp; then
+ ewarn "NQP is known to fail compilation/installation with rakudo and/or NQP"
+ ewarn "already being installed. So if it fails, try uninstalling them before"
+ ewarn "reporting a bug."
+ fi
}
-src_prepare() {
- eapply "${PATCHES[@]}"
- eapply_user
- use java && java-pkg-2_src_prepare
+java_prepare() {
+ # Don't clean stage0 jars.
+ einfo "Cleaning upstream jars"
+ java-pkg_clean 3rdparty/
+
+ # Don't use jars we just deleted.
+ sed -i -r 's/(:3rdparty[^:]*)+/:${THIRDPARTY_JARS}/g' \
+ src/vm/jvm/runners/nqp-j || die
}
-src_unpack() {
- if [[ ${PV} == "9999" ]]; then
- git-r3_src_unpack
- else
- unpack ${A}
- mv "${WORKDIR}/perl6-nqp-"* "${WORKDIR}/${P}" || die
- fi
+src_prepare() {
+ MULTIBUILD_VARIANTS=()
+ use moar && MULTIBUILD_VARIANTS+=( moar )
+ use java && MULTIBUILD_VARIANTS+=( jvm )
+
+ multibuild_copy_sources
+
+ # This will pull in conditional java_prepare
+ default
}
-src_configure() {
- local backends
- use java && backends+="jvm,"
- use moar && backends+="moar"
+nqp_configure() {
+ pushd "${BUILD_DIR}" > /dev/null || die
local myconfargs=(
- "--backend=${backends}"
+ "--backend=${MULTIBUILD_VARIANT}"
"--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
+ perl Configure.pl "${myconfargs[@]}" || die
+ popd || die
+}
+
+nqp_compile() {
+ if [[ "${MULTIBUILD_VARIANT}" = jvm ]]; then
+ emake -j1 \
+ -C "${BUILD_DIR}" \
+ THIRDPARTY_JARS=$(java-pkg_getjars --with-dependencies asm-4,jline,jna-4) \
+ JAVAC="$(java-pkg_get-javac) $(java-pkg_javac-args)"
+ elif [[ "${MULTIBUILD_VARIANT}" = moar ]]; then
+ emake -j1 \
+ -C "${BUILD_DIR}"
fi
+}
- perl Configure.pl "${myconfargs[@]}" || die
+nqp_test() {
+ emake -j1 \
+ -C "${BUILD_DIR}" \
+ test
+}
+
+nqp_install() {
+ # This is the actual reason we need multibuild.eclass.
+ # We need to distinguish the install procedure for MoarVM and JVM backends.
+ case "${MULTIBUILD_VARIANT}" in
+ moar)
+ emake \
+ DESTDIR="${ED}" \
+ -C "${BUILD_DIR}" \
+ install
+ ;;
+ jvm)
+ pushd "${BUILD_DIR}" > /dev/null || die
+ # Set JAVA_PKG_JARDEST early.
+ java-pkg_init_paths_
+
+ # Upstream sets the classpath to this location. Perhaps it's
+ # used to locate the additional libraries?
+ java-pkg_addcp "${JAVA_PKG_JARDEST}"
+
+ insinto "${JAVA_PKG_JARDEST}"
+ local jar
+
+ for jar in *.jar; do
+ if has ${jar} ${PN}.jar ${PN}-runtime.jar; then
+ # jars for NQP itself.
+ java-pkg_dojar ${jar}
+ else
+ # jars used by NQP.
+ doins ${jar}
+ fi
+ done
+
+ # Upstream uses -Xbootclasspath/a, which is faster due to lack
+ # of verification, but gjl isn't flexible enough yet. :(
+ java-pkg_dolauncher ${PN}-j --main ${PN}
+ dosym ${PN}-j /usr/bin/${PN}
+ dobin tools/jvm/eval-client.pl
+ popd > /dev/null || die
+ ;;
+ *)
+ die "Unknown MULTIBUILD_VARIANT ${MULTIBUILD_VARIANT}."
+ ;;
+ esac
+}
+
+src_configure() {
+ multibuild_foreach_variant nqp_configure
}
src_compile() {
- emake -j1
+ multibuild_foreach_variant nqp_compile
}
src_test() {
- emake -j1 test
+ multibuild_foreach_variant nqp_test
}
src_install() {
- emake DESTDIR="${ED}" install
+ multibuild_foreach_variant nqp_install
dodoc CREDITS README.pod
-
- if use doc; then
- dodoc -r docs/*
- fi
+ use doc && dodoc -r docs/*
}