summaryrefslogtreecommitdiff
path: root/pcr/gcc-gcj
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/gcc-gcj')
-rw-r--r--pcr/gcc-gcj/PKGBUILD83
-rw-r--r--pcr/gcc-gcj/gcc-gcj.install20
-rw-r--r--pcr/gcc-gcj/gcc_pure64.patch26
-rwxr-xr-xpcr/gcc-gcj/libjava-sjlj.dpatch65
4 files changed, 194 insertions, 0 deletions
diff --git a/pcr/gcc-gcj/PKGBUILD b/pcr/gcc-gcj/PKGBUILD
new file mode 100644
index 000000000..7ed03b889
--- /dev/null
+++ b/pcr/gcc-gcj/PKGBUILD
@@ -0,0 +1,83 @@
+# Contributor: Renan Manola <rmanola@gmail.com>
+# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
+# Based on a modified version of the gcc PKGBUILD
+# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.io>
+
+pkgname=gcc-gcj
+pkgver=4.7.2
+pkgrel=2
+pkgdesc="The GNU Compiler for Java"
+arch=('i686' 'x86_64')
+license=('GPL' 'LGPL')
+url="http://gcc.gnu.org"
+depends=("gcc=$pkgver" 'gtk2' 'file' 'zip' 'libsm' 'libxtst' 'alsa-lib' 'libart-lgpl')
+makedepends=('binutils>=2.20.1' 'mpfr>=2.4.2-2' 'cloog>=0.16.2-1' 'elfutils'
+ 'libmpc>=0.8.2-2' 'jack')
+options=('!libtool')
+install=$pkgname.install
+source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2 libjava-sjlj.dpatch gcc_pure64.patch)
+md5sums=('cc308a0891e778cfda7a151ab8a6e762'
+ 'afe3541abf5ce163223f94ccdbc66e30'
+ 'ced48436c1b3c981d721a829f1094de1')
+
+build() {
+ cd ${srcdir}/gcc-${pkgver}
+
+ # Do not install libiberty
+ sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
+
+ # Do not run fixincludes
+ sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+
+ chmod +x ${srcdir}/*.dpatch
+ ${srcdir}/libjava-sjlj.dpatch -patch
+
+ echo ${pkgver} > gcc/BASE-VER
+
+ [ -d build ] || mkdir build
+ if [ "${CARCH}" = "x86_64" ]; then
+ patch -p1 < $srcdir/gcc_pure64.patch
+ fi
+ cd build
+
+ ../configure --prefix=/usr --enable-shared --enable-languages=java \
+ --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info \
+ --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib \
+ --libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch \
+ --with-tune=generic --enable-java-awt=gtk --with-java-home="$JAVA_HOME" \
+ --enable-libgcj-multifile --disable-plugin --with-system-zlib
+ make
+}
+
+package() {
+ cd ${srcdir}/gcc-${pkgver}/build
+ make -j1 DESTDIR=${pkgdir} install-target-libjava
+
+ cd gcc
+ make -j1 DESTDIR=${pkgdir} java.install-common java.install-man
+
+ install -m755 jc1 ${pkgdir}/usr/lib/gcc/${CHOST}/${pkgver}/
+ install -m755 jvgenmain ${pkgdir}/usr/lib/gcc/${CHOST}/${pkgver}/
+
+ # Remove files which belong to the base gcc package
+ rm -f ${pkgdir}/usr/bin/{c,g}++
+ if [ "${CARCH}" = "x86_64" ]; then
+ rm -f ${pkgdir}/usr/bin/x86_64-unknown-linux-gnu-{c,g}++
+ else
+ rm -f ${pkgdir}/usr/bin/i686-pc-linux-gnu-{c,g}++
+ fi
+ rm -f ${pkgdir}/usr/man/man1/g++.*
+ # Rename two files to not conflict to classpath
+ mv ${pkgdir}/usr/share/info/cp-tools.info ${pkgdir}/usr/share/info/cp-tools-gcj.info
+ rm ${pkgdir}/usr/share/info/dir
+ mv ${pkgdir}/usr/share/man/man1/gjdoc.1 ${pkgdir}/usr/share/man/man1/gjdoc.gcj.1
+
+ find ${pkgdir}/usr/lib -type f -name '*.so.*' -exec strip --strip-unneeded {} \;
+
+ linkdir=`basename $pkgdir/usr/lib/gcj-${pkgver}*`
+ ln -sf $linkdir ${pkgdir}/usr/lib/gcj-${pkgver%.?}
+ ln -sf libgcj-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj-${pkgver%.?}.jar
+ ln -sf libgcj-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj.jar
+ ln -sf libgcj-tools-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj-tools-${pkgver%.?}.jar
+ ln -sf libgcj-tools-${pkgver}.jar ${pkgdir}/usr/share/java/libgcj-tools.jar
+}
diff --git a/pcr/gcc-gcj/gcc-gcj.install b/pcr/gcc-gcj/gcc-gcj.install
new file mode 100644
index 000000000..916aa6a17
--- /dev/null
+++ b/pcr/gcc-gcj/gcc-gcj.install
@@ -0,0 +1,20 @@
+infodir=usr/share/info
+filelist=(cp-tools-gcj.info)
+
+post_install() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+}
+
+post_upgrade() {
+ post_install "$1"
+}
+
+pre_remove() {
+ [[ -x usr/bin/install-info ]] || return 0
+ for file in "${filelist[@]}"; do
+ install-info --delete "$infodir/$file.gz" "$infodir/dir" 2> /dev/null
+ done
+} \ No newline at end of file
diff --git a/pcr/gcc-gcj/gcc_pure64.patch b/pcr/gcc-gcj/gcc_pure64.patch
new file mode 100644
index 000000000..a9b09bbcf
--- /dev/null
+++ b/pcr/gcc-gcj/gcc_pure64.patch
@@ -0,0 +1,26 @@
+diff -Naur gcc-orig/gcc/config/i386/linux64.h gcc/gcc/config/i386/linux64.h
+--- gcc-orig/gcc/config/i386/linux64.h 2011-07-08 01:38:34.000000000 +1000
++++ gcc/gcc/config/i386/linux64.h 2011-07-24 19:48:05.000000000 +1000
+@@ -28,6 +28,6 @@
+ #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
+ #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
+
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
++#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2"
++#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
+diff -Naur gcc-orig/gcc/config/i386/t-linux64 gcc/gcc/config/i386/t-linux64
+--- gcc-orig/gcc/config/i386/t-linux64 2011-07-08 01:38:34.000000000 +1000
++++ gcc/gcc/config/i386/t-linux64 2011-07-24 19:49:41.000000000 +1000
+@@ -34,8 +34,8 @@
+ comma=,
+ MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+ MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+-MULTILIB_OSDIRNAMES = m64=../lib64
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
++MULTILIB_OSDIRNAMES = m64=../lib
++MULTILIB_OSDIRNAMES+= m32=../lib32
+ MULTILIB_OSDIRNAMES+= mx32=../libx32
+
+ LIBGCC = stmp-multilib
diff --git a/pcr/gcc-gcj/libjava-sjlj.dpatch b/pcr/gcc-gcj/libjava-sjlj.dpatch
new file mode 100755
index 000000000..95b4673b3
--- /dev/null
+++ b/pcr/gcc-gcj/libjava-sjlj.dpatch
@@ -0,0 +1,65 @@
+#! /bin/sh -e
+
+# DP: Don't try to use _Unwind_Backtrace on SJLJ targets.
+# DP: See bug #387875, #388505, GCC PR 29206.
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+ pdir="-d $3"
+ dir="$3/"
+elif [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch)
+ patch $pdir -f --no-backup-if-mismatch -p1 < $0
+ #cd ${dir}gcc && autoconf
+ ;;
+ -unpatch)
+ patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
+ #rm ${dir}gcc/configure
+ ;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+---
+ libjava/sysdep/generic/backtrace.h | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+Index: src/libjava/sysdep/generic/backtrace.h
+===================================================================
+--- src.orig/libjava/sysdep/generic/backtrace.h 2006-11-06 14:00:32.000000000 -0500
++++ src/libjava/sysdep/generic/backtrace.h 2006-11-06 14:04:38.000000000 -0500
+@@ -13,6 +13,20 @@ details. */
+
+ #include <java-stack.h>
+
++#ifdef SJLJ_EXCEPTIONS
++
++#undef _Unwind_GetIPInfo
++#define _Unwind_GetIPInfo(ctx,ip_before_insn) \
++ (abort (), (void) (ctx), *ip_before_insn = 1, 0)
++
++#undef _Unwind_GetRegionStart
++#define _Unwind_GetRegionStart(ctx) \
++ (abort (), (void) (ctx), 0)
++
++#undef _Unwind_Backtrace
++#define _Unwind_Backtrace(trace_fn,state_ptr) \
++ (fallback_backtrace (trace_fn, state_ptr))
++
+ /* Unwind through the call stack calling TRACE_FN with STATE for every stack
+ frame. Returns the reason why the unwinding was stopped. */
+ _Unwind_Reason_Code
+@@ -20,4 +34,7 @@ fallback_backtrace (_Unwind_Trace_Fn, _J
+ {
+ return _URC_NO_REASON;
+ }
++
++#endif /* SJLJ_EXCEPTIONS */
++
+ #endif