diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-19 00:07:03 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-06-28 17:28:40 -0300 |
commit | d90c3c918a2555eff8776e1acabab7a777f13c31 (patch) | |
tree | 5db5cb5c4b9bc1017fb388957ad0261a619d2679 /src | |
parent | ccbf7cde13d12059dfd24dd8206ec92f09e10033 (diff) | |
download | luarocks-d90c3c918a2555eff8776e1acabab7a777f13c31.tar.gz luarocks-d90c3c918a2555eff8776e1acabab7a777f13c31.tar.bz2 luarocks-d90c3c918a2555eff8776e1acabab7a777f13c31.zip |
fs.win32.pe-parser: copy get_architecture from install.bat
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/fs/win32/pe-parser.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/luarocks/fs/win32/pe-parser.lua b/src/luarocks/fs/win32/pe-parser.lua index 9cd36ffc..34556812 100644 --- a/src/luarocks/fs/win32/pe-parser.lua +++ b/src/luarocks/fs/win32/pe-parser.lua | |||
@@ -550,4 +550,19 @@ function M.msvcrt(infile) | |||
550 | return nil, "No msvcrt found" | 550 | return nil, "No msvcrt found" |
551 | end | 551 | end |
552 | 552 | ||
553 | function M.get_architecture(program) | ||
554 | -- detect processor arch interpreter was compiled for | ||
555 | local proc = (M.parse(program) or {}).Machine | ||
556 | if not proc then | ||
557 | return nil, "Could not detect processor architecture used in "..program | ||
558 | end | ||
559 | proc = M.const.Machine[proc] -- collect name from constant value | ||
560 | if proc == "IMAGE_FILE_MACHINE_I386" then | ||
561 | proc = "x86" | ||
562 | else | ||
563 | proc = "x86_64" | ||
564 | end | ||
565 | return proc | ||
566 | end | ||
567 | |||
553 | return M | 568 | return M |