build a native binutils and gcc that at least runs 'g++ --help' on xomb. assumes a previous build of the xomb branch in a separate location, which supplies a cross compiler.

This commit is contained in:
wolfwood
2011-09-19 00:30:20 -04:00
parent 08e91225c8
commit 6820949a12
6 changed files with 398 additions and 0 deletions

22
cloog.patch Normal file
View File

@@ -0,0 +1,22 @@
diff -rupN ../../cloog-0.16.3/autoconf/config.sub ./autoconf/config.sub
--- ../../cloog-0.16.3/autoconf/config.sub 2011-09-30 23:58:48.765922513 -0400
+++ ./autoconf/config.sub 2011-10-01 00:15:25.789236074 -0400
@@ -1298,6 +1298,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -xomb* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
diff -rupN ../../cloog-0.16.3/isl/config.sub ./isl/config.sub
--- ../../cloog-0.16.3/isl/config.sub 2011-09-30 23:58:48.442589186 -0400
+++ ./isl/config.sub 2011-10-01 00:29:19.405886210 -0400
@@ -1298,6 +1298,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -xomb* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \

20
gmp.patch Normal file
View File

@@ -0,0 +1,20 @@
diff -rupN gmp-5.0.2.orig/configfsf.sub gmp-5.0.2/configfsf.sub
--- gmp-5.0.2.orig/configfsf.sub 2011-09-20 02:48:37.224034311 -0400
+++ gmp-5.0.2/configfsf.sub 2011-09-20 02:53:08.140695606 -0400
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
-timestamp='2011-03-23'
+timestamp='2011-09-20'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -1327,6 +1327,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -xomb* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \

11
mpc.patch Normal file
View File

@@ -0,0 +1,11 @@
diff -rupN ../../mpc-0.9/config.sub ./config.sub
--- ../../mpc-0.9/config.sub 2011-09-20 03:10:22.527341760 -0400
+++ ./config.sub 2011-09-20 03:18:05.710665907 -0400
@@ -1291,6 +1291,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -xomb* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \

11
mpfr.patch Normal file
View File

@@ -0,0 +1,11 @@
diff -rupN ../../mpfr-3.0.1/config.sub ./config.sub
--- ../../mpfr-3.0.1/config.sub 2011-09-20 03:10:10.274008670 -0400
+++ ./config.sub 2011-09-20 03:16:00.840668383 -0400
@@ -1291,6 +1291,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -xomb* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \

312
native-build.sh Executable file
View File

