Mercurial > projects > ldc
view revisions.pl.in @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | 230765fc82f4 |
children |
line wrap: on
line source
#!/usr/bin/perl use strict; use warnings; use File::stat; use Time::localtime; my $llvm_src = `perl @LLVM_CONFIG@ --src-root`; my $svn_info = `LC_ALL=C svn info $llvm_src 2>/dev/null`; my $extra_includes = ""; my $llvm_rev_str; my $llvm_rev_nr; my $llvm_date = ""; if ($svn_info =~ /^URL:.*\/trunk\s*$/m && $svn_info =~ /^Last Changed Rev:\s*(\d+)\s*/m) { $llvm_rev_str = qq!"LLVM trunk rev. $1"!; $llvm_rev_nr = $1; } else { # Either non-trunk or 'svn info' didn't report "Last Changed Rev". $extra_includes = qq!#include "llvm/Config/config.h"!; $llvm_rev_str = "PACKAGE_STRING"; # Assume latest release, so < any version we should be testing for. $llvm_rev_nr = 0; } # Use SVN date even if non-trunk: if ($svn_info =~ /^Last Changed Date: ([^(]*?)\s*(\(|$)/m) { $llvm_date = qq!" ($1)"!; } else { # Otherwise, try to get it from the libdir my $llvm_lib = `perl @LLVM_CONFIG@ --libdir`; $llvm_lib =~ s/\s+$//; if (-d $llvm_lib) { my $mod_time = ctime(stat($llvm_lib)->mtime); $llvm_date = qq!" ($mod_time)"!; } } my $ldc_rev = `hg -R@PROJECT_SOURCE_DIR@ log -r qparent --template '{rev}:{node|short} ({date|isodate})' 2>/dev/null || hg -R@PROJECT_SOURCE_DIR@ tip --template '{rev}:{node|short} ({date|isodate})'`; my $out = qq!#ifndef LDC_VERSIONS_H #define LDC_VERSIONS_H $extra_includes // LLVM version string, for use in -version output #define LLVM_REV_STR $llvm_rev_str$llvm_date // LDC version string, for use in -version output #define LDC_REV "rev. $ldc_rev" #endif // LDC_VERSIONS_H\n!; my $revh; my $old = ""; open $revh, "revisions.h" and $old = join "", <$revh>; if ($old ne $out) { open $revh, ">revisions.h" or die "cannot create revisions.h: $!"; print $revh $out; close $revh; } # Allow the user to manually define it on the command line... $out = qq@#ifndef LLVM_REV // LLVM svn revision number, used to adapt to changes in LLVM // (Is 0 if LLVM is not an SVN trunk version) #define LLVM_REV $llvm_rev_nr #endif // LLVM_REV #if !LLVM_REV #error "You need to add '-DLLVM_REV=<your-llvm-rev>' to CMAKE_CXX_FLAGS in the cmake configuration" #elif LLVM_REV < 67588 #error "Please update to a more recent LLVM version" #endif\n@; $old = ""; open $revh, "llvm-version.h" and $old = join "", <$revh>; if ($old ne $out) { open $revh, ">llvm-version.h" or die "cannot create llvm-version.h: $!"; print $revh $out; close $revh; }