We have a usable tag now. There's no need to fake a version number.
[metze/wireshark/wip.git] / make-version.pl
1 #!/usr/bin/perl -w
2 #
3 # Copyright 2004 Jörg Mayer (see AUTHORS file)
4 #
5 # $Id$
6 #
7 # Wireshark - Network traffic analyzer
8 # By Gerald Combs <gerald@wireshark.org>
9 # Copyright 1998 Gerald Combs
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24
25 # See below for usage
26 #
27 # If "version.conf" is present, it is parsed for configuration values.
28 # Possible values are:
29 #
30 #   enable     - Enable or disable versioning.  Zero (0) disables, nonzero
31 #                enables.
32 #   svn_client - Use svn client i.s.o. ugly internal SVN file hack
33 #   format     - A strftime() formatted string to use as a template for
34 #                the version string. The sequence "%#" will substitute
35 #                the SVN revision number.
36 #   pkg_enable - Enable or disable local package versioning.
37 #   pkg_format - Like "format", but used for the local package version.
38 #
39 # If run with the "-r" or "--set-release" argument the AC_INIT macro in
40 # configure.ac and the VERSION macro in config.nmake will have the
41 # pkg_format template appended to the version number. svnversion.h will
42 # _not_ be generated if either argument is present.
43 #
44 # Default configuration:
45 #
46 # enable: 1
47 # svn_client: 1
48 # format: SVN %Y%m%d%H%M%S
49 # pkg_enable: 1
50 # pkg_format: -SVN-%#
51
52 # XXX - We're pretty dumb about the "%#" substitution, and about having
53 # spaces in the package format.
54
55 use strict;
56
57 use Time::Local;
58 use File::Basename;
59 use POSIX qw(strftime);
60 use Getopt::Long;
61 use Pod::Usage;
62 use IO::Handle;
63 use English;
64
65 my $version_file = 'svnversion.h';
66 my $package_string = "";
67 my $vconf_file = 'version.conf';
68 my $tortoise_file = "tortoise_template";
69 my $last_change = 0;
70 my $revision = 0;
71 my $repo_path = "unknown";
72 my $git_description = undef;
73 my $get_svn = 0;
74 my $set_svn = 0;
75 my $set_version = 0;
76 my $set_release = 0;
77 my %version_pref = (
78         "version_major" => 1,
79         "version_minor" => 11,
80         "version_micro" => 3,
81         "version_build" => 0,
82
83         "enable"        => 1,
84         "git_client"    => 0,
85         "svn_client"    => 1,
86         "tortoise_svn"  => 0,
87         "format"        => "SVN %Y%m%d%H%M%S",
88         "is_release"    => 0,
89
90         # Normal development builds
91         "pkg_enable" => 1,
92         "pkg_format" => "-SVN-%#",
93
94         # Development releases
95         #"pkg_enable" => 0,
96         #"pkg_format" => "",
97         );
98 my $srcdir = ".";
99 my $info_cmd = "";
100
101 # Ensure we run with correct locale
102 $ENV{LANG} = "C";
103 $ENV{LC_ALL} = "C";
104 $ENV{GIT_PAGER} = "";
105
106 # Run "svn info".  Parse out the most recent modification time and the
107 # revision number.
108 sub read_repo_info {
109         my $line;
110         my $version_format = $version_pref{"format"};
111         my $package_format = "";
112         my $in_entries = 0;
113         my $svn_name;
114         my $repo_version;
115         my $repo_root = undef;
116         my $repo_url = undef;
117         my $do_hack = 1;
118         my $info_source = "Unknown";
119
120         if ($version_pref{"pkg_enable"}) {
121                 $package_format = $version_pref{"pkg_format"};
122         }
123
124         if (-d "$srcdir/.git" && ! -d "$srcdir/.git/svn") {
125                 $info_source = "Command line (git)";
126                 $version_pref{"git_client"} = 1;
127         } elsif (-d "$srcdir/.svn" or -d "$srcdir/../.svn") {
128                 $info_source = "Command line (svn info)";
129                 $info_cmd = "svn info $srcdir";
130         } elsif (-d "$srcdir/.git/svn") {
131                 $info_source = "Command line (git-svn)";
132                 $info_cmd = "(cd $srcdir; git svn info)";
133         }
134
135         #Git can give us:
136         #
137         # A big ugly hash: git rev-parse HEAD
138         # 1ddc83849075addb0cac69a6fe3782f4325337b9
139         #
140         # A small ugly hash: git rev-parse --short HEAD
141         # 1ddc838
142         #
143         # The upstream branch path: git rev-parse --abbrev-ref --symbolic-full-name @{upstream}
144         # origin/master-1.8
145         #
146         # A version description: git describe --tags --dirty
147         # wireshark-1.8.12-15-g1ddc838
148         #
149         # Number of commits in this branch: git rev-list --count HEAD
150         # 48879
151         #
152         # Number of commits since 1.8.0: git rev-list --count 5e212d72ce098a7fec4332cbe6c22fcda796a018..HEAD
153         # 320
154         #
155         # Refs: git ls-remote code.wireshark.org:wireshark
156         # ea19c7f952ce9fc53fe4c223f1d9d6797346258b (r48972, changed version to 1.11.0)
157
158         if ($version_pref{"git_client"}) {
159                 eval {
160                         use warnings "all";
161                         no warnings "all";
162
163                         chomp($line = qx{git log -1 --pretty=format:%at});
164                         if (defined($line)) {
165                                 $last_change = $line;
166                         }
167
168                         # Commits in current (master-1.8) branch. We may want to use
169                         # a different number.
170                         chomp($line = qx{git rev-list --count ea19c7f952ce9fc53fe4c223f1d9d6797346258b..HEAD});
171                         if (defined($line)) {
172                                 $revision = $line;
173                         }
174
175                         chomp($line = qx{git ls-remote --get-url origin});
176                         if (defined($line)) {
177                                 $repo_url = $line;
178                         }
179
180                         # Probably not quite what we're looking for
181                         chomp($line = qx{git rev-parse --abbrev-ref --symbolic-full-name \@\{upstream\}});
182                         if (defined($line)) {
183                                 $repo_path = basename($line);
184                         }
185
186                         chomp($line = qx{git describe --dirty --match "v*"});
187                         if (defined($line)) {
188                                 $git_description = "wireshark-" . substr($line, 1);
189                         }
190
191                         1;
192                 };
193
194                 if ($last_change && $revision && $repo_url && $repo_path) {
195                         $do_hack = 0;
196                 }
197         } elsif ($version_pref{"svn_client"}) {
198                 eval {
199                         use warnings "all";
200                         no warnings "all";
201                         $line = qx{$info_cmd};
202                         if (defined($line)) {
203                                 if ($line =~ /Last Changed Date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
204                                         $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
205                                 }
206                                 if ($line =~ /Last Changed Rev: (\d+)/) {
207                                         $revision = $1;
208                                 }
209                                 if ($line =~ /URL: (\S+)/) {
210                                         $repo_url = $1;
211                                 }
212                                 if ($line =~ /Repository Root: (\S+)/) {
213                                         $repo_root = $1;
214                                 }
215                         }
216                         1;
217                 };
218
219                 if ($last_change && $revision && $repo_url && $repo_root) {
220                         $do_hack = 0;
221                 }
222         } elsif ($version_pref{"tortoise_svn"}) {
223                 # Dynamically generic template file needed by TortoiseSVN
224                 open(TORTOISE, ">$tortoise_file");
225                 print TORTOISE "#define SVNVERSION \"\$WCREV\$\"\r\n";
226                 print TORTOISE "#define SVNPATH \"\$WCURL\$\"\r\n";
227                 close(TORTOISE);
228
229                 $info_source = "Command line (SubWCRev)";
230                 $info_cmd = "SubWCRev $srcdir $tortoise_file $version_file";
231                 my $tortoise = system($info_cmd);
232                 if ($tortoise == 0) {
233                         $do_hack = 0;
234                 }
235
236                 #clean up the template file
237                 unlink($tortoise_file);
238         }
239
240         if ($revision == 0) {
241                 # Fall back to config.nmake
242                 $info_source = "Prodding config.nmake";
243                 my $filepath = "$srcdir/config.nmake";
244                 open(CFGNMAKE, "< $filepath") || die "Can't read $filepath!";
245                 while ($line = <CFGNMAKE>) {
246                         if ($line =~ /^SVN_REVISION=(\d+)/) {
247                                 $revision = $1;
248                                 $do_hack = 0;
249                                 last;
250                         }
251                 }
252                 close (CFGNMAKE);
253         }
254         if ($revision == 0 and -d "$srcdir/.git") {
255
256                 # Try git...
257                 eval {
258                         use warnings "all";
259                         no warnings "all";
260                         # If someone had properly tagged 1.9.0 we could also use
261                         # "git describe --abbrev=1 --tags HEAD"
262                         
263                         $info_cmd = "(cd $srcdir; git log --format='%b' -n 1)";
264                         $line = qx{$info_cmd};
265                         if (defined($line)) {
266                                 if ($line =~ /svn path=.*; revision=(\d+)/) {
267                                         $revision = $1;
268                                 }
269                         }
270                         $info_cmd = "(cd $srcdir; git log --format='%ad' -n 1 --date=iso)";
271                         $line = qx{$info_cmd};
272                         if (defined($line)) {
273                                 if ($line =~ /(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
274                                         $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
275                                 }
276                         }
277                         $info_cmd = "(cd $srcdir; git branch)";
278                         $line = qx{$info_cmd};
279                         if (defined($line)) {
280                                 if ($line =~ /\* (\S+)/) {
281                                         $repo_path = $1;
282                                 }
283                         }
284                         1;
285                         };
286         }
287         if ($revision == 0 and -d "$srcdir/.bzr") {
288
289                 # Try bzr...
290                 eval {
291                         use warnings "all";
292                         no warnings "all";
293                         $info_cmd = "(cd $srcdir; bzr log -l 1)";
294                         $line = qx{$info_cmd};
295                         if (defined($line)) {
296                                 if ($line =~ /timestamp: \S+ (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
297                                         $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
298                                 }
299                                 if ($line =~ /svn revno: (\d+) \(on (\S+)\)/) {
300                                         $revision = $1;
301                                         $repo_path = $2;
302                                 }
303                         }
304                         1;
305                         };
306         }
307
308
309         # 'svn info' failed or the user really wants us to dig around in .svn/entries
310         if ($do_hack) {
311                 # Start of ugly internal SVN file hack
312                 if (! open (ENTRIES, "< $srcdir/.svn/entries")) {
313                         print ("Unable to open $srcdir/.svn/entries\n");
314                 } else {
315                         $info_source = "Prodding .svn";
316                         # We need to find out whether our parser can handle the entries file
317                         $line = <ENTRIES>;
318                         chomp $line;
319                         if ($line eq '<?xml version="1.0" encoding="utf-8"?>') {
320                                 $repo_version = "pre1.4";
321                         } elsif ($line =~ /^8$/) {
322                                 $repo_version = "1.4";
323                         } else {
324                                 $repo_version = "unknown";
325                         }
326
327                         if ($repo_version eq "pre1.4") {
328                                 # The entries schema is flat, so we can use regexes to parse its contents.
329                                 while ($line = <ENTRIES>) {
330                                         if ($line =~ /<entry$/ || $line =~ /<entry\s/) {
331                                                 $in_entries = 1;
332                                                 $svn_name = "";
333                                         }
334                                         if ($in_entries) {
335                                                 if ($line =~ /name="(.*)"/) { $svn_name = $1; }
336                                                 if ($line =~ /committed-date="(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)/) {
337                                                         $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
338                                                 }
339                                                 if ($line =~ /revision="(\d+)"/) { $revision = $1; }
340                                         }
341                                         if ($line =~ /\/>/) {
342                                                 if (($svn_name eq "" || $svn_name eq "svn:this_dir") &&
343                                                                 $last_change && $revision) {
344                                                         $in_entries = 0;
345                                                         last;
346                                                 }
347                                         }
348                                         # XXX - Fetch the repository root & URL
349                                 }
350                         }
351                         close ENTRIES;
352                 }
353         }
354
355         # If we picked up the revision and modification time,
356         # generate our strings.
357         if ($revision && $last_change) {
358                 $version_format =~ s/%#/$revision/;
359                 $package_format =~ s/%#/$revision/;
360                 $package_string = strftime($package_format, gmtime($last_change));
361         }
362
363         if ($repo_url && $repo_root && index($repo_url, $repo_root) == 0) {
364                 $repo_path = substr($repo_url, length($repo_root));
365         }
366
367         if ($get_svn) {
368                 print <<"Fin";
369 SVN revision    : $revision
370 Revision source : $info_source
371 Release stamp   : $package_string
372 Fin
373         }
374 }
375
376
377 # Read configure.ac, then write it back out with an updated
378 # "AC_INIT" line.
379 sub update_configure_ac
380 {
381         my $line;
382         my $contents = "";
383         my $version = "";
384         my $filepath = "$srcdir/configure.ac";
385
386         return if (!$set_version && $package_string eq "");
387
388         open(CFGIN, "< $filepath") || die "Can't read $filepath!";
389         while ($line = <CFGIN>) {
390                 if ($line =~ /^m4_define\( *\[?version_major\]? *,.*([\r\n]+)$/) {
391                         $line = sprintf("m4_define([version_major], [%d])$1", $version_pref{"version_major"});
392                 } elsif ($line =~ /^m4_define\( *\[?version_minor\]? *,.*([\r\n]+)$/) {
393                         $line = sprintf("m4_define([version_minor], [%d])$1", $version_pref{"version_minor"});
394                 } elsif ($line =~ /^m4_define\( *\[?version_micro\]? *,.*([\r\n]+)$/) {
395                         $line = sprintf("m4_define([version_micro], [%d])$1", $version_pref{"version_micro"});
396                 } elsif ($line =~ /^m4_append\( *\[?version_micro_extra\]? *,.*([\r\n]+)$/) {
397                         $line = sprintf("m4_append([version_micro_extra], [%s])$1", $package_string);
398                 }
399                 $contents .= $line
400         }
401
402         open(CFGIN, "> $filepath") || die "Can't write $filepath!";
403         print(CFGIN $contents);
404         close(CFGIN);
405         print "$filepath has been updated.\n";
406 }
407
408 # Read config.nmake, then write it back out with an updated
409 # "VERSION" line.
410 sub update_config_nmake
411 {
412         my $line;
413         my $contents = "";
414         my $version = "";
415         my $filepath = "$srcdir/config.nmake";
416
417         open(CFGNMAKE, "< $filepath") || die "Can't read $filepath!";
418         while ($line = <CFGNMAKE>) {
419                 if ($line =~ /^SVN_REVISION=.*([\r\n]+)$/) {
420                         $line = sprintf("SVN_REVISION=%d$1", $revision);
421                 } elsif ($set_version && $line =~ /^VERSION_MAJOR=.*([\r\n]+)$/) {
422                         $line = sprintf("VERSION_MAJOR=%d$1", $version_pref{"version_major"});
423                 } elsif ($set_version && $line =~ /^VERSION_MINOR=.*([\r\n]+)$/) {
424                         $line = sprintf("VERSION_MINOR=%d$1", $version_pref{"version_minor"});
425                 } elsif ($set_version && $line =~ /^VERSION_MICRO=.*([\r\n]+)$/) {
426                         $line = sprintf("VERSION_MICRO=%d$1", $version_pref{"version_micro"});
427                 } elsif ($line =~ /^VERSION_EXTRA=.*([\r\n]+)$/) {
428                         $line = "VERSION_EXTRA=$package_string$1";
429                 }
430                 $contents .= $line
431         }
432
433         open(CFGNMAKE, "> $filepath") || die "Can't write $filepath!";
434         print(CFGNMAKE $contents);
435         close(CFGNMAKE);
436         print "$filepath has been updated.\n";
437 }
438
439 # Read docbook/asciidoc.conf, then write it back out with an updated
440 # wireshark-version replacement line.
441 sub update_release_notes
442 {
443         my $line;
444         my $contents = "";
445         my $version = "";
446         my $filepath = "$srcdir/docbook/asciidoc.conf";
447
448         return if (!$set_version);
449
450         open(ADOC_CONF, "< $filepath") || die "Can't read $filepath!";
451         while ($line = <ADOC_CONF>) {
452                 # wireshark-version:\[\]=1.9.1
453
454                 if ($line =~ /^wireshark-version:\\\[\\\]=.*([\r\n]+)$/) {
455                         $line = sprintf("wireshark-version:\\\[\\\]=%d.%d.%d$1",
456                                         $version_pref{"version_major"},
457                                         $version_pref{"version_minor"},
458                                         $version_pref{"version_micro"},
459                                        );
460                 }
461                 $contents .= $line
462         }
463
464         open(ADOC_CONF, "> $filepath") || die "Can't write $filepath!";
465         print(ADOC_CONF $contents);
466         close(ADOC_CONF);
467         print "$filepath has been updated.\n";
468 }
469
470 # Read debian/changelog, then write back out an updated version.
471 sub update_debian_changelog
472 {
473         my $line;
474         my $contents = "";
475         my $version = "";
476         my $filepath = "$srcdir/debian/changelog";
477
478         return if ($set_version == 0);
479
480         open(CHANGELOG, "< $filepath") || die "Can't read $filepath!";
481         while ($line = <CHANGELOG>) {
482                 if ($set_version && CHANGELOG->input_line_number() == 1) {
483                         $line = sprintf("wireshark (%d.%d.%d) unstable; urgency=low\n",
484                                         $version_pref{"version_major"},
485                                         $version_pref{"version_minor"},
486                                         $version_pref{"version_micro"},
487                                        );
488                 }
489                 $contents .= $line
490         }
491
492         open(CHANGELOG, "> $filepath") || die "Can't write $filepath!";
493         print(CHANGELOG $contents);
494         close(CHANGELOG);
495         print "$filepath has been updated.\n";
496 }
497
498 # Read debian/wireshark-common.files, then write back out an updated version.
499 # The libraries updated here MUST match the updates made by update_lib_releases
500 # below. We should do this automatically.
501 sub update_debian_wcf
502 {
503         my $line;
504         my $contents = "";
505         my $version = "";
506         my $filepath = "$srcdir/debian/wireshark-common.files";
507
508         return if (!$set_version);
509
510         open(DWCF, "< $filepath") || die "Can't read $filepath!";
511         while ($line = <DWCF>) {
512                 # /usr/lib/wireshark/libwireshark.so.1.1.0
513
514                 if ($line =~ qr{^(/usr/lib/wireshark/lib(wireshark|wiretap|filetap).so\.\d+\.\d+\.)\d+$}) {
515                         $line = sprintf("$1%d\n", $version_pref{"version_micro"});
516                 }
517                 $contents .= $line
518         }
519
520         open(DWCF, "> $filepath") || die "Can't write $filepath!";
521         print(DWCF $contents);
522         close(DWCF);
523         print "$filepath has been updated.\n";
524 }
525
526 # Read Makefile.am for each library, then write back out an updated version.
527 sub update_lib_releases
528 {
529         my $line;
530         my $contents = "";
531         my $version = "";
532         my $filedir;
533         my $filepath;
534
535         return if (!$set_version);
536
537         # The Libtool manual says
538         #   "If the library source code has changed at all since the last
539         #    update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’)."
540         # epan changes with each minor release, almost by definition. wiretap
541         # and filetap changes with *most* releases.
542         #
543         # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
544         for $filedir ("epan", "wiretap", "filetap") {   # "wsutil"
545                 $contents = "";
546                 $filepath = $filedir . "/Makefile.am";
547                 open(MAKEFILE_AM, "< $filepath") || die "Can't read $filepath!";
548                 while ($line = <MAKEFILE_AM>) {
549                         # libwireshark_la_LDFLAGS = -version-info 2:1:1 -export-symbols
550
551                         if ($line =~ /^(lib\w+_la_LDFLAGS.*version-info\s+\d+:)\d+(:\d+.*)/) {
552                                 $line = sprintf("$1%d$2\n", $version_pref{"version_micro"});
553                         }
554                         $contents .= $line
555                 }
556
557                 open(MAKEFILE_AM, "> $filepath") || die "Can't write $filepath!";
558                 print(MAKEFILE_AM $contents);
559                 close(MAKEFILE_AM);
560                 print "$filepath has been updated.\n";
561         }
562 }
563
564 # Update distributed files that contain any version information
565 sub update_versioned_files
566 {
567         &update_configure_ac;
568         &update_config_nmake;
569         &update_release_notes;
570         &update_debian_changelog;
571         &update_debian_wcf;
572         &update_lib_releases;
573 }
574
575 # Print the SVN version to $version_file.
576 # Don't change the file if it is not needed.
577 sub print_svn_revision
578 {
579         my $svn_revision;
580         my $needs_update = 1;
581
582         if ($git_description) {
583                 $svn_revision = "#define SVNVERSION \"" .
584                         $git_description . "\"\n" .
585                         "#define SVNPATH \"" . $repo_path . "\"\n";
586         } elsif ($last_change && $revision) {
587                 $svn_revision = "#define SVNVERSION \"SVN Rev " .
588                         $revision . "\"\n" .
589                         "#define SVNPATH \"" . $repo_path . "\"\n";
590         } else {
591                 $svn_revision = "#define SVNVERSION \"SVN Rev Unknown\"\n" .
592                         "#define SVNPATH \"unknown\"\n";
593         }
594         if (open(OLDREV, "<$version_file")) {
595                 my $old_svn_revision = <OLDREV> . <OLDREV>;
596                 if ($old_svn_revision eq $svn_revision) {
597                         $needs_update = 0;
598                 }
599                 close OLDREV;
600         }
601
602         if (! $set_svn) { return; }
603
604         if ($needs_update) {
605                 # print "Updating $version_file so it contains:\n$svn_revision";
606                 open(VER, ">$version_file") || die ("Cannot write to $version_file ($!)\n");
607                 print VER "$svn_revision";
608                 close VER;
609                 print "$version_file has been updated.\n";
610         } else {
611                 print "$version_file unchanged.\n";
612         }
613 }
614
615 # Read values from the configuration file, if it exists.
616 sub get_config {
617         my $arg;
618         my $show_help = 0;
619
620         # Get our command-line args
621         # XXX - Do we need an option to undo --set-release?
622         GetOptions(
623                    "help|h", \$show_help,
624                    "get-svn|g", \$get_svn,
625                    "set-svn|s", \$set_svn,
626                    "set-version|v", \$set_version,
627                    "set-release|r|package-version|p", \$set_release
628                    ) || pod2usage(2);
629
630         if ($show_help) { pod2usage(1); }
631
632         if ( !( $show_help || $get_svn || $set_svn || $set_version || $set_release ) ) {
633                 $set_svn = 1;
634         }
635
636         if ($#ARGV >= 0) {
637                 $srcdir = $ARGV[0]
638         }
639
640         if (! open(FILE, "<$vconf_file")) {
641                 print STDERR "Version configuration file $vconf_file not "
642                 . "found.  Using defaults.\n";
643                 return 1;
644         }
645
646         while (<FILE>) {
647                 chomp;
648                 next if (/^#/);
649                 next unless (/^(\w+)(:|=)\s*(\S.*)/);
650                 $version_pref{$1} = $3;
651         }
652         close FILE;
653         return 1;
654 }
655
656 ##
657 ## Start of code
658 ##
659
660 &get_config();
661
662 &read_repo_info();
663
664 &print_svn_revision;
665
666 if ($set_version || $set_release) {
667         if ($set_version) {
668                 print "Generating version information\n";
669         }
670
671         if ($version_pref{"enable"} == 0) {
672                 print "Release information disabled in $vconf_file.\n";
673                 $set_release = 0;
674         }
675
676         if ($set_release) {
677                 print "Generating release information\n";
678         } else {
679                 print "Resetting release information\n";
680                 $revision = 0;
681                 $package_string = "";
682         }
683
684         &update_versioned_files;
685 }
686
687 __END__
688
689 =head1 NAM
690
691 make-version.pl - Get and set build-time version information for Wireshark
692
693 =head1 SYNOPSIS
694
695 make-version.pl [options] [source directory]
696
697   Options:
698
699     --help, -h                 This help message
700     --get-svn, -g              Print the SVN revision and source.
701     --set-svn, -s              Set the information in svnversion.h
702     --set-version, -v          Set the major, minor, and micro versions in
703                                configure.ac, config.nmake, debian/changelog,
704                                and docbook/asciidoc.conf.
705                                Resets the release information when used by
706                                itself.
707     --set-release, -r          Set the release information in configure.ac
708                                and config.nmake
709     --package-version, -p      Deprecated. Same as --set-release.
710
711 Options can be used in any combination. If none are specified B<--set-svn>
712 is assumed.
713
714 #
715 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
716 #
717 # Local variables:
718 # c-basic-offset: 8
719 # tab-width: 8
720 # indent-tabs-mode: t
721 # End:
722 #
723 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
724 # :indentSize=8:tabSize=8:noTabs=false:
725 #
726 #