mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Build action to create universal uv binary
This commit is contained in:
parent
7ba32cce6d
commit
bd10f7faab
2 changed files with 30 additions and 0 deletions
|
@ -19,6 +19,7 @@ use ninja_gen::inputs;
|
|||
use ninja_gen::protobuf::check_proto;
|
||||
use ninja_gen::protobuf::setup_protoc;
|
||||
use ninja_gen::python::setup_uv;
|
||||
use ninja_gen::python::setup_uv_universal;
|
||||
use ninja_gen::Build;
|
||||
use platform::overriden_python_target_platform;
|
||||
use pylib::build_pylib;
|
||||
|
@ -61,6 +62,7 @@ fn main() -> Result<()> {
|
|||
build_and_check_aqt(build)?;
|
||||
|
||||
if env::var("OFFLINE_BUILD").is_err() {
|
||||
setup_uv_universal(build)?;
|
||||
build_bundle(build)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use crate::archives::download_and_extract;
|
|||
use crate::archives::with_exe;
|
||||
use crate::archives::OnlineArchive;
|
||||
use crate::archives::Platform;
|
||||
use crate::command::RunCommand;
|
||||
use crate::hash::simple_hash;
|
||||
use crate::input::BuildInput;
|
||||
use crate::inputs;
|
||||
|
@ -80,6 +81,16 @@ pub fn setup_uv(build: &mut Build, platform: Platform) -> Result<()> {
|
|||
};
|
||||
build.add_dependency("uv_binary", uv_binary);
|
||||
|
||||
// Our macOS packaging needs access to the x86 binary on ARM.
|
||||
download_and_extract(
|
||||
build,
|
||||
"uv_mac_x86",
|
||||
uv_archive(Platform::MacX64),
|
||||
hashmap! { "bin" => [
|
||||
with_exe("uv")
|
||||
] },
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -269,3 +280,20 @@ impl BuildAction for PythonTest {
|
|||
true
|
||||
}
|
||||
}
|
||||
|
||||
pub fn setup_uv_universal(build: &mut Build) -> Result<()> {
|
||||
build.add_action(
|
||||
"bundle:uv_universal",
|
||||
RunCommand {
|
||||
command: "/usr/bin/lipo",
|
||||
args: "-create -output $out $arm_bin $x86_bin",
|
||||
inputs: hashmap! {
|
||||
"arm_bin" => inputs![":extract:uv:bin"],
|
||||
"x86_bin" => inputs![":extract:uv_mac_x86:bin"],
|
||||
},
|
||||
outputs: hashmap! {
|
||||
"out" => vec!["bundle/uv"],
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue