1
0
Fork 0
forked from len0rd/rockbox

Added an "all" option that builds all cross-compiler in one go. Expect it to

take a while... ;-)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10017 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2006-05-30 08:38:02 +00:00
parent d9069ef1de
commit 2731afa12f

View file

@ -10,8 +10,9 @@ dlwhere="$HOME/tmp"
# exists. # exists.
prefix="/usr/local" prefix="/usr/local"
# The binutils version to use # This directory is used to extract all files and to build everything in. It
binutils="2.16.1" # must not exist before this script is invoked (as a security measure).
builddir="$HOME/build-rbdev"
############################################################################## ##############################################################################
@ -76,6 +77,7 @@ fi
echo "Download directory: $dlwhere (edit script to change dir)" echo "Download directory: $dlwhere (edit script to change dir)"
echo "Install prefix: $prefix/[target] (edit script to change dir)" echo "Install prefix: $prefix/[target] (edit script to change dir)"
echo "Build dir: $builddir (edit script to change dir)"
########################################################################### ###########################################################################
# Verify that we can write in the prefix dir, as otherwise we will hardly # Verify that we can write in the prefix dir, as otherwise we will hardly
@ -88,23 +90,26 @@ fi
########################################################################### ###########################################################################
# If there's already a build dir, we don't overwrite it # If there's already a build dir, we don't overwrite it
if test -d build-rbdev; then if test -d $builddir; then
echo "you have a build-rbdev dir already, please remove and rerun" echo "you have a $builddir dir already, please remove and rerun"
exit exit
fi fi
echo "" cleardir () {
echo "Select target arch:" # $1 is the name of the build dir
echo "s. sh" # delete the build dirs and the source dirs
echo "m. m68k" rm -rf $1/build-gcc $1/build-binu $1/gcc* $1/binutils*
echo "a. arm" }
arch=`input` buildone () {
case $arch in gccpatch="" # default is no gcc patch
gccver="4.0.3" # default gcc version
binutils="2.16.1" # The binutils version to use
case $1 in
[Ss]) [Ss])
target="sh-elf" target="sh-elf"
gccver="4.0.3"
gccurl="http://www.rockbox.org/twiki/pub/Main/CrossCompiler" gccurl="http://www.rockbox.org/twiki/pub/Main/CrossCompiler"
gccpatch="gcc-4.0.3-rockbox-1.diff" gccpatch="gcc-4.0.3-rockbox-1.diff"
;; ;;
@ -114,7 +119,6 @@ case $arch in
;; ;;
[Aa]) [Aa])
target="arm-elf" target="arm-elf"
gccver="4.0.3"
;; ;;
*) *)
echo "unsupported" echo "unsupported"
@ -123,20 +127,28 @@ case $arch in
esac esac
bindir="$prefix/$target/bin" bindir="$prefix/$target/bin"
echo "== Summary ==" if test -n $pathadd; then
echo "Target: $target" pathadd="$pathadd:$bindir"
echo "gcc $gccver" else
if test -n "$gccpatch"; then pathadd="$bindir"
echo "gcc patch $gccpatch"
fi fi
echo "binutils $binutils"
echo "install in $prefix/$target"
echo "when complete, make your PATH include $bindir" mkdir $builddir
cd $builddir
echo "" summary="summary-$1"
echo "press ENTER to start"
read input echo "== Summary ==" > $summary
echo "Target: $target" >> $summary
echo "gcc $gccver" >> $summary
if test -n "$gccpatch"; then
echo "gcc patch $gccpatch" >> $summary
fi
echo "binutils $binutils" >> $summary
echo "install in $prefix/$target" >> $summary
echo "when complete, make your PATH include $bindir" >> $summary
cat $summary
if test -f "$dlwhere/binutils-$binutils.tar.bz2"; then if test -f "$dlwhere/binutils-$binutils.tar.bz2"; then
echo "binutils $binutils already downloaded" echo "binutils $binutils already downloaded"
@ -158,8 +170,6 @@ if test -n "$gccpatch"; then
fi fi
fi fi
mkdir build-rbdev
cd build-rbdev
echo "extracting binutils" echo "extracting binutils"
tar xjf $dlwhere/binutils-$binutils.tar.bz2 tar xjf $dlwhere/binutils-$binutils.tar.bz2
echo "extracting gcc" echo "extracting gcc"
@ -175,16 +185,59 @@ cd build-binu
../binutils-$binutils/configure --target=$target --prefix=$prefix/$target ../binutils-$binutils/configure --target=$target --prefix=$prefix/$target
make make
make install make install
cd .. # get out of build-binu
PATH="${PATH}:$bindir" PATH="${PATH}:$bindir"
SHELL=/bin/sh # seems to be needed by the gcc build in some cases SHELL=/bin/sh # seems to be needed by the gcc build in some cases
cd ../
mkdir build-gcc mkdir build-gcc
cd build-gcc cd build-gcc
../gcc-$gccver/configure --target=$target --prefix=$prefix/$target --enable-languages=c ../gcc-$gccver/configure --target=$target --prefix=$prefix/$target --enable-languages=c
make make
make install make install
cd .. # get out of build-gcc
cd .. # get out of $builddir
# end of buildone() function
}
echo ""
echo "Select target arch:"
echo "s - sh"
echo "m - m68k"
echo "a - arm"
echo "all - all three compilers"
arch=`input`
case $arch in
[Ss])
buildone $arch
;;
[Mm])
buildone $arch
;;
[Aa])
buildone $arch
;;
all)
echo "build ALL compilers!"
buildone s
cleardir $builddir
buildone m
cleardir $builddir
buildone a
# show the summaries:
cat $builddir/summary-*
;;
*)
echo "unsupported architecture option"
exit
;;
esac
echo "done" echo "done"
echo "" echo ""
echo "Set your PATH to point to $bindir" echo "Make your PATH include $pathadd"