summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-12-23 13:49:43 +0000
committerThomas Martitz <kugel@rockbox.org>2011-12-23 13:49:43 +0000
commit6296045e2a135174bd47d491d8716f7775d86600 (patch)
tree63a795f3c1586c33bc9ce160cb65fbe2e2eb4dbb
parentc00938e4a3f066fe77de4235399d869864cc6e89 (diff)
downloadrockbox-6296045e2a135174bd47d491d8716f7775d86600.zip
rockbox-6296045e2a135174bd47d491d8716f7775d86600.tar.gz
rockbox-6296045e2a135174bd47d491d8716f7775d86600.tar.bz2
rockbox-6296045e2a135174bd47d491d8716f7775d86600.tar.xz
Add crosstool-NG build to rockboxdev.sh.
rockboxdev.sh can now build toolchains using ct-ng (and build ct-ng before if required). It downloads the appropriate config for ct-ng and lets it do its job. Used for the upcoming YP-R0 target, which requires a full toolchain including libc. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31412 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/rockboxdev.sh88
1 files changed, 86 insertions, 2 deletions
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh
index f53f323..323ea9b 100755
--- a/tools/rockboxdev.sh
+++ b/tools/rockboxdev.sh
@@ -61,6 +61,10 @@ input() {
#$1 file
#$2 URL"root
getfile() {
+ if test -f $dlwhere/$1; then
+ echo "ROCKBOXDEV: Skipping download of $2/$1: File already exists"
+ return
+ fi
tool=`findtool curl`
if test -z "$tool"; then
tool=`findtool wget`
@@ -110,6 +114,10 @@ build() {
url="$GNU_MIRROR/binutils"
;;
+ ctng)
+ file="crosstool-ng-$version.tar.bz2"
+ url="http://crosstool-ng.org/download/crosstool-ng"
+ ;;
*)
echo "ROCKBOXDEV: Bad toolname $toolname"
exit
@@ -196,7 +204,16 @@ build() {
cd build-$toolname
echo "ROCKBOXDEV: $toolname/configure"
- CFLAGS=-U_FORTIFY_SOURCE ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params
+ case $toolname in
+ ctng) # ct-ng doesnt support out-of-tree build and the src folder is named differently
+ toolname="crosstool-ng"
+ cp -r ../$toolname-$version/{*,.version} .
+ ./configure --prefix=$prefix $configure_params
+ ;;
+ *)
+ CFLAGS=-U_FORTIFY_SOURCE ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params
+ ;;
+ esac
echo "ROCKBOXDEV: $toolname/make"
$make
@@ -209,6 +226,69 @@ build() {
rm -rf build-$toolname $toolname-$version
}
+
+make_ctng() {
+ if test -f "`which ct-ng 2>/dev/null`"; then
+ ctng="ct-ng"
+ else
+ ctng=""
+ fi
+
+ if test ! -n "$ctng"; then
+ if test ! -f "$prefix/bin/ct-ng"; then # look if we build it already
+ build "ctng" "" "1.13.2"
+ fi
+ fi
+ ctng=`PATH=$prefix/bin:$PATH which ct-ng`
+}
+
+build_ctng() {
+ ctng_target="$1"
+ extra="$2"
+ tc_arch="$3"
+ tc_host="$4"
+
+ make_ctng
+
+ dlurl="http://www.rockbox.org/gcc/$ctng_target"
+
+ # download
+ getfile "ct-ng-config" "$dlurl"
+
+ test -n "$extra" && getfile "$extra" "$dlurl"
+
+ # create build directory
+ if test -d $builddir; then
+ if test ! -w $builddir; then
+ echo "ROCKBOXDEV: No write permission for $builddir"
+ exit
+ fi
+ else
+ mkdir -p $builddir
+ fi
+
+ # copy config and cd to $builddir
+ mkdir $builddir/build-$ctng_target
+ ctng_config="$builddir/build-$ctng_target/.config"
+ cat "$dlwhere/ct-ng-config" | sed -e "s,\(CT_PREFIX_DIR=\).*,\1$prefix," > $ctng_config
+ cd $builddir/build-$ctng_target
+
+ #~ $ctng "build"
+
+ # install extras
+ if test -e "$dlwhere/$extra"; then
+ # verify the toolchain has sysroot support
+ if test -n `cat $ctng_config | grep CT_USE_SYSROOT\=y`; then
+ sysroot=`cat $ctng_config | grep CT_SYSROOT_NAME | sed -e 's,CT_SYSROOT_NAME\=\"\([a-zA-Z0-9]*\)\",\1,'`
+ tar xf "$dlwhere/$extra" -C "$prefix/$tc_arch-$ctng_target-$tc_host/$sysroot"
+ fi
+ fi
+
+ # cleanup
+ cd $builddir
+ rm -rf $builddir/build-$ctng_target
+}
+
##############################################################################
# Code:
@@ -242,6 +322,7 @@ else
fi
fi
+
# Verify the prefix dir
if test ! -d $prefix; then
mkdir -p $prefix
@@ -260,6 +341,7 @@ echo "s - sh (Archos models)"
echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)"
echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)"
echo "i - mips (Jz4740 and ATJ-based players)"
+echo "r - arm-app (Samsung ypr0)"
echo "separate multiple targets with spaces"
echo "(Example: \"s m a\" will build sh, m68k and arm)"
echo ""
@@ -305,7 +387,9 @@ do
build "binutils" "arm-elf-eabi" "2.20.1" "binutils-2.20.1-ld-thumb-interwork-long-call.diff" "$binopts --disable-werror"
build "gcc" "arm-elf-eabi" "4.4.4" "rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff" "$gccopts" "gmp mpfr"
;;
-
+ [Rr])
+ build_ctng "ypr0" "alsalib.tar.gz" "arm" "linux-gnueabi"
+ ;;
*)
echo "ROCKBOXDEV: Unsupported architecture option: $arch"
exit