From 0ccf65f9a75f1d9edc2d5c70ae382981ebdce238 Mon Sep 17 00:00:00 2001
From: Pavel Cherenkov <pcherenkov@gmail.com>
Date: Fri, 18 May 2012 17:06:09 +0400
Subject: [PATCH] custom-build: added build-specific options to compile LuaJIT

---
 third_party/CMakeLists.txt                                 | 7 ++++++-
 .../{beta9_hotfix1.patch => freebsd_beta9_hotfix1.patch}   | 0
 2 files changed, 6 insertions(+), 1 deletion(-)
 rename third_party/luajit/{beta9_hotfix1.patch => freebsd_beta9_hotfix1.patch} (100%)

diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index d9c25d9780..70aaf0ca65 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -20,11 +20,16 @@ add_subdirectory(gopt)
 
 macro (luajit_build)
     set (luajit_buildoptions BUILDMODE=static)
-    set (luajit_buildoptions ${luajit_buildoptions} CCOPT='-I.. -O1')
+    set (luajit_copt ${CCOPT})
     if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
         set (luajit_buildoptions ${luajit_buildoptions} CCDEBUG=-ggdb)
+    	set (luajit_copt ${luajit_copt} -O1)
         set (luajit_buildoptions ${luajit_buildoptions} XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT')
+    else ()
+   	set (luajit_copt ${luajit_copt} -O2)
     endif()
+    set (luajit_copt ${luajit_copt} -I.. )
+    set (luajit_buildoptions ${luajit_buildoptions} CCOPT="${luajit_copt}")
     set (luajit_buildoptions ${luajit_buildoptions} Q='')
     if (${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
         add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/third_party/luajit/src/libluajit.a
diff --git a/third_party/luajit/beta9_hotfix1.patch b/third_party/luajit/freebsd_beta9_hotfix1.patch
similarity index 100%
rename from third_party/luajit/beta9_hotfix1.patch
rename to third_party/luajit/freebsd_beta9_hotfix1.patch
-- 
GitLab