Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve cross for zig and pack xmake bundle for linux #6069

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,26 @@ jobs:
sudo apt install -y ruby ruby-dev rubygems build-essential llvm libc++-dev
sudo apt install -y libgl1-mesa-dev libglu1-mesa-dev
clang --version
xrepo install -y zig

- name: Tests
run: |
xmake lua -v -D tests/run.lua
xrepo --version

- name: Artifact
run: |
cd core
xrepo env -b zig xmake f --embed=y --toolchain=zig --cross=x86_64-linux-gnu.2.29 -c
xmake
mkdir ../artifacts
cp build/xmake ../artifacts/xmake-bundle
cd ..
- uses: actions/upload-artifact@v4
with:
name: xmake-bundle.linux.x86_64
path: artifacts/xmake-bundle

- name: Publish
if: github.event.action == 'published'
env:
Expand All @@ -57,3 +71,14 @@ jobs:
scripts/makeppa bionic # 18.04
scripts/makeppa xenial # 16.04
scripts/makeppa trusty # 14.04

- name: Publish bundle binary
if: github.event.action == 'published'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/xmake-bundle
asset_name: xmake-bundle-${{ steps.tagName.outputs.tag }}.linux.x86_64
asset_content_type: application/zip
37 changes: 19 additions & 18 deletions xmake/toolchains/zig/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,26 @@ toolchain("zig")
end

-- init target
local target
if toolchain:is_plat("cross") then
-- xmake f -p cross --toolchain=zig --cross=mips64el-linux-gnuabi64
target = toolchain:cross()
elseif toolchain:is_plat("macosx") then
--@see https://github.com/ziglang/zig/issues/14226
target = arch .. "-macos-none"
elseif toolchain:is_plat("linux") then
if arch == "arm" then
target = "arm-linux-gnueabi"
elseif arch == "mips64" or arch == "mips64el" then
target = arch .. "-linux-gnuabi64"
else
target = arch .. "-linux-gnu"
local target = toolchain:cross()
if target == nil then
if toolchain:is_plat("cross") then
-- xmake f -p cross --toolchain=zig --cross=mips64el-linux-gnuabi64
elseif toolchain:is_plat("macosx") then
--@see https://github.com/ziglang/zig/issues/14226
target = arch .. "-macos-none"
elseif toolchain:is_plat("linux") then
if arch == "arm" then
target = "arm-linux-gnueabi"
elseif arch == "mips64" or arch == "mips64el" then
target = arch .. "-linux-gnuabi64"
else
target = arch .. "-linux-gnu"
end
elseif toolchain:is_plat("windows") then
target = arch .. "-windows-msvc"
elseif toolchain:is_plat("mingw") then
target = arch .. "-windows-gnu"
end
elseif toolchain:is_plat("windows") then
target = arch .. "-windows-msvc"
elseif toolchain:is_plat("mingw") then
target = arch .. "-windows-gnu"
end
if target then
toolchain:add("asflags", "-target", target)
Expand Down
Loading