use winres in portable

This commit is contained in:
rustdesk 2024-03-04 22:19:18 +08:00
parent eff6ac254f
commit 794636e208
5 changed files with 33 additions and 60 deletions

47
Cargo.lock generated
View File

@ -1834,19 +1834,6 @@ version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "embed-resource"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f54cc3e827ee1c3812239a9a41dede7b4d7d5d5464faa32d71bd7cba28ce2cb2"
dependencies = [
"cc",
"rustc_version",
"toml 0.8.6",
"vswhom",
"winreg 0.51.0",
]
[[package]]
name = "encoding_rs"
version = "0.8.33"
@ -5512,13 +5499,13 @@ dependencies = [
[[package]]
name = "rustdesk-portable-packer"
version = "0.1.0"
version = "1.2.4"
dependencies = [
"brotli",
"dirs 5.0.1",
"embed-resource",
"md5",
"winapi 0.3.9",
"winres",
]
[[package]]
@ -6923,26 +6910,6 @@ dependencies = [
"log",
]
[[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.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3b17ae1f6c8a2b28506cd96d412eebf83b4a0ff2cbefeeb952f2f9dfa44ba18"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "waker-fn"
version = "1.1.1"
@ -7706,16 +7673,6 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "winreg"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc"
dependencies = [
"cfg-if 1.0.0",
"windows-sys 0.48.0",
]
[[package]]
name = "winres"
version = "0.1.12"

View File

@ -162,9 +162,8 @@ members = ["libs/scrap", "libs/hbb_common", "libs/enigo", "libs/clipboard", "lib
exclude = ["vdi/host", "examples/custom_plugin"]
[package.metadata.winres]
LegalCopyright = "Copyright © 2023 Purslane, Inc."
# this FileDescription overrides package.description
FileDescription = "RustDesk"
LegalCopyright = "Copyright © 2024 Purslane, Inc."
OriginalFilename = "rustdesk.exe"
[target.'cfg(target_os="windows")'.build-dependencies]
winres = "0.1"

View File

@ -1,17 +1,25 @@
[package]
name = "rustdesk-portable-packer"
version = "0.1.0"
version = "1.2.4"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
build = "build.rs"
[build-dependencies]
embed-resource = "2.1"
[dependencies]
brotli = "3.4"
dirs = "5.0"
md5 = "0.7"
winapi = { version = "0.3", features = ["winbase"] }
[package.metadata.winres]
LegalCopyright = "Copyright © 2024 Purslane, Inc."
ProductName = "rustdesk"
#ProductVersion = ""
[target.'cfg(target_os="windows")'.build-dependencies]
winres = "0.1"
winapi = { version = "0.3", features = [ "winnt", "pdh", "synchapi" ] }

View File

@ -1,10 +1,19 @@
extern crate embed_resource;
use std::fs;
fn main() {
let runner_res_path = "Runner.res";
match fs::metadata(runner_res_path) {
Ok(_) => println!("cargo:rustc-link-lib=dylib:+verbatim=./libs/portable/Runner.res"),
Err(_) => embed_resource::compile("icon.rc", embed_resource::NONE),
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
res.set_icon("../../res/icon.ico")
.set_language(winapi::um::winnt::MAKELANGID(
winapi::um::winnt::LANG_ENGLISH,
winapi::um::winnt::SUBLANG_ENGLISH_US,
))
.set_manifest_file("../../res/manifest.xml");
match res.compile() {
Err(e) => {
write!(std::io::stderr(), "{}", e).unwrap();
std::process::exit(1);
}
Ok(_) => {}
}
}
}

View File

@ -1,3 +1,3 @@
#! /usr/bin/env bash
sed -i "s/$1/$2/g" res/*spec res/PKGBUILD flutter/pubspec.yaml Cargo.toml .github/workflows/*yml flatpak/*json appimage/*yml
sed -i "s/$1/$2/g" res/*spec res/PKGBUILD flutter/pubspec.yaml Cargo.toml .github/workflows/*yml flatpak/*json appimage/*yml libs/portable/Cargo.toml
cargo run # to bump version in cargo lock