Cleaner solution to plugin-included core files.
[kugel-rb.git] / tools / release / w32sims.pl
blob058e2bb302be738ef27da0f238f2f89a59ead5c0
1 #!/usr/bin/perl
2 # This is basically a copy of tools/release/bins.pl, with small changes
3 # You need to set up $PATH to include the bin dir of a crosscompiled SDL
4 # installation, and have mingw32 compilers installed. Everything else should
5 # Just Work[tm].
7 my $verbose, $update, $doonly, $version;
8 while (scalar @ARGV > 0) {
9 if ($ARGV[0] eq "-h") {
10 print $ARGV[0]."\n";
11 print <<MOO
12 Usage: w32sims [-v] [-u] [-r VERSION] [buildonly]
13 -v Verbose output
14 -u Run svn up before building
15 -r Use the specified version string for filenames (defaults to SVN
16 revision)
17 MOO
19 exit 1;
21 elsif ($ARGV[0] eq "-v") {
22 $verbose =1;
24 elsif ($ARGV[0] eq "-u") {
25 $update =1;
27 elsif ($ARGV[0] eq "-r") {
28 $version =$ARGV[1];
29 shift @ARGV;
31 else {
32 $doonly =$ARGV[0];
33 # This will only be printed if the -v flag comes earler
34 print "only build $doonly\n" if($verbose);
36 shift @ARGV;
39 if($update) {
40 # svn update!
41 system("svn -q up");
44 $rev = `svnversion`;
45 chomp $rev;
46 print "rev $rev\n" if($verbose);
48 if (!defined($version)) {
49 $version = sprintf("r%d", $rev);
52 # made once for all targets
53 sub runone {
54 my ($dir, $confnum, $extra)=@_;
55 my $a;
57 if($doonly && ($doonly ne $dir)) {
58 return;
61 mkdir "build-$dir";
62 chdir "build-$dir";
63 print "Build in build-$dir\n" if($verbose);
65 # build the target
66 $a = buildit($dir, $confnum, $extra);
68 chdir "..";
70 print "Zip up the sim and associated files\n" if ($verbose);
71 system("mv build-$dir rockbox-$dir-w32-sim");
72 `zip -9 -r -q rockbox-$dir-w32-sim/rockbox.zip rockbox-$dir-w32-sim/{rockboxui.exe,UI256.bmp,SDL.dll,archos}`;
74 my $o="rockbox-$dir-w32-sim/rockbox.zip";
75 if (-f $o) {
76 my $newo="output/rockbox-$dir-$version-w32-sim.zip";
77 system("mkdir -p output");
78 system("mv $o $newo");
79 print "moved $o to $newo\n" if($verbose);
82 print "remove all contents in rockbox-$dir-w32-sim\n" if($verbose);
83 system("rm -rf rockbox-$dir-w32-sim");
85 return $a;
88 sub buildit {
89 my ($target, $confnum, $extra)=@_;
91 `rm -rf * >/dev/null 2>&1`;
93 my $c = sprintf('printf "%s\n%ss\n" | ../tools/configure',
94 $confnum, $extra);
96 print "C: $c\n" if($verbose);
97 `$c`;
99 print "Run 'make'\n" if($verbose);
100 `make -j 2>/dev/null`;
102 print "Run 'make install'\n" if($verbose);
103 `make install 2>/dev/null`;
105 print "Find and copy SDL.dll\n" if ($verbose);
106 `cp \`dirname \\\`which sdl-config\\\`\`/SDL.dll ./`;
110 # run make in tools first to make sure they're up-to-date
111 print "cd tools && make\n" if($verbose);
112 `(cd tools && make ) >/dev/null 2>&1`;
114 runone("player", "player", '\n');
115 runone("recorder", "recorder", '\n');
116 runone("recorder8mb", "recorder", '8\n');
117 runone("fmrecorder", "fmrecorder", '\n');
118 runone("fmrecorder8mb", "fmrecorder", '8\n');
119 runone("recorderv2", "recorderv2", '\n');
120 runone("ondiosp", "ondiosp", '\n');
121 runone("ondiofm", "ondiofm", '\n');
122 runone("h100", "h100");
123 runone("h120", "h120");
124 runone("h300", "h300");
125 runone("ipodcolor", "ipodcolor");
126 runone("ipodnano", "ipodnano");
127 runone("ipod4gray", "ipod4g");
128 runone("ipodvideo", "ipodvideo", '32\n');
129 runone("ipodvideo64mb", "ipodvideo", '64\n');
130 runone("ipod3g", "ipod3g");
131 runone("ipod1g2g", "ipod1g2g");
132 runone("iaudiox5", "x5");
133 runone("iaudiom5", "m5");
134 runone("iaudiom3", "m3");
135 runone("ipodmini1g", "ipodmini");
136 runone("ipodmini2g", "ipodmini2g");
137 runone("h10", "h10");
138 runone("h10_5gb", "h10_5gb");
139 runone("gigabeatf", "gigabeatf");
140 runone("sansae200", "e200");
141 runone("sansac200", "c200");
142 #runone("mrobe500", "mrobe500");
143 runone("mrobe100", "mrobe100");
144 runone("cowond2", "cowond2");