diff options
Diffstat (limited to 'tools/rockboxdev.sh')
-rwxr-xr-x | tools/rockboxdev.sh | 109 |
1 files changed, 81 insertions, 28 deletions
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh index d7328c54c6..42aa5a30d4 100755 --- a/tools/rockboxdev.sh +++ b/tools/rockboxdev.sh | |||
@@ -10,8 +10,9 @@ dlwhere="$HOME/tmp" | |||
10 | # exists. | 10 | # exists. |
11 | prefix="/usr/local" | 11 | prefix="/usr/local" |
12 | 12 | ||
13 | # The binutils version to use | 13 | # This directory is used to extract all files and to build everything in. It |
14 | binutils="2.16.1" | 14 | # must not exist before this script is invoked (as a security measure). |
15 | builddir="$HOME/build-rbdev" | ||
15 | 16 | ||
16 | ############################################################################## | 17 | ############################################################################## |
17 | 18 | ||
@@ -76,6 +77,7 @@ fi | |||
76 | 77 | ||
77 | echo "Download directory: $dlwhere (edit script to change dir)" | 78 | echo "Download directory: $dlwhere (edit script to change dir)" |
78 | echo "Install prefix: $prefix/[target] (edit script to change dir)" | 79 | echo "Install prefix: $prefix/[target] (edit script to change dir)" |
80 | echo "Build dir: $builddir (edit script to change dir)" | ||
79 | 81 | ||
80 | ########################################################################### | 82 | ########################################################################### |
81 | # Verify that we can write in the prefix dir, as otherwise we will hardly | 83 | # Verify that we can write in the prefix dir, as otherwise we will hardly |
@@ -88,23 +90,26 @@ fi | |||
88 | 90 | ||
89 | ########################################################################### | 91 | ########################################################################### |
90 | # If there's already a build dir, we don't overwrite it | 92 | # If there's already a build dir, we don't overwrite it |
91 | if test -d build-rbdev; then | 93 | if test -d $builddir; then |
92 | echo "you have a build-rbdev dir already, please remove and rerun" | 94 | echo "you have a $builddir dir already, please remove and rerun" |
93 | exit | 95 | exit |
94 | fi | 96 | fi |
95 | 97 | ||
96 | echo "" | 98 | cleardir () { |
97 | echo "Select target arch:" | 99 | # $1 is the name of the build dir |
98 | echo "s. sh" | 100 | # delete the build dirs and the source dirs |
99 | echo "m. m68k" | 101 | rm -rf $1/build-gcc $1/build-binu $1/gcc* $1/binutils* |
100 | echo "a. arm" | 102 | } |
101 | 103 | ||
102 | arch=`input` | 104 | buildone () { |
103 | 105 | ||
104 | case $arch in | 106 | gccpatch="" # default is no gcc patch |
107 | gccver="4.0.3" # default gcc version | ||
108 | binutils="2.16.1" # The binutils version to use | ||
109 | |||
110 | case $1 in | ||
105 | [Ss]) | 111 | [Ss]) |
106 | target="sh-elf" | 112 | target="sh-elf" |
107 | gccver="4.0.3" | ||
108 | gccurl="http://www.rockbox.org/twiki/pub/Main/CrossCompiler" | 113 | gccurl="http://www.rockbox.org/twiki/pub/Main/CrossCompiler" |
109 | gccpatch="gcc-4.0.3-rockbox-1.diff" | 114 | gccpatch="gcc-4.0.3-rockbox-1.diff" |
110 | ;; | 115 | ;; |
@@ -114,7 +119,6 @@ case $arch in | |||
114 | ;; | 119 | ;; |
115 | [Aa]) | 120 | [Aa]) |
116 | target="arm-elf" | 121 | target="arm-elf" |
117 | gccver="4.0.3" | ||
118 | ;; | 122 | ;; |
119 | *) | 123 | *) |
120 | echo "unsupported" | 124 | echo "unsupported" |
@@ -123,20 +127,28 @@ case $arch in | |||
123 | esac | 127 | esac |
124 | 128 | ||
125 | bindir="$prefix/$target/bin" | 129 | bindir="$prefix/$target/bin" |
126 | echo "== Summary ==" | 130 | if test -n $pathadd; then |
127 | echo "Target: $target" | 131 | pathadd="$pathadd:$bindir" |
128 | echo "gcc $gccver" | 132 | else |
129 | if test -n "$gccpatch"; then | 133 | pathadd="$bindir" |
130 | echo "gcc patch $gccpatch" | ||
131 | fi | 134 | fi |
132 | echo "binutils $binutils" | ||
133 | echo "install in $prefix/$target" | ||
134 | 135 | ||
135 | echo "when complete, make your PATH include $bindir" | 136 | mkdir $builddir |
137 | cd $builddir | ||
136 | 138 | ||
137 | echo "" | 139 | summary="summary-$1" |
138 | echo "press ENTER to start" | 140 | |
139 | read input | 141 | echo "== Summary ==" > $summary |
142 | echo "Target: $target" >> $summary | ||
143 | echo "gcc $gccver" >> $summary | ||
144 | if test -n "$gccpatch"; then | ||
145 | echo "gcc patch $gccpatch" >> $summary | ||
146 | fi | ||
147 | echo "binutils $binutils" >> $summary | ||
148 | echo "install in $prefix/$target" >> $summary | ||
149 | echo "when complete, make your PATH include $bindir" >> $summary | ||
150 | |||
151 | cat $summary | ||
140 | 152 | ||
141 | if test -f "$dlwhere/binutils-$binutils.tar.bz2"; then | 153 | if test -f "$dlwhere/binutils-$binutils.tar.bz2"; then |
142 | echo "binutils $binutils already downloaded" | 154 | echo "binutils $binutils already downloaded" |
@@ -158,8 +170,6 @@ if test -n "$gccpatch"; then | |||
158 | fi | 170 | fi |
159 | fi | 171 | fi |
160 | 172 | ||
161 | mkdir build-rbdev | ||
162 | cd build-rbdev | ||
163 | echo "extracting binutils" | 173 | echo "extracting binutils" |
164 | tar xjf $dlwhere/binutils-$binutils.tar.bz2 | 174 | tar xjf $dlwhere/binutils-$binutils.tar.bz2 |
165 | echo "extracting gcc" | 175 | echo "extracting gcc" |
@@ -175,16 +185,59 @@ cd build-binu | |||
175 | ../binutils-$binutils/configure --target=$target --prefix=$prefix/$target | 185 | ../binutils-$binutils/configure --target=$target --prefix=$prefix/$target |
176 | make | 186 | make |
177 | make install | 187 | make install |
188 | cd .. # get out of build-binu | ||
178 | PATH="${PATH}:$bindir" | 189 | PATH="${PATH}:$bindir" |
179 | SHELL=/bin/sh # seems to be needed by the gcc build in some cases | 190 | SHELL=/bin/sh # seems to be needed by the gcc build in some cases |
180 | 191 | ||
181 | cd ../ | ||
182 | mkdir build-gcc | 192 | mkdir build-gcc |
183 | cd build-gcc | 193 | cd build-gcc |
184 | ../gcc-$gccver/configure --target=$target --prefix=$prefix/$target --enable-languages=c | 194 | ../gcc-$gccver/configure --target=$target --prefix=$prefix/$target --enable-languages=c |
185 | make | 195 | make |
186 | make install | 196 | make install |
197 | cd .. # get out of build-gcc | ||
198 | cd .. # get out of $builddir | ||
199 | |||
200 | # end of buildone() function | ||
201 | } | ||
202 | |||
203 | echo "" | ||
204 | echo "Select target arch:" | ||
205 | echo "s - sh" | ||
206 | echo "m - m68k" | ||
207 | echo "a - arm" | ||
208 | echo "all - all three compilers" | ||
209 | |||
210 | arch=`input` | ||
211 | |||
212 | case $arch in | ||
213 | [Ss]) | ||
214 | buildone $arch | ||
215 | ;; | ||
216 | [Mm]) | ||
217 | buildone $arch | ||
218 | ;; | ||
219 | [Aa]) | ||
220 | buildone $arch | ||
221 | ;; | ||
222 | all) | ||
223 | echo "build ALL compilers!" | ||
224 | buildone s | ||
225 | cleardir $builddir | ||
226 | |||
227 | buildone m | ||
228 | cleardir $builddir | ||
229 | |||
230 | buildone a | ||
231 | |||
232 | # show the summaries: | ||
233 | cat $builddir/summary-* | ||
234 | ;; | ||
235 | *) | ||
236 | echo "unsupported architecture option" | ||
237 | exit | ||
238 | ;; | ||
239 | esac | ||
187 | 240 | ||
188 | echo "done" | 241 | echo "done" |
189 | echo "" | 242 | echo "" |
190 | echo "Set your PATH to point to $bindir" | 243 | echo "Make your PATH include $pathadd" |