diff --git a/Cargo.lock b/Cargo.lock index b507c76..f5515b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2273,7 +2273,7 @@ dependencies = [ [[package]] name = "sanzu" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "bindgen 0.63.0", @@ -2314,6 +2314,7 @@ dependencies = [ "vsock", "webpki-roots", "winapi", + "winres", "x11-clipboard", "x11rb 0.11.0", "x509-parser", @@ -3202,6 +3203,14 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +[[package]] +name = "winres" +version = "0.1.11" +source = "git+https://github.com/serpilliere/winres?branch=link_resources#7f4f86eadc2e005b94ac56e210c55e64d217c6ef" +dependencies = [ + "toml", +] + [[package]] name = "x11-clipboard" version = "0.7.0" diff --git a/sanzu/Cargo.toml b/sanzu/Cargo.toml index d6f6a41..51ea99d 100644 --- a/sanzu/Cargo.toml +++ b/sanzu/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sanzu" -version = "0.1.0" +version = "0.1.1" authors = ["Fabrice Desclaux "] edition = "2018" readme = "README.md" @@ -10,6 +10,7 @@ license = "GPL-3.0" [build-dependencies] bindgen = "0.63" cc = "1.0" +winres = {git = "https://github.com/serpilliere/winres", branch="link_resources"} [dependencies] anyhow = "1.0" @@ -108,6 +109,9 @@ assets = [ { source = "README.md", dest = "/usr/share/doc/sanzu/README", mode = "0644", doc = true }, ] +[package.metadata.winres] +LegalCopyright = "Copyright © 2021-2023" +FileDescription = "Sanzu video server, proxy and client" # Compilation for Windows: # export PKG_CONFIG_ALLOW_CROSS=1 diff --git a/sanzu/build.rs b/sanzu/build.rs new file mode 100644 index 0000000..7c96765 --- /dev/null +++ b/sanzu/build.rs @@ -0,0 +1,31 @@ +extern crate winres; + +fn main() { + // only run if target os is windows + if std::env::var("CARGO_CFG_TARGET_OS").unwrap() != "windows" { + return; + } + // only build the resource for release builds + // as calling rc.exe might be slow + if std::env::var("PROFILE").unwrap() == "release" { + let mut res = winres::WindowsResource::new(); + if cfg!(unix) { + // paths for X64 on archlinux + res.set_toolkit_path("/usr/bin"); + // ar tool for mingw in toolkit path + res.set_ar_path("/usr/bin/x86_64-w64-mingw32-ar"); + // windres tool + res.set_windres_path("/usr/bin/x86_64-w64-mingw32-windres"); + } + + res.set_icon("data/icons/sanzu.ico") + // can't use winapi crate constants for cross compiling + // MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US ) + .set_language(0x0409) + .set_manifest_file("data/winres/manifest.xml"); + if let Err(e) = res.compile() { + eprintln!("{}", e); + std::process::exit(1); + } + } +} diff --git a/sanzu/data/icons/sanzu.ico b/sanzu/data/icons/sanzu.ico new file mode 100644 index 0000000..f12951c Binary files /dev/null and b/sanzu/data/icons/sanzu.ico differ diff --git a/sanzu/data/winres/manifest.xml b/sanzu/data/winres/manifest.xml new file mode 100644 index 0000000..2204418 --- /dev/null +++ b/sanzu/data/winres/manifest.xml @@ -0,0 +1,40 @@ + + + + + Sanzu + + + + + + + + + + + + + + + + + + + + + + +