summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2015-12-04 21:35:21 +0800
committerruki <[email protected]>2015-12-04 21:35:21 +0800
commit95cc4b92a1b940058c2cc8f2bdf0e05ae222a33e (patch)
tree2461948d420fcbe2ade286c60358e66d3caa1d34
parent55c9ce5e25f0b7a41c5b3d58436f3621f817f599 (diff)
get extractor for windows
-rw-r--r--xmake/scripts/base/makefile.lua10
-rw-r--r--xmake/scripts/platform/windows/prober.lua1
-rw-r--r--xmake/scripts/platform/windows/tools/extract.lua76
-rw-r--r--xmake/scripts/platform/windows/windows.lua1
4 files changed, 80 insertions, 8 deletions
diff --git a/xmake/scripts/base/makefile.lua b/xmake/scripts/base/makefile.lua
index 48550809a..934772fe5 100644
--- a/xmake/scripts/base/makefile.lua
+++ b/xmake/scripts/base/makefile.lua
@@ -98,15 +98,9 @@ function makefile._make_object_for_static(file, target, srcfile, objfile)
else mode = "" end
-- get extractor name
- local toolname = nil
- local extractor, errors = tools.get("ex")
- if not extractor then
- utils.error(errors)
- return false
- end
- toolname = extractor.name
+ local toolname = platform.tool("ex")
if not toolname then
- utils.error("cannot get the extractor name!")
+ utils.error("cannot get extractor!")
return false
end
diff --git a/xmake/scripts/platform/windows/prober.lua b/xmake/scripts/platform/windows/prober.lua
index a8ccb9a42..d32fac686 100644
--- a/xmake/scripts/platform/windows/prober.lua
+++ b/xmake/scripts/platform/windows/prober.lua
@@ -239,6 +239,7 @@ function prober._probe_toolchains(configs)
if not prober._probe_toolpath(configs, "ld", "link.exe", "the linker") then return false end
if not prober._probe_toolpath(configs, "ar", "link.exe -lib", "the static library linker") then return false end
if not prober._probe_toolpath(configs, "sh", "link.exe -dll", "the shared library linker") then return false end
+ if not prober._probe_toolpath(configs, "ex", "lib.exe", "the library extractor") then return false end
if not prober._probe_toolpath(configs, "make", "nmake.exe", "the make") then return false end
-- leave envirnoment
diff --git a/xmake/scripts/platform/windows/tools/extract.lua b/xmake/scripts/platform/windows/tools/extract.lua
new file mode 100644
index 000000000..593807cdd
--- /dev/null
+++ b/xmake/scripts/platform/windows/tools/extract.lua
@@ -0,0 +1,76 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2009 - 2015, ruki All rights reserved.
+--
+-- @author ruki
+-- @file extract.lua
+--
+
+-- define module: extract
+local extract = extract or {}
+
+-- load modules
+local os = require("base/os")
+local path = require("base/path")
+local utils = require("base/utils")
+local string = require("base/string")
+
+-- the main function
+--
+-- extract /home/[lib]xxx.[a|lib] /home/xxx/*.[o|obj]
+-- only support: lib -extract membername -out xxx.obj
+function extract.main(self, ...)
+
+ -- check
+ local args = ...
+ assert(#args == 3)
+
+ -- get toolname
+ local toolname = args[1]
+ assert(toolname)
+
+ -- be not ar?
+ if not toolname:find("lib.exe", 1, true) then
+ utils.error("%s is not lib.exe!", toolname)
+ return false
+ end
+
+ -- get library and object file path
+ local libfile = args[2]
+ local objfile = args[3]
+ assert(libfile and objfile)
+
+ -- get object directory
+ local objdir = path.directory(objfile)
+ if not os.isdir(objdir) then os.mkdir(objdir) end
+ if not os.isdir(objdir) then
+ utils.error("%s not found!", objdir)
+ return false
+ end
+
+ -- trace
+ print(toolname, libfile, objfile, objdir)
+
+ -- abort
+ assert(false)
+
+ -- ok
+ return true
+end
+
+-- return module: extract
+return extract
diff --git a/xmake/scripts/platform/windows/windows.lua b/xmake/scripts/platform/windows/windows.lua
index 6a7a84881..00aa4f8ad 100644
--- a/xmake/scripts/platform/windows/windows.lua
+++ b/xmake/scripts/platform/windows/windows.lua
@@ -113,6 +113,7 @@ function windows.make(configs)
configs.tools.ar = config.get("ar")
configs.tools.sh = config.get("sh")
configs.tools.as = config.get("as")
+ configs.tools.ex = config.get("ex")
end