From 412edc3d3e250aec7f6cfdb6a85d53cbafce49b6 Mon Sep 17 00:00:00 2001 From: Bono Fox Date: Wed, 22 Oct 2025 15:26:35 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A5=20Removed=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8aa6472..7b4a189 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,6 @@ readme = "README.md" keywords = ["obsbot", "tiny2", "camera", "webcam", "linux"] categories = ["hardware-support"] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] tiny4linux_assets = { git = "https://github.com/OpenFoxes/Tiny4Linux-Icons", rev = "ba11e78" } iced = { version = "0.13.0", features = ["image", "tokio"] } From 52340bd1bd9f18f5deeec78836e1bb31d6961480 Mon Sep 17 00:00:00 2001 From: Bono Fox Date: Wed, 22 Oct 2025 15:54:31 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20#58:=20Separated=20GUI?= =?UTF-8?q?-=20and=20CLI-features?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - optional feature dependencies for each binary - only necessary dependencies are downloaded - optimizes especially the cli-version --- Cargo.toml | 18 ++++++++++++------ build.rs | 24 ++++++++++++++++++++---- deployment/cli/aur/PKGBUILD | 2 +- deployment/gui/aur/PKGBUILD | 2 +- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7b4a189..acf4549 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,13 @@ readme = "README.md" keywords = ["obsbot", "tiny2", "camera", "webcam", "linux"] categories = ["hardware-support"] +[features] +gui = ["iced", "tiny4linux_assets"] +cli = ["clap", "clap_complete", "dialoguer"] + [dependencies] -tiny4linux_assets = { git = "https://github.com/OpenFoxes/Tiny4Linux-Icons", rev = "ba11e78" } -iced = { version = "0.13.0", features = ["image", "tokio"] } +tiny4linux_assets = { git = "https://github.com/OpenFoxes/Tiny4Linux-Icons", rev = "ba11e78", optional = true } +iced = { version = "0.13.0", features = ["image", "tokio"], optional = true } nix = { version = "0.30.0", features = ["ioctl"] } errno = "0.3.14" hex = "0.4.3" @@ -23,17 +27,19 @@ glob = "0.3.3" enum_dispatch = "0.3.13" thiserror = "2.0.0" hexdump = "0.1.2" -clap = { version = "4.4.18", features = ["derive"] } -clap_complete = "4.5.59" -dialoguer = { version = "0.12.0", features = ["fuzzy-select"] } +clap = { version = "4.4.18", features = ["derive"], optional = true } +clap_complete = { version = "4.5.59", optional = true } +dialoguer = { version = "0.12.0", features = ["fuzzy-select"], optional = true } [build-dependencies] -tiny4linux_assets = { git = "https://github.com/OpenFoxes/Tiny4Linux-Icons", rev = "ba11e78" } +tiny4linux_assets = { git = "https://github.com/OpenFoxes/Tiny4Linux-Icons", rev = "ba11e78", optional = true } [[bin]] name = "tiny4linux-gui" path = "src/gui/main.rs" +required-features = ["gui"] [[bin]] name = "tiny4linux-cli" path = "src/cli/main.rs" +required-features = ["cli"] diff --git a/build.rs b/build.rs index 0a41383..f96e385 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,19 @@ -use std::fs; -use std::path::Path; -use tiny4linux_assets::absolute_path_for_t4l_asset; - fn main() { + let gui_feature_enabled = std::env::var("CARGO_FEATURE_GUI").is_ok(); + + if !gui_feature_enabled { + return; + } + + build_gui_assets(); +} + +#[cfg(feature = "gui")] +fn build_gui_assets() { + use std::fs; + use std::path::Path; + use tiny4linux_assets::absolute_path_for_t4l_asset; + let asset_src = absolute_path_for_t4l_asset("generated/png/title-icon/v2.0-soft-shadow.png"); let out_dir = std::env::var("OUT_DIR").unwrap(); @@ -17,3 +28,8 @@ fn main() { println!("cargo:rerun-if-changed={}", asset_src.display()); } + +#[cfg(not(feature = "gui"))] +fn build_gui_assets() { + // Noop +} diff --git a/deployment/cli/aur/PKGBUILD b/deployment/cli/aur/PKGBUILD index cd39cc9..b6e971d 100644 --- a/deployment/cli/aur/PKGBUILD +++ b/deployment/cli/aur/PKGBUILD @@ -14,7 +14,7 @@ source=("$url/releases/download/v$pkgver/tiny4linux-$pkgver.tar.gz") sha256sums=('2e2fb12ed6080c35dd389a0c0b30906cf9abab0c2fd7035296c7e4fa41728df6') build() { - cargo build --release --locked + cargo build --release --features cli --locked } package() { diff --git a/deployment/gui/aur/PKGBUILD b/deployment/gui/aur/PKGBUILD index 3c4ecac..90fbe5a 100644 --- a/deployment/gui/aur/PKGBUILD +++ b/deployment/gui/aur/PKGBUILD @@ -14,7 +14,7 @@ source=("$url/releases/download/v$pkgver/tiny4linux-$pkgver.tar.gz") sha256sums=('2e2fb12ed6080c35dd389a0c0b30906cf9abab0c2fd7035296c7e4fa41728df6') build() { - cargo build --release --locked + cargo build --release --features gui --locked } package() {