Search
lxdream.org :: lxdream/src/checkver.pl
lxdream 0.9.1
released Jun 29
Download Now
filename src/checkver.pl
changeset 1068:a422f30ce0a8
prev738:0cbff49086b8
author nkeynes
date Tue Feb 28 17:25:26 2012 +1000 (10 years ago)
permissions -rwxr-xr-x
last change Implement display output for the GLES2 case (no fixed function
rendering)
file annotate diff log raw
nkeynes@738
     1
#!/usr/bin/perl
nkeynes@738
     2
# Usage: updatever.pl <basever> <top_srcdir> <version file>
nkeynes@738
     3
nkeynes@1068
     4
my $hgversion = "hg identify -i -n";
nkeynes@738
     5
my $basever = $ARGV[0];
nkeynes@738
     6
my $top_srcdir = $ARGV[1];
nkeynes@738
     7
my $outfile = $ARGV[2];
nkeynes@738
     8
nkeynes@1068
     9
my $rev = "", $hash;
nkeynes@738
    10
my $full_ver = "$basever";
nkeynes@738
    11
nkeynes@1068
    12
if( $hgversion ) {
nkeynes@1068
    13
   my $ident = `$hgversion "$top_srcdir" 2>/dev/null`;
nkeynes@1068
    14
   if ( $? == 0 ) {
nkeynes@1068
    15
      chomp $ident;
nkeynes@1068
    16
      ($hash,$rev) = split /\s+/,$ident,2;
nkeynes@1068
    17
      $rev =~ s/\+//g;
nkeynes@1068
    18
      $full_ver = "${basever}.${rev}:${hash}";
nkeynes@738
    19
   }
nkeynes@738
    20
}
nkeynes@738
    21
my $header = "/* Autogenerated by checkver.pl */";
nkeynes@738
    22
my $output = "${header}\n".
nkeynes@738
    23
             "const char lxdream_package_name[] = \"lxdream $basever\";\n" .
nkeynes@738
    24
             "const char lxdream_short_version[] = \"$basever\";\n" .
nkeynes@738
    25
             "const char lxdream_full_version[] = \"$full_ver\";\n" .
nkeynes@738
    26
             "const char lxdream_copyright[] = \"Copyright (C) 2005-2008 Nathan Keynes\";\n";
nkeynes@738
    27
nkeynes@738
    28
my $oldfile = "";
nkeynes@738
    29
if( -e $outfile ) {
nkeynes@738
    30
    open(VERSIONFILE, "<$outfile") || die "Unable to read from $outfile\n";
nkeynes@738
    31
    $oldfile = join "", <VERSIONFILE>;
nkeynes@738
    32
    close(VERSIONFILE);
nkeynes@738
    33
}
nkeynes@738
    34
nkeynes@738
    35
if( $oldfile ne $output ) {
nkeynes@738
    36
    open(VERSIONFILE, ">$outfile") || die "Unable to write to $outfile\n";
nkeynes@738
    37
    print VERSIONFILE $output;
nkeynes@738
    38
    close(VERSIONFILE);
nkeynes@738
    39
}
.