aboutsummaryrefslogtreecommitdiffstats
path: root/version.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-07 15:21:56 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-07-07 15:21:56 -0700
commit07ff8e874b0bd1d1c4fa893c94063fbedf6e3315 (patch)
tree38fdb21cf0feb6a7c68acdc767833a9b25edb504 /version.pl
parentfd40500625723610a9abe7fb20775da4d88ca4dc (diff)
downloadsyslinux-07ff8e874b0bd1d1c4fa893c94063fbedf6e3315.tar.gz
syslinux-07ff8e874b0bd1d1c4fa893c94063fbedf6e3315.tar.xz
syslinux-07ff8e874b0bd1d1c4fa893c94063fbedf6e3315.zip
Centralize more of the version number machinery
Centralize more (most) of the version number machinery to version.pl.
Diffstat (limited to 'version.pl')
-rwxr-xr-xversion.pl29
1 files changed, 22 insertions, 7 deletions
diff --git a/version.pl b/version.pl
index ee5c5c6c..a08ce835 100755
--- a/version.pl
+++ b/version.pl
@@ -5,20 +5,35 @@
use Fcntl;
+sub defx($$$) {
+ my($def, $name, $val) = @_;
+
+ $def =~ s/\</${name}/g;
+ $def =~ s/\@/${val}/g;
+
+ return $def."\n";
+}
+
($vfile, $vout, $def) = @ARGV;
sysopen(VERSION, $vfile, O_RDONLY) or die "$0: Cannot open $vfile\n";
-$version = <VERSION>;
-chomp $version;
+$vfile = <VERSION>;
+chomp $vfile;
close(VERSION);
-unless ( $version =~ /^([0-9]+)\.([0-9]+)$/ ) {
+unless ( $vfile =~ /^(([0-9]+)\.([0-9]+))\s+([0-9]+)$/ ) {
die "$0: Cannot parse version format\n";
}
-$vma = $1+0; $vmi = $2+0;
+$version = $1;
+$vma = $2+0;
+$vmi = $3+0;
+$year = $4;
sysopen(VI, $vout, O_WRONLY|O_CREAT|O_TRUNC)
or die "$0: Cannot create $vout: $!\n";
-print VI "$def VERSION \"$version\"\n";
-print VI "$def VER_MAJOR $vma\n";
-print VI "$def VER_MINOR $vmi\n";
+print VI defx($def, 'VERSION', $version);
+print VI defx($def, 'VERSION_STR', '"'.$version.'"');
+print VI defx($def, 'VERSION_MAJOR', $vma);
+print VI defx($def, 'VERSION_MINOR', $vmi);
+print VI defx($def, 'YEAR', $year);
+print VI defx($def, 'YEAR_STR', '"'.$year.'"');
close(VI);