build: add target armv7-unknown-linux-gnueabihf, aarch64-unknown-linux-gnu

This commit is contained in:
Shunsuke Shibayama 2023-04-12 15:20:19 +09:00
parent 5dbcb7721c
commit 7c9e47d015
3 changed files with 11 additions and 9 deletions

View file

@ -22,17 +22,14 @@ jobs:
strategy:
matrix:
include:
## permission denied?
# - target: armv7-unknown-linux-gnueabihf
# os: ubuntu-latest
# - target: aarch64-unknown-linux-gnu
# os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
# - target: x86_64-unknown-linux-musl
# os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc

4
Cross.toml Normal file
View file

@ -0,0 +1,4 @@
[target.aarch64-unknown-linux-gnu]
pre-build = ["apt-get update && apt-get install --assume-yes python3"]
[target.armv7-unknown-linux-gnueabihf]
pre-build = ["apt-get update && apt-get install --assume-yes python3"]

View file

@ -3,6 +3,7 @@
//! CPythonを呼び出すためのユーティリティー
use std::process::Command;
use crate::fn_name_full;
use crate::serialize::get_magic_num_from_bytes;
#[cfg(unix)]
@ -535,11 +536,11 @@ pub fn which_python() -> String {
let out = Command::new(cmd)
.arg(python)
.output()
.expect("python not found");
.unwrap_or_else(|_| panic!("{}: {python} not found", fn_name_full!()));
let res = String::from_utf8(out.stdout).unwrap();
let res = res.split('\n').next().unwrap_or("").replace('\r', "");
if res.is_empty() {
println!("python not found");
println!("{}: {python} not found", fn_name_full!());
std::process::exit(1);
} else if res.contains("pyenv") && cfg!(windows) {
println!("cannot use pyenv-win"); // because pyenv-win does not support `-c` option