Skip to content

Commit 785782a

Browse files
committed
try build
1 parent 925694b commit 785782a

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
include:
1919
- { os: ubuntu-20.04, target: x86_64-unknown-linux-gnu, platform: linux-x64, cross: general }
2020
- { os: ubuntu-22.04, target: aarch64-unknown-linux-gnu, platform: linux-arm64, cross: aarch64 }
21-
- { os: ubuntu-20.04, target: x86_64-unknown-linux-musl, platform: linux-musl, cross: musl }
21+
- { os: ubuntu-20.04, target: x86_64-unknown-linux-musl, platform: linux-musl, cross: cross }
2222
- { os: ubuntu-22.04, target: x86_64-unknown-freebsd, platform: linux-bsd, cross: bsd }
2323
- { os: macos-latest, target: x86_64-apple-darwin, platform: darwin-x64, cross: general }
2424
- { os: macos-latest, target: aarch64-apple-darwin, platform: darwin-arm64, cross: general }
@@ -36,13 +36,8 @@ jobs:
3636
run: |
3737
rustup target add ${{ matrix.target }}
3838
cargo build --release --target ${{ matrix.target }} --target-dir target/${{ matrix.platform }}
39-
- name: Build - musl
40-
if: ${{ matrix.cross == 'musl' }}
41-
run: |
42-
cargo install cross
43-
cross build --release --target ${{ matrix.target }} --target-dir target/${{ matrix.platform }}
44-
- name: Build - aarch64
45-
if: ${{ matrix.cross == 'aarch64' }}
39+
- name: Build - cross
40+
if: ${{ matrix.cross == 'cross' }}
4641
run: |
4742
cargo install cross
4843
cross build --release --target ${{ matrix.target }} --target-dir target/${{ matrix.platform }}

build.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
1+
use std::{env, process::Command};
2+
13
fn main() {
24
std::env::set_var("CC_LOG", "1");
5+
if cfg!(target_os = "linux") && cfg!(target_arch = "aarch64") {
6+
std::env::set_var("CC", "aarch64-linux-gnu-gcc");
7+
std::env::set_var("CXX", "aarch64-linux-gnu-g++");
8+
print_compiler_version();
9+
}
10+
311
build_lua();
412
build_lua_seri();
513
build_lpeglabel();
614
cfg!(windows).then(|| build_setfilemode());
715
build_emmyluacodestyle();
816
}
917

18+
fn print_compiler_version() {
19+
if cfg!(target_os = "linux") {
20+
let cc = env::var("CC").unwrap_or_else(|_| {
21+
"gcc".to_string()
22+
});
23+
24+
let cc_version = Command::new(&cc)
25+
.arg("--version")
26+
.output()
27+
.expect("Failed to execute CC command");
28+
println!(
29+
"CC version:\n{}",
30+
String::from_utf8_lossy(&cc_version.stdout)
31+
);
32+
33+
let cxx = env::var("CXX").unwrap_or_else(|_| {
34+
"g++".to_string()
35+
});
36+
37+
let cxx_version = Command::new(&cxx)
38+
.arg("--version")
39+
.output()
40+
.expect("Failed to execute CXX command");
41+
println!(
42+
"CXX version:\n{}",
43+
String::from_utf8_lossy(&cxx_version.stdout)
44+
);
45+
}
46+
}
47+
1048
fn build_lua() {
1149
cc::Build::new()
1250
.include("3rd/lua")

0 commit comments

Comments
 (0)