Skip to content

Commit ac6871a

Browse files
authored
Merge pull request #72 from rcitach/rcitach/xuantie
add xuantie toolchain
2 parents f1611c9 + 16f2ee7 commit ac6871a

File tree

17 files changed

+197
-22
lines changed

17 files changed

+197
-22
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- aarch64
3737
- arm
3838
- riscv64gc
39+
- xuantie
3940

4041
steps:
4142
- name: ⬇️ checkout
@@ -44,7 +45,11 @@ jobs:
4445
submodules: true
4546

4647
- name: ⬇️ install xmake
47-
uses: xmake-io/github-action-setup-xmake@v1
48+
shell: bash
49+
run: |
50+
wget -q https://github.com/xmake-io/xmake/releases/download/v2.8.7/xmake-v2.8.7.gz.run
51+
sudo chmod 777 ./xmake-v2.8.7.gz.run
52+
./xmake-v2.8.7.gz.run
4853
4954
- name: 👷 build
5055
shell: bash
@@ -85,7 +90,8 @@ jobs:
8590
export XMAKE_ROOT=y # Only need to use "--root" in CI
8691
xmake --version
8792
source env.sh
88-
pushd apps/${{ matrix.app }}
93+
pushd apps
94+
echo "includes(path.join(path.join(os.scriptdir(), \"${{ matrix.app }}\"), \"xmake.lua\"))" > xmake.lua
8995
xmake f -a x86_64 --target_os=linux -vyD
9096
xmake -j$(nproc) -vyD -P .
9197
popd

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua
5555
xmake f -a aarch64 # 配置为 aarch64平台,如果不执行该条指令进行配置,则默认为 aarch64
5656
xmake -j$(nproc)
5757
```
58-
59-
目前支持的平台:arm、aarch64、riscv64gc。
58+
> 如果使用其他平台,只需修改上述的配置命令,然后再执行编译命令,这里以xuantie平台为例:
59+
> `xmake f -a xuantie`
60+
> 目前支持的平台:arm、aarch64、riscv64gc、xuantie。
61+
> 注:目前xuantie平台只验证了busybox
6062
6163
![image-20230531173059551](./assets/image-20230531173059551.png)
6264

apps/xmake.lua

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
for _, packagedir in ipairs(os.dirs(path.join(os.scriptdir(), "*"))) do
2-
local packagefile = path.join(packagedir, "xmake.lua")
3-
if os.isfile(packagefile) then
4-
includes(packagefile)
1+
local arch = get_config("arch")
2+
if arch == "xuantie" then
3+
local run_apps = {
4+
"busybox",
5+
"cpp",
6+
"hello",
7+
"shm_ping",
8+
"shm_pong",
9+
"smart-fetch",
10+
"zlib",
11+
}
12+
for _, packagedir in ipairs(run_apps) do
13+
local packagefile = path.join(path.join(os.scriptdir(), packagedir), "xmake.lua")
14+
if os.isfile(packagefile) then
15+
includes(packagefile)
16+
end
17+
end
18+
else
19+
for _, packagedir in ipairs(os.dirs(path.join(os.scriptdir(), "*"))) do
20+
local packagefile = path.join(packagedir, "xmake.lua")
21+
if os.isfile(packagefile) then
22+
includes(packagefile)
23+
end
524
end
625
end

repo/packages/f/ffmpeg/xmake.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ do
6666
if package:config("shared") then
6767
table.insert(configs, "--enable-shared")
6868
end
69-
69+
table.insert(configs, "--disable-doc")
7070
local buildenvs = import("package.tools.autoconf").buildenvs(package,
7171
{ldflags = ldflags, packagedeps = packagedeps})
7272
import("package.tools.autoconf").configure(package, configs, {envs = buildenvs})
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.

0 commit comments

Comments
 (0)