summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in4
-rw-r--r--nasm.spec.in1
-rwxr-xr-xversion.pl39
3 files changed, 25 insertions, 19 deletions
diff --git a/Makefile.in b/Makefile.in
index e240845..4fd20f6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -172,4 +172,6 @@ tar: dist
tar cvjf ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 ../`./nasm-dir`
nasm.spec: nasm.spec.in version
- sed -e s/@@VERSION@@/`cat version`/g < nasm.spec.in > nasm.spec
+ sed -e s/@@VERSION@@/`cat $(srcdir)/version`/g \
+ -e s/@@ID@@/`$(PERL) $(srcdir)/version.pl < $(srcdir)/version`/g \
+ < nasm.spec.in > nasm.spec
diff --git a/nasm.spec.in b/nasm.spec.in
index d0fe6ec..1cbe193 100644
--- a/nasm.spec.in
+++ b/nasm.spec.in
@@ -1,6 +1,7 @@
Summary: The Netwide Assembler, a portable x86 assembler with Intel-like syntax
Name: nasm
Version: @@VERSION@@
+Serial: @@ID@@
Release: 1
Copyright: LGPL
Group: Development/Languages
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";
}