summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-05-15 13:26:59 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-05-15 13:26:59 +0000
commitcce0d65a976003de6c9d246f41326efd4e974b2d (patch)
tree8d1d6a6fa6313fe5c8d36b8a5b5ae7bc01ffd2c2
parent4b2b804f2b6794fe9e23fa7094e1e7330a7b83a7 (diff)
downloadrockbox-cce0d65a976003de6c9d246f41326efd4e974b2d.tar.gz
rockbox-cce0d65a976003de6c9d246f41326efd4e974b2d.zip
handy script that downloads, builds and installs a cross-compiler setup for you
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9940 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/rockboxdev.sh137
1 files changed, 137 insertions, 0 deletions
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh
new file mode 100755
index 0000000000..302bb57672
--- /dev/null
+++ b/tools/rockboxdev.sh
@@ -0,0 +1,137 @@
1#!/bin/sh
2
3# this is where this script will store downloaded files and check for already
4# downloaded files
5dlwhere="$HOME/tmp"
6
7# will append the target string to the prefix dir mentioned here
8# Note that the user running this script must be able to do make install in
9# this given prefix directory. Also make sure that this given root dir
10# exists.
11prefix="/usr/local"
12
13# The binutils version to use
14binutils="2.16.1"
15
16##############################################################################
17
18findtool(){
19 file="$1"
20
21 IFS=":"
22 for path in $PATH
23 do
24 # echo "checks for $file in $path" >&2
25 if test -f "$path/$file"; then
26 echo "$path/$file"
27 return
28 fi
29 done
30}
31
32input() {
33 read response
34 echo $response
35}
36
37#$1 file
38#$2 URL"root
39getfile() {
40 tool=`findtool curl`
41 if test -z "$tool"; then
42 tool=`findtool wget`
43 if test -n "$tool"; then
44 # wget download
45 echo "download $2/$1 using wget"
46 $tool -O $dlwhere/$1 $2/$1
47 fi
48 else
49 # curl download
50 echo "download $2/$1 using curl"
51 $tool -Lo $dlwhere/$1 $2/$1
52 fi
53 if test -z "$tool"; then
54 echo "couldn't find downloader tool to use!"
55 exit
56 fi
57
58
59}
60
61echo "Pick target arch:"
62echo "s. sh"
63echo "m. m68k"
64echo "a. arm"
65
66arch=`input`
67
68case $arch in
69 [Ss])
70 target="sh-elf"
71 gccver="4.0.3"
72 ;;
73 [Mm])
74 target="m68k-elf"
75 gccver="3.4.6"
76 ;;
77 [Aa])
78 target="arm-elf"
79 gccver="4.0.3"
80 ;;
81 *)
82 echo "unsupported"
83 exit
84 ;;
85esac
86
87if test -d build-rbdev; then
88 echo "you have a build-rbdev dir already, please remove and rerun"
89 exit
90fi
91
92bindir="$prefix/$target/bin"
93echo "Summary:"
94echo "Target: $target"
95echo "gcc $gccver"
96echo "binutils $binutils"
97echo "install in $prefix/$target"
98echo ""
99echo "Set your PATH to point to $bindir"
100
101
102if test -f "$dlwhere/binutils-$binutils.tar.bz2"; then
103 echo "binutils $binutils already downloaded"
104else
105 getfile binutils-$binutils.tar.bz2 ftp://ftp.gnu.org/pub/gnu/binutils
106fi
107
108if test -f "$dlwhere/gcc-$gccver.tar.bz2"; then
109 echo "gcc $gccver already downloaded"
110else
111 getfile gcc-$gccver.tar.bz2 ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$gccver
112fi
113
114
115mkdir build-rbdev
116cd build-rbdev
117echo "extracting binutils"
118tar xjf $dlwhere/binutils-$binutils.tar.bz2
119echo "extracting gcc"
120tar xf $dlwhere/gcc-$gccver.tar.bz2
121
122mkdir build-binu
123cd build-binu
124../binutils-$binutils/configure --target=$target --prefix=$prefix/$target
125make
126make install
127PATH="${PATH}:$bindir"
128SHELL=/bin/sh # seems to be needed by the gcc build in some cases
129
130cd ../
131mkdir build-gcc
132cd build-gcc
133../gcc-$gccver/configure --target=$target --prefix=$prefix/$target --enable-languages=c
134make
135make install
136
137echo "done"