Search
lxdream.org :: lxdream/src/checkver.pl
lxdream 0.9.1
released Jun 29
Download Now
filename src/checkver.pl
changeset 738:0cbff49086b8
next1068:a422f30ce0a8
author nkeynes
date Thu Aug 07 23:35:03 2008 +0000 (11 years ago)
permissions -rwxr-xr-x
last change Fix compiler warnings
view annotate diff log raw
     1 #!/usr/bin/perl
     2 # Usage: updatever.pl <basever> <top_srcdir> <version file>
     4 my $svnversion = "svnversion";
     5 my $basever = $ARGV[0];
     6 my $top_srcdir = $ARGV[1];
     7 my $outfile = $ARGV[2];
     9 my $rev = "";
    10 my $full_ver = "$basever";
    12 if( $svnversion ) {
    13    $rev = `$svnversion "$top_srcdir"`;
    14    chomp $rev;
    15    if( $rev == "exported" ) {
    16       $rev = "";
    17    } else {
    18       $full_ver = "${basever}.${rev}";
    19    }
    20 }
    21 my $header = "/* Autogenerated by checkver.pl */";
    22 my $output = "${header}\n".
    23              "const char lxdream_package_name[] = \"lxdream $basever\";\n" .
    24              "const char lxdream_short_version[] = \"$basever\";\n" .
    25              "const char lxdream_full_version[] = \"$full_ver\";\n" .
    26              "const char lxdream_copyright[] = \"Copyright (C) 2005-2008 Nathan Keynes\";\n";
    28 my $oldfile = "";
    29 if( -e $outfile ) {
    30     open(VERSIONFILE, "<$outfile") || die "Unable to read from $outfile\n";
    31     $oldfile = join "", <VERSIONFILE>;
    32     close(VERSIONFILE);
    33 }
    35 if( $oldfile ne $output ) {
    36     open(VERSIONFILE, ">$outfile") || die "Unable to write to $outfile\n";
    37     print VERSIONFILE $output;
    38     close(VERSIONFILE);
    39 }
.