diff --git a/Cargo.lock b/Cargo.lock index 98dace6..099f3cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2224,7 +2224,7 @@ dependencies = [ [[package]] name = "mouth" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "arboard", @@ -2252,6 +2252,7 @@ dependencies = [ "tray-icon", "windows-sys 0.59.0", "winit", + "winresource", ] [[package]] @@ -3635,6 +3636,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3962,7 +3972,7 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml", + "toml 0.8.2", "version-compare", ] @@ -4179,11 +4189,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", - "serde_spanned", + "serde_spanned 0.6.9", "toml_datetime 0.6.3", "toml_edit 0.20.2", ] +[[package]] +name = "toml" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.1", +] + [[package]] name = "toml_datetime" version = "0.6.3" @@ -4221,7 +4246,7 @@ checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap", "serde", - "serde_spanned", + "serde_spanned 0.6.9", "toml_datetime 0.6.3", "winnow 0.5.40", ] @@ -4247,6 +4272,12 @@ dependencies = [ "winnow 1.0.1", ] +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + [[package]] name = "tower" version = "0.5.3" @@ -5303,6 +5334,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winresource" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087" +dependencies = [ + "toml 1.1.2+spec-1.1.0", + "version_check", +] + [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/Cargo.toml b/Cargo.toml index 5c4686d..9bc4970 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,5 +67,8 @@ serde_json = "1" anyhow = "1" thiserror = "2" +[build-dependencies] +winresource = "0.1" + [target.'cfg(windows)'.dependencies] windows-sys = { version = "0.59", features = ["Win32_System_Console", "Win32_UI_WindowsAndMessaging", "Win32_System_Pipes", "Win32_System_IO", "Win32_Storage_FileSystem", "Win32_Foundation", "Win32_Security"] } diff --git a/assets/mouth.ico b/assets/mouth.ico new file mode 100644 index 0000000..e1eb988 Binary files /dev/null and b/assets/mouth.ico differ diff --git a/assets/mouth.rc b/assets/mouth.rc new file mode 100644 index 0000000..1c09602 --- /dev/null +++ b/assets/mouth.rc @@ -0,0 +1 @@ +1 ICON "assets/mouth.ico" diff --git a/build-win.sh b/build-win.sh new file mode 100755 index 0000000..89a523a --- /dev/null +++ b/build-win.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +~/.cargo/bin/cargo xwin build --release --target x86_64-pc-windows-msvc +cp target/x86_64-pc-windows-msvc/release/mouth.exe /mnt/nas/xfer/mouth/ +echo "Done: /mnt/nas/xfer/mouth/mouth.exe" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..4a4492c --- /dev/null +++ b/build.rs @@ -0,0 +1,10 @@ +fn main() { + let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); + if target_os == "windows" { + let mut res = winresource::WindowsResource::new(); + res.set_icon("assets/mouth.ico"); + if let Err(e) = res.compile() { + eprintln!("cargo:warning=Failed to embed Windows icon: {e}"); + } + } +} diff --git a/release.sh b/release.sh index 55b1fd5..a9c6266 100755 --- a/release.sh +++ b/release.sh @@ -55,14 +55,15 @@ FAILED=() build_target() { local target="$1" local label="$2" - local ext="${3:-}" + local friendly_name="$3" + local ext="${4:-}" echo "--- Building ${label} (${target}) ---" if cargo build --release --target "${target}" 2>&1; then local binary="target/${target}/release/${BINARY_NAME}${ext}" if [ -f "${binary}" ]; then - local archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-${target}" + local archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-${friendly_name}" if [ -n "${ext}" ]; then # Windows: ship the exe directly cp "${binary}" "${archive}${ext}" @@ -91,7 +92,7 @@ build_target() { # ============================================================ # Linux x86_64 (native — always available) -build_target "x86_64-unknown-linux-gnu" "Linux x86_64" +build_target "x86_64-unknown-linux-gnu" "Linux x86_64" "linux-x86_64" # Windows x86_64 (MSVC target via cargo-xwin) if command -v cargo-xwin &>/dev/null && rustup target list --installed | grep -q x86_64-pc-windows-msvc; then @@ -99,7 +100,7 @@ if command -v cargo-xwin &>/dev/null && rustup target list --installed | grep -q if cargo xwin build --release --target x86_64-pc-windows-msvc 2>&1; then local_binary="target/x86_64-pc-windows-msvc/release/${BINARY_NAME}.exe" if [ -f "${local_binary}" ]; then - archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-x86_64-pc-windows-msvc.exe" + archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-windows-x86_64.exe" cp "${local_binary}" "${archive}" echo " -> ${archive}" BUILT+=("${archive}")