-
Notifications
You must be signed in to change notification settings - Fork 498
Add cargo-binstall support and adopt Rust target triple naming #1390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
f8b7b62
7344c97
0c7b795
1020ef8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
|
@@ -86,10 +86,30 @@ 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: | | ||
| 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 | ||
|
|
@@ -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` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely sure, but I think the code above will remove
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes you’re right, the packaging step removes the |
||
|
|
||
| Both formats are available in this release for backwards compatibility. | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| [package] | ||
| authors = ["Simon Persson <simon@flaskpost.org>", "Sven Lechner <sven.lechner@rwth-aachen.de>", "eladyn <eladyn@protonmail.com>"] | ||
| authors = [ | ||
| "Simon Persson <simon@flaskpost.org>", | ||
| "Sven Lechner <sven.lechner@rwth-aachen.de>", | ||
| "eladyn <eladyn@protonmail.com>", | ||
| ] | ||
| 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"], | ||
| [ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is rather picky, but maybe we can keep the previous formatting of the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem at all, I'll revert to the original formatting. Consistency is important. |
||
| "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 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be possible to just use
rustc -vVto automatically determine the host target triple?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right, using
rustc -vVis cleaner and more reliable. I'll make that change. Thanks for the suggestion.