# # Based on crosstool by Dan Kegel # export GNU_SITE=http://mirror.csclub.uwaterloo.ca/gnu export OLD_PATH=$PATH export BUILD=i386-pc-solaris2.11 export HOST=i486-kopensolaris-gnu export TARGET=$HOST export ROOT=/opt/gnu-toolchain export SYSROOT=$ROOT/$TARGET export BUILD_ROOT=$ROOT/src export ROOT_GCC_CORE=$BUILD_ROOT/install_gcc-core/bin export CHROOT=/opt/gnu-chroot export PATH=$ROOT/bin:$ROOT_GCC_CORE/bin:$OLD_PATH # tarballs and patches mkdir -p $BUILD_ROOT; cd $BUILD_ROOT wget $GNU_SITE/glibc/glibc-2.7.tar.bz2 wget $GNU_SITE/binutils/binutils-2.18.tar.bz2 wget $GNU_SITE/gcc/gcc-4.2.4/gcc-4.2.4.tar.bz2 wget http://csclub.uwaterloo.ca/~dtbartle/opensolaris/config.guess wget http://csclub.uwaterloo.ca/~dtbartle/opensolaris/config.sub wget http://csclub.uwaterloo.ca/~dtbartle/opensolaris/binutils-2.18-kopensolaris-gnu.diff wget http://csclub.uwaterloo.ca/~dtbartle/opensolaris/gcc-4.2.4-kopensolaris-gnu.diff wget http://csclub.uwaterloo.ca/~dtbartle/opensolaris/glibc-2.7-kopensolaris-gnu.diff.gz tar -xjf binutils-2.18.tar.bz2 cd binutils-2.18 patch -p1 < ../binutils-2.18-kopensolaris-gnu.diff cp ../config.{guess,sub} . cd .. tar -xjf gcc-4.2.4.tar.bz2 cd gcc-4.2.4 patch -p1 < ../gcc-4.2.4-kopensolaris-gnu.diff cp ../config.{guess,sub} . cd .. tar -xjf glibc-2.7.tar.bz2 cd glibc-2.7 gunzip -c ../glibc-2.7-kopensolaris-gnu.diff.gz | patch -p1 cp ../config.{guess,sub} scripts cd .. # binutils mkdir build_binutils; cd build_binutils ../binutils-2.18/configure --target=$TARGET --prefix=$ROOT --with-sysroot=$SYSROOT make all make install cd .. # gcc-core mkdir build_gcc-core; cd build_gcc-core ../gcc-4.2.4/configure --target=$TARGET --prefix=$ROOT_GCC_CORE --disable-multilib \ --disable-nls --enable-threads=no --enable-symvers=gnu \ --disable-shared --enable-languages=c,c++ --without-headers make all-gcc make install-gcc mkdir -p $ROOT_GCC_CORE/$TARGET/bin for tool in ar as ld strip; do ln -s $SYSROOT/bin/$tool $ROOT_GCC_CORE/$TARGET/bin/$tool done cd .. # glibc (headers and libs only) cd $BUILD_ROOT mkdir build_glibc; cd build_glibc CC="$TARGET-gcc -march=i586" libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes \ ../glibc-2.7/configure --build=$BUILD --host=$HOST --prefix= make lib make install_root=$SYSROOT install-headers install-lib-all cp bits/stdio_lim.h $SYSROOT/include/bits/stdio_lim.h cp ../glibc-2.7/include/gnu/stubs.h $SYSROOT/sys-include/gnu/stubs.h cd .. # gcc mkdir build_gcc; cd build_gcc ../gcc-4.2.4/configure --target=$TARGET --prefix=$ROOT \ --with-headers=$SYSROOT/include --with-local-prefix=$SYSROOT \ --enable-multilib --disable-libgomp --enable-languages=c,c++ \ --with-arch=i586 make all make install cd .. # glibc (chroot) rm -rf build_glibc; mkdir build_glibc; cd build_glibc ../glibc-2.7/configure --prefix=/usr --build=$BUILD --host=$HOST \ --sysconfdir=/etc make all make install_root=$CHROOT install cp $CHROOT/usr/include/gnu/stubs*.h $SYSROOT/sys-include/gnu cd .. export PATH=$OLD_PATH # # libtool # # In order to compile many packages, you need to update libtool. This can be # done by running autoreconf. Alternatively, the package's configure can be # modified: # # In general, anything like this: # # # This must be Linux ELF. # linux*) # # should be changed to: # # # This must be Linux ELF. # linux* | kopensolaris*-gnu) # # Also, any instances of k*bsd*-gnu should be modified to also include # kopensolaris*-gnu. # # # Packages that should be cross-compiled and installed to the chroot: # # bash, coreutils, make, libiconv, pcre, grep, autoconf, automake, # m4, gawk, sed, binutils, gcc, gzip, bzip2, tar, diffutils, # ncurses, texinfo, wget, findutils # # These commands can generally be used to cross-compile: # # Change the . below to the actual location of config.{sub,guess} in # # the source (e.g. build-aux, scripts, etc...). # cp $BUILD_ROOT/config.sub $BUILD_ROOT/config.guess . # ./configure --build=$BUILD --host=$HOST --prefix=/usr --sysconfdir=/etc \ # --localstatedir=/var --enable-shared # make all # make DESTDIR=$CHROOT install # # coreutils: # # You must remove 'binPROGRAMS_INSTALL=./ginstall' from src/Makefile. # # grep: # # You must add the following to the configure line: # # --disable-perl-regexp # # gcc: # # In gcc/Makefile.in, change: # # # to: # # SYSTEM_HEADER_DIR = ${CHROOT}/usr/include # # gzip: # # Apply this patch: # # http://cvs.fedoraproject.org/viewvc/devel/gzip/gzip-1.3.12-futimens.patch?revision=1.1 # # ncurses: # # You should build ncurses and install it to the toolchain directory: # # ./configure --build=$BUILD --host=$HOST --prefix=$SYSROOT # make all # make install #