summaryrefslogtreecommitdiff
path: root/extra/lua-lpeg
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-04-04 12:10:43 +0100
committerdavidovski <david@davidovski.xyz>2022-04-04 12:10:43 +0100
commit92790a96688344c9f6fd6dadbaad73c1f88804a0 (patch)
treed6a1357a110475d8f6e39040aeae02920696e827 /extra/lua-lpeg
parentd093bc7b86a8ef1f149ac413d3d40d3cb728ad21 (diff)
fixed network manager
Diffstat (limited to 'extra/lua-lpeg')
-rw-r--r--extra/lua-lpeg/build-static-lib.patch29
-rw-r--r--extra/lua-lpeg/test-fix-setlocale.patch20
2 files changed, 49 insertions, 0 deletions
diff --git a/extra/lua-lpeg/build-static-lib.patch b/extra/lua-lpeg/build-static-lib.patch
new file mode 100644
index 0000000..d8a8f8c
--- /dev/null
+++ b/extra/lua-lpeg/build-static-lib.patch
@@ -0,0 +1,29 @@
+--- a/makefile
++++ b/makefile
+@@ -24,12 +24,15 @@
+
+ CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
+ CC = gcc
++AR = ar
++RANLIB = ranlib
+
+ FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
+
+ # For Linux
+ linux:
+ $(MAKE) lpeg.so "DLLFLAGS = -shared -fPIC"
++ $(MAKE) lpeg.a
+
+ # For Mac OS
+ macosx:
+@@ -37,6 +40,10 @@
+
+ lpeg.so: $(FILES)
+ env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
++
++lpeg.a: $(FILES)
++ env $(AR) rc lpeg.a $(FILES)
++ env $(RANLIB) lpeg.a
+
+ $(FILES): makefile
+
diff --git a/extra/lua-lpeg/test-fix-setlocale.patch b/extra/lua-lpeg/test-fix-setlocale.patch
new file mode 100644
index 0000000..028c18c
--- /dev/null
+++ b/extra/lua-lpeg/test-fix-setlocale.patch
@@ -0,0 +1,20 @@
+os.setlocale just calls setlocale() from libc and musl's implementation
+behaves a bit differently in comparison with BSD libc or glibc.
+
+When particular locales for all categories are the same, e.g. "C",
+`setlocale(LC_ALL, "")` returns just "C" on BSD libc (tested on macOS)
+and glibc, but musl returns "C;C;C;C;C;C". When some locale is different,
+e.g. LC_CTYPE, then on macOS you get "C/en_US.UTF-8/C/C/C/C", on glibc
+"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;...", on musl "en_US.UTF-8;C;C;C;C;C".
+
+--- a/test.lua
++++ b/test.lua
+@@ -1428,7 +1428,7 @@
+
+
+ -- testing pre-defined names
+-assert(os.setlocale("C") == "C")
++assert(os.setlocale("C"):sub(1, 1) == "C")
+
+ function eqlpeggsub (p1, p2)
+ local s1 = cs2str(re.compile(p1))