Skip to content

Commit 0d2bd15

Browse files
authored
Merge pull request #5548 from Redbeanw44602/dev
Add missing Linux platform triples in autoconf tool.
2 parents 47e72b2 + a81b8dc commit 0d2bd15

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

xmake/modules/package/tools/autoconf.lua

+17-13
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,6 @@ function _get_msvc_runenvs(package)
7777
return os.joinenvs(_get_msvc(package):runenvs())
7878
end
7979

80-
-- is cross compilation?
81-
function _is_cross_compilation(package)
82-
if not package:is_plat(os.subhost()) then
83-
return true
84-
end
85-
if package:is_plat("macosx") and not package:is_arch(os.subarch()) then
86-
return true
87-
end
88-
return false
89-
end
90-
9180
-- get memcache
9281
function _memcache()
9382
return memcache.cache("package.tools.autoconf")
@@ -115,7 +104,7 @@ function _get_configs(package, configs)
115104
table.insert(configs, "--prefix=" .. _translate_paths(package:installdir()))
116105

117106
-- add host for cross-complation
118-
if not configs.host and _is_cross_compilation(package) then
107+
if not configs.host and package:is_cross() then
119108
if package:is_plat("iphoneos", "macosx") then
120109
local triples =
121110
{
@@ -150,6 +139,21 @@ function _get_configs(package, configs)
150139
x86_64 = "x86_64-w64-mingw32"
151140
}
152141
table.insert(configs, "--host=" .. (triples[package:arch()] or triples.i386))
142+
elseif package:is_plat("linux") then
143+
local triples =
144+
{
145+
["arm64-v8a"] = "aarch64-linux-gnu",
146+
arm64 = "aarch64-linux-gnu",
147+
i386 = "i686-linux-gnu",
148+
x86_64 = "x86_64-linux-gnu",
149+
armv7 = "arm-linux-gnueabihf",
150+
mips = "mips-linux-gnu",
151+
mips64 = "mips64-linux-gnu",
152+
mipsel = "mipsel-linux-gnu",
153+
mips64el = "mips64el-linux-gnu",
154+
loong64 = "loongarch64-linux-gnu"
155+
}
156+
table.insert(configs, "--host=" .. (triples[package:arch()] or triples.i386))
153157
elseif package:is_plat("cross") and package:targetos() then
154158
local host = package:arch()
155159
if package:is_arch("arm64") then
@@ -240,7 +244,7 @@ function buildenvs(package, opt)
240244
local envs = {}
241245
local cross = false
242246
local cflags, cxxflags, cppflags, asflags, ldflags, shflags, arflags
243-
if not _is_cross_compilation(package) and not package:config("toolchains") then
247+
if not package:is_cross() and not package:config("toolchains") then
244248
cppflags = {}
245249
cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags"))
246250
cxxflags = table.join(table.wrap(package:config("cxflags")), package:config("cxxflags"))

xmake/modules/private/action/trybuild/autoconf.lua

+17-13
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ end
6868
function _get_buildenvs()
6969
local envs = {}
7070
local cross = false
71-
if not _is_cross_compilation() then
71+
if not is_cross() then
7272
local cflags = table.join(table.wrap(_get_buildenv("cxflags")), _get_buildenv("cflags"))
7373
local cxxflags = table.join(table.wrap(_get_buildenv("cxflags")), _get_buildenv("cxxflags"))
7474
local asflags = table.copy(table.wrap(_get_buildenv("asflags")))
@@ -174,17 +174,6 @@ function _get_buildenvs()
174174
return envs
175175
end
176176

177-
-- is cross compilation?
178-
function _is_cross_compilation()
179-
if not is_plat(os.subhost()) then
180-
return true
181-
end
182-
if is_plat("macosx") and not is_arch(os.subarch()) then
183-
return true
184-
end
185-
return false
186-
end
187-
188177
-- get configs
189178
function _get_configs(artifacts_dir)
190179

@@ -201,7 +190,7 @@ function _get_configs(artifacts_dir)
201190
end
202191

203192
-- add host for cross-complation
204-
if _is_cross_compilation() then
193+
if is_cross() then
205194
if is_plat("iphoneos", "macosx") then
206195
local triples =
207196
{
@@ -236,6 +225,21 @@ function _get_configs(artifacts_dir)
236225
x86_64 = "x86_64-w64-mingw32"
237226
}
238227
table.insert(configs, "--host=" .. (triples[config.arch()] or triples.i386))
228+
elseif is_plat("linux") then
229+
local triples =
230+
{
231+
["arm64-v8a"] = "aarch64-linux-gnu",
232+
arm64 = "aarch64-linux-gnu",
233+
i386 = "i686-linux-gnu",
234+
x86_64 = "x86_64-linux-gnu",
235+
armv7 = "arm-linux-gnueabihf",
236+
mips = "mips-linux-gnu",
237+
mips64 = "mips64-linux-gnu",
238+
mipsel = "mipsel-linux-gnu",
239+
mips64el = "mips64el-linux-gnu",
240+
loong64 = "loongarch64-linux-gnu"
241+
}
242+
table.insert(configs, "--host=" .. (triples[config.arch()] or triples.i386))
239243
elseif is_plat("cross") then
240244
local host = config.arch()
241245
if is_arch("arm64") then

0 commit comments

Comments
 (0)