annotate revisions.pl.in @ 883:b52d5de7783f

GC defines and linkage changes.
author Christian Kamm <kamm incasoftware de>
date Thu, 08 Jan 2009 18:20:02 +0100
parents a331ce9bc749
children d66ab756c75b
rev   line source
kamm@853 1 #!/usr/bin/perl
kamm@853 2
kamm@853 3 use strict;
kamm@853 4 use warnings;
kamm@853 5 use File::stat;
kamm@853 6 use Time::localtime;
kamm@853 7
kamm@853 8 my $llvm_src = `perl @LLVM_CONFIG@ --src-root`;
kamm@853 9
kamm@853 10 my $llvm_rev = `svnversion $llvm_src`;
kamm@853 11
kamm@853 12 if ($llvm_rev =~ s/(\d+)\s+$/$1/) {
kamm@853 13 $llvm_rev = qq!#define LLVM_REV "LLVM rev.$llvm_rev"!
kamm@853 14 } else {
kamm@853 15 my $llvm_lib = `perl @LLVM_CONFIG@ --libdir`;
kamm@853 16 $llvm_lib =~ s/\s+$//;
kamm@853 17 $llvm_rev = ctime(stat($llvm_lib)->mtime) if (-d $llvm_lib);
kamm@853 18 $llvm_rev = qq!#include "llvm/Config/config.h"\n#define LLVM_REV PACKAGE_STRING" ($llvm_rev)"!;
kamm@853 19 }
kamm@853 20
kamm@853 21 my $ldc_rev = `hg -R@PROJECT_SOURCE_DIR@ tip --template {rev}`;
kamm@853 22
elrood@873 23 my $out = qq!#ifndef LDC_VERSIONS_H
kamm@853 24 #define LDC_VERSIONS_H
kamm@853 25
kamm@853 26 $llvm_rev
kamm@853 27 #define LDC_REV "rev.$ldc_rev"
kamm@853 28
kamm@853 29 #endif // LDC_VERSIONS_H\n!;
kamm@853 30
elrood@873 31 my $revh;
elrood@873 32 my $old = "";
elrood@873 33 open $revh, "revisions.h" and $old = join "", <$revh>;
elrood@873 34
elrood@873 35 if ($old ne $out) {
elrood@873 36 open $revh, ">revisions.h" or die "cannot create revisions.h: $!";
elrood@873 37 print $revh $out;
elrood@873 38 close $revh;
elrood@873 39 }