stremio-shell-ng/build.rs
Vladimir Borisov b8a0345b0d
Some checks failed
Continuous integration / test (push) Has been cancelled
Arm64 installer
2025-12-18 12:40:50 +02:00

48 lines
1.8 KiB
Rust

use chrono::{Datelike, Local};
use std::{env, fs, io::Cursor, path::PathBuf};
extern crate winres;
fn main() {
let now = Local::now();
let copyright = format!("Copyright © {} Smart Code OOD", now.year());
let exe_name = format!("{}.exe", env::var("CARGO_PKG_NAME").unwrap());
let mut res = winres::WindowsResource::new();
res.set_manifest(
r#"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
"#,
);
res.set("FileDescription", "Freedom to Stream");
res.set("LegalCopyright", &copyright);
res.set("OriginalFilename", &exe_name);
res.set_icon_with_id("images/stremio.ico", "MAINICON");
res.append_rc_content(r##"SPLASHIMAGE IMAGE "images/stremio.png""##);
res.compile().unwrap();
//extract libmpv-2
let target = std::env::var("TARGET").unwrap();
let (arch, archive, flags) = match target.as_str() {
"x86_64-pc-windows-msvc" => ("x64", "libmpv-2_x64.zip", "/LIBPATH:.\\mpv-x64"),
"aarch64-pc-windows-msvc" => ("arm64", "libmpv-2_arm64.zip", "/LIBPATH:.\\mpv-arm64"),
_ => panic!("Unsupported target {}", target),
};
println!("cargo:rustc-env=ARCH={}", arch);
println!("cargo:rustc-link-arg={}", flags);
let archive = fs::read(archive).unwrap();
let target_dir = PathBuf::from(".");
zip_extract::extract(Cursor::new(archive), &target_dir, true).ok();
}