@@ -0,0 +1,312 @@
# --- resources ---
function title {
echo -en "\033]0;$@\007"
}
function setphase {
title $1
echo ">>>>>>> $1"
}
# --- Argument processing ---
NOTEST=1
EXTRAS=1
for arg in $@; do
case $arg in
--clean) rm -rf local/ build/*/;;
--notest) NOTEST=1;;
--extras) EXTRA=1;;
esac
done
# --- Variables ---
# EDIT THESE
OSNAME=xomb
NCPU=4
BINUTILS_VER=2.21.1
GCC_VER=4.6.1
GMP_VER=5.0.2
MPFR_VER=3.1.0
NEWLIB_VER=1.19.0
MPC_VER=0.9
PPL_VER=0.11.2
CLOOG_VER=0.16.3
# NO M0AR EDITS PLZ
TARGET=x86_64-pc-${OSNAME}
PREFIX=`pwd`/local
#export PATH=$PREFIX/bin:$PATH
WFLAGS=-c
XOMBPATH=/home/wolfwood/repos/xomb
CROSSPATH=/home/wolfwood/repos/buildtools/local
if [ ! -d $XOMBPATH ]; then
XOMBPATH=`pwd`/../xomb
fi
if [ ! -f $XOMBPATH/app/build/elf.ld ]; then
echo "cannot find xomb $XOMBPATH"
exit
fi
#export LIBS="-l:drt0.a -l:syscall.a -l:mindrt.a"
export SHAREDLDFLAGS="-T$XOMBPATH/app/build/elf.ld"
# -L$XOMBPATH/user/c/lib -L$XOMBPATH/runtimes/mindrt"
export LDFLAGS="-static $SHAREDLDFLAGS -L$CROSSPATH/$TARGET"
export CPPFLAGS="-I$CROSSPATH/$TARGET/include/c++ -I$CROSSPATH/$TARGET/include/c++/$GCC_VER"
export CFLAGS="-static -O2 $CPPFLAGS"
export CXXFLAGS="$CFLAGS -lsupc++ -lstdc++ -L$CROSSPATH/$TARGET"
export CC=$TARGET-gcc
export CXX=$TARGET-g++
export AR=$TARGET-ar
export AS=$TARGET-as
#DLLTOOL
export LD=$TARGET-ld
#LIPO
export NM=$TARGET-nm
export RANLIB=$TARGET-ranlib
export STRIP=$TARGET-strip
#WINDRES
#WINDMC
export OBJCOPY=$TARGET-objcopy
export OBJDUMP=$TARGET-objdump
export CC_FOR_TARGET=$TARGET-gcc
export CXX_FOR_TARGET=$TARGET-g++
export AR_FOR_TARGET=$TARGET-ar
export AS_FOR_TARGET=$TARGET-as
#DLLTOOL
export LD_FOR_TARGET=$TARGET-ld
#LIPO
export NM_FOR_TARGET=$TARGET-nm
export RANLIB_FOR_TARGET=$TARGET-ranlib
export STRIP_FOR_TARGET=$TARGET-strip
#WINDRES
#WINDMC
export OBJCOPY_FOR_TARGET=$TARGET-objcopy
export OBJDUMP_FOR_TARGET=$TARGET-objdump
# --- Directory creation ---
mkdir -p build
mkdir -p local
cd build
setphase "MAKE OBJECT DIRECTORIES"
mkdir -p binutils-obj
mkdir -p gcc-obj
mkdir -p newlib-obj
mkdir -p gmp-obj
mkdir -p mpfr-obj
mkdir -p mpc-obj
if [ $EXTRAS -eq 1 ]; then
mkdir -p ppl-obj
mkdir -p cloog-obj
fi
# --- Fetch and extract each package ---
setphase "FETCH BINUTILS"
wget $WFLAGS http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VER}.tar.bz2
tar -xf binutils-${BINUTILS_VER}.tar.bz2
setphase "FETCH GCC"
wget $WFLAGS http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-core-${GCC_VER}.tar.gz
tar -xf gcc-core-${GCC_VER}.tar.gz
wget $WFLAGS http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-g++-${GCC_VER}.tar.gz
tar -xf gcc-g++-${GCC_VER}.tar.gz
wget $WFLAGS http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-fortran-${GCC_VER}.tar.gz
tar -xf gcc-fortran-${GCC_VER}.tar.gz
setphase "FETCH GMP"
wget $WFLAGS http://ftp.gnu.org/gnu/gmp/gmp-${GMP_VER}.tar.gz
tar -xf gmp-${GMP_VER}.tar.gz
setphase "FETCH MPFR"
wget $WFLAGS http://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VER}.tar.gz
tar -xf mpfr-${MPFR_VER}.tar.gz
setphase "FETCH MPC"
wget $WFLAGS http://www.multiprecision.org/mpc/download/mpc-${MPC_VER}.tar.gz
tar -xf mpc-${MPC_VER}.tar.gz
setphase "FETCH NEWLIB"
wget $WFLAGS ftp://sources.redhat.com/pub/newlib/newlib-${NEWLIB_VER}.tar.gz
tar -xf newlib-${NEWLIB_VER}.tar.gz
if [ $EXTRAS -eq 1 ]; then
setphase "FETCH PPL"
wget $WFLAGS ftp://ftp.cs.unipr.it/pub/ppl/releases/${PPL_VER}/ppl-${PPL_VER}.tar.bz2
tar -xf ppl-${PPL_VER}.tar.bz2
setphase "FETCH CLooG"
wget $WFLAGS http://www.bastoul.net/cloog/pages/download/count.php3?url=./cloog-${CLOOG_VER}.tar.gz -O cloog-${CLOOG_VER}.tar.gz
tar -xf cloog-${CLOOG_VER}.tar.gz
fi
# --- Patch and push new code into each package ---
# Fix patches with osname
#PERLCMD="s/{{OSNAME}}/${OSNAME}/g"
#perl -pi -e $PERLCMD *.patch
#perl -pi -e $PERLCMD gcc-files/gcc/config/os.h
# diff -rupN
setphase "PATCH BINUTILS"
patch -p0 -d binutils-${BINUTILS_VER} < ../binutils.patch || exit
cp ../binutils-files/ld/emulparams/os_x86_64.sh binutils-${BINUTILS_VER}/ld/emulparams/${OSNAME}_x86_64.sh
setphase "PATCH GMP"
patch -p1 -d gmp-${GMP_VER} < ../gmp.patch || exit
setphase "PATCH MPFR"
patch -p0 -d mpfr-${MPFR_VER} < ../mpfr.patch || exit
setphase "PATCH MPC"
patch -p0 -d mpc-${MPC_VER} < ../mpc.patch || exit
if [ $EXTRAS -eq 1 ]; then
setphase "PATCH PPL"
patch -p0 -d ppl-${PPL_VER} < ../ppl.patch || exit
setphase "PATCH CLOOG"
patch -p0 -d cloog-${CLOOG_VER} < ../cloog.patch || exit
fi
setphase "PATCH GCC"
patch -p0 -d gcc-${GCC_VER} < ../gcc.patch || exit
cp ../gcc-files/gcc/config/os.h gcc-${GCC_VER}/gcc/config/${OSNAME}.h
setphase "PATCH NEWLIB"
patch -p0 -d newlib-${NEWLIB_VER} < ../newlib.patch || exit
mkdir -p newlib-${NEWLIB_VER}/newlib/libc/sys/${OSNAME}
cp -r ../newlib-files/* newlib-${NEWLIB_VER}/newlib/libc/sys/${OSNAME}/.
cp ../newlib-files/vanilla-syscalls.c newlib-${NEWLIB_VER}/newlib/libc/sys/${OSNAME}/syscalls.c
# --- Compile all packages ---
# relevant thread for building static bin utils (and dealing with ppl :)
# http://sources.redhat.com/ml/binutils/2011-08/msg00182.html
setphase "COMPILE _static_ BINUTILS"
cd binutils-obj
#--enable-plugins: Building BFD with plugin support requires a host that supports -ldl.
../binutils-${BINUTILS_VER}/configure --host=$TARGET --prefix=$PREFIX --enable-gold --disable-werror || exit
make configure-host || exit
make -j$NCPU all-gold LDFLAGS="-all-static $SHAREDLDFLAGS" || exit
make -j$NCPU LDFLAGS="-all-static $SHAREDLDFLAGS" || exit
make install || exit
cd ..
setphase "COMPILE GMP"
cd gmp-obj
../gmp-${GMP_VER}/configure --host=$TARGET --prefix=$PREFIX --enable-cxx --disable-shared || exit
make -j$NCPU || exit
if [ $NOTEST -ne 1 ]; then
make check || exit
fi
make install || exit
cd ..
setphase "COMPILE MPFR"
cd mpfr-obj
../mpfr-${MPFR_VER}/configure --host=$TARGET --prefix=$PREFIX --with-gmp=$PREFIX --disable-shared
make -j$NCPU || exit
if [ $NOTEST -ne 1 ]; then
make check || exit
fi
make install || exit
cd ..
setphase "COMPILE MPC"
cd mpc-obj
../mpc-${MPC_VER}/configure --host=$TARGET --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --disable-shared || exit
make -j$NCPU || exit
if [ $NOTEST -ne 1 ]; then
make check || exit
fi
make install || exit
cd ..
if [ $EXTRAS -eq 1 ]; then
setphase "COMPILE PPL"
cd ppl-obj
../ppl-${PPL_VER}/configure --host=$TARGET --prefix=$PREFIX --with-gmp-prefix=$PREFIX --disable-shared || exit
make -j$NCPU || exit
if [ $NOTEST -ne 1 ]; then
make check || exit
fi
make install || exit
cd ..
setphase "COMPILE CLOOG"
cd cloog-obj
../cloog-${CLOOG_VER}/configure --host=$TARGET --prefix=$PREFIX --with-gmp-prefix=$PREFIX --disable-shared || exit
make -j$NCPU || exit
if [ $NOTEST -ne 1 ]; then
make check || exit
fi
make install || exit
cd ..
fi
setphase "AUTOCONF GCC"
cd gcc-${GCC_VER}/libstdc++-v3
#autoreconf || exit
#autoconf || exit
cd ../..
setphase "COMPILE GCC"
cd gcc-obj
../gcc-${GCC_VER}/configure --prefix=$PREFIX --host=$TARGET --enable-languages=c,c++ --disable-libssp --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --with-ppl=$PREFIX --enable-cloog-backend=isl --disable-nls --with-newlib --without-headers --disable-shared || exit
#--with-cloog=$PREFIX
make -j$NCPU all-gcc LDFLAGS="$LDFLAGS" || exit
make install-gcc LDFLAGS="$LDFLAGS" || exit
cd ..
setphase "AUTOCONF NEWLIB-XOMB"
cd newlib-${NEWLIB_VER}/newlib/libc/sys
autoconf || exit
cd ${OSNAME}
autoreconf || exit
cd ../../../../..
setphase "CONFIGURE NEWLIB"
cp ../newlib-files/syscalls.c newlib-${NEWLIB_VER}/newlib/libc/sys/${OSNAME}/syscalls.c
cd newlib-obj
../newlib-${NEWLIB_VER}/configure --target=$TARGET --host=$TARGET --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX -enable-newlib-hw-fp || exit
setphase "COMPILE NEWLIB"
make -j$NCPU || exit
make install || exit
cd ..
setphase "PASS-2 COMPILE GCC"
cd gcc-obj
#make all-target-libgcc
#make install-target-libgcc
make -j$NCPU all-target-libstdc++-v3 LDFLAGS="$LDFLAGS" || exit
make install-target-libstdc++-v3 LDFLAGS="$LDFLAGS" || exit
make -j$NCPU all LDFLAGS="$LDFLAGS" || exit
make install LDFLAGS="$LDFLAGS" || exit
cd ..

22
ppl.patch Normal file
View File

@@ -0,0 +1,22 @@
diff -rupN ../../ppl-0.11.2/config.sub ./config.sub
--- ../../ppl-0.11.2/config.sub 2011-02-27 04:07:47.000000000 -0500
+++ ./config.sub 2011-09-30 22:36:38.336020289 -0400
@@ -1306,6 +1306,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -xomb* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
diff -rupN ../../ppl-0.11.2/Watchdog/config.sub ./Watchdog/config.sub
--- ../../ppl-0.11.2/Watchdog/config.sub 2011-02-27 04:07:47.000000000 -0500
+++ ./Watchdog/config.sub 2011-09-30 22:35:51.082687892 -0400
@@ -1306,6 +1306,7 @@ case $os in
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
+ | -xomb* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \