aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-pc/lpc-lua5.2-compat.patch
blob: 17a9aaab4b656cf570c4a60d4fabe48de673fa09 (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
41
diff -ru lpc-1.0.0.orig/Makefile lpc-1.0.0/Makefile
--- lpc-1.0.0.orig/Makefile	2012-08-21 17:39:10.000000000 -0300
+++ lpc-1.0.0/Makefile	2014-05-10 13:52:18.833865486 -0300
@@ -1,16 +1,20 @@
-LUA_PREFIX = /usr/local/
-PREFIX	= /usr/local/
+LUA_PKGCONF ?= lua
+
 MODULE = lpc
 VERSION = 1.0.0
 
-INSTALL_PREFIX = $(PREFIX)/lib/lua/5.1/
+ifneq ($(shell pkg-config $(LUA_PKGCONF) || echo not-installed),)
+$(error $(LUA_PKGCONF).pc not found)
+endif
+
+INSTALL_PREFIX = $(PREFIX)$(shell pkg-config $(LUA_PKGCONF) --variable=INSTALL_CMOD)
 
 CC	= gcc
 TARGET	= lpc.so
 OBJS	= lpc.o
 LIBS	=
-CFLAGS	= -I $(LUA_PREFIX)/include -fPIC
-LDFLAGS	= -shared -fPIC
+CFLAGS	= $(shell pkg-config $(LUA_PKGCONF) --cflags) -fPIC
+LDFLAGS	= $(shell pkg-config $(LUA_PKGCONF) --libs) -shared -fPIC
 
 default: $(TARGET)
 
diff -ru lpc-1.0.0.orig/lpc.c lpc-1.0.0/lpc.c
--- lpc-1.0.0.orig/lpc.c	2012-08-21 17:39:10.000000000 -0300
+++ lpc-1.0.0/lpc.c	2014-05-10 13:51:01.740949801 -0300
@@ -192,7 +192,7 @@
 	lua_settable (L, -3);
 }
 
-static const struct luaL_reg lpclib[] =
+static const struct luaL_Reg lpclib[] =
 {
 	{"run", lpc_run},
 	{"wait", lpc_wait},