-
Notifications
You must be signed in to change notification settings - Fork 0
/
mach
executable file
·153 lines (139 loc) · 4.68 KB
/
mach
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
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/perl
$mcp_mach = './platform/mach';
$osname = $^O;
# Check to see if ./platform/mach exists.
die "Error: There is no platform codebase.
Make sure you have checked out the platform submodule before using this command.\n" unless -e $mcp_mach;
# Check to see if the updater-xml command was given.
if (@ARGV[0] eq "updater-xml") {
use Digest::file qw(digest_file_hex);
if ($osname eq "msys") {
$realos = 'WINNT';
$objdir32 = './obj-i686-pc-mingw32/dist';
$objdir64 = './obj-x86_64-pc-mingw32/dist';
} elsif ($osname eq "linux") {
# 32-bit Linux builds aren't easy to do on RHEL 7,
# and we don't officially support them.
$realos = 'Linux';
$osstring = $osname;
$objdir32 = './obj-i686-pc-linux-gnu/dist';
$objdir64 = './obj-x86_64-pc-linux-gnu/dist';
$special = 'gtk3';
} elsif ($osname eq "solaris") {
$realos = 'SunOS';
$osstring = $osname.'2.11';
$objdir32 = './obj-i386-pc-solaris2.11/dist';
$objdir64 = './obj-x86_64-pc-solaris2.11/dist';
$special = 'illumos';
} else {
die "Error: Unknown platform.";
}
if (-d $objdir32) {
$marfile32 = glob "$objdir32/*.mar";
die "Error: 32-bit MAR file not generated yet."
unless -e $marfile32;
$jsonfile32 = glob "$objdir32/*.json";
} elsif ($osname eq "msys") {
# Lack of 32-bit build is only fatal on Windows.
die "Error: 32-bit Epyrus not built."
}
if (-d $objdir64) {
$marfile64 = glob "$objdir64/*.mar";
die "Error: 64-bit MAR file not generated yet."
unless -e $marfile64;
$jsonfile64 = glob "$objdir64/*.json";
} else {
die "Error: 64-bit Epyrus not built."
}
print "What was the last released version of Epyrus?\n";
$prev_version = <STDIN>;
chomp($prev_version);
open($versiontext, '<', "./mail/config/version.txt");
$curr_version = <$versiontext>;
close $versiontext;
chomp($curr_version);
if ($osname eq "msys") {
# Create an update.xml for 32-bit Windows.
open ($buildidjson, '<', $jsonfile32);
while (<$buildidjson>) {
if ($_ =~ /"buildid"/) {
$_ =~ /(.*)\"(.*)\"/;
$buildid = $2;
}
}
close $buildidjson;
$size = -s $marfile32;
$sha256 = digest_file_hex($marfile32, "SHA-256");
open (UPDATE, '>', $objdir32.'/update.xml');
print UPDATE ('<updates>
<update type="major"
appVersion="'.${curr_version}.'"
buildID="'.${buildid}.'"
extensionVersion="2.0.0"
displayVersion="'.${curr_version}.'"
detailsURL="https://www.epyrus.org/info/releasenotes-1.2.3.html">
<patch type="complete"
URL="https://www.addons.epyrus.org/WINNT_x86-msvc/'.${prev_version}.'/epyrus-'.${curr_version}.'.win32.mar"
hashFunction="SHA256"
hashValue="'.${sha256}.'"
size="'.${size}.'"/>
</update>
</updates>');
close(UPDATE);
# Ditto for 64-bit Windows.
open ($buildidjson, '<', $jsonfile64);
while (<$buildidjson>) {
if ($_ =~ /"buildid"/) {
$_ =~ /(.*)\"(.*)\"/;
$buildid = $2;
}
}
close $buildidjson;
$size = -s $marfile64;
$sha256 = digest_file_hex($marfile64, "SHA-256");
open (UPDATE, '>', $objdir64.'/update.xml');
print UPDATE ('<updates>
<update type="major"
appVersion="'.${curr_version}.'"
buildID="'.${buildid}.'"
extensionVersion="2.0.0"
displayVersion="'.${curr_version}.'"
detailsURL="https://www.epyrus.org/info/releasenotes-1.2.3.html">
<patch type="complete"
URL="https://www.addons.epyrus.org/WINNT_x86_64-msvc/'.${prev_version}.'/epyrus-'.${curr_version}.'.win64.mar"
hashFunction="SHA256"
hashValue="'.${sha256}.'"
size="'.${size}.'"/>
</update>
</updates>');
} else {
open ($buildidjson, '<', $jsonfile64);
while (<$buildidjson>) {
if ($_ =~ /"buildid"/) {
$_ =~ /(.*)\"(.*)\"/;
$buildid = $2;
}
}
close $buildidjson;
$size = -s $marfile64;
$sha256 = digest_file_hex($marfile64, "SHA-256");
open (UPDATE, '>', $objdir64.'/update.xml');
print UPDATE ('<updates>
<update type="major"
appVersion="'.${curr_version}.'"
buildID="'.${buildid}.'"
extensionVersion="2.0.0"
displayVersion="'.${curr_version}.'"
detailsURL="https://www.epyrus.org/info/releasenotes-1.2.3.html">
<patch type="complete"
URL="https://www.addons.epyrus.org/'.${realos}.'_x86_64-gcc3/'.${prev_version}.'/epyrus-'.${curr_version}.'.'.${osstring}.'-x86_64-'.${special}.'.mar"
hashFunction="SHA256"
hashValue="'.${sha256}.'"
size="'.${size}.'"/>
</update>
</updates>');
}
} else {
# Pass all other arguments to ./platform/mach.
system($mcp_mach, @ARGV);
}