diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/rockboxdev.sh | 88 |
1 files changed, 86 insertions, 2 deletions
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh index f53f323368..323ea9b625 100755 --- a/tools/rockboxdev.sh +++ b/tools/rockboxdev.sh | |||
@@ -61,6 +61,10 @@ input() { | |||
61 | #$1 file | 61 | #$1 file |
62 | #$2 URL"root | 62 | #$2 URL"root |
63 | getfile() { | 63 | getfile() { |
64 | if test -f $dlwhere/$1; then | ||
65 | echo "ROCKBOXDEV: Skipping download of $2/$1: File already exists" | ||
66 | return | ||
67 | fi | ||
64 | tool=`findtool curl` | 68 | tool=`findtool curl` |
65 | if test -z "$tool"; then | 69 | if test -z "$tool"; then |
66 | tool=`findtool wget` | 70 | tool=`findtool wget` |
@@ -110,6 +114,10 @@ build() { | |||
110 | url="$GNU_MIRROR/binutils" | 114 | url="$GNU_MIRROR/binutils" |
111 | ;; | 115 | ;; |
112 | 116 | ||
117 | ctng) | ||
118 | file="crosstool-ng-$version.tar.bz2" | ||
119 | url="http://crosstool-ng.org/download/crosstool-ng" | ||
120 | ;; | ||
113 | *) | 121 | *) |
114 | echo "ROCKBOXDEV: Bad toolname $toolname" | 122 | echo "ROCKBOXDEV: Bad toolname $toolname" |
115 | exit | 123 | exit |
@@ -196,7 +204,16 @@ build() { | |||
196 | cd build-$toolname | 204 | cd build-$toolname |
197 | 205 | ||
198 | echo "ROCKBOXDEV: $toolname/configure" | 206 | echo "ROCKBOXDEV: $toolname/configure" |
199 | CFLAGS=-U_FORTIFY_SOURCE ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params | 207 | case $toolname in |
208 | ctng) # ct-ng doesnt support out-of-tree build and the src folder is named differently | ||
209 | toolname="crosstool-ng" | ||
210 | cp -r ../$toolname-$version/{*,.version} . | ||
211 | ./configure --prefix=$prefix $configure_params | ||
212 | ;; | ||
213 | *) | ||
214 | CFLAGS=-U_FORTIFY_SOURCE ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params | ||
215 | ;; | ||
216 | esac | ||
200 | 217 | ||
201 | echo "ROCKBOXDEV: $toolname/make" | 218 | echo "ROCKBOXDEV: $toolname/make" |
202 | $make | 219 | $make |
@@ -209,6 +226,69 @@ build() { | |||
209 | rm -rf build-$toolname $toolname-$version | 226 | rm -rf build-$toolname $toolname-$version |
210 | } | 227 | } |
211 | 228 | ||
229 | |||
230 | make_ctng() { | ||
231 | if test -f "`which ct-ng 2>/dev/null`"; then | ||
232 | ctng="ct-ng" | ||
233 | else | ||
234 | ctng="" | ||
235 | fi | ||
236 | |||
237 | if test ! -n "$ctng"; then | ||
238 | if test ! -f "$prefix/bin/ct-ng"; then # look if we build it already | ||
239 | build "ctng" "" "1.13.2" | ||
240 | fi | ||
241 | fi | ||
242 | ctng=`PATH=$prefix/bin:$PATH which ct-ng` | ||
243 | } | ||
244 | |||
245 | build_ctng() { | ||
246 | ctng_target="$1" | ||
247 | extra="$2" | ||
248 | tc_arch="$3" | ||
249 | tc_host="$4" | ||
250 | |||
251 | make_ctng | ||
252 | |||
253 | dlurl="http://www.rockbox.org/gcc/$ctng_target" | ||
254 | |||
255 | # download | ||
256 | getfile "ct-ng-config" "$dlurl" | ||
257 | |||
258 | test -n "$extra" && getfile "$extra" "$dlurl" | ||
259 | |||
260 | # create build directory | ||
261 | if test -d $builddir; then | ||
262 | if test ! -w $builddir; then | ||
263 | echo "ROCKBOXDEV: No write permission for $builddir" | ||
264 | exit | ||
265 | fi | ||
266 | else | ||
267 | mkdir -p $builddir | ||
268 | fi | ||
269 | |||
270 | # copy config and cd to $builddir | ||
271 | mkdir $builddir/build-$ctng_target | ||
272 | ctng_config="$builddir/build-$ctng_target/.config" | ||
273 | cat "$dlwhere/ct-ng-config" | sed -e "s,\(CT_PREFIX_DIR=\).*,\1$prefix," > $ctng_config | ||
274 | cd $builddir/build-$ctng_target | ||
275 | |||
276 | #~ $ctng "build" | ||
277 | |||
278 | # install extras | ||
279 | if test -e "$dlwhere/$extra"; then | ||
280 | # verify the toolchain has sysroot support | ||
281 | if test -n `cat $ctng_config | grep CT_USE_SYSROOT\=y`; then | ||
282 | sysroot=`cat $ctng_config | grep CT_SYSROOT_NAME | sed -e 's,CT_SYSROOT_NAME\=\"\([a-zA-Z0-9]*\)\",\1,'` | ||
283 | tar xf "$dlwhere/$extra" -C "$prefix/$tc_arch-$ctng_target-$tc_host/$sysroot" | ||
284 | fi | ||
285 | fi | ||
286 | |||
287 | # cleanup | ||
288 | cd $builddir | ||
289 | rm -rf $builddir/build-$ctng_target | ||
290 | } | ||
291 | |||
212 | ############################################################################## | 292 | ############################################################################## |
213 | # Code: | 293 | # Code: |
214 | 294 | ||
@@ -242,6 +322,7 @@ else | |||
242 | fi | 322 | fi |
243 | fi | 323 | fi |
244 | 324 | ||
325 | |||
245 | # Verify the prefix dir | 326 | # Verify the prefix dir |
246 | if test ! -d $prefix; then | 327 | if test ! -d $prefix; then |
247 | mkdir -p $prefix | 328 | mkdir -p $prefix |
@@ -260,6 +341,7 @@ echo "s - sh (Archos models)" | |||
260 | echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)" | 341 | echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)" |
261 | echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)" | 342 | echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)" |
262 | echo "i - mips (Jz4740 and ATJ-based players)" | 343 | echo "i - mips (Jz4740 and ATJ-based players)" |
344 | echo "r - arm-app (Samsung ypr0)" | ||
263 | echo "separate multiple targets with spaces" | 345 | echo "separate multiple targets with spaces" |
264 | echo "(Example: \"s m a\" will build sh, m68k and arm)" | 346 | echo "(Example: \"s m a\" will build sh, m68k and arm)" |
265 | echo "" | 347 | echo "" |
@@ -305,7 +387,9 @@ do | |||
305 | build "binutils" "arm-elf-eabi" "2.20.1" "binutils-2.20.1-ld-thumb-interwork-long-call.diff" "$binopts --disable-werror" | 387 | build "binutils" "arm-elf-eabi" "2.20.1" "binutils-2.20.1-ld-thumb-interwork-long-call.diff" "$binopts --disable-werror" |
306 | build "gcc" "arm-elf-eabi" "4.4.4" "rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff" "$gccopts" "gmp mpfr" | 388 | build "gcc" "arm-elf-eabi" "4.4.4" "rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff" "$gccopts" "gmp mpfr" |
307 | ;; | 389 | ;; |
308 | 390 | [Rr]) | |
391 | build_ctng "ypr0" "alsalib.tar.gz" "arm" "linux-gnueabi" | ||
392 | ;; | ||
309 | *) | 393 | *) |
310 | echo "ROCKBOXDEV: Unsupported architecture option: $arch" | 394 | echo "ROCKBOXDEV: Unsupported architecture option: $arch" |
311 | exit | 395 | exit |