diff options
| author | ruki <[email protected]> | 2019-04-25 22:36:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-04-25 09:36:41 +0800 |
| commit | 64a34fcca6999e1e0478d77d86801a8bf5fbff21 (patch) | |
| tree | 455d4e0ba2d104a9ee4dd43fce1eb14cec43ebf4 | |
| parent | 34ceb97cebf1addf9456222078aab1b78425594c (diff) | |
support mingw for autoconf
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 54 | ||||
| -rw-r--r-- | xmake/platforms/mingw/config.lua | 10 |
2 files changed, 34 insertions, 30 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index 852a2e628..69873f1bb 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -31,28 +31,36 @@ function _get_configs(package, configs) -- add host for cross-complation if not configs.host and not package:is_plat(os.host()) then if package:is_plat("iphoneos") then - local hosts = { arm64 = "aarch64-apple-darwin", - arm64e = "aarch64-apple-darwin", - armv7 = "armv7-apple-darwin", - armv7s = "armv7s-apple-darwin", - i386 = "i386-apple-darwin", - x86_64 = "x86_64-apple-darwin"} - table.insert(configs, "--host=" .. (hosts[package:arch()] or "aarch64-apple-darwin")) + local triples = + { + arm64 = "aarch64-apple-darwin", + arm64e = "aarch64-apple-darwin", + armv7 = "armv7-apple-darwin", + armv7s = "armv7s-apple-darwin", + i386 = "i386-apple-darwin", + x86_64 = "x86_64-apple-darwin" + } + table.insert(configs, "--host=" .. (triples[package:arch()] or triples.arm64)) elseif package:is_plat("android") then -- @see https://developer.android.com/ndk/guides/other_build_systems#autoconf local triples = { - ["armv5te"] = "arm-linux-androideabi" - , ["armv7-a"] = "arm-linux-androideabi" - , ["arm64-v8a"] = "aarch64-linux-android" - , i386 = "i686-linux-android" - , x86_64 = "x86_64-linux-android" - , mips = "mips-linux-android" - , mips64 = "mips64-linux-android" + ["armv5te"] = "arm-linux-androideabi", + ["armv7-a"] = "arm-linux-androideabi", + ["arm64-v8a"] = "aarch64-linux-android", + i386 = "i686-linux-android", + x86_64 = "x86_64-linux-android", + mips = "mips-linux-android", + mips64 = "mips64-linux-android" + } + table.insert(configs, "--host=" .. (triples[package:arch()] or triples["armv7-a"])) + elseif package:is_plat("mingw") then + local triples = + { + i386 = "i686-w64-mingw32", + x86_64 = "x86_64-w64-mingw32" } - table.insert(configs, "--host=" .. (triples[package:arch()] or "arm-linux-androideabi")) - elseif package:is_plat("cross") then - -- TODO + table.insert(configs, "--host=" .. (triples[package:arch()] or triples.i386)) else raise("autoconf: unknown platform(%s)!", package:plat()) end @@ -105,18 +113,6 @@ function _enter_envs(package) os.addenvp("ARFLAGS", package:build_getenv("arflags"), ' ') os.addenvp("LDFLAGS", package:build_getenv("ldflags"), ' ') os.addenvp("SHFLAGS", package:build_getenv("shflags"), ' ') - if package:is_plat("android") then - local gcc_toolchain = config.get("gcc_toolchain") - if not gcc_toolchain then - local bindir = config.get("bin") - if bindir then - gcc_toolchain = path.directory(bindir) - end - end - if gcc_toolchain and os.isdir(gcc_toolchain) then - os.setenv("TOOLCHAIN", gcc_toolchain) - end - end end for _, dep in ipairs(package:orderdeps()) do local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") diff --git a/xmake/platforms/mingw/config.lua b/xmake/platforms/mingw/config.lua index 4cdce32ef..8d96e5a44 100644 --- a/xmake/platforms/mingw/config.lua +++ b/xmake/platforms/mingw/config.lua @@ -58,13 +58,15 @@ function _toolchains() -- init toolchains local cc = toolchain("the c compiler") local cxx = toolchain("the c++ compiler") + local cpp = toolchain("the c preprocessor") local ld = toolchain("the linker") local sh = toolchain("the shared library linker") local ar = toolchain("the static library archiver") local ex = toolchain("the static library extractor") + local ranlib = toolchain("the static library index generator") local as = toolchain("the assember") local mrc = toolchain("the resource compiler") - local toolchains = {cc = cc, cxx = cxx, as = as, ld = ld, sh = sh, ar = ar, ex = ex, mrc = mrc} + local toolchains = {cc = cc, cxx = cxx, cpp = cpp, as = as, ld = ld, sh = sh, ar = ar, ex = ex, ranlib = ranlib, mrc = mrc} -- init the c compiler cc:add("$(env CC)", {name = "gcc", cross = cross}) @@ -74,6 +76,9 @@ function _toolchains() cxx:add({name = "gcc", cross = cross}) cxx:add({name = "g++", cross = cross}) + -- init the c preprocessor + cpp:add("$(env CPP)", {name = "gcc -E", cross = cross}) + -- init the assember as:add("$(env AS)", {name = "gcc", cross = cross}) @@ -93,6 +98,9 @@ function _toolchains() -- init the static library extractor ex:add("$(env AR)", {name = "ar", cross = cross}) + -- init the static library extractor + ranlib:add("$(env RANLIB)", {name = "ranlib", cross = cross}) + -- init the resource compiler mrc:add({name = "windres", cross = cross}) |
