|
| 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 |
0 commit comments