From dc235a0800a51b305b47ebc63079b5098c25dc05 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Fri, 8 Jul 2005 07:33:31 +0000 Subject: [PATCH] improved script error checking set syscalls dir for devkitPSP --- build-devkit.sh | 89 ++++++++---------------------- dkpsp/scripts/build-crtls.sh | 6 +- dkpsp/scripts/build-gcc.sh | 40 +++++++++----- patches/devkit-newlib-1.13.0.patch | 18 +++--- 4 files changed, 61 insertions(+), 92 deletions(-) diff --git a/build-devkit.sh b/build-devkit.sh index 93984d4..a621b28 100644 --- a/build-devkit.sh +++ b/build-devkit.sh @@ -110,7 +110,7 @@ echo "this is the top level directory for devkitpro" read INSTALLDIR echo -[ ! -z "$INSTALLDIR" ] && mkdir -p $INSTALLDIR && touch $INSTALLDIR/nonexistantfile && rm $INSTALLDIR/nonexistantfile || exit 1 +[ ! -z "$INSTALLDIR" ] && mkdir -p $INSTALLDIR && touch $INSTALLDIR/nonexistantfile && rm $INSTALLDIR/nonexistantfile || exit 1; if [ $DOWNLOAD -eq 1 ] then @@ -198,68 +198,28 @@ then else - wget -c $BINUTILS_URL - if [ ! -f $BINUTILS ] - then - echo "Error: Failed to download "$BINUTILS - exit - fi + wget -c $BINUTILS_URL || { echo "Error: Failed to download "$BINUTILS; exit; } - wget -c $GCC_CORE_URL - if [ ! -f $GCC_CORE ] - then - echo "Error: Failed to download "$GCC_CORE - exit - fi + wget -c $GCC_CORE_URL || { echo "Error: Failed to download "$GCC_CORE; exit; } - wget -c $GCC_GPP_URL - if [ ! -f $GCC_GPP ] - then - echo "Error: Failed to download "$GCC_GPP - exit - fi + wget -c $GCC_GPP_URL || { echo "Error: Failed to download "$GCC_GPP; exit; } - wget --passive-ftp -c $NEWLIB_URL - if [ ! -f $NEWLIB ] - then - echo "Error: Failed to download "$NEWLIB - exit - fi + wget --passive-ftp -c $NEWLIB_URL || { echo "Error: Failed to download "$NEWLIB; exit; } if [ $VERSION -eq 2 ] then - wget -c $LIBOGC_URL - if [ ! -f $LIBOGC ] - then - echo "Error: Failed to download "$LIBOGC - exit - fi + wget -c $LIBOGC_URL || { echo "Error: Failed to download "$LIBOGC; exit; } fi if [ $VERSION -eq 3 ] then - wget -c $PSPSDK_URL - if [ ! -f $PSPSDK ] - then - echo "Error: Failed to download "$PSPSDK - exit - fi + wget -c $PSPSDK_URL || { echo "Error: Failed to download "$PSPSDK; exit; } fi if [ $VERSION -eq 1 ] then - wget -c $LIBNDS_URL - if [ ! -f $LIBNDS ] - then - echo "Error: Failed to download "$LIBNDS - exit - fi - wget -c $LIBGBA_URL - if [ ! -f $LIBGBA ] - then - echo "Error: Failed to download "$LIBGBA - exit - fi + wget -c $LIBNDS_URL || { echo "Error: Failed to download "$LIBNDS; exit; } + wget -c $LIBGBA_URL || { echo "Error: Failed to download "$LIBGBA; exit; } fi SRCDIR=`pwd` fi @@ -301,7 +261,6 @@ fi echo use $MAKE as make export MAKE - #--------------------------------------------------------------------------------- # Extract source packages #--------------------------------------------------------------------------------- @@ -309,47 +268,47 @@ export MAKE BUILDSCRIPTDIR=$(pwd) echo "Extracting $BINUTILS" -tar -xjvf $SRCDIR/$BINUTILS +tar -xjvf $SRCDIR/$BINUTILS || { echo "Error extracting "$BINUTILS; exit; } echo "Extracting $GCC_CORE" -tar -xjvf $SRCDIR/$GCC_CORE +tar -xjvf $SRCDIR/$GCC_CORE || { echo "Error extracting "$GCC_CORE; exit; } echo "Extracting $GCC_GPP" -tar -xjvf $SRCDIR/$GCC_GPP +tar -xjvf $SRCDIR/$GCC_GPP || { echo "Error extracting "$GCC_GPP; exit; } echo "Extracting $NEWLIB" -tar -xzvf $SRCDIR/$NEWLIB +tar -xzvf $SRCDIR/$NEWLIB || { echo "Error extracting "$NEWLIB; exit; } if [ $VERSION -eq 2 ] then echo "Extracting $LIBOGC" mkdir -p $LIBOGC_SRCDIR - bzip2 -cd $SRCDIR/$LIBOGC | tar -xv -C $LIBOGC_SRCDIR + bzip2 -cd $SRCDIR/$LIBOGC | tar -xv -C $LIBOGC_SRCDIR || { echo "Error extracting "$LIBOGC; exit; } fi if [ $VERSION -eq 3 ] then echo "Extracting $PSPSDK" - tar -xzvf $SRCDIR/$PSPSDK + tar -xzvf $SRCDIR/$PSPSDK || { echo "Error extracting "$PSPSDK; exit; } fi if [ $VERSION -eq 1 ] then echo "Extracting $LIBNDS" mkdir -p $LIBNDS_SRCDIR - bzip2 -cd $SRCDIR/$LIBNDS | tar -xv -C $LIBNDS_SRCDIR + bzip2 -cd $SRCDIR/$LIBNDS | tar -xv -C $LIBNDS_SRCDIR || { echo "Error extracting "$LIBNDS; exit; } echo "Extracting $LIBGBA" mkdir -p $LIBGBA_SRCDIR - bzip2 -cd $SRCDIR/$LIBGBA | tar -xv -C $LIBGBA_SRCDIR + bzip2 -cd $SRCDIR/$LIBGBA | tar -xv -C $LIBGBA_SRCDIR || { echo "Error extracting "$LIBGBA; exit; } fi #--------------------------------------------------------------------------------- # apply patches #--------------------------------------------------------------------------------- -patch -p1 -d $BINUTILS_SRCDIR -i $(pwd)/patches/devkit-binutils-$BINUTILS_VER.patch -patch -p1 -d $GCC_SRCDIR -i $(pwd)/patches/devkit-gcc-$GCC_VER.patch -patch -p1 -d $NEWLIB_SRCDIR -i $(pwd)/patches/devkit-newlib-$NEWLIB_VER.patch +patch -p1 -d $BINUTILS_SRCDIR -i $(pwd)/patches/devkit-binutils-$BINUTILS_VER.patch || { echo "Error patching binutils"; exit; } +patch -p1 -d $GCC_SRCDIR -i $(pwd)/patches/devkit-gcc-$GCC_VER.patch || { echo "Error patching gcc"; exit; } +patch -p1 -d $NEWLIB_SRCDIR -i $(pwd)/patches/devkit-newlib-$NEWLIB_VER.patch || { echo "Error patching newlib"; exit; } if [ $VERSION -eq 3 ] then @@ -379,9 +338,9 @@ export DEBUG_FLAGS='' #--------------------------------------------------------------------------------- # Build and install devkit components #--------------------------------------------------------------------------------- -if [ -f $scriptdir/build-gcc.sh ]; then . $scriptdir/build-gcc.sh ; cd $BUILDSCRIPTDIR; fi -if [ -f $scriptdir/build-crtls.sh ]; then . $scriptdir/build-crtls.sh ; cd $BUILDSCRIPTDIR; fi -if [ -f $scriptdir/build-tools.sh ]; then . $scriptdir/build-tools.sh ; cd $BUILDSCRIPTDIR; fi +if [ -f $scriptdir/build-gcc.sh ]; then . $scriptdir/build-gcc.sh || { echo "Error building toolchain"; exit; }; cd $BUILDSCRIPTDIR; fi +if [ -f $scriptdir/build-crtls.sh ]; then . $scriptdir/build-crtls.sh || { echo "Error building crtls"; exit; }; cd $BUILDSCRIPTDIR; fi +if [ -f $scriptdir/build-tools.sh ]; then . $scriptdir/build-tools.sh || { echo "Error building tools"; exit; }; cd $BUILDSCRIPTDIR; fi strip $INSTALLDIR/$package/bin/* strip $INSTALLDIR/$package/$target/bin/* @@ -401,7 +360,7 @@ rm -fr $GCC_SRCDIR rm -fr $LIBOGC_SRCDIR $LIBGBA_SRCDIR $LIBNDS_SRCDIR $PSPSDK_SRCDIR echo -echo "Would you like to delete the source packages? [y/N]" +echo "Would you like to delete the downloaded source packages? [y/N]" read answer if [ "$answer" = "y" -o "$answer" = "Y" ] diff --git a/dkpsp/scripts/build-crtls.sh b/dkpsp/scripts/build-crtls.sh index f6d7ff4..c6d17cb 100644 --- a/dkpsp/scripts/build-crtls.sh +++ b/dkpsp/scripts/build-crtls.sh @@ -6,10 +6,10 @@ echo "building pspsdk ..." cd $PSPSDK_SRCDIR -./configure -$MAKE +./configure || { echo "Error configuring pspsdk"; exit 1; } +$MAKE || { echo "Error building pspsdk"; exit 1; } echo "installing pspsdk ..." -$MAKE install +$MAKE install || { echo "Error installing pspsdk"; exit 1; } cd $BUILDSCRIPTDIR diff --git a/dkpsp/scripts/build-gcc.sh b/dkpsp/scripts/build-gcc.sh index 4200bd8..0963d9c 100644 --- a/dkpsp/scripts/build-gcc.sh +++ b/dkpsp/scripts/build-gcc.sh @@ -1,7 +1,4 @@ #!/bin/sh -#--------------------------------------------------------------------------------- -# Check Parameters -#--------------------------------------------------------------------------------- prefix=$INSTALLDIR/devkitPSP @@ -15,14 +12,19 @@ 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 --with-stabs \ - 2>&1 | tee $BUILDSCRIPTDIR/binutils_configure.log + || { echo "Error configuring binutils"; exit 1; } -$MAKE 2>&1 | tee binutils_make.log -$MAKE install 2>&1 | tee $BUILDSCRIPTDIR/binutils_install.log +$MAKE || { echo "Error building binutils"; exit 1; } +$MAKE install || { echo "Error installing binutils"; exit 1; } cd $BUILDSCRIPTDIR +#--------------------------------------------------------------------------------- +# remove temp stuff to conserve disc space +#--------------------------------------------------------------------------------- +rm -fr $target/binutils +rm -fr $BINUTILS_SRCDIR #--------------------------------------------------------------------------------- # build and install just the c compiler @@ -40,10 +42,10 @@ cd $target/gcc --target=$target \ --with-newlib \ --prefix=$prefix \ - 2>&1 | tee $BUILDSCRIPTDIR/gcc_configure.log + || { echo "Error configuring gcc"; exit 1; } -$MAKE all-gcc 2>&1| tee $BUILDSCRIPTDIR/gcc_make.log -$MAKE install-gcc 2>&1 | tee $BUILDSCRIPTDIR/gcc_install.log +$MAKE all-gcc || { echo "Error building gcc"; exit 1; } +$MAKE install-gcc || { echo "Error installing gcc"; exit 1; } cd $BUILDSCRIPTDIR @@ -57,20 +59,28 @@ mkdir etc $BUILDSCRIPTDIR/$NEWLIB_SRCDIR/configure \ --target=$target \ --prefix=$prefix \ - | tee $BUILDSCRIPTDIR/newlib_configure.log + || { echo "Error configuring newlib"; exit 1; } -$MAKE | tee $BUILDSCRIPTDIR/newlib_make.log -$MAKE install | tee $BUILDSCRIPTDIR/newlib_install.log +$MAKE || { echo "Error building newlib"; exit 1; } +$MAKE install || { echo "Error installing newlib"; exit 1; } + +cd $BUILDSCRIPTDIR + +#--------------------------------------------------------------------------------- +# remove temp stuff to conserve disc space +#--------------------------------------------------------------------------------- +rm -fr $target/newlib +rm -fr $NEWLIB_SRCDIR #--------------------------------------------------------------------------------- # build and install the final compiler #--------------------------------------------------------------------------------- -cd $BUILDSCRIPTDIR cd $target/gcc -$MAKE | tee $BUILDSCRIPTDIR/gcc_final_make.log 2>&1 -$MAKE install | tee $BUILDSCRIPTDIR/gcc_final_install.log 2>&1 +$MAKE || { echo "Error building g++"; exit 1; } +$MAKE install || { echo "Error installing g++"; exit 1; } + cd $BUILDSCRIPTDIR diff --git a/patches/devkit-newlib-1.13.0.patch b/patches/devkit-newlib-1.13.0.patch index 0700a25..fb9afc1 100644 --- a/patches/devkit-newlib-1.13.0.patch +++ b/patches/devkit-newlib-1.13.0.patch @@ -64,9 +64,8 @@ diff -NBaur newlib-1.13.0/configure.in newlib-1.13.0-new/configure.in mips*-*-*) noconfigdirs="$noconfigdirs gprof ${libgcj}" ;; -diff -NBaur newlib-1.13.0/newlib/configure.host newlib-1.13.0-new/newlib/configure.host --- newlib-1.13.0/newlib/configure.host Tue Oct 5 20:44:24 2004 -+++ newlib-1.13.0-new/newlib/configure.host Wed Jul 6 18:25:48 2005 ++++ newlib-1.13.0-new/newlib/configure.host Fri Jul 8 05:45:18 2005 @@ -389,6 +389,9 @@ powerpcle-*-pe) posix_dir=posix @@ -77,16 +76,17 @@ diff -NBaur newlib-1.13.0/newlib/configure.host newlib-1.13.0-new/newlib/configu sh*-*) sys_dir=sh ;; -@@ -569,8 +572,13 @@ +@@ -569,8 +572,14 @@ newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES" ;; mips*-*-elf*) -+ case "${host}" in -+ mipsallegrex*) -+ newlib_cflags="${newlib_cflags} -G0 -DPREFER_SIZE_OVER_SPEED -DCOMPACT_CTYPE -DCLOCK_PROVIDED" ;; -+ * ) -+ newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES" ;; -+ esac ++ case "${host}" in ++ mipsallegrex*-psp-*) ++ syscall_dir=syscalls ++ newlib_cflags="${newlib_cflags} -G0 -DPREFER_SIZE_OVER_SPEED -DCOMPACT_CTYPE -DCLOCK_PROVIDED" ;; ++ * ) ++ newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES" ;; ++ esac default_newlib_io_long_long="yes" - newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES" ;;