From 794752c3c2e9d1de594098816d1bd6d0fa7a1ba7 Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Tue, 4 Oct 2022 14:08:58 +0300 Subject: [PATCH] Embedded metadata --- Cargo.lock | 131 ++++++++++++++++++++++++++++----------------------- Cargo.toml | 5 +- build.rs | 16 ++++++- resources.rc | 3 -- 4 files changed, 88 insertions(+), 67 deletions(-) delete mode 100644 resources.rc diff --git a/Cargo.lock b/Cargo.lock index bd6b9cc..3738fbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "atty" version = "0.2.14" @@ -40,18 +49,27 @@ version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-integer", + "num-traits", + "time", + "wasm-bindgen", + "winapi 0.3.9", +] + [[package]] name = "clap" version = "3.1.12" @@ -124,17 +142,10 @@ dependencies = [ ] [[package]] -name = "embed-resource" -version = "1.7.2" +name = "core-foundation-sys" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc24ff8d764818e9ab17963b0593c535f077a513f565e75e4352d758bc4d8c0" -dependencies = [ - "cc", - "rustc_version", - "toml", - "vswhom", - "winreg", -] +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "flume" @@ -195,6 +206,19 @@ dependencies = [ "libc", ] +[[package]] +name = "iana-time-zone" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "js-sys", + "wasm-bindgen", + "winapi 0.3.9", +] + [[package]] name = "indexmap" version = "1.8.1" @@ -238,9 +262,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.124" +version = "0.2.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" +checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" [[package]] name = "libm" @@ -331,6 +355,16 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.14" @@ -500,15 +534,6 @@ version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - [[package]] name = "ryu" version = "1.0.9" @@ -521,12 +546,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "semver" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" - [[package]] name = "serde" version = "1.0.136" @@ -581,8 +600,8 @@ name = "stremio-shell-ng" version = "5.0.0" dependencies = [ "bitflags", + "chrono", "clap", - "embed-resource", "flume", "kernel32-sys", "libmpv", @@ -601,6 +620,7 @@ dependencies = [ "whoami", "win32job", "winapi 0.3.9", + "winres", ] [[package]] @@ -691,6 +711,17 @@ dependencies = [ "syn", ] +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi", + "winapi 0.3.9", +] + [[package]] name = "toml" version = "0.5.9" @@ -733,31 +764,11 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "vswhom" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" -dependencies = [ - "libc", - "vswhom-sys", -] - -[[package]] -name = "vswhom-sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22025f6d8eb903ebf920ea6933b70b1e495be37e2cb4099e62c80454aaf57c39" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" @@ -916,10 +927,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "winreg" -version = "0.10.1" +name = "winres" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" dependencies = [ - "winapi 0.3.9", + "toml", ] diff --git a/Cargo.toml b/Cargo.toml index f34a24c..0a2e29f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ winapi = { version = "0.3.9", features = [ ] } webview2 = "0.1.0" webview2-sys = "0.1.0-beta.1" -libmpv = "2.0.1" +libmpv = "2.0.1" libmpv-sys = "3.1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -35,6 +35,7 @@ kernel32-sys = "0.2" whoami = "1.2.1" [build-dependencies] -embed-resource = "1.3" +winres = "0.1" +chrono = "0.4.22" [dev-dependencies] serde_test = "1.0.*" diff --git a/build.rs b/build.rs index 588147f..65fcee9 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,16 @@ -extern crate embed_resource; +use chrono::{Datelike, Local}; +use std::env; + +extern crate winres; fn main() { - embed_resource::compile("resources.rc"); + 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("FileDescription", "Freedom to Stream"); + res.set("LegalCopyright", ©right); + 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(); } diff --git a/resources.rc b/resources.rc deleted file mode 100644 index 16a9977..0000000 --- a/resources.rc +++ /dev/null @@ -1,3 +0,0 @@ -#define RT_MANIFEST 24 -MAINICON ICON "images/stremio.ico" -SPLASHIMAGE IMAGE "images/stremio.png" \ No newline at end of file