Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / win32utils / makeversion.pl
blob7109cbdbc0f9d6d9bc68de9f660181dd8a0d07f9
1 #!/usr/bin/perl
3 # Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: makeversion.pl,v 1.8 2007/06/19 23:47:24 tbox Exp
20 # This script takes the version information from the version file located
21 # at the root of the source tree and the api files in each library directory
22 # and writes the resulting information into a version.h file that the build
23 # process uses to build the executable code.
24 # This program was written by PDM. danny.mayer@nominum.com 1-Jul-2001.
26 # List of directories with version files
27 @dirlist = ("isc","dns","isccc","isccfg","lwres","bind9");
28 $LibMacros{"isc"} = "LIBISC_EXPORTS";
29 $LibMacros{"dns"} = "LIBDNS_EXPORTS";
30 $LibMacros{"isccc"} = "LIBISCCC_EXPORTS";
31 $LibMacros{"isccfg"} = "LIBISCCFG_EXPORTS";
32 $LibMacros{"lwres"} = "LIBLWRES_EXPORTS";
33 $LibMacros{"bind9"} = "LIBBIND9_EXPORTS";
36 @VersionNames = ("LIBINTERFACE", "LIBREVISION", "LIBAGE");
37 $versionfile = "versions.h";
38 $versionpath = "../$versionfile";
41 # First get the version information
43 open (VERSIONFILE, "../version");
44 while (<VERSIONFILE>) {
45 chomp;
46 ($data) = split(/\#/);
47 if($data) {
48 ($name, $value) = split(/=/,$data);
49 ($name) = split(/\s+/, $name);
50 ($value) = split(/\s+/, $value);
51 $Versions{$name} = $value;
54 close(VERSIONFILE);
56 # Now set up the output version file
58 $ThisDate = scalar localtime();
59 open (OUTVERSIONFILE, ">$versionpath") ||
60 die "Can't open output file $versionpath: $!";
62 #Standard Header
64 print OUTVERSIONFILE '/*
65 * Copyright (C) 2001 Internet Software Consortium.
67 * Permission to use, copy, modify, and distribute this software for any
68 * purpose with or without fee is hereby granted, provided that the above
69 * copyright notice and this permission notice appear in all copies.
71 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
72 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
73 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
74 * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
75 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
76 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
77 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
78 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
83 print OUTVERSIONFILE "/*\n";
84 print OUTVERSIONFILE " * $versionfile.";
85 print OUTVERSIONFILE " Generated automatically by makeversion.pl.\n";
86 print OUTVERSIONFILE " * Date generated: $ThisDate\n";
87 print OUTVERSIONFILE " */\n\n";
89 print OUTVERSIONFILE '
90 #ifndef VERSIONS_H
91 #define VERSIONS_H 1
95 $Version = "$Versions{'MAJORVER'}.$Versions{'MINORVER'}.$Versions{'PATCHVER'}";
96 $Version = "$Version$Versions{'RELEASETYPE'}$Versions{'RELEASEVER'}";
97 print "BIND Version: $Version\n";
99 print OUTVERSIONFILE "#define VERSION \"$Version\"\n\n";
101 foreach $dir (@dirlist) {
102 $apifile = "../lib/$dir/api";
103 open (APIVERSION, $apifile);
104 while (<APIVERSION>) {
105 chomp;
106 ($data) = split(/\#/);
107 if ($data) {
108 ($name, $value) = split(/=/, $data);
109 $name =~ s/\s+//;
110 $value =~ s/\s+//;
111 $ApiVersions{$name} = $value;
115 print OUTVERSIONFILE "\n#ifdef $LibMacros{$dir}\n";
116 foreach $name (@VersionNames) {
117 print OUTVERSIONFILE "#define $name\t$ApiVersions{$name}\n";
119 print OUTVERSIONFILE "#endif\n\n";
122 print OUTVERSIONFILE "#endif /* VERSIONS_H */\n";
123 close OUTVERSIONFILE;