#!/usr/bin/perl # # This is a simple build script for the rockbox buildsystem # # This script expects the following commandline parameters: # checkout date (like: "20080131T173511Z") # rockbox build line (like: "build-h120:iriver H120 - Normal:rockbox.iriver:e200\\n\\n") # add client specific compiler path here: $ENV{'PATH'}.=":/usr/local/sh-elf/bin:/usr/local/m68k-elf/bin:/usr/local/arm-elf/bin:/usr/local/mipsel-elf/bin"; # Original rockbox target sub: sub target { my ($dir, $desc, $output, $config) = @_; my $buildlog="buildlog"; `rm -rf *`; `printf "$config" | ../tools/configure >> $buildlog 2>&1`; if(-f $output) { return 1; } # use "-j" or "-j 4" etc depending on your system `make -j 1 -k >>$buildlog 2>&1`; if(! -f $output) { return 2; } # build zip `make zip`; return 0; } # start time of the build my $starttime = time(); # should check arguments, just using them now. my $date = shift; my $build = shift; # parse the buildline. $build =~ /([^:]*):([^:]*):([^:]*):(.*)/; my ($dir, $desc, $target, $config)=($1,$2,$3,$4); # output a buidlog for the master :) `rm -f masterlog-$dir`; open(DEST, ">masterlog-$dir"); # to keep all other scripts working, use the same output as buildall.pl: print DEST "Build Start Single\n"; print DEST "Build Date: $date\n"; print DEST "Build Type: $desc\n"; print DEST "Build Dir: $dir\n"; my $pwd = `pwd`; my $fail; chomp $pwd; # create build dir if it doesn't exist if (! -d $dir) { mkdir $dir; } # switch to the builddir if (chdir $dir) { $fail = target($dir, $desc, $target, $config); chdir $pwd; } else { # failed to create/enter dir? $fail = 4; } if ($fail) { print DEST "Build Status: Failed\n"; } else { print DEST "Build Status: Fine\n"; } # add the build time to the log. $tooktime = time() - $starttime; print DEST "Build Time: $tooktime\n"; # copy the log of the actual building print DEST "Build Log Start\n"; open(LOG, "<$dir/buildlog"); while() { print DEST " $_"; } close(LOG); # end properly to keep everybody happy. print DEST "Build Log End\n"; print DEST "Build End\n"; # close the log. everything is ready for the master to pickup. close(DEST);