aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-cjson/0001-Use-pkg-config-to-detect-cflags-or-fallback-to-LUA_I.patch
blob: a3134474453d2308a4ac4e396988586bdca5ba5c (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
32
33
34
35
36
37
38
39
40
From 659e292fc741163f6e4370ff682e3e42312cd51d Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 26 Jun 2013 06:33:15 +0000
Subject: [PATCH] Use pkg-config to detect cflags or fallback to
 LUA_INCLUDE_DIR

---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 6fdb1f2..ed0f925 100644
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,13 @@ PREFIX =            /usr/local
 CFLAGS =            -O3 -Wall -pedantic -DNDEBUG
 CJSON_CFLAGS =      -fpic
 CJSON_LDFLAGS =     -shared
+LUA_PC =            lua$(LUA_VERSION)
 LUA_INCLUDE_DIR =   $(PREFIX)/include
 LUA_CMODULE_DIR =   $(PREFIX)/lib/lua/$(LUA_VERSION)
 LUA_MODULE_DIR =    $(PREFIX)/share/lua/$(LUA_VERSION)
 LUA_BIN_DIR =       $(PREFIX)/bin
+LUA_CFLAGS =        $(shell pkg-config $(LUA_PC) --cflags --silence-errors \
+	|| echo "-I$(LUA_INCLUDE_DIR)")
 
 ##### Platform overrides #####
 ##
@@ -79,7 +82,7 @@ EXECPERM =          755
 
 ASCIIDOC =          asciidoc
 
-BUILD_CFLAGS =      -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS)
+BUILD_CFLAGS =      $(LUA_CFLAGS) $(CJSON_CFLAGS)
 OBJS =              lua_cjson.o strbuf.o $(FPCONV_OBJS)
 
 .PHONY: all clean install install-extra doc
-- 
1.8.3.1