http://www.oopo.net/consoledev/files/ne ... 060128.tgz
Code: Select all
 ###################
 ## WHAT IS THIS? ##
 ###################
  This is my second attempt at a great script for automating the building
  and installing of various toolchains. A brief list of the new changes:
  - Moved from a shell script to a perl script.
  - Presents an easy-to-read interface to the user.
  - Supports PS2, PSP and GP2X in one script. Adding more is easy.
  - Logs everything to a log file and shows the last 20 lines on an error.
  - Allows the easy choosing of which steps to run and which to skip.
  - Automatically grabs the latest in patches and software, when possible.
 ######################
 ## HOW DO I USE IT? ##
 ######################
  Usage:
   ./toolchain.pl [system] <list_of_steps>
  Valid systems are currently:
   PS2 PSP GP2X GP2X-LIBS (case sensitive)
  Valid steps are as follows:
   PS2
    1 = binutils
    2 = gcc (C)
    3 = newlib
    4 = gcc (C++)
    5 = pspsdk
    6 = ps2client
   PSP
    1 = binutils
    2 = gcc (C)
    3 = pspsdk headers
    4 = newlib
    5 = gcc (C++)
    6 = pspsdk
   GP2X
    1 = linux-headers
    2 = binutils
    3 = glibc (stage1)
    4 = gcc (stage1)
    5 = glibc (stage2)
    6 = gcc (stage2)
   GP2X-LIBS
    1 = zlib
    2 = jpeglib
    3 = libpng
    4 = freetype
    5 = SDL
    6 = SDL_image
    7 = SDL_mixer
    8 = SDL_ttf
   Steps can be specified in any order and can even be repeated. Be careful
   to not specify an order that is invalid as you'll end up with a bad build.
  ###################
  ## ANY EXAMPLES? ##
  ###################
   To build a complete ps2dev toolchain:
    ./toolchain.sh PS2
   To update and build only the pspsdk:
    ./toolchain.sh PSP 6
   To build just the pspdev binutils and pspsdk:
    ./toolchain.sh PSP 1 6
   To be really weird:
    ./toolchain.sh PS2 1 2 3 4 5 6 5 4 3 2 1
  ###########################
  ## WHO THE HELL ARE YOU? ##
  ###########################
   I'm Dan, sometimes known as ooPo. I can be found at:
    peori@oopo.net
    ooPo on freenode (#ps2dev & #pspdev)
    ooPo on efnet (#gp2xdev)
    http://www.oopo.net/consoledev
    http://forums.ps2dev.org
   Enjoy the script, and if you want to modify it... go ahead!
   Just let me know, ok?
Code: Select all
 my %dependencies = (
   "COMMON" => [
    [ " gcc:\t\t", "{ gcc -v; }", "Please install gcc before continuing." ],
    [ " $make:\t\t", "{ $make -v; }", "Please install $make before continuing." ],
    [ " wget:\t\t", "{ wget -V; }", "Please install wget before continuing." ],
    [ " patch:\t\t", "{ patch -v; }", "Please install patch before continuing." ],
   ],
   "PS2" => [
    [ " svn:\t\t", "{ svn help; }", "Please install subversion before continuing."],
    [ " \$PS2DEV:\t", "{ export | grep ' PS2DEV='; }", "Please read README.PS2 for information." ],
    [ " \$PS2SDK:\t", "{ export | grep ' PS2SDK='; }", "Please read README.PS2 for information." ],
    [ " path:\t\t", "{ export | grep ' PATH=' | grep '$PS2DEV'; }", "Please read README.PS2 for information." ],
    [ " privs:\t\t", "{ mkdir -p $PS2DEV && touch $PS2DEV/.test && rm $PS2DEV/.test; }", "Please read README.PS2 for information." ],
   ],
   "PSP" => [
    [ " svn:\t\t", "{ svn help; }", "Please install subversion before continuing."],
    [ " automake:\t", "{ automake --version; }", "Please install automake before continuing." ],
    [ " autoconf:\t", "{ autoconf --version; }", "Please install autoconf before continuing." ],
    [ " \$PSPDEV:\t", "{ export | grep ' PSPDEV='; }", "Please read README.PSP for information." ],
    [ " path:\t\t", "{ export | grep ' PATH=' | grep '$PSPDEV'; }", "Please read README.PSP for information." ],
    [ " privs:\t\t", "{ mkdir -p $PSPDEV && touch $PSPDEV/.test && rm $PSPDEV/.test; }", "Please read README.PSP for information." ],
   ],Code: Select all
   "PSP" => [
    [ "binutils-2.16.1", [ "psp" ],
     "{ wget -c ftp://ftp.gnu.org/pub/gnu/binutils/binutils-2.16.1.tar.bz2; }",
     "{ rm -Rf binutils-2.16.1 && tar xfvj binutils-2.16.1.tar.bz2; }",
     "{ cd binutils-2.16.1 && svn cat svn://svn.pspdev.org/psp/trunk/psptoolchain/binutils-2.16.1.patch | patch -p1; }",
     "{ cd binutils-2.16.1 && mkdir -p build-\$target && cd build-\$target && ../configure --prefix=$PSPDEV --target=\$target --enable-install-libbfd && $make && $make install && $make clean; }",
    ],
    [ "gcc-4.0.2 (C)", [ "psp" ],
     "{ wget -c ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.0.2/gcc-core-4.0.2.tar.bz2 && wget -c ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.0.2/gcc-g++-4.0.2.tar.bz2; }",
     "{ rm -Rf gcc-4.0.2 && tar xfvj gcc-core-4.0.2.tar.bz2 && tar xfvj gcc-g++-4.0.2.tar.bz2; }",
     "{ cd gcc-4.0.2 && svn cat svn://svn.pspdev.org/psp/trunk/psptoolchain/gcc-4.0.2.patch | patch -p1; }",
     "{ cd gcc-4.0.2 && mkdir -p build-\$target && cd build-\$target && ../configure --prefix=$PSPDEV --target=\$target --enable-languages='c' --with-newlib --without-headers && $make && $make install && $make clean; }",
    ],
    [ "pspsdk-current (headers)", [ "psp" ],
     "{ svn checkout svn://svn.pspdev.org/psp/trunk/pspsdk; }",
     "",
     "",
     "{ cd pspsdk && ./bootstrap && ./configure --with-pspdev=$PSPDEV && $make install-data && $make clean; }",
    ],
    [ "newlib-1.13.0", [ "psp" ],
     "{ wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.13.0.tar.gz; }",
     "{ rm -Rf newlib-1.13.0 && tar xfvz newlib-1.13.0.tar.gz; }",
     "{ cd newlib-1.13.0 && svn cat svn://svn.pspdev.org/psp/trunk/psptoolchain/newlib-1.13.0.patch | patch -p1; }",
     "{ cd newlib-1.13.0 && mkdir -p build-\$target && cd build-\$target && ../configure --prefix=$PSPDEV --target=\$target && CPPFLAGS='-G0' $make && $make install && $make clean; }",
    ],
Code: Select all
$ ../toolchain.pl
Dependencies:
 gcc:           Found!
 make:          Found!
 wget:          Found!
 patch:         Found!
 svn:           Found!
 privs:         Found!
 automake:      Found!
 autoconf:      Found!
Step 1 of 6: binutils-2.14
 downloading:   Done!
 unpacking:     Done!
 patching:      Done!
 building:
  ee:           Done!
  iop:          Done!
  dvp:          Done!
Step 2 of 6: gcc-3.2.2 (C)
 downloading:   Done!
 unpacking:     Done!
 patching:      Done!
 building:
  ee:           Done!
  iop:          Done!
Step 3 of 6: newlib-1.10.0
 downloading:   Done!
 unpacking:     Done!
 patching:      Done!
 building:
  ee:           Done!
Step 4 of 6: g++-3.2.2 (C/C++)
 downloading:   Done!
 unpacking:     Done!
 patching:      Done!
 building:
  ee:           Done!
Step 5 of 6: ps2sdk-current
 downloading:	Done!
 unpacking:     Done!
 patching:	Done!
 building:
  ee:           Done!
=====================
== ERROR DETECTED! ==
=====================
Installing include/speedregs.h to /usr/local/ps2dev/ps2sdk/common/include
Installing include/tamtypes.h to /usr/local/ps2dev/ps2sdk/common/include
Installing include/tcpip.h to /usr/local/ps2dev/ps2sdk/common/include
Installing include/sys/fcntl.h to /usr/local/ps2dev/ps2sdk/common/include/sys
Installing include/sys/ioctl.h to /usr/local/ps2dev/ps2sdk/common/include/sys
Installing include/sys/select.h to /usr/local/ps2dev/ps2sdk/common/include/sys
Installing include/sys/stat.h to /usr/local/ps2dev/ps2sdk/common/include/sys
Installing include/sys/time.h to /usr/local/ps2dev/ps2sdk/common/include/sys
make[1]: Leaving directory `/home/peori/Coding/ps2/toolchain/TEST/ps2sdk/common'
make -C samples release
make[1]: Entering directory `/home/peori/Coding/ps2/toolchain/TEST/ps2sdk/samples'
mkdir -p /usr/local/ps2dev/ps2sdk/samples
cp -f Makefile_sample /usr/local/ps2dev/ps2sdk/samples/Makefile
cp -f Makefile.pref_sample /usr/local/ps2dev/ps2sdk/samples/Makefile.pref
cp -f Makefile.eeglobal_sample /usr/local/ps2dev/ps2sdk/samples/Makefile.eeglobal
cp -f Makefile.eeglobal_cpp_sample /usr/local/ps2dev/ps2sdk/samples/Makefile.eeglobal_cpp
cp -f Makefile.iopglobal_sample /usr/local/ps2dev/ps2sdk/samples/Makefile.iopglobal
Released samples dir.
make[1]: Leaving directory `/home/peori/Coding/ps2/toolchain/TEST/ps2sdk/samples'
ln: creating symbolic link `/usr/local/ps2dev/ee/lib/gcc-lib//3.2.2//crt0.o' to `/usr/local/ps2dev/ps2sdk/ee/startup/crt0.o': No such file or directory
