summaryrefslogtreecommitdiff
path: root/version.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-05-21 02:28:51 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-05-21 02:28:51 +0000
commitf29b128afdb80ec8f2718c1897e754c6a531bc37 (patch)
tree77803f6f58171a7eb3e93633233eb501da33f1c5 /version.pl
parent2feab99ee958dd1430cdc89c9a64a91585c3a52d (diff)
downloadnasm-f29b128afdb80ec8f2718c1897e754c6a531bc37.tar.gz
nasm-f29b128afdb80ec8f2718c1897e754c6a531bc37.tar.bz2
nasm-f29b128afdb80ec8f2718c1897e754c6a531bc37.zip
Accept X.YYplZ as a valid version number (equivalent to X.YY.0.Z) and
generate Serial: tags in the RPM spec file to help clue RPM in.
Diffstat (limited to 'version.pl')
-rwxr-xr-xversion.pl39
1 files changed, 21 insertions, 18 deletions
diff --git a/version.pl b/version.pl
index bf8a916..0f9ea75 100755
--- a/version.pl
+++ b/version.pl
@@ -7,7 +7,7 @@
#
# The NASM version number is assumed to consist of:
#
-# <major>.<minor>[.<subminor>[.<patchlevel>]]<tail>
+# <major>.<minor>[.<subminor>][pl<patchlevel>]]<tail>
#
# ... where <tail> is not necessarily numeric.
#
@@ -35,28 +35,27 @@
$line = <STDIN>;
chomp $line;
-if ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/ ) {
- $maj = $1; $nmaj = $maj+0;
- $min = $2; $nmin = $min+0;
- $smin = $3; $nsmin = $smin+0;
- $plvl = $4; $nplvl = $plvl+0;
- $tail = $';
-} elsif ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)/ ) {
- $maj = $1; $nmaj = $maj+0;
- $min = $2; $nmin = $min+0;
- $smin = $3; $nsmin = $smin+0;
- $plvl = ''; $nplvl = 0;
- $tail = $';
-} elsif ( $line =~ /^([0-9]+)\.([0-9]+)/ ) {
- $maj = $1; $nmaj = $maj+0;
- $min = $2; $nmin = $min+0;
- $smin = ''; $nsmin = 0;
- $plvl = ''; $nplvl = 0;
+undef $man, $min, $smin, $plvl, $tail;
+
+if ( $line =~ /^([0-9]+)\.([0-9]+)/ ) {
+ $maj = $1;
+ $min = $2;
$tail = $';
+ if ( $tail =~ /^\.([0-9]+)/ ) {
+ $smin = $1;
+ $tail = $';
+ }
+ if ( $tail =~ /^(pl|\.)([0-9]+)/ ) {
+ $plvl = $2;
+ $tail = $';
+ }
} else {
die "$0: Invalid input format\n";
}
+$nmaj = $maj+0; $nmin = $min+0;
+$nsmin = $smin+0; $nplvl = $plvl+0;
+
$nasm_id = ($nmaj << 24)+($nmin << 16)+($nsmin << 8)+$nplvl;
if ( $what eq 'h' ) {
@@ -76,6 +75,10 @@ if ( $what eq 'h' ) {
printf "%%define __NASM_PATCHLEVEL__ %d\n", $nplvl;
printf "%%define __NASM_VERSION_ID__ 0%08Xh\n", $nasm_id;
printf "%%define __NASM_VER__ \"%s\"\n", $line;
+} elsif ( $what eq 'id' ) {
+ print $nasm_id, "\n"; # Print ID in decimal
+} elsif ( $what eq 'xid' ) {
+ printf "0x%08x\n", $nasm_id; # Print ID in hexadecimal
} else {
die "$0: Unknown output: $what\n";
}