Skip to content

Commit 5ea1ebf

Browse files
committed
add xuantie toolchain and support busybox
1 parent f1611c9 commit 5ea1ebf

14 files changed

Lines changed: 121 additions & 5 deletions

File tree

apps/xmake.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
for _, packagedir in ipairs(os.dirs(path.join(os.scriptdir(), "*"))) do
2-
local packagefile = path.join(packagedir, "xmake.lua")
1+
local arch = get_config("arch")
2+
if arch == "xuantie" then
3+
local packagefile = path.join(path.join(os.scriptdir(), "busybox"), "xmake.lua")
34
if os.isfile(packagefile) then
45
includes(packagefile)
56
end
7+
else
8+
for _, packagedir in ipairs(os.dirs(path.join(os.scriptdir(), "*"))) do
9+
local packagefile = path.join(packagedir, "xmake.lua")
10+
if os.isfile(packagefile) then
11+
includes(packagefile)
12+
end
13+
end
614
end

repo/packages/b/busybox/xmake.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ do
4949
local sdk = rtflags.get_sdk()
5050
table.join2(ldflags, sdk.ldflags)
5151
table.join2(cxflags, sdk.cxflags)
52+
table.join2(cxflags, " -Wno-return-mismatch ")
5253

5354
os.vcp(path.join(os.scriptdir(), "port", version, ".config"), ".")
5455
io.gsub(".config", "CONFIG_PREFIX=.-\n", 'CONFIG_PREFIX="' .. package:installdir() .. '"')
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
-- Licensed under the Apache License, Version 2.0 (the "License");
2+
-- You may not use this file except in compliance with the License.
3+
-- You may obtain a copy of the License at
4+
--
5+
-- http://www.apache.org/licenses/LICENSE-2.0
6+
--
7+
-- Unless required by applicable law or agreed to in writing, software
8+
-- distributed under the License is distributed on an "AS IS" BASIS,
9+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
-- See the License for the specific language governing permissions and
11+
-- limitations under the License.
12+
--
13+
-- Copyright (C) 2023-2023 RT-Thread Development Team
14+
--
15+
-- @author xqyjlj
16+
-- @file xmake.lua
17+
--
18+
-- Change Logs:
19+
-- Date Author Notes
20+
-- ------------ ---------- -----------------------------------------------
21+
-- 2023-05-12 xqyjlj initial version
22+
--
23+
package("xuantie-900-gcc-musl")
24+
do
25+
set_kind("toolchain")
26+
set_homepage("https://www.xrvm.cn/")
27+
set_description("riscv64 xuantie embedded compiler for rt-smart.")
28+
29+
local version = os.getenv("RT_XMAKE_TOOLCHAIN_XUANTIE_VERSION")
30+
local sha256 = os.getenv("RT_XMAKE_TOOLCHAIN_XUANTIE_SHA256")
31+
32+
if is_host("linux") then
33+
add_urls(
34+
"https://github.com/RT-Thread/toolchains-ci/releases/download/v1.9/Xuantie-900-gcc-linux-6.6.0-musl64-x86_64-V$(version).tar.gz")
35+
36+
if (version and sha256) then
37+
add_versions(version, sha256)
38+
else
39+
add_versions("3.0.2", "26b338747a10cc32c8b83f340ce1980b786e7a0445380a70544867b6ed10199b")
40+
end
41+
end
42+
43+
on_install("@windows", "@linux|x86_64", function(package)
44+
os.vcp("*", package:installdir(), {rootdir = ".", symlink = true})
45+
package:addenv("PATH", "bin")
46+
end)
47+
48+
on_test(function(package)
49+
local gcc = "riscv64-unknown-linux-musl-gcc"
50+
if is_host("windows") then
51+
gcc = gcc .. ".exe"
52+
end
53+
local file = os.tmpfile() .. ".c"
54+
io.writefile(file, "int main(int argc, char** argv) {return 0;}")
55+
os.vrunv(gcc, {"-c", file})
56+
end)
57+
end
3.93 KB
Binary file not shown.
7.61 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
59.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)