view @ 853:82ad6c0c601c

Add Elrood's patch to output LDC and LLVM source revs.
author Christian Kamm <kamm incasoftware de>
date Sun, 14 Dec 2008 16:51:36 +0100
children a331ce9bc749
line wrap: on
line source

use strict;
use warnings;
use File::stat;
use Time::localtime;

my $llvm_src = `perl @LLVM_CONFIG@ --src-root`;
#my $llvm_src = "k:/sources/llvm";

my $llvm_rev = `svnversion $llvm_src`;

if ($llvm_rev =~ s/(\d+)\s+$/$1/) {
	$llvm_rev = qq!#define LLVM_REV "LLVM rev.$llvm_rev"!
} else {
	my $llvm_lib = `perl @LLVM_CONFIG@ --libdir`;
	$llvm_lib =~ s/\s+$//;
	$llvm_rev = ctime(stat($llvm_lib)->mtime) if (-d $llvm_lib);
	$llvm_rev = qq!#include "llvm/Config/config.h"\n#define LLVM_REV PACKAGE_STRING" ($llvm_rev)"!;

my $ldc_rev = `hg -R@PROJECT_SOURCE_DIR@ tip --template {rev}`;

open my $revh, ">", "revisions.h" or die "cannot create revisions.h";

print $revh qq!#ifndef LDC_VERSIONS_H

#define LDC_REV "rev.$ldc_rev"

#endif // LDC_VERSIONS_H\n!;

close $revh;