aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.bat56
-rw-r--r--win32/bin/objdump.exebin0 -> 2247694 bytes
2 files changed, 47 insertions, 9 deletions
diff --git a/install.bat b/install.bat
index 2150d2c3..4e1ede31 100644
--- a/install.bat
+++ b/install.bat
@@ -18,6 +18,7 @@ vars.LUA_LIBNAME = nil
18vars.LUA_VERSION = "5.1" 18vars.LUA_VERSION = "5.1"
19vars.LUA_SHORTV = nil 19vars.LUA_SHORTV = nil
20vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a" 20vars.LUA_LIB_NAMES = "lua5.1.lib lua51.dll liblua.dll.a"
21vars.LUA_RUNTIME = nil
21 22
22local P_SET = false 23local P_SET = false
23local FORCE = false 24local FORCE = false
@@ -263,6 +264,39 @@ local function look_for_headers (directory)
263 return false 264 return false
264end 265end
265 266
267local function get_runtime()
268 local infile = vars.LUA_BINDIR .."\\"..vars.LUA_INTERPRETER
269 local outfile = "output.txt"
270 local content
271 -- analyze binary
272 if exec([[.\bin\objdump -x "]]..infile..[[" > ]]..outfile) then
273 -- read temp file
274 local fh = io.open(outfile)
275 content = fh:read("*a")
276 fh:close()
277 end
278 -- delete temp file
279 os.remove(outfile)
280 if not content then
281 print(" Failed to analyze "..infile.." for the runtime used")
282 return false
283 end
284
285 -- lookup
286 content = content:upper()
287 local result = content:match('DLL NAME%: (MSVCR%d*)%.DLL')
288 if not result then
289 result = content:match('DLL NAME%: (MSVCRT)%.DLL')
290 end
291
292 if result then
293 vars.LUA_RUNTIME = result
294 print(" "..vars.LUA_INTERPRETER.." uses "..tostring(result)..".DLL as runtime")
295 return true
296 end
297 return false
298end
299
266local function look_for_lua_install () 300local function look_for_lua_install ()
267 print("Looking for Lua interpreter") 301 print("Looking for Lua interpreter")
268 local directories = { [[c:\lua5.1.2]], [[c:\lua]], [[c:\kepler\1.1]] } 302 local directories = { [[c:\lua5.1.2]], [[c:\lua]], [[c:\kepler\1.1]] }
@@ -275,7 +309,7 @@ local function look_for_lua_install ()
275 look_for_headers(vars.LUA_INCDIR) 309 look_for_headers(vars.LUA_INCDIR)
276 then 310 then
277 if exec(S"$LUA_BINDIR\\$LUA_INTERPRETER -v 2>NUL") then 311 if exec(S"$LUA_BINDIR\\$LUA_INTERPRETER -v 2>NUL") then
278 print(" Ok") 312 print(" Ok")
279 return true 313 return true
280 end 314 end
281 end 315 end
@@ -290,12 +324,15 @@ local function look_for_lua_install ()
290 if look_for_link_libraries(directory) then 324 if look_for_link_libraries(directory) then
291 print("Link library found, now looking for headers...") 325 print("Link library found, now looking for headers...")
292 if look_for_headers(directory) then 326 if look_for_headers(directory) then
293 print("Headers found, now testing interpreter...") 327 print("Headers found, checking runtime to use...")
294 if exec(S[[$LUA_BINDIR\$LUA_INTERPRETER -v 2>NUL]]) then 328 if get_runtime() then
295 print(" Ok") 329 print("Runtime found, now testing interpreter...")
296 return true 330 if exec(S[[$LUA_BINDIR\$LUA_INTERPRETER -v 2>NUL]]) then
331 print(" Ok")
332 return true
333 end
334 print(" Interpreter returned an error, not ok")
297 end 335 end
298 print(" Interpreter returned an error, not ok")
299 end 336 end
300 end 337 end
301 end 338 end
@@ -358,6 +395,7 @@ if not look_for_lua_install() then
358 vars.LUA_LIBDIR = vars.LIBDIR 395 vars.LUA_LIBDIR = vars.LIBDIR
359 vars.LUA_INCDIR = vars.INCDIR 396 vars.LUA_INCDIR = vars.INCDIR
360 vars.LUA_LIBNAME = "lua5.1.lib" 397 vars.LUA_LIBNAME = "lua5.1.lib"
398 vars.LUA_RUNTIME = "MSVCR80"
361else 399else
362 print(S[[ 400 print(S[[
363 401
@@ -367,7 +405,7 @@ Lua interpreter: $LUA_BINDIR\$LUA_INTERPRETER
367Lua binaries : $LUA_BINDIR 405Lua binaries : $LUA_BINDIR
368Lua libraries : $LUA_LIBDIR 406Lua libraries : $LUA_LIBDIR
369Lua includes : $LUA_INCDIR 407Lua includes : $LUA_INCDIR
370Binaries will be linked against: $LUA_LIBNAME 408Binaries will be linked against: $LUA_LIBNAME with runtime $LUA_RUNTIME
371 409
372]]) 410]])
373end 411end
@@ -521,10 +559,10 @@ rocks_trees = {
521 f:write(S"scripts_dir=[[$SCRIPTS_DIR]]\n") 559 f:write(S"scripts_dir=[[$SCRIPTS_DIR]]\n")
522 end 560 end
523 f:write("variables = {\n") 561 f:write("variables = {\n")
524 if USE_MINGW then 562 if USE_MINGW and vars.LUA_RUNTIME == "MSVCRT" then
525 f:write(" MSVCRT = 'm',\n") 563 f:write(" MSVCRT = 'm',\n")
526 else 564 else
527 f:write(" MSVCRT = 'msvcr80',\n") 565 f:write(" MSVCRT = '"..vars.LUA_RUNTIME.."',\n")
528 end 566 end
529 f:write(S" LUALIB = '$LUA_LIBNAME'\n") 567 f:write(S" LUALIB = '$LUA_LIBNAME'\n")
530 f:write("}\n") 568 f:write("}\n")
diff --git a/win32/bin/objdump.exe b/win32/bin/objdump.exe
new file mode 100644
index 00000000..4429d103
--- /dev/null
+++ b/win32/bin/objdump.exe
Binary files differ