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 Sun Mar 04 20:56:40 2012 +1000 (12 years ago)
permissions -rwxr-xr-x
last change Add support for armv7-a abi and make it the default - it's a good bit faster
view annotate diff log raw
     1 #!/usr/bin/perl
     2 # Usage: updatever.pl <basever> <top_srcdir> <version file>
     4 my $hgversion = "hg identify -i -n";
     5 my $basever = $ARGV[0];
     6 my $top_srcdir = $ARGV[1];
     7 my $outfile = $ARGV[2];
     9 my $rev = "", $hash;
    10 my $full_ver = "$basever";
    12 if( $hgversion ) {
    13    my $ident = `$hgversion "$top_srcdir" 2>/dev/null`;
    14    if ( $? == 0 ) {
    15       chomp $ident;
    16       ($hash,$rev) = split /\s+/,$ident,2;
    17       $rev =~ s/\+//g;
    18       $full_ver = "${basever}.${rev}:${hash}";
    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 }
.