38
38
- x86_64-apple-darwin
39
39
- aarch64-apple-darwin
40
40
- x86_64-unknown-freebsd
41
+ - loongarch64-unknown-linux-gnu
41
42
include :
42
43
- os : ubuntu-latest
43
44
target : x86_64-unknown-linux-musl
@@ -130,6 +131,13 @@ jobs:
130
131
strip : false
131
132
compress : false
132
133
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 : " "
133
141
134
142
env :
135
143
CARGO_INCREMENTAL : 0
@@ -154,8 +162,45 @@ jobs:
154
162
rustup default nightly
155
163
cross build --release --locked --target=${{ matrix.target }} ${{ matrix.cargo_flags }}
156
164
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
159
204
run : |
160
205
rustup target add ${{ matrix.target }}
161
206
cargo build --release --locked --target=${{ matrix.target }} ${{ matrix.cargo_flags }}
0 commit comments