From f8b7b621b2d00e97f75bfa97683d94866740bf9b Mon Sep 17 00:00:00 2001 From: Muktar Sadiq Date: Wed, 14 Jan 2026 19:02:19 +0100 Subject: [PATCH 1/3] Add cargo-binstall support and adopt Rust target triple naming --- .github/workflows/cd.yml | 42 ++++++++++++++++++++++++++++-- Cargo.toml | 46 ++++++++++++++++++++++++++++----- docs/src/installation/README.md | 43 ++++++++++++++++++++++++++---- 3 files changed, 118 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2dc0bf79..a365c4c0 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -86,6 +86,26 @@ jobs: run: | features="--no-default-features --features ${{ matrix.dbus }},${{ matrix.audio_backends }}" echo CARGO_ARGS="--locked --release $features" | tee -a "$GITHUB_ENV" + - name: Determine target triple + id: target_triple + shell: bash + run: | + # Map OS/arch to Rust target target_triple + if [ "${{ matrix.target }}" != "" ]; then + # Use the cross-compilation target if specified + TARGET_TRIPLE="${{ matrix.target }}" + elif [ "${{ matrix.os }}" = "linux" ] && [ "${{ matrix.arch }}" = "x86_64" ]; then + TARGET_TRIPLE="x86_64-unknown-linux-gnu" + elif [ "${{ matrix.os }}" = "macos" ] && [ "${{ matrix.arch }}" = "x86_64" ]; then + TARGET_TRIPLE="x86_64-apple-darwin" + elif [ "${{ matrix.os }}" = "macos" ] && [ "${{ matrix.arch }}" = "aarch64" ]; then + TARGET_TRIPLE="aarch64-apple-darwin" + else + echo "Unknown target: ${{ matrix.os }}-${{ matrix.arch }}" + exit 1 + fi + echo "target_triple=$TARGET_TRIPLE" >> $GITHUB_OUTPUT + echo "Target triple: $TARGET_TRIPLE" - name: Build (using cargo) if: matrix.target == '' run: | @@ -99,10 +119,15 @@ jobs: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} args: $CARGO_ARGS - - name: Uploading artifacts + - name: Uploading artifacts (new naming) + uses: actions/upload-artifact@v4 + with: + name: spotifyd-${{ steps.target_triple.outputs.target_triple }}-${{ matrix.artifact_type }} + path: target/${{ matrix.target }}/release/spotifyd + - name: Uploading artifacts (legacy naming - deprecated) uses: actions/upload-artifact@v4 with: - name: spotifyd-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.artifact_type }} + name: spotifyd-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.artifact_type }}-legacy path: target/${{ matrix.target }}/release/spotifyd release: # only runs when a version tag is pushed if: startsWith(github.ref, 'refs/tags/v') @@ -118,6 +143,8 @@ jobs: do pushd $artifact_dir artifact_name=$(basename $artifact_dir) + # Remove -legacy suffix for old naming format + artifact_name=${artifact_name%-legacy} tar czvf $artifact_name.tar.gz spotifyd shasum -a 512 $artifact_name.tar.gz > $artifact_name.sha512 popd @@ -128,5 +155,16 @@ jobs: files: | **/*.tar.gz **/*.sha512 + body: | + ## Asset Naming Change + Starting with this release, we're transitioning to Rust's standard target triple naming convention to support `cargo-binstall`. + + **New format:** `spotifyd-{target-triple}-{variant}.tar.gz` + - Example: `spotifyd-x86_64-unknown-linux-gnu-full.tar.gz` + + **Legacy format** (deprecated, will be removed in next release): `spotifyd-{os}-{arch}-{variant}.tar.gz` + - Example: `spotifyd-linux-x86_64-full-legacy.tar.gz` + + Both formats are available in this release for backwards compatibility. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index 25b32407..9edbe2e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,9 @@ [package] -authors = ["Simon Persson ", "Sven Lechner ", "eladyn "] +authors = [ + "Simon Persson ", + "Sven Lechner ", + "eladyn ", +] edition = "2024" name = "spotifyd" description = "A Spotify daemon" @@ -23,7 +27,12 @@ libc = "0.2.82" log = "0.4.6" serde = { version = "1.0.115", features = ["derive"] } sha-1 = "0.10" -tokio = {version = "1.44.2", features = ["signal", "rt-multi-thread", "process", "io-std"] } +tokio = { version = "1.44.2", features = [ + "signal", + "rt-multi-thread", + "process", + "io-std", +] } tokio-stream = "0.1.7" url = "2.2.2" librespot-audio = { version = "0.8.0", default-features = false } @@ -38,7 +47,9 @@ toml = "0.9.8" color-eyre = "0.6" directories = "6.0.0" thiserror = "2.0" -time = { version = "0.3.37", default-features = false, features = ["formatting"] } +time = { version = "0.3.37", default-features = false, features = [ + "formatting", +] } clap = { version = "4.5.23", features = ["derive"] } serde_ignored = "0.1.10" @@ -71,9 +82,21 @@ rodiojack_backend = ["librespot-playback/rodiojack-backend"] depends = "$auto" features = ["pulseaudio_backend", "dbus_mpris"] assets = [ - ["target/release/spotifyd", "usr/bin/", "755"], - ["README.md", "usr/share/doc/spotifyd/README", "644"], - ["contrib/spotifyd.service", "etc/systemd/user/", "644"], + [ + "target/release/spotifyd", + "usr/bin/", + "755", + ], + [ + "README.md", + "usr/share/doc/spotifyd/README", + "644", + ], + [ + "contrib/spotifyd.service", + "etc/systemd/user/", + "644", + ], ] [package.metadata.generate-rpm] @@ -83,6 +106,17 @@ assets = [ { source = "contrib/spotifyd.service", dest = "/etc/systemd/user/spotifyd.service", mode = "644" }, ] +# cargo-binstall support +[package.metadata.binstall] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }-full{ archive-suffix }" +bin-dir = "{ bin }{ binary-ext }" +pkg-fmt = "tgz" +disabled-strategies = ["quick-install", "compile"] + +[package.metadata.binstall.overrides.x86_64-pc-windows-msvc] +pkg-fmt = "zip" + + [profile.release] lto = true diff --git a/docs/src/installation/README.md b/docs/src/installation/README.md index 89ec672b..d38522b7 100644 --- a/docs/src/installation/README.md +++ b/docs/src/installation/README.md @@ -3,6 +3,22 @@ Getting `spotifyd` on your system should be as easy as downloading a binary in most cases. If you'd like to learn how to compile `spotifyd` yourself, head over to [building from source](./source.md). +## Using cargo-binstall (Recommended) + +If you have Rust installed, the easiest way to install `spotifyd` is using `cargo-binstall` + +```console +cargo binstall spotifyd +``` + +This will automatically download and install the appropriate pre-built binary for your system with all features enabled (`full` variant). + +If you don't have `cargo-binstall` installed yet, you can get it with: + +```console +cargo install cargo-binstall +``` + ## Linux Some linux distributions include `spotifyd` in their official repositories. Have a look at [Repology](https://repology.org/project/spotifyd/versions) @@ -41,22 +57,39 @@ and the platform architecture that they were built for. You can find the latest If you're unsure which version to choose, just go for `default` on desktop systems and `slim` on headless systems. +**Asset Naming Convention:** +Starting with version 0.4.2, release assets follow Rust's standard target triple naming format: + +Format: `spotifyd-{target-triple}-{variant}.tar.gz` + +Examples: +`spotifyd-x86_64-unknown-linux-gnu-full.tar.gz` +`spotifyd-aarch64-apple-darwin-default.tar.gz` +`spotifyd-armv7-unknown-linux-gnueabihf-slim.tar.gz` + +**Legacy naming:** (deprecated, available only in version 0.4.2 for backwards compatibility) +`spotifyd-linux-x86_64-full-legacy.tar.gz` +`spotifyd-macos-aarch64-default-legacy.tar.gz` + **Architecture:** If you're on Linux, check your platform architecture with `uname -m`: -- `x86_64`: Download one of the `spotifyd-linux-x86_64-{full,default,slim}.tar.gz` packages. -- `armhf`, `armv7`: Download one of the `spotifyd-linux-armv7-{full,default,slim}.tar.gz` packages. -- `aarch64`: Download one of the `spotifyd-linux-aarch64-{full,default,slim}.tar.gz` +- `x86_64`: Download one of the `spotifyd-x86_64-unknown-linux-gnu-{full,default,slim}.tar.gz` packages. +- `armhf`, `armv7`: Download one of the `spotifyd-armv7-unknown-linux-gnueabihf-{full,default,slim}.tar.gz` packages. +- `aarch64`: Download one of the `spotifyd-aarch64-unknown-linux-gnu-{full,default,slim}.tar.gz` - `armv6`: Unfortunately, we no longer support this architecture. If you still need this to work, please open an issue or join the [community matrix channel](https://matrix.to/#/#spotifyd:matrix.org) and we'll try to find a solution. -If you're on macOS, download one of the `spotifyd-macos-{full,default,slim}.tar.gz` packages. +If you're on macOS: + +- Intel Macs: Download one of the `spotifyd-x86_64-apple-darwin-{default,slim}.tar.gz` packages. + +- Apple Silicon Macs: Download one of the `spotifyd-aarch64-apple-darwin-{default,slim}.tar.gz` packages. You should now extract the downloaded archive, make the `spotifyd` file executable and copy it to a sensible location. This can be done using the following commands: ```console $ tar xzf spotifyd-*.tar.gz # extract -$ cd spotifyd-*/ $ chmod +x spotifyd # make binary executable $ # move to correct location, e.g. on Linux: $ # for a user-wide installation (make sure that your $PATH includes ~/.local/bin) From 7344c97868d6d211c1f9efddcd20ad468b2419af Mon Sep 17 00:00:00 2001 From: Muktar Sadiq Date: Thu, 15 Jan 2026 12:23:11 +0100 Subject: [PATCH 2/3] Fix YAML indentation in release body --- .github/workflows/cd.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a365c4c0..8658bbf4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,7 +5,7 @@ on: branches: - master tags: - - 'v*.*.*' + - "v*.*.*" jobs: build: @@ -16,7 +16,7 @@ jobs: os: [macos, linux] arch: [x86_64, aarch64, armv7] rust: [stable] - artifact_type: ['slim', 'default', 'full'] # The build strategy will build all types for each OS specified + artifact_type: ["slim", "default", "full"] # The build strategy will build all types for each OS specified include: # Runner configuration - os: macos @@ -29,7 +29,7 @@ jobs: runs_on: ubuntu-22.04 # DBus configuration - artifact_type: slim - dbus: '' + dbus: "" - artifact_type: default dbus: dbus_mpris - artifact_type: full @@ -56,7 +56,7 @@ jobs: audio_backends: portaudio_backend,rodio_backend exclude: - os: macos - artifact_type: 'full' + artifact_type: "full" - os: macos arch: armv7 steps: @@ -109,7 +109,7 @@ jobs: - name: Build (using cargo) if: matrix.target == '' run: | - cargo +${{ matrix.rust }} build $CARGO_ARGS + cargo +${{ matrix.rust }} build $CARGO_ARGS - name: Build (using cross) if: matrix.target != '' uses: houseabsolute/actions-rust-cross@v1 @@ -165,6 +165,6 @@ jobs: **Legacy format** (deprecated, will be removed in next release): `spotifyd-{os}-{arch}-{variant}.tar.gz` - Example: `spotifyd-linux-x86_64-full-legacy.tar.gz` - Both formats are available in this release for backwards compatibility. + Both formats are available in this release for backwards compatibility. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0c7b795faa9bd095c24bc902e491cf2299ed94a7 Mon Sep 17 00:00:00 2001 From: Muktar Sadiq Date: Sun, 1 Feb 2026 14:50:51 +0100 Subject: [PATCH 3/3] Add cargo-binstall corrections --- .github/workflows/cd.yml | 19 +++++-------------- Cargo.toml | 4 ---- docs/src/installation/README.md | 12 +++--------- src/dbus_mpris.rs | 1 + 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8658bbf4..d5fd5a0f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -90,19 +90,12 @@ jobs: id: target_triple shell: bash run: | - # Map OS/arch to Rust target target_triple - if [ "${{ matrix.target }}" != "" ]; then - # Use the cross-compilation target if specified + # Use the cross-compilation target if specified + if [ "${{ matrix.target}}" != ""]; then TARGET_TRIPLE="${{ matrix.target }}" - elif [ "${{ matrix.os }}" = "linux" ] && [ "${{ matrix.arch }}" = "x86_64" ]; then - TARGET_TRIPLE="x86_64-unknown-linux-gnu" - elif [ "${{ matrix.os }}" = "macos" ] && [ "${{ matrix.arch }}" = "x86_64" ]; then - TARGET_TRIPLE="x86_64-apple-darwin" - elif [ "${{ matrix.os }}" = "macos" ] && [ "${{ matrix.arch }}" = "aarch64" ]; then - TARGET_TRIPLE="aarch64-apple-darwin" - else - echo "Unknown target: ${{ matrix.os }}-${{ matrix.arch }}" - exit 1 + else + # Get the host target from rustc + TARGET_TRIPLE=$(rustc -vV | grep 'host:' | awk '{print $2}') fi echo "target_triple=$TARGET_TRIPLE" >> $GITHUB_OUTPUT echo "Target triple: $TARGET_TRIPLE" @@ -143,8 +136,6 @@ jobs: do pushd $artifact_dir artifact_name=$(basename $artifact_dir) - # Remove -legacy suffix for old naming format - artifact_name=${artifact_name%-legacy} tar czvf $artifact_name.tar.gz spotifyd shasum -a 512 $artifact_name.tar.gz > $artifact_name.sha512 popd diff --git a/Cargo.toml b/Cargo.toml index 9edbe2e3..50b5fb95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -113,10 +113,6 @@ bin-dir = "{ bin }{ binary-ext }" pkg-fmt = "tgz" disabled-strategies = ["quick-install", "compile"] -[package.metadata.binstall.overrides.x86_64-pc-windows-msvc] -pkg-fmt = "zip" - - [profile.release] lto = true diff --git a/docs/src/installation/README.md b/docs/src/installation/README.md index d38522b7..3309066c 100644 --- a/docs/src/installation/README.md +++ b/docs/src/installation/README.md @@ -3,9 +3,9 @@ Getting `spotifyd` on your system should be as easy as downloading a binary in most cases. If you'd like to learn how to compile `spotifyd` yourself, head over to [building from source](./source.md). -## Using cargo-binstall (Recommended) +## Using cargo-binstall (Optional) -If you have Rust installed, the easiest way to install `spotifyd` is using `cargo-binstall` +If you have Rust installed, you can quickly install `spotifyd` is using `cargo-binstall` ```console cargo binstall spotifyd @@ -58,19 +58,13 @@ and the platform architecture that they were built for. You can find the latest If you're unsure which version to choose, just go for `default` on desktop systems and `slim` on headless systems. **Asset Naming Convention:** -Starting with version 0.4.2, release assets follow Rust's standard target triple naming format: - -Format: `spotifyd-{target-triple}-{variant}.tar.gz` +Release assets follow Rust's standard target triple naming format: `spotifyd-{target-triple}-{variant}.tar.gz` Examples: `spotifyd-x86_64-unknown-linux-gnu-full.tar.gz` `spotifyd-aarch64-apple-darwin-default.tar.gz` `spotifyd-armv7-unknown-linux-gnueabihf-slim.tar.gz` -**Legacy naming:** (deprecated, available only in version 0.4.2 for backwards compatibility) -`spotifyd-linux-x86_64-full-legacy.tar.gz` -`spotifyd-macos-aarch64-default-legacy.tar.gz` - **Architecture:** If you're on Linux, check your platform architecture with `uname -m`: diff --git a/src/dbus_mpris.rs b/src/dbus_mpris.rs index 37679baa..9d10f643 100644 --- a/src/dbus_mpris.rs +++ b/src/dbus_mpris.rs @@ -161,6 +161,7 @@ impl RepeatState { } } + impl From<(bool, bool)> for RepeatState { fn from((context, track): (bool, bool)) -> Self { if context {