aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-pc/0001-main-lua-lpc-fix-flags.patch
blob: 7b6b1c30c9b2ce69d7ce4e18e90330db4d221a11 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
From 658e1c25e291c2c24f18376f66029203e63baa84 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Sat, 10 May 2014 14:06:24 +0000
Subject: [PATCH] main/lua-lpc: fix flags

---
 main/lua-pc/APKBUILD                |   8 +--
 main/lua-pc/lpc-lua5.2-compat.patch | 115 +++++++++++++++++++-----------------
 2 files changed, 65 insertions(+), 58 deletions(-)

diff --git a/main/lua-pc/APKBUILD b/main/lua-pc/APKBUILD
index 2b8bc90..32f8e2d 100644
--- a/main/lua-pc/APKBUILD
+++ b/main/lua-pc/APKBUILD
@@ -5,7 +5,7 @@ _luaversions="5.1 5.2"
 pkgname=lua-pc
 _name=lpc
 pkgver=1.0.0
-pkgrel=8
+pkgrel=9
 pkgdesc="Lua Process Call"
 url="https://github.com/LuaDist/lpc"
 arch="all"
@@ -63,8 +63,8 @@ for _i in $_luaversions; do
 done
 
 md5sums="a8cd8b0c190e7d72dd7ec2f76e74e3c8  lpc-1.0.0.tar.gz
-3fc5dcd932cb30fb0ee94fa5d316ed7c  lpc-lua5.2-compat.patch"
+97c3a94797b03b84c6340781b413e5be  lpc-lua5.2-compat.patch"
 sha256sums="2fbbdfbbfa03a70792bb83655f3e1f990fcb972c55a074717ba417514261805c  lpc-1.0.0.tar.gz
-0916026d33d20b24b9a5c324922261323c69e461242aacac22df04c050577b6f  lpc-lua5.2-compat.patch"
+7937be39287210166bbe364bee56f575f63a1b928acc838388d09fb6ab1b3fe4  lpc-lua5.2-compat.patch"
 sha512sums="a955f802b9ea7c4615b8b22b1f4ab540d41e4ddb0edb5e1b77f2f2e1472c49248cb276f8bfec6b929d23ef01681a0018db6cbd401ade1cc1eb366b0a6ace9772  lpc-1.0.0.tar.gz
-e0731fedff4815071dfa4909e6d0c7fd8ea588081d18dc3e44c9fdbff9df82863e3bff8ac37b2d7c22feb53c32de12ea5b57944e6374e51189b0b9bc408f2db8  lpc-lua5.2-compat.patch"
+d98aba2a757cb4dd6ceebefb4b0bebb4b91d8a38360193f6246be727f0dc89fe438154596c22232d16539f86d5589730e13834cdaf5b71965728904fbdea8615  lpc-lua5.2-compat.patch"
diff --git a/main/lua-pc/lpc-lua5.2-compat.patch b/main/lua-pc/lpc-lua5.2-compat.patch
index e12131e..98ec7b1 100644
--- a/main/lua-pc/lpc-lua5.2-compat.patch
+++ b/main/lua-pc/lpc-lua5.2-compat.patch
@@ -1,7 +1,6 @@
-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 14:54:26.573670586 -0300
-@@ -1,16 +1,20 @@
+--- lpc-1.0.0.orig/Makefile
++++ lpc-1.0.0/Makefile
+@@ -1,17 +1,24 @@
 -LUA_PREFIX = /usr/local/
 -PREFIX	= /usr/local/
 +LUA_PKGCONF ?= lua
@@ -13,23 +12,35 @@ diff -ru lpc-1.0.0.orig/Makefile lpc-1.0.0/Makefile
 +ifneq ($(shell pkg-config $(LUA_PKGCONF) || echo not-installed),)
 +$(error $(LUA_PKGCONF).pc not found)
 +endif
-+
-+INSTALL_PREFIX = $(DESTDIR)$(shell pkg-config $(LUA_PKGCONF) --variable=INSTALL_CMOD)
  
++INSTALL_PREFIX = $(DESTDIR)$(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
++CFLAGS	= -fPIC
+ LDFLAGS	= -shared -fPIC
  
++LUA_CFLAGS = $(shell pkg-config $(LUA_PKGCONF) --cflags)
++LUA_LDFLAGS = $(shell pkg-config $(LUA_PKGCONF) --libs)
++
  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 16:35:47.714059553 -0300
+ 
+@@ -29,7 +36,7 @@
+ 	rm -rf $(MODULE)-$(VERSION)
+ 
+ $(TARGET): $(OBJS)
+-	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS)
++	$(CC) $(LUA_LDFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJS)
+ 
+ .c.o:
+-	$(CC) $(CFLAGS) -c $< -o $@
++	$(CC) $(LUA_CFLAGS) $(CFLAGS) -c $< -o $@
+--- lpc-1.0.0.orig/lpc.c
++++ lpc-1.0.0/lpc.c
 @@ -1,7 +1,7 @@
  /*
  ** LuaProcessCall
@@ -45,7 +56,12 @@ diff -ru lpc-1.0.0.orig/lpc.c lpc-1.0.0/lpc.c
  
 -#define topfile(L)	((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
 +#if LUA_VERSION_NUM < 502
-+
+ 
+-static FILE *tofile (lua_State *L) {
+-  FILE **f = topfile(L);
+-  if (*f == NULL)
+-    luaL_error(L, "attempt to use a closed file");
+-  return *f;
 +static int lua_absindex(lua_State *L, int idx) {
 +	return (idx > 0 || idx <= LUA_REGISTRYINDEX)? idx : lua_gettop(L) + idx + 1;
 +} /* lua_absindex() */
