summaryrefslogtreecommitdiffstats
path: root/plugins/luarocks/lua-rapidjson-1-fixes.patch
blob: b509c2f5d5307014439d9299b3fe63734ec2f11e (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
This file is part of MXE. See LICENSE.md for licensing information.

From dbedfa6c3b350b6cb2c13d17790a17129ce28721 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Sun, 11 Oct 2015 22:47:50 +0200
Subject: [PATCH 1/2] use Unix file functions on MinGW

---
 src/rapidjson.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rapidjson.cpp b/src/rapidjson.cpp
index 3b5b129..955009f 100644
--- a/src/rapidjson.cpp
+++ b/src/rapidjson.cpp
@@ -54,7 +54,7 @@ static void setfuncs(lua_State* L, const luaL_Reg *funcs)
 FILE* openForRead(const char* filename)
 {
 	FILE* fp = NULL;
-#if WIN32
+#if WIN32 && !defined(__MINGW32__)
 	fopen_s(&fp, filename, "rb");
 #else
 	fp = fopen(filename, "r");
@@ -66,7 +66,7 @@ FILE* openForRead(const char* filename)
 FILE* openForWrite(const char* filename)
 {
 	FILE* fp = NULL;
-#if WIN32
+#if WIN32 && !defined(__MINGW32__)
 	fopen_s(&fp, filename, "wb");
 #else
 	fp = fopen(filename, "w");
-- 
1.7.10.4


From ad7426ad156f90dcf2b051fe125900caf5b8b2da Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Sun, 11 Oct 2015 22:48:26 +0200
Subject: [PATCH 2/2] link with Lua libraries on MinGW and MXE

---
 rapidjson-0.2.2-1.rockspec |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/rapidjson-0.2.2-1.rockspec b/rapidjson-0.2.2-1.rockspec
index 9efe7e1..6ad9188 100644
--- a/rapidjson-0.2.2-1.rockspec
+++ b/rapidjson-0.2.2-1.rockspec
@@ -27,6 +27,13 @@ dependencies = {
   "lua >= 5.1"
 }
 
+-- windows DLL needs link with importlib.
+local link = {
+  variables = {
+    LUA_LIBRARIES = "$(LUA_LIBDIR)/$(LUALIB)",
+  }
+}
+
 -- cmake -Bbuild -H. -DBUILD_SHARED_LIBS=ON
 -- cmake --build build --target install --config Release
 build = {
@@ -39,10 +46,8 @@ build = {
   },
   -- Override default build options
   platforms = {
-    windows = {
-      variables = {
-        LUA_LIBRARIES = "$(LUA_LIBDIR)/$(LUALIB)", -- windows DLL needs link with importlib.
-      }
-    }
+    windows = link,
+    mingw = link,
+    mxe = link,
   }
 }
-- 
1.7.10.4