2 # This is basically a copy of tools/release/bins.pl, with small changes.
7 require "tools/builds.pm";
9 my $verbose, $strip, $update, $doonly, $version;
12 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time());
17 my $filename = "rockbox-sim-<target>-<version>";
19 while (scalar @ARGV > 0) {
20 if ($ARGV[0] eq "-h") {
23 Usage: w32sims [-v] [-u] [-s] [-w] [-r VERSION] [-f filename] [buildonly]
25 -u Run svn up before building
26 -r Use the specified version string for filenames (defaults to SVN
28 -s Strip binaries before zipping them up.
29 -w Crosscompile for Windows (requires mingw32)
30 -f Filename format string (without extension). This can include a
31 filepath (relative or absolute) May include the following special
33 <version> - Replaced by the revision (or version name if -r is
35 <target> - Target shortname
36 <YYYY> - Year (4 digits)
37 <MM> - Month (2 digits)
38 <DD> - Day of month (2 digits - 0-padded)
39 <HH> - Hour of day (2 digits, 0-padded, 00-23)
40 <mm> - Minute (2 digits, 0-padded)
41 The default filename is rockbox-sim-<target>-<version>
46 elsif ($ARGV[0] eq "-v") {
49 elsif ($ARGV[0] eq "-u") {
52 elsif ($ARGV[0] eq "-s") {
55 elsif ($ARGV[0] eq "-w") {
58 elsif ($ARGV[0] eq "-r") {
62 elsif ($ARGV[0] eq "-f") {
67 push(@doonly,$ARGV[0]);
77 $test = `sdl-config --libs`;
79 printf("You don't appear to have sdl-config\n");
83 $rev = `tools/version.sh .`;
85 print "rev $rev\n" if($verbose);
88 printf("Build only %s\n", join(', ', @doonly)) if($verbose);
91 if (!defined($version)) {
95 # made once for all targets
100 if(@doonly > 0 && !grep(/^$dir$/, @doonly)) {
106 print "Build in build-$dir\n" if($verbose);
109 $a = buildit
($dir, $extra);
111 # Do not continue if the rockboxui executable is not created. This will
112 # prevent a good build getting overwritten by a bad build when
113 # uploaded to the web server.
114 unless ( (-e
"rockboxui") || (-e
"rockboxui.exe") ) {
115 print "No rockboxui, clean up and return\n" if($verbose);
117 system("rm -rf build-$dir");
122 print "Stripping binaries\n" if ($verbose);
123 # find \( -name "*.exe" -o -name "*.rock" -o -name "*.codec" \) -exec ls -l "{}" ";"
124 open(MAKE
, "Makefile");
125 my $AS=(grep(/^export AS=/, <MAKE
>))[0];
127 (my $striptool = $AS) =~ s/^export AS=(.*)as$/$1strip/;
129 $cmd = "find \\( -name 'rockboxui*' -o -iname '*dll' -o -name '*.rock' -o -name '*.codec' \\) -exec $striptool '{}' ';'";
130 print("$cmd\n") if ($verbose);
139 $newo =~ s/<version>/$version/g;
140 $newo =~ s/<target>/$dir/g;
141 $newo =~ s/<YYYY>/$year/g;
142 $newo =~ s/<MM>/$mon/g;
143 $newo =~ s/<DD>/$mday/g;
144 $newo =~ s/<HH>/$hour/g;
145 $newo =~ s/<mm>/$min/g;
148 print "Zip up the sim and associated files\n" if ($verbose);
149 mkpath
(dirname
($newo));
150 system("mv build-$dir $newo");
152 print "Find and copy SDL.dll\n" if ($verbose);
153 open(MAKE
, "$newo/Makefile");
154 my $GCCOPTS=(grep(/^export GCCOPTS=/, <MAKE
>))[0];
156 (my $sdldll = $GCCOPTS) =~ s/^export GCCOPTS=.*-I([^ ]+)\/include\/SDL
.*$/$1\/bin\
/SDL.dll/;
157 print "Found $sdldll\n" if ($verbose);
158 `cp $sdldll ./$newo/`;
161 my $toplevel = getcwd
();
162 chdir(dirname
($newo));
163 $cmd = "zip -9 -r -q \"".basename
($newo)."\" "
164 . "\"".basename
($newo)."\"/rockboxui* "
165 . "\"".basename
($newo)."\"/UI256.bmp "
166 . "\"".basename
($newo)."\"/SDL.dll "
167 . "\"".basename
($newo)."\"/simdisk ";
168 print("$cmd\n") if($verbose);
172 print "remove all contents in $newo\n" if($verbose);
173 system("rm -rf $newo");
179 my ($dir, $extra)=@_;
181 `rm -rf * >/dev/null 2>&1`;
184 $simstring = 'a\nw\ns\n\n';
190 my $c = sprintf('printf "%s\n%s%s" | ../tools/configure',
191 $dir, $extra, $simstring);
193 print "C: $c\n" if($verbose);
196 print "Run 'make'\n" if($verbose);
199 print "Run 'make install'\n" if($verbose);
200 `make install 2>/dev/null`;
203 for my $b (sort byname
keys %builds) {
204 if ($builds{$b}{status
} >= 2)
206 # ipodvideo64mb uses the ipodvideo simulator
207 # sansae200r uses the sansae200 simulator
208 if ($b ne 'ipodvideo64mb' && $b ne 'sansae200r')
210 if ($builds{$b}{ram
} ne '')
212 # These builds need the ram size sent to configure
213 runone
($b, $builds{$b}{ram
} . '\n');
223 #The following ports are in the unusable category, but the simulator does build
224 runone
("gogearhdd1630");
225 runone
("gogearsa9200");
228 runone
("ondavx747p");
230 runone
("sansam200v4");
232 runone
("zenvisionm30gb");
233 runone
("zenvisionm60gb");