@@ -96,27 +112,8 @@ diff -ru lpc-1.0.0.orig/lpc.c lpc-1.0.0/lpc.c
 +		lua_pushinteger(L, en);
 +		return 3;
 +	}
-+}
-+
-+#define isclosed(p) ((p)->f == NULL)
-+#define markclosed(p) ((p)->f = NULL)
-+
-+#else
-+
-+#define isclosed(p) ((p)->closef == NULL)
-+#define markclosed(p) ((p)->closef = NULL)
-+
-+#endif
-+
-+#define tolstream(L) ((luaL_Stream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))
+ }
  
- static FILE *tofile (lua_State *L) {
--  FILE **f = topfile(L);
--  if (*f == NULL)
--    luaL_error(L, "attempt to use a closed file");
--  return *f;
--}
--
 -static int pushresult (lua_State *L, int i, const char *filename) {
 -  int en = errno;  /* calls to Lua API may change this value */
 -  if (i) {
@@ -132,32 +129,43 @@ diff -ru lpc-1.0.0.orig/lpc.c lpc-1.0.0/lpc.c
 -    lua_pushinteger(L, en);
 -    return 3;
 -  }
--}
--
--static int io_fclose (lua_State *L) {
--  FILE **p = topfile(L);
--  int ok = (fclose(*p) == 0);
--  *p = NULL;
--  return pushresult(L, ok, NULL);
++#define isclosed(p) ((p)->f == NULL)
++#define markclosed(p) ((p)->f = NULL)
++
++#else
++
++#define isclosed(p) ((p)->closef == NULL)
++#define markclosed(p) ((p)->closef = NULL)
++
++#endif
++
++#define tolstream(L) ((luaL_Stream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))
++
++static FILE *tofile (lua_State *L) {
 +	luaL_Stream *p = tolstream(L);
 +	if (isclosed(p))
 +		luaL_error(L, "attempt to use a closed file");
 +	return p->f;
  }
  
--static FILE **newfile_fd(lua_State *L, int fd, const char *mode)
+-static int io_fclose (lua_State *L) {
+-  FILE **p = topfile(L);
+-  int ok = (fclose(*p) == 0);
+-  *p = NULL;
+-  return pushresult(L, ok, NULL);
 +static int io_fclose (lua_State *L)
- {
--	FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));
--	*pf = NULL;  /* file handle is currently `closed' */
++{
 +	luaL_Stream *p = tolstream(L);
 +	int res = fclose(p->f);
 +	markclosed(p);
 +	return luaL_fileresult(L, (res == 0), NULL);
-+}
-+
+ }
+ 
+-static FILE **newfile_fd(lua_State *L, int fd, const char *mode)
 +static luaL_Stream *newfile_fd(lua_State *L, int fd, const char *mode)
-+{
+ {
+-	FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));
+-	*pf = NULL;  /* file handle is currently `closed' */
 +	luaL_Stream *p = (luaL_Stream *) lua_newuserdata(L, sizeof(luaL_Stream));
 +	markclosed(p);
  	luaL_getmetatable(L, LUA_FILEHANDLE);
@@ -202,12 +210,6 @@ diff -ru lpc-1.0.0.orig/lpc.c lpc-1.0.0/lpc.c
 -		/* Cleanup */
 -		close(p_out[0]);
 -		close(p_in[1]);
--
--		lua_pushnumber(L, pid);
--		out = newfile_fd(L, p_out[1], "w");
--		in = newfile_fd(L, p_in[0], "r");
--		return 3;
--	}
 +	/* Cleanup */
 +	close(p_out[0]);
 +	close(p_in[1]);
@@ -215,7 +217,12 @@ diff -ru lpc-1.0.0.orig/lpc.c lpc-1.0.0/lpc.c
 +	newfile_fd(L, p_out[1], "w");
 +	newfile_fd(L, p_in[0], "r");
 +	return 3;
-+
+ 
+-		lua_pushnumber(L, pid);
+-		out = newfile_fd(L, p_out[1], "w");
+-		in = newfile_fd(L, p_in[0], "r");
+-		return 3;
+-	}
 +err_closeinout:
 +	close(p_in[0]);
 +	close(p_in[1]);
-- 
1.8.4.3