diff options
| author | ruki <[email protected]> | 2016-05-24 20:42:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-05-24 20:42:12 +0800 |
| commit | 487eda865797da4fc81ba8ba8ec932dc2fb64cec (patch) | |
| tree | a731cdefc5607d65e03219d1e1625f62518eb52c /xmake/tools | |
| parent | e932acd1440734e5977bd23176c9ac7a133f6b53 (diff) | |
impl extractor using ar
Diffstat (limited to 'xmake/tools')
| -rw-r--r-- | xmake/tools/ar.lua | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/xmake/tools/ar.lua b/xmake/tools/ar.lua index e100db74a..de220ca88 100644 --- a/xmake/tools/ar.lua +++ b/xmake/tools/ar.lua @@ -21,11 +21,14 @@ -- -- init it -function init(shellname) +function init(shellname, kind) -- save the shell name _g.shellname = shellname or "ar" + -- save the tool kind + _g.kind = kind or "ar" + -- init arflags _g.arflags = { "-cr" } @@ -47,15 +50,42 @@ function linkdir(dir) end -- make the link command -function linkcmd(objfiles, targetfile, flags) +function linkcmd(objectfiles, targetfile, flags) -- make it - return format("%s %s %s %s", _g.shellname, flags, targetfile, objfiles) + return format("%s %s %s %s", _g.shellname, flags, targetfile, objectfiles) +end + +-- extract the static library to object directory +function extract(libraryfile, objectdir) + + -- make the object directory first + os.mkdir(objectdir) + + -- get the absolute path of this library + libraryfile = path.absolute(libraryfile) + + -- enter the object directory + os.cd(objectdir) + + -- extract it + os.run("%s -x %s", _g.shellname, libraryfile) + + -- TODO + -- check repeat object name + + -- leave the object directory + os.cd("-") end -- run command function run(...) + -- extract it + if _g.kind == "ex" then + return extract(...) + end + -- run it os.run(...) end |
