4 # This script is a hack to update the ScummVM version in all (?) files that
5 # contain it. Obviously, it should be used before a release.
9 if ($#ARGV+1 < 3 or $#ARGV+1 > 4) {
10 # TODO: Allow the user to specify the version as "1.2.3svn"
11 # and automatically split that into 1, 2, 3, svn
12 print STDERR
"Usage: $0 MAJOR MINOR PATCH [EXTRA]\n";
13 print STDERR
" TODO\n";
17 # TODO: Verify that major/minor/patch are actually numbers
18 my $VER_MAJOR = $ARGV[0];
19 my $VER_MINOR = $ARGV[1];
20 my $VER_PATCH = $ARGV[2];
21 my $VER_EXTRA = $ARGV[3];
22 my $VERSION = "$VER_MAJOR.$VER_MINOR.$VER_PATCH$VER_EXTRA";
24 die "MAJOR must be a natural number\n" unless ($VER_MAJOR =~ /^\d+$/);
25 die "MINOR must be a natural number\n" unless ($VER_MINOR =~ /^\d+$/);
26 die "PATCH must be a natural number\n" unless ($VER_PATCH =~ /^\d+$/);
29 print "Setting version to '$VERSION'\n";
32 # List of the files in which we need to perform substitution.
34 base/internal_version.h
35 dists/redhat/scummvm.spec
37 dists/slackware/scummvm.SlackBuild
39 backends/platform/psp/README.PSP
43 VER_MAJOR
=> $VER_MAJOR,
44 VER_MINOR
=> $VER_MINOR,
45 VER_PATCH
=> $VER_PATCH,
46 VER_EXTRA
=> $VER_EXTRA,
50 foreach my $file (@subs_files) {
51 print "Processing $file...\n";
52 open(INPUT
, "< $file.in") or die "Can't open '$file.in' for reading: $!\n";
53 open(OUTPUT
, "> $file") or die "Can't open '$file' for writing: $!\n";
56 while (my ($key, $value) = each(%subs)) {