diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rwxr-xr-x | make_version_h.pl | 23 | ||||
-rw-r--r-- | mkpasswd.c | 1 | ||||
-rw-r--r-- | whois.c | 1 |
6 files changed, 29 insertions, 3 deletions
@@ -1,6 +1,7 @@ *_del.h tld_serv.h servers_charset.h +version.h Makefile.depend *.o @@ -69,6 +69,9 @@ mkpasswd: $(mkpasswd_OBJECTS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(mkpasswd_LDADD) $(LIBS) ############################################################################## +version.h: debian/changelog make_version_h.pl + $(PERL) -w make_version_h.pl $< > $@ + as_del.h: as_del_list make_as_del.pl $(PERL) -w make_as_del.pl < $< > $@ @@ -1,6 +1,3 @@ -/* Program version */ -#define VERSION "5.1.1" - /* Configurable features */ /* Always hide legal disclaimers */ diff --git a/make_version_h.pl b/make_version_h.pl new file mode 100755 index 0000000..d7344e9 --- /dev/null +++ b/make_version_h.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +my $changelog = $ARGV[0] or die "Usage: $0 debian/changelog\n"; + +open(my $fh, '<', $changelog) or die "open($changelog): $!"; +my $line = <$fh>; +close($fh) or die "close($changelog): $!"; + +my ($ver) = $line =~ /^whois \s+ \( ( [^\)]+ ) \) \s+ \S+/x; +die "Version number not found in $changelog!\n" if not $ver; + +$ver =~ s/ ( ~deb\d+.* | ubuntu\d+ ) $//x; + +# The version number must not deviate from this format or the -V option +# to RIPE-like servers will break. If needed, update the previous regexp. +die "Invalid version number in $changelog!\n" + unless $ver =~ /^ \d+\.\d+ ( \.\d+ )? $/x; + +print qq|#define VERSION "$ver"\n|; + @@ -45,6 +45,7 @@ #endif /* Application-specific */ +#include "version.h" #include "utils.h" /* Global variables */ @@ -39,6 +39,7 @@ #endif /* Application-specific */ +#include "version.h" #include "data.h" #include "whois.h" #include "utils.h" |