blob: 03333a596358478145e345103cd03dc9eeae2439 [file] [log] [blame]
Daniel Stenberg7728c942008-10-14 20:44:49 +00001#!/usr/bin/perl
Franklin Wei54e7eaf2019-10-28 00:54:52 -04002$version="3.15";
Daniel Stenberg7728c942008-10-14 20:44:49 +00003
Jonathan Gordon7a50f6f2010-01-27 08:52:55 +00004require "tools/builds.pm";
Daniel Stenberg7728c942008-10-14 20:44:49 +00005
6my $verbose;
7if($ARGV[0] eq "-v") {
8 $verbose =1;
9 shift @ARGV;
10}
11
12my $update;
13if($ARGV[0] eq "-u") {
14 $update =1;
15 shift @ARGV;
16}
17
18my $doonly;
19if($ARGV[0]) {
20 $doonly = $ARGV[0];
21 print "only build $doonly\n" if($verbose);
22}
23
24if($update) {
25 # svn update!
26 system("svn -q up");
27}
28
29$rev = `svnversion`;
30chomp $rev;
31print "rev $rev\n" if($verbose);
32
33# made once for all targets
34sub runone {
35 my ($dir, $confnum, $extra)=@_;
36 my $a;
37
38 if($doonly && ($doonly ne $dir)) {
39 return;
40 }
41
42 mkdir "build-$dir";
43 chdir "build-$dir";
44 print "Build in build-$dir\n" if($verbose);
45
46 # build the manual(s)
47 $a = buildit($dir, $confnum, $extra);
48
49 chdir "..";
50
51 my $o="build-$dir/rockbox.zip";
Alex Parkerbf7276d2011-02-20 19:27:09 +000052 my $map="build-$dir/rockbox-maps.zip";
Alex Parkercdce4dd2011-02-20 20:07:41 +000053 my $elf="build-$dir/rockbox-elfs.zip";
Daniel Stenberg7728c942008-10-14 20:44:49 +000054 if (-f $o) {
55 my $newo="output/rockbox-$dir-$version.zip";
Alex Parkerbf7276d2011-02-20 19:27:09 +000056 my $newmap="output/rockbox-$dir-$version-maps.zip";
Alex Parkercdce4dd2011-02-20 20:07:41 +000057 my $newelf="output/rockbox-$dir-$version-elfs.zip";
Daniel Stenberg7728c942008-10-14 20:44:49 +000058 system("mkdir -p output");
59 system("mv $o $newo");
60 print "moved $o to $newo\n" if($verbose);
Alex Parkerbf7276d2011-02-20 19:27:09 +000061 system("mv $map $newmap");
62 print "moved $map to $newmap\n" if($verbose);
Alex Parkercdce4dd2011-02-20 20:07:41 +000063 system("mv $elf $newelf");
64 print "moved $elf to $newelf\n" if($verbose);
Daniel Stenberg7728c942008-10-14 20:44:49 +000065 }
66
67 print "remove all contents in build-$dir\n" if($verbose);
68 system("rm -rf build-$dir");
69
70 return $a;
71};
72
73sub fonts {
74 my ($dir, $confnum, $newl)=@_;
75 my $a;
76
77 if($doonly && ($doonly ne $dir)) {
78 return;
79 }
80
81 mkdir "build-$dir";
82 chdir "build-$dir";
83 print "Build fonts in build-$dir\n" if($verbose);
84
Björn Stenbergc0740442009-12-07 12:19:08 +000085 # build the fonts
Daniel Stenberg7728c942008-10-14 20:44:49 +000086 $a = buildfonts($dir, $confnum, $newl);
87
88 chdir "..";
89
90 my $o="build-$dir/rockbox-fonts.zip";
91 if (-f $o) {
92 my $newo="output/rockbox-fonts-$version.zip";
93 system("mv $o $newo");
94 print "moved $o to $newo\n" if($verbose);
95 }
96
97 print "remove all contents in build-$dir\n" if($verbose);
98 system("rm -rf build-$dir");
99
100 return $a;
101};
102
103
104
105sub buildit {
106 my ($target, $confnum, $extra)=@_;
107
108 `rm -rf * >/dev/null 2>&1`;
109
Björn Stenbergc0740442009-12-07 12:19:08 +0000110 my $ram = $extra ? $extra : -1;
111 my $c = "../tools/configure --type=n --target=$confnum --ram=$ram";
Daniel Stenberg7728c942008-10-14 20:44:49 +0000112
113 print "C: $c\n" if($verbose);
114 `$c`;
115
116 print "Run 'make'\n" if($verbose);
Alex Parkerbf7276d2011-02-20 19:27:09 +0000117 `make VERSION=$version`;
Daniel Stenberg7728c942008-10-14 20:44:49 +0000118
119 print "Run 'make zip'\n" if($verbose);
Frank Gevaertsd0731062011-12-07 17:59:11 +0000120 `make zip VERSION=$version`;
Daniel Stenberg7728c942008-10-14 20:44:49 +0000121
122 print "Run 'make mapzip'\n" if($verbose);
Frank Gevaertsd0731062011-12-07 17:59:11 +0000123 `make mapzip VERSION=$version`;
Alex Parkercdce4dd2011-02-20 20:07:41 +0000124
125 print "Run 'make elfzip'\n" if($verbose);
Frank Gevaertsd0731062011-12-07 17:59:11 +0000126 `make elfzip VERSION=$version`;
Daniel Stenberg7728c942008-10-14 20:44:49 +0000127}
128
129sub buildfonts {
130 my ($target, $confnum, $newl)=@_;
131
132 `rm -rf * >/dev/null 2>&1`;
133
Björn Stenbergc0740442009-12-07 12:19:08 +0000134 my $ram = $extra ? $extra : -1;
135 my $c = "../tools/configure --type=n --target=$confnum --ram=$ram";
Daniel Stenberg7728c942008-10-14 20:44:49 +0000136
137 print "C: $c\n" if($verbose);
138 `$c`;
139
140 print "Run 'make fontzip'\n" if($verbose);
Rafaël Carré2438d8b2010-06-03 21:13:36 +0000141 `make fontzip`;
Daniel Stenberg7728c942008-10-14 20:44:49 +0000142}
143
144# run make in tools first to make sure they're up-to-date
145print "cd tools && make\n" if($verbose);
Rafaël Carré2438d8b2010-06-03 21:13:36 +0000146`(cd tools && make ) >/dev/null`;
Daniel Stenberg7728c942008-10-14 20:44:49 +0000147
Björn Stenbergc0740442009-12-07 12:19:08 +0000148for my $b (&stablebuilds) {
Björn Stenbergd5171cc2010-06-04 06:39:28 +0000149 my $configname = $builds{$b}{configname} ? $builds{$b}{configname} : $b;
150 runone($b, $configname, $builds{$b}{ram});
Björn Stenbergc0740442009-12-07 12:19:08 +0000151}
Daniel Stenberg7728c942008-10-14 20:44:49 +0000152
Björn Stenbergc0740442009-12-07 12:19:08 +0000153fonts("fonts", "iaudiox5");
Daniel Stenberg7728c942008-10-14 20:44:49 +0000154