diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | lfw/luarocks_config.lua | 2 | ||||
-rwxr-xr-x | makedist | 2 | ||||
-rw-r--r-- | src/luarocks/build/builtin.lua | 12 | ||||
-rw-r--r-- | src/luarocks/cfg.lua | 18 | ||||
-rw-r--r-- | win32/bin/rclauncher.c | 174 |
6 files changed, 108 insertions, 102 deletions
@@ -97,7 +97,7 @@ luadoc: | |||
97 | 97 | ||
98 | check_makefile: clean | 98 | check_makefile: clean |
99 | echo $(BIN_FILES) | tr " " "\n" | sort > makefile_list.txt | 99 | echo $(BIN_FILES) | tr " " "\n" | sort > makefile_list.txt |
100 | ( cd src/bin && ls -d * ) | grep -v "rclauncher.c" | sort > luarocks_dir.txt | 100 | ( cd src/bin && ls -d * ) | sort > luarocks_dir.txt |
101 | echo $(LUAROCKS_FILES) | tr " " "\n" | sort >> makefile_list.txt | 101 | echo $(LUAROCKS_FILES) | tr " " "\n" | sort >> makefile_list.txt |
102 | ( cd src/luarocks && find * -name "*.lua" ) | sort >> luarocks_dir.txt | 102 | ( cd src/luarocks && find * -name "*.lua" ) | sort >> luarocks_dir.txt |
103 | diff makefile_list.txt luarocks_dir.txt | 103 | diff makefile_list.txt luarocks_dir.txt |
diff --git a/lfw/luarocks_config.lua b/lfw/luarocks_config.lua index 9fd0aebd..557890f4 100644 --- a/lfw/luarocks_config.lua +++ b/lfw/luarocks_config.lua | |||
@@ -7,4 +7,4 @@ rocks_trees = { | |||
7 | bin_dir = LFW_ROOT, lua_dir = LFW_ROOT..[[\lua]], | 7 | bin_dir = LFW_ROOT, lua_dir = LFW_ROOT..[[\lua]], |
8 | lib_dir = LFW_ROOT..[[\clibs]] } | 8 | lib_dir = LFW_ROOT..[[\clibs]] } |
9 | } | 9 | } |
10 | variables.WRAPPER = LFW_ROOT..[[\rclauncher.obj]] | 10 | variables.WRAPPER = LFW_ROOT..[[\rclauncher.c]] |
@@ -61,7 +61,7 @@ mkdir "release-windows" | |||
61 | mv "$out" "release-windows/$out-win32" | 61 | mv "$out" "release-windows/$out-win32" |
62 | 62 | ||
63 | cd "release-unix/$out" | 63 | cd "release-unix/$out" |
64 | rm -rf makedist install.bat COPYING.lua COPYING.7z win32 lfw src/bin/rclauncher.c | 64 | rm -rf makedist install.bat COPYING.lua COPYING.7z win32 lfw |
65 | cd .. | 65 | cd .. |
66 | tar czvpf ../"$out.tar.gz" "$out" | 66 | tar czvpf ../"$out.tar.gz" "$out" |
67 | cd .. | 67 | cd .. |
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 96ce35a6..f9cc0302 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
@@ -88,8 +88,10 @@ function run(rockspec) | |||
88 | make_rc(fullname, fullbasename..".rc") | 88 | make_rc(fullname, fullbasename..".rc") |
89 | local ok = execute(variables.RC, "-o", resname, rcname) | 89 | local ok = execute(variables.RC, "-o", resname, rcname) |
90 | if not ok then return ok end | 90 | if not ok then return ok end |
91 | ok = execute(variables.LD, "-o", wrapname, resname, variables.WRAPPER, | 91 | ok = execute(variables.CC.." "..variables.CFLAGS, "-I"..variables.LUA_INCDIR, |
92 | dir.path(variables.LUA_LIBDIR, variables.LUALIB), "-l" .. (variables.MSVCRT or "m"), "-luser32") | 92 | "-o", wrapname, resname, variables.WRAPPER, |
93 | dir.path(variables.LUA_LIBDIR, variables.LUALIB), | ||
94 | "-l" .. (variables.MSVCRT or "m"), "-luser32") | ||
93 | return ok, wrapname | 95 | return ok, wrapname |
94 | end | 96 | end |
95 | elseif cfg.is_platform("win32") then | 97 | elseif cfg.is_platform("win32") then |
@@ -119,13 +121,17 @@ function run(rockspec) | |||
119 | compile_wrapper_binary = function(fullname, name) | 121 | compile_wrapper_binary = function(fullname, name) |
120 | local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") | 122 | local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") |
121 | local basename = name:gsub("%.lua$", ""):gsub("/", "\\") | 123 | local basename = name:gsub("%.lua$", ""):gsub("/", "\\") |
124 | local object = basename..".obj" | ||
122 | local rcname = basename..".rc" | 125 | local rcname = basename..".rc" |
123 | local resname = basename..".res" | 126 | local resname = basename..".res" |
124 | local wrapname = basename..".exe" | 127 | local wrapname = basename..".exe" |
125 | make_rc(fullname, fullbasename..".rc") | 128 | make_rc(fullname, fullbasename..".rc") |
126 | local ok = execute(variables.RC, "-r", "-fo"..resname, rcname) | 129 | local ok = execute(variables.RC, "-r", "-fo"..resname, rcname) |
127 | if not ok then return ok end | 130 | if not ok then return ok end |
128 | ok = execute(variables.LD, "-out:"..wrapname, resname, variables.WRAPPER, | 131 | ok = execute(variables.CC.." "..variables.CFLAGS, "-c", "-Fo"..object, |
132 | "-I"..variables.LUA_INCDIR, variables.WRAPPER) | ||
133 | if not ok then return ok end | ||
134 | ok = execute(variables.LD, "-out:"..wrapname, resname, object, | ||
129 | dir.path(variables.LUA_LIBDIR, variables.LUALIB), "user32.lib") | 135 | dir.path(variables.LUA_LIBDIR, variables.LUALIB), "user32.lib") |
130 | local manifestfile = wrapname..".manifest" | 136 | local manifestfile = wrapname..".manifest" |
131 | if ok and fs.exists(manifestfile) then | 137 | if ok and fs.exists(manifestfile) then |
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index e16079f4..12a477a0 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -193,18 +193,18 @@ local defaults = { | |||
193 | MAKE = "make", | 193 | MAKE = "make", |
194 | CC = "cc", | 194 | CC = "cc", |
195 | LD = "ld", | 195 | LD = "ld", |
196 | 196 | ||
197 | CVS = "cvs", | 197 | CVS = "cvs", |
198 | GIT = "git", | 198 | GIT = "git", |
199 | SSCM = "sscm", | 199 | SSCM = "sscm", |
200 | SVN = "svn", | 200 | SVN = "svn", |
201 | HG = "hg", | 201 | HG = "hg", |
202 | 202 | ||
203 | RSYNC = "rsync", | 203 | RSYNC = "rsync", |
204 | WGET = "wget", | 204 | WGET = "wget", |
205 | SCP = "scp", | 205 | SCP = "scp", |
206 | CURL = "curl", | 206 | CURL = "curl", |
207 | 207 | ||
208 | PWD = "pwd", | 208 | PWD = "pwd", |
209 | MKDIR = "mkdir", | 209 | MKDIR = "mkdir", |
210 | RMDIR = "rmdir", | 210 | RMDIR = "rmdir", |
@@ -221,18 +221,18 @@ local defaults = { | |||
221 | GUNZIP = "gunzip", | 221 | GUNZIP = "gunzip", |
222 | BUNZIP2 = "bunzip2", | 222 | BUNZIP2 = "bunzip2", |
223 | TAR = "tar", | 223 | TAR = "tar", |
224 | 224 | ||
225 | MD5SUM = "md5sum", | 225 | MD5SUM = "md5sum", |
226 | OPENSSL = "openssl", | 226 | OPENSSL = "openssl", |
227 | MD5 = "md5", | 227 | MD5 = "md5", |
228 | STAT = "stat", | 228 | STAT = "stat", |
229 | 229 | ||
230 | CMAKE = "cmake", | 230 | CMAKE = "cmake", |
231 | SEVENZ = "7z", | 231 | SEVENZ = "7z", |
232 | 232 | ||
233 | STATFLAG = "-c '%a'", | 233 | STATFLAG = "-c '%a'", |
234 | }, | 234 | }, |
235 | 235 | ||
236 | external_deps_subdirs = { | 236 | external_deps_subdirs = { |
237 | bin = "bin", | 237 | bin = "bin", |
238 | lib = "lib", | 238 | lib = "lib", |
@@ -262,7 +262,7 @@ if detected.windows then | |||
262 | defaults.variables.MAKE = "nmake" | 262 | defaults.variables.MAKE = "nmake" |
263 | defaults.variables.CC = "cl" | 263 | defaults.variables.CC = "cl" |
264 | defaults.variables.RC = "rc" | 264 | defaults.variables.RC = "rc" |
265 | defaults.variables.WRAPPER = site_config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.obj" | 265 | defaults.variables.WRAPPER = site_config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.c" |
266 | defaults.variables.LD = "link" | 266 | defaults.variables.LD = "link" |
267 | defaults.variables.MT = "mt" | 267 | defaults.variables.MT = "mt" |
268 | defaults.variables.LUALIB = "lua"..lua_version..".lib" | 268 | defaults.variables.LUALIB = "lua"..lua_version..".lib" |
@@ -293,7 +293,7 @@ if detected.mingw32 then | |||
293 | defaults.variables.MAKE = "mingw32-make" | 293 | defaults.variables.MAKE = "mingw32-make" |
294 | defaults.variables.CC = "mingw32-gcc" | 294 | defaults.variables.CC = "mingw32-gcc" |
295 | defaults.variables.RC = "windres" | 295 | defaults.variables.RC = "windres" |
296 | defaults.variables.WRAPPER = site_config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.o" | 296 | defaults.variables.WRAPPER = site_config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.c" |
297 | defaults.variables.LD = "mingw32-gcc" | 297 | defaults.variables.LD = "mingw32-gcc" |
298 | defaults.variables.CFLAGS = "-O2" | 298 | defaults.variables.CFLAGS = "-O2" |
299 | defaults.variables.LIBFLAG = "-shared" | 299 | defaults.variables.LIBFLAG = "-shared" |
diff --git a/win32/bin/rclauncher.c b/win32/bin/rclauncher.c index 60284638..77459f46 100644 --- a/win32/bin/rclauncher.c +++ b/win32/bin/rclauncher.c | |||
@@ -24,55 +24,55 @@ | |||
24 | ** Assumes that the error message is on top of the stack. | 24 | ** Assumes that the error message is on top of the stack. |
25 | */ | 25 | */ |
26 | static int report (lua_State *L) { | 26 | static int report (lua_State *L) { |
27 | fprintf (stderr, "lua: fatal error: `%s'\n", lua_tostring (L, -1)); | 27 | fprintf (stderr, "lua: fatal error: `%s'\n", lua_tostring (L, -1)); |
28 | fflush (stderr); | 28 | fflush (stderr); |
29 | printf ("Content-type: text/plain\n\nConfiguration fatal error: see error log!\n"); | 29 | printf ("Content-type: text/plain\n\nConfiguration fatal error: see error log!\n"); |
30 | printf ("%s", lua_tostring(L, -1)); | 30 | printf ("%s", lua_tostring(L, -1)); |
31 | return 1; | 31 | return 1; |
32 | } | 32 | } |
33 | 33 | ||
34 | static int runlua (lua_State *L, const char *lua_string, int argc, char *argv[]) { | 34 | static int runlua (lua_State *L, const char *lua_string, int argc, char *argv[]) { |
35 | int err_func; | 35 | int err_func; |
36 | int err; | 36 | int err; |
37 | 37 | ||
38 | lua_getglobal(L, "debug"); | 38 | lua_getglobal(L, "debug"); |
39 | lua_pushliteral(L, "traceback"); | 39 | lua_pushliteral(L, "traceback"); |
40 | lua_gettable(L, -2); | 40 | lua_gettable(L, -2); |
41 | err_func = lua_gettop (L); | 41 | err_func = lua_gettop (L); |
42 | err = luaL_loadstring (L, lua_string); | 42 | err = luaL_loadstring (L, lua_string); |
43 | if(!err) { | 43 | if(!err) { |
44 | // fill global arg table | 44 | int i; |
45 | lua_getglobal(L, "arg"); | 45 | // fill global arg table |
46 | int i; | 46 | lua_getglobal(L, "arg"); |
47 | for(i = 1; i < argc; i++) | 47 | for(i = 1; i < argc; i++) |
48 | { | 48 | { |
49 | lua_pushstring(L, argv[i]); | 49 | lua_pushstring(L, argv[i]); |
50 | lua_rawseti(L, -2, i); | 50 | lua_rawseti(L, -2, i); |
51 | } | 51 | } |
52 | lua_pop(L, 1); | 52 | lua_pop(L, 1); |
53 | // fill parameters (in vararg '...') | 53 | // fill parameters (in vararg '...') |
54 | for(i = 1; i < argc; i++) | 54 | for(i = 1; i < argc; i++) |
55 | lua_pushstring(L, argv[i]); | 55 | lua_pushstring(L, argv[i]); |
56 | return lua_pcall (L, argc - 1, LUA_MULTRET, err_func); | 56 | return lua_pcall (L, argc - 1, LUA_MULTRET, err_func); |
57 | } else return err; | 57 | } else return err; |
58 | } | 58 | } |
59 | 59 | ||
60 | static DWORD GetModulePath( HINSTANCE hInst, LPTSTR pszBuffer, DWORD dwSize ) | 60 | static DWORD GetModulePath( HINSTANCE hInst, LPTSTR pszBuffer, DWORD dwSize ) |
61 | // | 61 | // |
62 | // Return the size of the path in bytes. | 62 | // Return the size of the path in bytes. |
63 | { | 63 | { |
64 | DWORD dwLength = GetModuleFileName( hInst, pszBuffer, dwSize ); | 64 | DWORD dwLength = GetModuleFileName( hInst, pszBuffer, dwSize ); |
65 | if( dwLength ) | 65 | if( dwLength ) |
66 | { | 66 | { |
67 | while( dwLength && pszBuffer[ dwLength ] != '.' ) | 67 | while( dwLength && pszBuffer[ dwLength ] != '.' ) |
68 | { | 68 | { |
69 | dwLength--; | 69 | dwLength--; |
70 | } | 70 | } |
71 | 71 | ||
72 | if( dwLength ) | 72 | if( dwLength ) |
73 | pszBuffer[ dwLength ] = '\000'; | 73 | pszBuffer[ dwLength ] = '\000'; |
74 | } | 74 | } |
75 | return dwLength; | 75 | return dwLength; |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
@@ -80,60 +80,60 @@ static DWORD GetModulePath( HINSTANCE hInst, LPTSTR pszBuffer, DWORD dwSize ) | |||
80 | ** MAIN | 80 | ** MAIN |
81 | */ | 81 | */ |
82 | int main (int argc, char *argv[]) { | 82 | int main (int argc, char *argv[]) { |
83 | char name[ MAX_PATH ]; | 83 | char name[ MAX_PATH ]; |
84 | DWORD dwLength; | 84 | DWORD dwLength; |
85 | int size; | 85 | int size; |
86 | luaL_Buffer b; | 86 | luaL_Buffer b; |
87 | int i; | 87 | int i; |
88 | #ifdef UNICODE | 88 | #ifdef UNICODE |
89 | TCHAR lua_wstring[4098]; | 89 | TCHAR lua_wstring[4098]; |
90 | #endif | 90 | #endif |
91 | char lua_string[4098]; | 91 | char lua_string[4098]; |
92 | lua_State *L = luaL_newstate(); | 92 | lua_State *L = luaL_newstate(); |
93 | (void)argc; /* avoid "unused parameter" warning */ | 93 | (void)argc; /* avoid "unused parameter" warning */ |
94 | luaL_openlibs(L); | 94 | luaL_openlibs(L); |
95 | lua_newtable(L); // create arg table | 95 | lua_newtable(L); // create arg table |
96 | lua_pushstring(L, argv[0]); // add interpreter to arg table | 96 | lua_pushstring(L, argv[0]); // add interpreter to arg table |
97 | lua_rawseti(L, -2, -1); | 97 | lua_rawseti(L, -2, -1); |
98 | dwLength = GetModulePath( NULL, name, MAX_PATH ); | 98 | dwLength = GetModulePath( NULL, name, MAX_PATH ); |
99 | if(dwLength) { /* Optional bootstrap */ | 99 | if(dwLength) { /* Optional bootstrap */ |
100 | strcat(name, ".lua"); | 100 | strcat(name, ".lua"); |
101 | lua_pushstring(L, name); // add lua script to arg table | 101 | lua_pushstring(L, name); // add lua script to arg table |
102 | lua_rawseti(L, -2, 0); | 102 | lua_rawseti(L, -2, 0); |
103 | lua_setglobal(L,"arg"); // set global arg table | 103 | lua_setglobal(L,"arg"); // set global arg table |
104 | if(!luaL_loadfile (L, name)) { | 104 | if(!luaL_loadfile (L, name)) { |
105 | if(lua_pcall (L, 0, LUA_MULTRET, 0)) { | 105 | if(lua_pcall (L, 0, LUA_MULTRET, 0)) { |
106 | report (L); | 106 | report (L); |
107 | lua_close (L); | 107 | lua_close (L); |
108 | return EXIT_FAILURE; | 108 | return EXIT_FAILURE; |
109 | } | 109 | } |
110 | } | 110 | } |
111 | } | 111 | } |
112 | else | 112 | else |
113 | { | 113 | { |
114 | lua_pushstring(L, argv[0]); // no lua script, so add interpreter again, now as lua script | 114 | lua_pushstring(L, argv[0]); // no lua script, so add interpreter again, now as lua script |
115 | lua_rawseti(L, -2, 0); | 115 | lua_rawseti(L, -2, 0); |
116 | lua_setglobal(L,"arg"); // set global arg table | 116 | lua_setglobal(L,"arg"); // set global arg table |
117 | } | 117 | } |
118 | 118 | ||
119 | luaL_buffinit(L, &b); | 119 | luaL_buffinit(L, &b); |
120 | for(i = 1; ; i++) { | 120 | for(i = 1; ; i++) { |
121 | #ifdef UNICODE | 121 | #ifdef UNICODE |
122 | size = LoadString(GetModuleHandle(NULL), i, lua_wstring, | 122 | size = LoadString(GetModuleHandle(NULL), i, lua_wstring, |
123 | sizeof(lua_string)/sizeof(TCHAR)); | 123 | sizeof(lua_string)/sizeof(TCHAR)); |
124 | if(size > 0) wcstombs(lua_string, lua_wstring, size + 1); | 124 | if(size > 0) wcstombs(lua_string, lua_wstring, size + 1); |
125 | #else | 125 | #else |
126 | size = LoadString(GetModuleHandle(NULL), i, lua_string, | 126 | size = LoadString(GetModuleHandle(NULL), i, lua_string, |
127 | sizeof(lua_string)/sizeof(char)); | 127 | sizeof(lua_string)/sizeof(char)); |
128 | #endif | 128 | #endif |
129 | if(size) luaL_addlstring(&b, lua_string, size); else break; | 129 | if(size) luaL_addlstring(&b, lua_string, size); else break; |
130 | } | 130 | } |
131 | luaL_pushresult(&b); | 131 | luaL_pushresult(&b); |
132 | if (runlua (L, lua_tostring(L, -1), argc, argv)) { | 132 | if (runlua (L, lua_tostring(L, -1), argc, argv)) { |
133 | report (L); | 133 | report (L); |
134 | lua_close (L); | 134 | lua_close (L); |
135 | return EXIT_FAILURE; | 135 | return EXIT_FAILURE; |
136 | } | 136 | } |
137 | lua_close (L); | 137 | lua_close (L); |
138 | return EXIT_SUCCESS; | 138 | return EXIT_SUCCESS; |
139 | } | 139 | } |