1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#!/usr/bin/perl -w
use strict;
my @repos_in_order = qw(
buildsystem
libwapcaplet
libparserutils
libcss
libhubbub
libdom
libnsbmp
libnsgif
librosprite
libnsfb
libsvgtiny
nsgenjsbind
netsurf
);
my %repos = (
buildsystem => "buildsystem",
libwapcaplet => "libwapcaplet",
libparserutils => "libparserutils",
libcss => "libcss",
libhubbub => "libhubbub",
libdom => "libdom",
libnsbmp => "libnsbmp",
libnsgif => "libnsgif",
librosprite => "librosprite",
libnsfb => "libnsfb",
libsvgtiny => "libsvgtiny",
nsgenjsbind => "nsgenbind",
rufl => "librufl",
libpencil => "libpencil",
netsurf => "netsurf",
);
my %vers = ();
foreach my $arg (@ARGV) {
$arg =~ /^([^=]+)=(.*)$/;
$vers{$1} = $2;
print "Memoising $1 = $2\n";
}
# Utility functions
sub repourl {
my $repo = shift;
return "git://git.netsurf-browser.org/${repo}.git";
}
sub tarurl {
my $repo = shift;
return "http://ci.netsurf-browser.org/builds/sources/$repos{${repo}}-$vers{${repo}}.tar.gz";
}
sub tarfile {
my $repo = shift;
return "tars/$repos{${repo}}-$vers{${repo}}.tar.gz";
}
`mkdir -p gits tars`;
# Step 1, acquire the versions of all the repos in order
foreach my $repo (keys %repos) {
if (defined $vers{$repo}) {
print "Assuming $repo is at $vers{$repo}\n";
} else {
print "Interrogating ${repo}...\n";
my $url = repourl($repo);
system("git clone $url gits/$repo") unless (-d "gits/$repo");
system("cd gits/$repo; git remote update origin");
my $ver = `cd gits/$repo; git describe --abbrev=0 origin/master`;
chomp $ver;
$ver =~ s/^release\///;
$vers{$repo} = $ver;
print "Determined $repo is at $vers{$repo}\n";
}
}
# Step 2, acquire the tarballs
foreach my $repo (keys %repos) {
next if ($vers{$repo} eq '');
print "Acquiring tar for $repo\n";
my $url = tarurl($repo);
my $file = tarfile($repo);
system("wget -O $file $url") unless (-r $file);
}
# Step 3, prepare the tar
`rm -rf netsurf-full-$vers{netsurf}`;
`mkdir -p netsurf-full-$vers{netsurf}/src`;
foreach my $repo (keys %repos) {
next if ($vers{$repo} eq '');
print "Unpacking $repo\n";
my $file = tarfile($repo);
system("cd netsurf-full-$vers{netsurf}/src; tar xzf ../../$file");
}
# Step 4, prepare top level Makefile
open INFILE, "<", "basis.mk";
open OUTFILE, ">", "netsurf-full-$vers{netsurf}/Makefile";
while (my $line = <INFILE>) {
unless ($line =~ /^###([^#]+)###$/) {
print OUTFILE $line;
next;
}
my $what = $1;
if ($what eq 'TARGS') {
my $libtargs = "";
foreach my $repo (@repos_in_order) {
next if ($vers{$repo} eq '');
my $basis = $repos{$repo};
my $ver = $vers{$repo};
$repo =~ y/a-z/A-Z/;
print OUTFILE "${repo}_BASE := src/$basis\n";
print OUTFILE "${repo}_VERS := $ver\n";
print OUTFILE "${repo}_TARG := \$(${repo}_BASE)-\$(${repo}_VERS)\n";
print OUTFILE "\n";
unless ($repo eq 'NETSURF') {
$libtargs .= " \$(${repo}_TARG)";
}
}
print OUTFILE "NSLIBTARG :=$libtargs\n";
print OUTFILE "\n";
}
}
close OUTFILE;
close INFILE;
print "Tarring it all up\n";
`tar czf netsurf-full-$vers{netsurf}.tar.gz netsurf-full-$vers{netsurf}`;
|