-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gcc-5.5.0-1: Rebuild with gcj (GNU-Java) support
- gcj and some other tools under bin are needed to bootstrap the openjdk builds (Using a 'regular' jdk does not work). Only drawback, one also needs the 'alien' ecj (Eclipse-Java) compiler to get a working gcj. - g++ has been setup to use the old c++ abi per default, since I expect, that if it is used, its used to compile old stuff. (Note: -D_GLIBCXX_USE_CXX11_ABI=[0|1] works of course)
Showing
1 changed file
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#! /bin/bash | ||
|
||
# COOKIE=$(mcookie); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 1; exec bash /dev/shm/runme-$COOKIE.sh | ||
|
||
PKG=gcc | ||
VERSION=5.5.0 | ||
BUILD=1 | ||
# URL=http://ftp.gnu.org/gnu/gcc/gcc-${VERSION}/gcc-${VERSION}.tar.gz | ||
URL=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$VERSION/gcc-$VERSION.tar.xz | ||
SRC=$( echo $URL | rev | cut -d/ -f1 | rev ) | ||
|
||
# gcc 3.4 didn't need this to build java (back in the good old days ...) | ||
ECJ_URL=ftp://sourceware.org/pub/java/ecj-latest.jar | ||
ECJ_JAR=$( echo $ECJ_URL | rev | cut -d/ -f1 | rev ) | ||
|
||
PREFIX=/pkg/$PKG-$VERSION-$BUILD | ||
# PREFIX=/dev/shm/pkg/$PKG-$VERSION-$BUILD | ||
|
||
set -xe | ||
umask 022 | ||
|
||
BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp | ||
test -d $BUILD_TMPDIR && rm -rf $BUILD_TMPDIR | ||
mkdir -p $BUILD_TMPDIR/home | ||
export TMPDIR=$BUILD_TMPDIR | ||
export HOME=$BUILD_TMPDIR/home | ||
|
||
exec </dev/null | ||
|
||
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/package/bin:/usr/local/bin | ||
|
||
mkdir -p $PREFIX | ||
cat >$PREFIX/profile <<-EOF | ||
PATH=$PREFIX/bin:\$PATH | ||
LD_LIBRARY_PATH=$PREFIX/lib64\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH | ||
export LD_LIBRARY_PATH | ||
EOF | ||
. $PREFIX/profile | ||
|
||
BUILDDIR=$PREFIX/build | ||
|
||
mkdir -p $BUILDDIR | ||
cd $BUILDDIR | ||
|
||
test -e $SRC || wget $URL | ||
test -n 'XWIPE' && rm -rf ./gcc-$VERSION ./gcc-$VERSION-build | ||
test -d gcc-$VERSION || tar xf $SRC | ||
|
||
# Copy ecj.jar into the TLD of the source. Needed to build the java compiler. | ||
test -e $ECJ_JAR || wget $ECJ_URL | ||
test -e gcc-$VERSION/ecj.jar || cp $ECJ_JAR gcc-$VERSION/ecj.jar | ||
|
||
mkdir -p gcc-$VERSION-build | ||
|
||
cd gcc-$VERSION-build | ||
|
||
../gcc-$VERSION/configure \ | ||
--prefix=$PREFIX \ | ||
--enable-shared \ | ||
--enable-bootstrap \ | ||
--enable-threads=posix \ | ||
--enable-checking=release \ | ||
--enable-clocale=gnu \ | ||
--enable-languages=c,c++,fortran,objc,obj-c++,go,java,lto \ | ||
--disable-multilib \ | ||
--enable-objc-gc \ | ||
--with-system-zlib \ | ||
--enable-libstdcxx-dual-abi \ | ||
--with-default-libstdcxx-abi=gcc4-compatible \ | ||
--enable-__cxa_atexit \ | ||
--enable-libssp \ | ||
--enable-lto \ | ||
--enable-java-awt=gtk \ | ||
--disable-gtktest \ | ||
--verbose | ||
|
||
make -j $(nproc) | ||
# make -k check 2>&1 | tee check.log | ||
make install | ||
|
||
cd $PREFIX | ||
mkdir -vp lib64 | ||
ln -sv ${PREFIX}/bin/cpp lib64/ | ||
test -e bin/cc || ln -sv gcc bin/cc | ||
|
||
install -v -dm755 lib64/bfd-plugins | ||
ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/$VERSION/liblto_plugin.so lib64/bfd-plugins/ | ||
|
||
# and dump these ... | ||
rm -v lib64/*-gdb.py | ||
|
||
# ++++++++++++++++++ Prepare OpenJDK build ++++++++++++++++++ | ||
|
||
# create a JDK compatible directory structure below $PREFIX/lib/jvm (yes, 'lib') | ||
# emulation is required in order to compile OpenJDK using GNU java | ||
# Main author: Eric Hameleers <alien@slackware.com> December 2011 | ||
|
||
cd $PREFIX | ||
|
||
JVM=$PREFIX/lib/jvm | ||
BINDIR=$PREFIX/bin | ||
LIB_ARCH=amd64 # not kidding, grep amd64 in openjdk-boot/jdk/make/jdk_generic_profile.sh ;) | ||
|
||
GCJVER=$(gcj -dumpversion) | ||
# next yields a '16' | ||
GCJSOVER=$( readlink -f $(gcj -print-file-name=libgcj.so) | rev | cut -d. -f3 | rev ) | ||
|
||
# remove the old set of symlinks if they should exist: | ||
rm -fr $JVM | ||
|
||
mkdir -p $JVM | ||
mkdir -p $JVM/bin | ||
mkdir -p $JVM/jre/bin | ||
mkdir -p $JVM/jre/lib/${LIB_ARCH}/client | ||
mkdir -p $JVM/jre/lib/${LIB_ARCH}/server | ||
mkdir -p $JVM/lib | ||
|
||
ln -sf $BINDIR/gjar $JVM/bin/jar | ||
ln -sf $BINDIR/grmic $JVM/bin/rmic | ||
ln -sf $BINDIR/gjavah $JVM/bin/javah | ||
ln -sf $BINDIR/jcf-dump $JVM/bin/javap | ||
ln -sf $BINDIR/gappletviewer $JVM/bin/appletviewer | ||
ln -sf $BINDIR/grmiregistry $JVM/bin/rmiregistry | ||
ln -sf $BINDIR/grmiregistry $JVM/jre/bin/rmiregistry | ||
ln -sf $BINDIR/gkeytool $JVM/bin/keytool | ||
ln -sf $BINDIR/gkeytool $JVM/jre/bin/keytool | ||
ln -sf $BINDIR/gij $JVM/bin/java | ||
ln -sf $BINDIR/ecj $JVM/bin/javac | ||
ln -sf $BINDIR/gnative2ascii $JVM/bin/native2ascii | ||
ln -sf $PREFIX/lib/gcj-${GCJVER}-$GCJSOVER/libjvm.so $JVM/jre/lib/${LIB_ARCH}/client/libjvm.so | ||
ln -sf $PREFIX/lib/gcj-${GCJVER}-$GCJSOVER/libjvm.so $JVM/jre/lib/${LIB_ARCH}/server/libjvm.so | ||
ln -sf $PREFIX/lib/gcj-${GCJVER}-$GCJSOVER/libjawt.so $JVM/jre/lib/${LIB_ARCH}/libjawt.so | ||
ln -sf $PREFIX/share/java/libgcj-${GCJVER}.jar $JVM/jre/lib/rt.jar | ||
ln -sf $PREFIX/share/java/libgcj-tools-${GCJVER}.jar $JVM/lib/tools.jar | ||
ln -sf $PREFIX/include/c++/${GCJVER}/gnu/java $JVM/include | ||
|
||
# Add a Eclipse Java Compiler wrapper which is required | ||
# for bootstrapping OpenJDK using GNU java: | ||
cat <<EOT > $PREFIX/bin/ecj | ||
#!/bin/sh | ||
CLASSPATH=$PREFIX/share/java/ecj.jar\${CLASSPATH:+:}\$CLASSPATH \ | ||
java org.eclipse.jdt.internal.compiler.batch.Main "\$@" | ||
EOT | ||
chmod 755 $PREFIX/bin/ecj | ||
|
||
# exit 1 # inhibit 'closing' | ||
exit |