summaryrefslogtreecommitdiff
path: root/dev-java/ecj-gcj
diff options
context:
space:
mode:
Diffstat (limited to 'dev-java/ecj-gcj')
-rw-r--r--dev-java/ecj-gcj/Manifest4
-rw-r--r--dev-java/ecj-gcj/ecj-gcj-4.4.2.ebuild93
-rw-r--r--dev-java/ecj-gcj/files/ecj-gcj.in23
-rw-r--r--dev-java/ecj-gcj/metadata.xml11
4 files changed, 131 insertions, 0 deletions
diff --git a/dev-java/ecj-gcj/Manifest b/dev-java/ecj-gcj/Manifest
new file mode 100644
index 000000000000..3380c7f2bcb3
--- /dev/null
+++ b/dev-java/ecj-gcj/Manifest
@@ -0,0 +1,4 @@
+AUX ecj-gcj.in 840 BLAKE2B ec5a8f37428c4e9a133898b534eec0d70559dc4bbe1b3aa8ad825bb172c8fbf3e167cee72f7df9a64847d2b299aa53254874f296567df96deb84aaaaa0f6dcd0 SHA512 7ed6620090643f31f33762a1fe8f0024518bb808bf8aa2e8bfc8f9c0475e41f699670939bfa945a48aa5f5fad61b557a9e315c2781103717c2a6a1bd67a048a1
+DIST ecjsrc-4.4.2.jar 1764959 BLAKE2B 402bcbb040c28fa10dad07c4223daed9976f3246d6984ac74d95087a6cdcd5a742072126a999435eb2d49d49bb2884474461ae8439a9839617b2891297cd7c07 SHA512 53e850fc64994b104d45f58c22f1302ceb1f23bcf69300940be5689dfa6278bea14b4506746fec7b14db6f48c24ccbee16755943fffcdd7f6ad4fe5d9ddc1f20
+EBUILD ecj-gcj-4.4.2.ebuild 2433 BLAKE2B 9606ed88b77a1903a31d191a489c4229bc0982beff5584d5ea2c52146ee473fa42a0881a7ad47bee7fcfc6444de47184fbefcd8dd1fec1d928239fdd4c0a05e6 SHA512 7e84f812d8549a2893acd7494cc5004100810244debf556591029cecfddb3e8c69a232b951e8d3bccebc4932c14ac6155ea2f37fbf758a12baf5db246776b6c7
+MISC metadata.xml 403 BLAKE2B e0bb5fa6775b686338aea038dda01ad0af5e25ed0758ac7c7796ed734a0dd69fd60d069cd0e74cf0513c022d65727bcc460ed95ed98921010c995e668983e014 SHA512 9a887b9b4ae389bddf88e08c0a9ad145dc3fb69340822938fe7fd6fdb02c55c5b87c34742dc4349dae880ea48fd00161ac70d6c5289c23336c1301c561d0c90c
diff --git a/dev-java/ecj-gcj/ecj-gcj-4.4.2.ebuild b/dev-java/ecj-gcj/ecj-gcj-4.4.2.ebuild
new file mode 100644
index 000000000000..9f3ec5665c73
--- /dev/null
+++ b/dev-java/ecj-gcj/ecj-gcj-4.4.2.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit java-pkg-2 prefix toolchain-funcs
+
+MY_PN="ecj"
+DMF="R-${PV}-201502041700"
+
+DESCRIPTION="Subset of Eclipse Compiler for Java compiled by gcj, serving as javac in gcj-jdk"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="http://download.eclipse.org/eclipse/downloads/drops4/${DMF}/${MY_PN}src-${PV}.jar"
+
+LICENSE="EPL-1.0"
+SLOT="4.4"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+IUSE="+native"
+
+RDEPEND="sys-devel/gcc:*[gcj]
+ app-eselect/eselect-java"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ !dev-java/eclipse-ecj:3.5[gcj]"
+
+JAVA_PKG_WANT_SOURCE=1.6
+JAVA_PKG_WANT_TARGET=1.6
+
+MY_PS="${MY_PN}-${SLOT}"
+S="${WORKDIR}"
+
+java_prepare() {
+ # We don't need the ant adapter here
+ rm org/eclipse/jdt/core/JDTCompilerAdapter.java || die
+ rm -r org/eclipse/jdt/internal/antadapter || die
+
+ # upstream build.xml excludes this
+ rm META-INF/eclipse.inf || die
+
+ # these java6 specific classes cannot compile with gcj
+ rm -r org/eclipse/jdt/internal/compiler/{apt,tool}/ || die
+}
+
+src_compile() {
+ local gccbin=$(gcc-config -B)
+ local gcj="${gccbin}/gcj"
+
+ find org/ -name "*.java" > sources.lst || die
+
+ einfo "bootstrapping ${MY_PN} with gcj ..."
+ "${gcj}" -w -C -fsource=${JAVA_PKG_WANT_SOURCE} -d bootstrap @sources.lst || die
+
+ einfo "building ${MY_PN} with bootstrapped ${MY_PN} ..."
+ "${gccbin}/gij" -cp bootstrap:. org.eclipse.jdt.internal.compiler.batch.Main -nowarn $(java-pkg_javac-args) @sources.lst || die
+ find org/ META-INF/ -type f ! -name "*.java" -exec "${gccbin}/gjar" cf ${MY_PN}.jar {} + || die
+
+ if use native; then
+ einfo "building native ${MY_PS} library, patience needed ..."
+ "${gcj}" ${CFLAGS} ${LDFLAGS} -findirect-dispatch -shared -fPIC -Wl,-Bsymbolic \
+ -o ${MY_PS}.so ${MY_PN}.jar || die
+ fi
+}
+
+src_install() {
+ java-pkg_dojar ${MY_PN}.jar
+
+ sed -e "s|@SLOT@|${SLOT}|" \
+ "${FILESDIR}/${PN}.in" \
+ > "${T}"/${PN}-${SLOT} || die
+ eprefixify "${T}/${PN}-${SLOT}"
+ dobin "${T}/${PN}-${SLOT}"
+
+ use native && dolib.so ${MY_PS}.so
+}
+
+pkg_postinst() {
+ if use native; then
+ local dbtool="$(gcc-config -B)/gcj-dbtool"
+
+ "${dbtool}" -a $("${dbtool}" -p) \
+ "${EROOT}usr/share/${PN}-${SLOT}/lib/ecj.jar" \
+ "${EROOT}usr/$(get_libdir)/${MY_PN}-${SLOT}.so"
+ fi
+
+ einfo "To select between slots of ECJ..."
+ einfo " # eselect ecj"
+
+ eselect ecj update ${PN}-${SLOT}
+}
+
+pkg_postrm() {
+ eselect ecj update
+}
diff --git a/dev-java/ecj-gcj/files/ecj-gcj.in b/dev-java/ecj-gcj/files/ecj-gcj.in
new file mode 100644
index 000000000000..4f838d5de240
--- /dev/null
+++ b/dev-java/ecj-gcj/files/ecj-gcj.in
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# /usr/bin/gij was installed by gcj-jdk in the past and is now handled by
+# gcc-config, fall back to gcc-config to locate the binary should the
+# symlink/wrapper-binary not yet exists.
+GIJ_BIN="@GENTOO_PORTAGE_EPREFIX@/usr/bin/gij"
+if [[ ! -f ${GIJ_BIN} ]]; then
+ GIJ_BIN="$(gcc-config -B)/gij"
+fi
+if [[ ! -f ${GIJ_BIN} ]]; then
+ echo "gij not found! check that gcc is compiled with gcj flag"
+ exit 1
+fi
+# calling java-config would be an unnecessary slowdown here
+
+# we need to append user CLASSPATH otherwise it will be overriden by the -classpath parameter
+# this breaks e.g. bootstrap of ant-core
+ecj_cp="@GENTOO_PORTAGE_EPREFIX@/usr/share/ecj-gcj-@SLOT@/lib/ecj.jar"
+if [[ -n "${CLASSPATH}" ]]; then
+ ecj_cp="${ecj_cp}:${CLASSPATH}"
+fi
+
+${GIJ_BIN} -classpath "${ecj_cp}" org.eclipse.jdt.internal.compiler.batch.Main "${@}"
diff --git a/dev-java/ecj-gcj/metadata.xml b/dev-java/ecj-gcj/metadata.xml
new file mode 100644
index 000000000000..0c0a51809582
--- /dev/null
+++ b/dev-java/ecj-gcj/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>java@gentoo.org</email>
+ <name>Java</name>
+</maintainer>
+<use>
+ <flag name="native">Build a native binary along with the jar. Provides faster execution time, but needs about 1G memory and some patience to compile.</flag>
+</use>
+</pkgmetadata>