CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/ios/version-transform.pl
Views: 1401
1
# Used to convert git describe strings like 1.17.1-421-g0100c6b32b
2
# to three dot-separated integers, as iOS wants for the short version.
3
4
$version = $ARGV[0];
5
6
# Strip a "v" if the version starts with it.
7
$version =~ s/^v//;
8
9
# Use multiple regexes to parse the various formats we may encounter.
10
# I don't know perl better than this.
11
12
if ($version =~ /^(\d+)\.(\d+)\.(\d+)-(\d+)/) {
13
my $major = $1 * 10000 + $2;
14
my $minor = $3;
15
my $rev = $4;
16
print $major . "." . $minor . "." . $rev . "\n"; # Output: 1017.1.421
17
exit
18
}
19
20
if ($version =~ /^(\d+)\.(\d+)\.(\d+)/) {
21
my $major = $1 * 10000 + $2;
22
my $minor = $3;
23
my $rev = "0";
24
print $major . "." . $minor . "." . $rev . "\n"; # Output: 1017.0.0
25
exit
26
}
27
28
if ($version =~ /^(\d+)\.(\d+)/) {
29
my $major = $1 * 10000 + $2;
30
my $minor = "0";
31
my $rev = "0";
32
print $major . "." . $minor . "." . $rev . "\n"; # Output: 1017.0.0
33
exit
34
}
35
36
die($version)
37