File lightspark-0.5.7-llvm_31.patch of Package lightspark

commit eaed71005f8cfc1a421790ea2def20882e7d25c3
Author: Alessandro Pignotti <a.pignotti@sssup.it>
Date:   Mon May 21 13:05:36 2012 +0200

    Add support for LLVM 3.1

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -229,9 +229,12 @@ ENDIF(${LLVM_STRING_VERSION} VERSION_EQU
 IF(${LLVM_STRING_VERSION} VERSION_EQUAL 2.8)
 	ADD_DEFINITIONS(-DLLVM_28)
 ENDIF(${LLVM_STRING_VERSION} VERSION_EQUAL 2.8)
-IF(${LLVM_STRING_VERSION} VERSION_GREATER 2.9)
-	ADD_DEFINITIONS(-DLLVM_3)
-ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 2.9)
+IF(${LLVM_STRING_VERSION} VERSION_EQUAL 3.0)
+	ADD_DEFINITIONS(-DLLVM_30)
+ENDIF(${LLVM_STRING_VERSION} VERSION_EQUAL 3.0)
+IF(${LLVM_STRING_VERSION} VERSION_GREATER 3.0)
+	ADD_DEFINITIONS(-DLLVM_31)
+ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 3.0)
 INCLUDE(FindZLIB REQUIRED)
 INCLUDE(FindFreetype REQUIRED)
 IF(NOT(ENABLE_GLES2))
Index: src/scripting/abc.cpp
===================================================================
--- src/scripting/abc.cpp.orig
+++ src/scripting/abc.cpp
@@ -23,10 +23,10 @@
 #include <llvm/ExecutionEngine/JIT.h>
 #include <llvm/LLVMContext.h>
 #include <llvm/Target/TargetData.h>
-#ifdef LLVM_3
-#include <llvm/Support/TargetSelect.h>
-#else
+#ifdef LLVM_28
 #include <llvm/Target/TargetSelect.h>
+#else
+#include <llvm/Support/TargetSelect.h>
 #endif
 #include <llvm/Target/TargetOptions.h>
 #include <llvm/Analysis/Verifier.h>
@@ -1426,14 +1426,26 @@ void ABCVm::Run(ABCVm* th)
 
 	if(th->m_sys->useJit)
 	{
+#ifdef LLVM_31
+		llvm::TargetOptions Opts;
+		Opts.JITExceptionHandling = true;
+#else
 		llvm::JITExceptionHandling = true;
+#endif
 #ifndef NDEBUG
+#ifdef LLVM_31
+		Opts.JITEmitDebugInfo = true;
+#else
 		llvm::JITEmitDebugInfo = true;
 #endif
+#endif
 		llvm::InitializeNativeTarget();
 		th->module=new llvm::Module(llvm::StringRef("abc jit"),th->llvm_context);
 		llvm::EngineBuilder eb(th->module);
 		eb.setEngineKind(llvm::EngineKind::JIT);
+#ifdef LLVM_31
+		eb.setTargetOptions(Opts);
+#endif
 		eb.setOptLevel(llvm::CodeGenOpt::Default);
 		th->ex=eb.create();
 		assert_and_throw(th->ex);
Index: src/scripting/abc.h
===================================================================
--- src/scripting/abc.h.orig
+++ src/scripting/abc.h
@@ -23,12 +23,12 @@
 #ifdef LLVM_28
 #define alignof alignOf
 #endif
-#ifdef LLVM_3
-#define LLVMTYPE llvm::Type*
-#define LLVMMAKEARRAYREF(T) makeArrayRef(T)
-#else
+#ifdef LLVM_28
 #define LLVMTYPE const llvm::Type*
 #define LLVMMAKEARRAYREF(T) T
+#else
+#define LLVMTYPE llvm::Type*
+#define LLVMMAKEARRAYREF(T) makeArrayRef(T)
 #endif
 
 #include "compat.h"