From 3357aee4b2d3c706aa42dabc0d66d149dfa85bc3 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Tue, 31 Jul 2007 10:27:37 +0000 Subject: [PATCH] add flags to allow resuming build --- README.TXT | 20 +-- build-devkit.sh | 242 +++++++++++++++++--------------- dkarm-eabi/scripts/build-gcc.sh | 150 ++++++++++++-------- 3 files changed, 235 insertions(+), 177 deletions(-) diff --git a/README.TXT b/README.TXT index e84393f..d3d8255 100644 --- a/README.TXT +++ b/README.TXT @@ -13,13 +13,6 @@ Bison, Flex and Wget from the gnuwin32 project http://sourceforge.net/projects/gnuwin32/ - -Two other packages are required on all platforms, these should be built and installed before building the toolchain(s). It appears there is no UPX version for OS X, the scripts will report an error but this is non fatal. - -upx - -http://upx.sourceforge.net/ - For devkitPSP a command line subversion client is required to get the PSP SDK http://www.tigris.org Downloading the source packages @@ -28,8 +21,16 @@ Downloading the source packages When you run the build script it will ask you to choose from one of two options, one for if you have already downloaded the source packages and another for if you want it to download them for you (using wget). If you choose option one and want to get the source packages for yourself then you can find them at the urls listed below; binutils 2.17 - http://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2 -gcc-core 4.1.1 - http://ftp.gnu.org/gnu/gcc/gcc-4.1.1/gcc-core-4.1.1.tar.bz2 -gcc-g++ 4.1.1 - http://ftp.gnu.org/gnu/gcc/gcc-4.1.1/gcc-g++-4.1.1.tar.bz2 +gcc-core 4.1.2 - http://ftp.gnu.org/gnu/gcc/gcc-4.1.1/gcc-core-4.1.2.tar.bz2 +gcc-g++ 4.1.2 - http://ftp.gnu.org/gnu/gcc/gcc-4.1.1/gcc-g++-4.1.2.tar.bz2 +newlib 1.15.0 - ftp://sources.redhat.com/pub/newlib/newlib-1.15.0.tar.gz + + +Currently devkitPPC is still using earlier versions of the tools. + +binutils 2.16.1 - http://ftp.gnu.org/gnu/binutils/binutils-2.16.1.tar.bz2 +gcc-core 3.4.6 - http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-core-3.4.6.tar.bz2 +gcc-g++ 3.4.6 - http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-g++-3.4.6.tar.bz2 newlib 1.14.0 - ftp://sources.redhat.com/pub/newlib/newlib-1.14.0.tar.gz libogc, libgba, libnds, libmirko, dswifi and libfat can be found in the sourceforge project. @@ -37,6 +38,7 @@ libogc, libgba, libnds, libmirko, dswifi and libfat can be found in the sourcefo http://sourceforge.net/projects/devkitpro + The top level shell script has now been unified and offers the option of devkitARM, devkitPPC or devkitPSP. Building the devkits diff --git a/build-devkit.sh b/build-devkit.sh index 1c99043..a502bb4 100644 --- a/build-devkit.sh +++ b/build-devkit.sh @@ -8,10 +8,10 @@ #--------------------------------------------------------------------------------- LIBOGC_VER=20070118 LIBGBA_VER=20060720 -LIBNDS_VER=20070327 +LIBNDS_VER=20070616 LIBFAT_VER=20070127 -DSWIFI_VER=0.3d -LIBMIRKO_VER=0.9.7 +DSWIFI_VER=0.3.2 +LIBMIRKO_VER=0.9.8 GDB_VER=6.6 LIBOGC="libogc-src-$LIBOGC_VER.tar.bz2" @@ -54,19 +54,42 @@ done case "$VERSION" in "1" ) - GCC_VER=4.1.2 + GCC_VER=4.2.1 BINUTILS_VER=2.17 NEWLIB_VER=1.15.0 + basedir='dkarm-eabi' + package=devkitARM + builddir=arm-eabi + target=arm-eabi + toolchain=DEVKITARM ;; "2" ) GCC_VER=3.4.6 BINUTILS_VER=2.16.1 NEWLIB_VER=1.14.0 + basedir='dkppc' + package=devkitPPC + builddir=powerpc-gekko + target=powerpc-gekko + toolchain=DEVKITPPC ;; "3" ) GCC_VER=4.1.2 BINUTILS_VER=2.16.1 - NEWLIB_VER=1.14.0 + NEWLIB_VER=1.15.0 + basedir='dkpsp' + package=devkitPSP + builddir=psp + target=psp + toolchain=DEVKITPSP + + if test "`svn help`" + then + SVN="svn" + else + echo "ERROR: Please make sure you have 'subversion (svn)' installed." + exit + fi ;; esac @@ -79,43 +102,6 @@ BINUTILS_URL="http://ftp.gnu.org/gnu/binutils/$BINUTILS" NEWLIB="newlib-$NEWLIB_VER.tar.gz" NEWLIB_URL="ftp://sources.redhat.com/pub/newlib/$NEWLIB" - - -if [ $VERSION -eq 1 ] -then - basedir='dkarm-eabi' - package=devkitARM - builddir=arm-eabi - target=arm-eabi - toolchain=DEVKITARM -fi - -if [ $VERSION -eq 2 ] -then - basedir='dkppc' - package=devkitPPC - builddir=powerpc-gekko - target=powerpc-gekko - toolchain=DEVKITPPC -fi - -if [ $VERSION -eq 3 ] -then - basedir='dkpsp' - package=devkitPSP - builddir=psp - target=psp - toolchain=DEVKITPSP - - if test "`svn help`" - then - SVN="svn" - else - echo "ERROR: Please make sure you have 'subversion (svn)' installed." - exit - fi -fi - DOWNLOAD=0 while [ $DOWNLOAD -eq 0 ] @@ -262,31 +248,35 @@ then else - $WGET --passive-ftp -c $BINUTILS_URL || { echo "Error: Failed to download "$BINUTILS; exit; } + if [ ! -f downloaded_sources ] + then + $WGET --passive-ftp -c $BINUTILS_URL || { echo "Error: Failed to download "$BINUTILS; exit; } - $WGET -c $GCC_CORE_URL || { echo "Error: Failed to download "$GCC_CORE; exit; } + $WGET -c $GCC_CORE_URL || { echo "Error: Failed to download "$GCC_CORE; exit; } - $WGET -c $GCC_GPP_URL || { echo "Error: Failed to download "$GCC_GPP; exit; } + $WGET -c $GCC_GPP_URL || { echo "Error: Failed to download "$GCC_GPP; exit; } - $WGET -c $GDB_URL || { echo "Error: Failed to download "$GDB; exit; } + $WGET -c $GDB_URL || { echo "Error: Failed to download "$GDB; exit; } - $WGET --passive-ftp -c $NEWLIB_URL || { echo "Error: Failed to download "$NEWLIB; exit; } + $WGET --passive-ftp -c $NEWLIB_URL || { echo "Error: Failed to download "$NEWLIB; exit; } - if [ $VERSION -eq 2 ] - then - $WGET -c $LIBOGC_URL || { echo "Error: Failed to download "$LIBOGC; exit; } - fi + if [ $VERSION -eq 2 ] + then + $WGET -c $LIBOGC_URL || { echo "Error: Failed to download "$LIBOGC; exit; } + fi - if [ $VERSION -eq 1 ] - then - $WGET -c $LIBNDS_URL || { echo "Error: Failed to download "$LIBNDS; exit; } - $WGET -c $LIBGBA_URL || { echo "Error: Failed to download "$LIBGBA; exit; } - $WGET -c $DSWIFI_URL || { echo "Error: Failed to download "$DSWIFI; exit; } - $WGET -c $LIBFAT_URL || { echo "Error: Failed to download "$LIBFAT; exit; } - $WGET -c $LIBMIRKO_URL || { echo "Error: Failed to download "$LIBMIRKO; exit; } - fi - SRCDIR=`pwd` + if [ $VERSION -eq 1 ] + then + $WGET -c $LIBNDS_URL || { echo "Error: Failed to download "$LIBNDS; exit; } + $WGET -c $LIBGBA_URL || { echo "Error: Failed to download "$LIBGBA; exit; } + $WGET -c $DSWIFI_URL || { echo "Error: Failed to download "$DSWIFI; exit; } + $WGET -c $LIBFAT_URL || { echo "Error: Failed to download "$LIBFAT; exit; } + $WGET -c $LIBMIRKO_URL || { echo "Error: Failed to download "$LIBMIRKO; exit; } + fi + SRCDIR=`pwd` + touch downloaded_sources + fi fi BINUTILS_SRCDIR="binutils-$BINUTILS_VER" @@ -349,62 +339,85 @@ scriptdir=$(pwd)/$basedir/scripts BUILDSCRIPTDIR=$(pwd) -echo "Extracting $BINUTILS" -tar -xjvf $SRCDIR/$BINUTILS || { echo "Error extracting "$BINUTILS; exit; } - -echo "Extracting $GCC_CORE" -tar -xjvf $SRCDIR/$GCC_CORE || { echo "Error extracting "$GCC_CORE; exit; } - -echo "Extracting $GCC_GPP" -tar -xjvf $SRCDIR/$GCC_GPP || { echo "Error extracting "$GCC_GPP; exit; } - -echo "Extracting $NEWLIB" -tar -xzvf $SRCDIR/$NEWLIB || { echo "Error extracting "$NEWLIB; exit; } - -echo "Extracting $GDB" -tar -xjvf $SRCDIR/$GDB || { echo "Error extracting "$GCC_GPP; exit; } - -if [ $VERSION -eq 2 ] +if [ ! -f extracted_archives ] then - echo "Extracting $LIBOGC" - mkdir -p $LIBOGC_SRCDIR - bzip2 -cd $SRCDIR/$LIBOGC | tar -xvf - -C $LIBOGC_SRCDIR || { echo "Error extracting "$LIBOGC; exit; } + echo "Extracting $BINUTILS" + tar -xjvf $SRCDIR/$BINUTILS || { echo "Error extracting "$BINUTILS; exit; } + + echo "Extracting $GCC_CORE" + tar -xjvf $SRCDIR/$GCC_CORE || { echo "Error extracting "$GCC_CORE; exit; } + + echo "Extracting $GCC_GPP" + tar -xjvf $SRCDIR/$GCC_GPP || { echo "Error extracting "$GCC_GPP; exit; } + + echo "Extracting $NEWLIB" + tar -xzvf $SRCDIR/$NEWLIB || { echo "Error extracting "$NEWLIB; exit; } + + echo "Extracting $GDB" + tar -xjvf $SRCDIR/$GDB || { echo "Error extracting "$GCC_GPP; exit; } + + if [ $VERSION -eq 2 ] + then + echo "Extracting $LIBOGC" + mkdir -p $LIBOGC_SRCDIR + bzip2 -cd $SRCDIR/$LIBOGC | tar -xvf - -C $LIBOGC_SRCDIR || { echo "Error extracting "$LIBOGC; exit; } + fi + + if [ $VERSION -eq 1 ] + then + echo "Extracting $LIBNDS" + mkdir -p $LIBNDS_SRCDIR + bzip2 -cd $SRCDIR/$LIBNDS | tar -xvf - -C $LIBNDS_SRCDIR || { echo "Error extracting "$LIBNDS; exit; } + + echo "Extracting $LIBGBA" + mkdir -p $LIBGBA_SRCDIR + bzip2 -cd $SRCDIR/$LIBGBA | tar -xvf - -C $LIBGBA_SRCDIR || { echo "Error extracting "$LIBGBA; exit; } + + + echo "Extracting $LIBFAT" + mkdir -p $LIBFAT_SRCDIR + bzip2 -cd $SRCDIR/$LIBFAT | tar -xvf - -C $LIBFAT_SRCDIR || { echo "Error extracting "$LIBFAT; exit; } + + echo "Extracting $DSWIFI" + mkdir -p $DSWIFI_SRCDIR + bzip2 -cd $SRCDIR/$DSWIFI | tar -xvf - -C $DSWIFI_SRCDIR || { echo "Error extracting "$DSWIFI; exit; } + + echo "Extracting $LIBMIRKO" + mkdir -p $LIBMIRKO_SRCDIR + bzip2 -cd $SRCDIR/$LIBMIRKO | tar -xvf - -C $LIBMIRKO_SRCDIR || { echo "Error extracting "$LIBMIRKO; exit; } + fi + + touch extracted_archives + fi -if [ $VERSION -eq 1 ] -then - echo "Extracting $LIBNDS" - mkdir -p $LIBNDS_SRCDIR - bzip2 -cd $SRCDIR/$LIBNDS | tar -xvf - -C $LIBNDS_SRCDIR || { echo "Error extracting "$LIBNDS; exit; } - - echo "Extracting $LIBGBA" - mkdir -p $LIBGBA_SRCDIR - bzip2 -cd $SRCDIR/$LIBGBA | tar -xvf - -C $LIBGBA_SRCDIR || { echo "Error extracting "$LIBGBA; exit; } - - - echo "Extracting $LIBFAT" - mkdir -p $LIBFAT_SRCDIR - bzip2 -cd $SRCDIR/$LIBFAT | tar -xvf - -C $LIBFAT_SRCDIR || { echo "Error extracting "$LIBFAT; exit; } - - echo "Extracting $DSWIFI" - mkdir -p $DSWIFI_SRCDIR - bzip2 -cd $SRCDIR/$DSWIFI | tar -xvf - -C $DSWIFI_SRCDIR || { echo "Error extracting "$DSWIFI; exit; } - - echo "Extracting $LIBMIRKO" - mkdir -p $LIBMIRKO_SRCDIR - bzip2 -cd $SRCDIR/$LIBMIRKO | tar -xvf - -C $LIBMIRKO_SRCDIR || { echo "Error extracting "$LIBMIRKO; exit; } -fi - - #--------------------------------------------------------------------------------- # apply patches #--------------------------------------------------------------------------------- -patch -p1 -d $BINUTILS_SRCDIR -i $patchdir/binutils-$BINUTILS_VER.patch || { echo "Error patching binutils"; exit; } -patch -p1 -d $GCC_SRCDIR -i $patchdir/gcc-$GCC_VER.patch || { echo "Error patching gcc"; exit; } -patch -p1 -d $NEWLIB_SRCDIR -i $patchdir/newlib-$NEWLIB_VER.patch || { echo "Error patching newlib"; exit; } -if [ -f $patchdir/gdb-$GDB_VER.patch ] +if [ ! -f patch_sources ] then - patch -p1 -d $GDB_SRCDIR -i $patchdir/gdb-$GDB_VER.patch || { echo "Error patching gdb"; exit; } + + if [ -f $patchdir/binutils-$BINUTILS_VER.patch ] + then + patch -p1 -d $BINUTILS_SRCDIR -i $patchdir/binutils-$BINUTILS_VER.patch || { echo "Error patching binutils"; exit; } + fi + + if [ -f $patchdir/gcc-$GCC_VER.patch ] + then + patch -p1 -d $GCC_SRCDIR -i $patchdir/gcc-$GCC_VER.patch || { echo "Error patching gcc"; exit; } + fi + + if [ -f $patchdir/newlib-$NEWLIB_VER.patch ] + then + patch -p1 -d $NEWLIB_SRCDIR -i $patchdir/newlib-$NEWLIB_VER.patch || { echo "Error patching newlib"; exit; } + fi + + if [ -f $patchdir/gdb-$GDB_VER.patch ] + then + patch -p1 -d $GDB_SRCDIR -i $patchdir/gdb-$GDB_VER.patch || { echo "Error patching gdb"; exit; } + fi + + touch patch_sources fi #--------------------------------------------------------------------------------- @@ -418,13 +431,16 @@ if [ -f $scriptdir/build-tools.sh ]; then . $scriptdir/build-tools.sh || { echo # strip binaries # strip has trouble using wildcards so do it this way instead #--------------------------------------------------------------------------------- -for f in $INSTALLDIR/$package/bin/* \ - $INSTALLDIR/$package/$target/bin/* \ - $INSTALLDIR/$package/libexec/gcc/$target/$GCC_VER/* +for f in $INSTALLDIR/$package/bin/* \ + $INSTALLDIR/$package/$target/bin/* \ + $INSTALLDIR/$package/libexec/gcc/$target/$GCC_VER/* do - strip $f + strip $f done +#--------------------------------------------------------------------------------- +# remove rather large pre-compiled headers +#--------------------------------------------------------------------------------- rm -fr $INSTALLDIR/$package/include/c++/$GCC_VER/$target/bits/stdc++.h.gch #--------------------------------------------------------------------------------- diff --git a/dkarm-eabi/scripts/build-gcc.sh b/dkarm-eabi/scripts/build-gcc.sh index 6abe4d2..14b5e79 100644 --- a/dkarm-eabi/scripts/build-gcc.sh +++ b/dkarm-eabi/scripts/build-gcc.sh @@ -12,22 +12,28 @@ prefix=$INSTALLDIR/devkitARM mkdir -p $target/binutils cd $target/binutils -../../$BINUTILS_SRCDIR/configure \ - --prefix=$prefix --target=$target --disable-nls --disable-shared --disable-debug \ - --disable-threads --with-gcc --with-gnu-as --with-gnu-ld \ - || { echo "Error configuring binutils"; exit 1; } +if [ ! -f configured-binutils ] +then + ../../$BINUTILS_SRCDIR/configure \ + --prefix=$prefix --target=$target --disable-nls --disable-shared --disable-debug \ + --disable-threads --with-gcc --with-gnu-as --with-gnu-ld \ + || { echo "Error configuring binutils"; exit 1; } + touch configured-binutils +fi -$MAKE || { echo "Error building binutils"; exit 1; } -$MAKE install || { echo "Error installing binutils"; exit 1; } +if [ ! -f built-binutils ] +then + $MAKE || { echo "Error building binutils"; exit 1; } + touch built-binutils +fi +if [ ! -f installed-binutils ] +then + $MAKE install || { echo "Error installing binutils"; exit 1; } + touch installed-binutils +fi cd $BUILDSCRIPTDIR -#--------------------------------------------------------------------------------- -# remove temp stuff to conserve disc space -#--------------------------------------------------------------------------------- -rm -fr $target/binutils -rm -fr $BINUTILS_SRCDIR - #--------------------------------------------------------------------------------- # build and install just the c compiler #--------------------------------------------------------------------------------- @@ -35,22 +41,38 @@ mkdir -p $target/gcc cd $target/gcc -CFLAGS=-D__USE_MINGW_ACCESS ../../$GCC_SRCDIR/configure \ - --enable-languages=c,c++ \ - --with-cpu=arm7tdmi\ - --enable-interwork --enable-multilib\ - --with-gcc --with-gnu-ld --with-gnu-as \ - --disable-shared --disable-threads --disable-win32-registry --disable-nls --disable-debug\ - --disable-libmudflap --disable-libssp \ - --target=$target \ - --with-newlib \ - --prefix=$prefix\ - || { echo "Error configuring gcc"; exit 1; } +if [ ! -f configured-gcc ] +then + CFLAGS=-D__USE_MINGW_ACCESS ../../$GCC_SRCDIR/configure \ + --enable-languages=c,c++ \ + --with-cpu=arm7tdmi\ + --enable-interwork --enable-multilib\ + --with-gcc --with-gnu-ld --with-gnu-as \ + --disable-shared --disable-threads --disable-win32-registry --disable-nls --disable-debug\ + --disable-libmudflap --disable-libssp \ + --target=$target \ + --with-newlib \ + --prefix=$prefix\ + || { echo "Error configuring gcc"; exit 1; } + touch configured-gcc +fi + + +# hack to get around msys/mingw build problem mkdir -p libiberty libcpp fixincludes -$MAKE all-gcc || { echo "Error building gcc"; exit 1; } -$MAKE install-gcc || { echo "Error installing gcc"; exit 1; } +if [ ! -f built-gcc ] +then + $MAKE all-gcc || { echo "Error building gcc"; exit 1; } + touch built-gcc +fi + +if [ ! -f installed-gcc ] +then + $MAKE install-gcc || { echo "Error installing gcc"; exit 1; } + touch installed-gcc +fi cd $BUILDSCRIPTDIR @@ -61,20 +83,28 @@ mkdir -p $target/newlib cd $target/newlib mkdir -p etc -CFLAGS=-DREENTRANT_SYSCALLS_PROVIDED ../../$NEWLIB_SRCDIR/configure \ - --disable-newlib-supplied-syscalls \ - --target=$target \ - --prefix=$prefix \ - || { echo "Error configuring newlib"; exit 1; } +if [ ! -f configured-newlib ] +then + CFLAGS=-DREENTRANT_SYSCALLS_PROVIDED ../../$NEWLIB_SRCDIR/configure \ + --disable-newlib-supplied-syscalls \ + --target=$target \ + --prefix=$prefix \ + || { echo "Error configuring newlib"; exit 1; } + touch configured-newlib +fi -$MAKE || { echo "Error building newlib"; exit 1; } -$MAKE install || { echo "Error installing newlib"; exit 1; } +if [ ! -f built-newlib ] +then + $MAKE || { echo "Error building newlib"; exit 1; } + touch built-newlib +fi -#--------------------------------------------------------------------------------- -# remove temp stuff to conserve disc space -#--------------------------------------------------------------------------------- -rm -fr $target/newlib -rm -fr $NEWLIB_SRCDIR + +if [ ! -f installed-newlib ] +then + $MAKE install || { echo "Error installing newlib"; exit 1; } + touch installed-newlib +fi #--------------------------------------------------------------------------------- # build and install the final compiler @@ -83,32 +113,42 @@ rm -fr $NEWLIB_SRCDIR cd $BUILDSCRIPTDIR cd $target/gcc -$MAKE || { echo "Error building g++"; exit 1; } -$MAKE install || { echo "Error installing g++"; exit 1; } +if [ ! -f built-g++ ] +then + $MAKE || { echo "Error building g++"; exit 1; } + touch built-g++ +fi + +if [ ! -f installed-g++ ] +then + $MAKE install || { echo "Error installing g++"; exit 1; } + touch built-g++ +fi cd $BUILDSCRIPTDIR -#--------------------------------------------------------------------------------- -# remove temp stuff to conserve disc space -#--------------------------------------------------------------------------------- -rm -fr $target/gcc -rm -fr $GCC_SRCDIR - #--------------------------------------------------------------------------------- # build and install the debugger #--------------------------------------------------------------------------------- mkdir -p $target/gdb cd $target/gdb -../../$GDB_SRCDIR/configure \ - --prefix=$prefix --target=$target --disable-nls \ - || { echo "Error configuring gdb"; exit 1; } +if [ ! -f configured-gdb ] +then + ../../$GDB_SRCDIR/configure \ + --prefix=$prefix --target=$target --disable-nls \ + || { echo "Error configuring gdb"; exit 1; } + touch configured-gdb +fi -$MAKE || { echo "Error building gdb"; exit 1; } -$MAKE install || { echo "Error installing gdb"; exit 1; } +if [ ! -f built-gdb ] +then + $MAKE || { echo "Error building gdb"; exit 1; } + touch built-gdb +fi -#--------------------------------------------------------------------------------- -# remove temp stuff to conserve disc space -#--------------------------------------------------------------------------------- -rm -fr $target/gdb -rm -fr $GDB_SRCDIR +if [ ! -f installed-gdb ] +then + $MAKE install || { echo "Error installing gdb"; exit 1; } + touch installed-gdb +fi