Skip to content

Commit a509025

Browse files
committed
feat: support build for loongarch64-unknown-linux-gnu
update update update update fix home dir update update update update update fix fix update update update update update update1
1 parent 92bb9e3 commit a509025

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
- x86_64-apple-darwin
3939
- aarch64-apple-darwin
4040
- x86_64-unknown-freebsd
41+
- loongarch64-unknown-linux-gnu
4142
include:
4243
- os: ubuntu-latest
4344
target: x86_64-unknown-linux-musl
@@ -130,6 +131,13 @@ jobs:
130131
strip: false
131132
compress: false
132133
cargo_flags: ""
134+
- os: ubuntu-latest
135+
target: loongarch64-unknown-linux-gnu
136+
artifact_name: ps-tree
137+
cross: false
138+
strip: false
139+
compress: false
140+
cargo_flags: ""
133141

134142
env:
135143
CARGO_INCREMENTAL: 0
@@ -154,8 +162,45 @@ jobs:
154162
rustup default nightly
155163
cross build --release --locked --target=${{ matrix.target }} ${{ matrix.cargo_flags }}
156164
157-
- name: Build with Cargo
158-
if: ${{ !matrix.cross }}
165+
- name: Build with Cargo (Unix)
166+
if: runner.os != 'windows' && matrix.cross == false
167+
shell: bash
168+
run: |
169+
rustup target add ${{ matrix.target }}
170+
171+
if [ ${{ matrix.target }} = "loongarch64-unknown-linux-gnu" ]; then
172+
# 定义远程文件 URL 和本地目录
173+
REMOTE_URL="https://github.com/loongson/build-tools/releases/download/2024.06.01/x86_64-cross-tools-loongarch64-binutils_2.42-gcc_14.1.0-glibc_2.39.tar.xz"
174+
TARGET_DIR="$HOME/.local/share/loongarch64-unknown-linux-gnu"
175+
176+
# 下载远程 tar.xz 文件
177+
echo "Downloading tar.xz archive..."
178+
wget "$REMOTE_URL" -O /tmp/archive.tar.xz
179+
180+
# 解压到目标目录
181+
echo "Extracting archive to $TARGET_DIR..."
182+
mkdir -p "$TARGET_DIR"
183+
tar -xf /tmp/archive.tar.xz -C "$TARGET_DIR"
184+
185+
# 设置环境变量
186+
export LC_ALL=POSIX
187+
export CROSS_TARGET="loongarch64-unknown-linux-gnu"
188+
export MABI="lp64d"
189+
export BUILD64="-mabi=lp64d"
190+
export PATH=$PATH:$TARGET_DIR/cross-tools/bin
191+
export JOBS=-j8
192+
export CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-unknown-linux-gnu-gcc
193+
export CC_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc
194+
export CXX_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-g++
195+
export AR_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-ar
196+
export RANLIB_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-ranlib
197+
export LINKER_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc
198+
fi
199+
200+
cargo build --release --locked --target=${{ matrix.target }} ${{ matrix.cargo_flags }}
201+
202+
- name: Build with Cargo (Windows)
203+
if: runner.os == 'Windows' && matrix.cross == false
159204
run: |
160205
rustup target add ${{ matrix.target }}
161206
cargo build --release --locked --target=${{ matrix.target }} ${{ matrix.cargo_flags }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# gpm
1+
# ps-tree.rs
22

33
[![ci](https://github.com/axetroy/ps-tree.rs/actions/workflows/ci.yml/badge.svg)](https://github.com/axetroy/ps-tree.rs/actions/workflows/ci.yml)
44
[![ci](https://github.com/axetroy/ps-tree.rs/actions/workflows/build.yml/badge.svg)](https://github.com/axetroy/ps-tree.rs/actions/workflows/build.yml)

0 commit comments

Comments
 (0)