summaryrefslogtreecommitdiff
path: root/pcr/uci/uci-0.8.0-lua5.1.patch
blob: d3e486f87757d37a81d04915ffd408d5fb37edec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- uci-0.8.0.orig/lua/CMakeLists.txt	2011-07-19 15:39:56.000000000 -0500
+++ uci-0.8.0/lua/CMakeLists.txt	2013-02-12 21:16:02.583984374 -0500
@@ -4,7 +4,18 @@
 
 SET(CMAKE_INSTALL_PREFIX /)
 
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I..)
+IF(NOT LUA_CFLAGS)
+	FIND_PROGRAM(PKG_CONFIG pkg-config)
+	IF(PKG_CONFIG)
+		EXECUTE_PROCESS(
+			COMMAND pkg-config --silence-errors --cflags lua5.1
+			OUTPUT_VARIABLE LUA_CFLAGS
+			OUTPUT_STRIP_TRAILING_WHITESPACE
+		)
+	ENDIF()
+ENDIF()
+
+ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I.. ${LUA_CFLAGS})
 LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
 IF(APPLE)
@@ -13,7 +24,7 @@
 
 IF(NOT LUAPATH)
 	EXECUTE_PROCESS(
-		COMMAND  lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,1) == \"/\" then print(k) break end end"
+		COMMAND  lua5.1 -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,1) == \"/\" then print(k) break end end"
 		OUTPUT_VARIABLE LUAPATH
 		RESULT_VARIABLE LUA_CHECK_RES
 		OUTPUT_STRIP_TRAILING_WHITESPACE