Skip to content

Commit

Permalink
docs: mention cross and remove rpi64 workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
eladyn committed Mar 7, 2025
1 parent c2a3f84 commit 8c519dd
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 82 deletions.
3 changes: 1 addition & 2 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

- [Installation](./installation/README.md)
- [Running as a service](./installation/service.md)
- [Installing on RaspberryPi OS 64-bit](./installation/raspberrypi64.md)
- [Building from source](./installation/source.md)
- [Cross-Compile using Docker](./installation/cross-compile-using-docker.md)
- [Cross-Compilation](./installation/cross-compilation.md)
- [Configuration](./configuration/README.md)
- [Authentication](./configuration/auth.md)
- [Audio](./configuration/audio.md)
Expand Down
10 changes: 5 additions & 5 deletions docs/src/installation/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Installation

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). And if you're running a 64-bit RaspbianOS system, have a look [here](./raspbian64.md).
If you'd like to learn how to compile `spotifyd` yourself, head over to [building from source](./source.md).

## Linux

Expand Down Expand Up @@ -45,10 +45,10 @@ If you're unsure which version to choose, just go for `default` on desktop syste

If you're on Linux, check your platform architecture with `uname -m`:

- `x86_64`: Download one of the `spotifyd-linux-{full,default,slim}.tar.gz` packages.
- `armhf`, `armv7`: Download one of the `spotifyd-linux-armhf-{full,default,slim}.tar.gz` packages.
- `armv6`: Download the `spotifyd-linux-armv6-slim.tar.gz` package.
- `aarch64`: Head over to the [RaspberryPi OS 64-bit installation guide](./raspberrypi64.md).
- `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`
- `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.

Expand Down
68 changes: 68 additions & 0 deletions docs/src/installation/cross-compilation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Cross-Compilation

If you want to run `spotifyd` on lower-power hardware such as a RaspberryPi, but none of our prebuilt binaries suit your needs, you might want to cross-compile `spotifyd` on a more powerful machine and deploy the binary on the target system.

## Using `cross`

The easiest way to cross-compile is using the amazing [`cross` project](https://github.com/cross-rs/cross). This way, the build environment comes already pre-configured.
Follow the instructions in their README to install `cross`.

<div class="warning">

In the current latest release of cross (v0.2.5), some targets are too outdated and compilation will fail. Thus, it is currently recommended to install the latest version of `cross` from their git repo instead of a prebuilt binary.

</div>

Then, you should be able to run `cross build --target <your desired target>`, where target is one of the targets in `rustc --print target-list`. Please also refer to [the general from source guide](./source.md) for additional flags that you might want to append to that command.

If this was successful, copy the resulting binary from `target/<your desired target>/{release,debug}/spotifyd` to the `spotifyd` machine and try running it there.

If `cross` doesn't support your target, you can try the alternative approach using Docker and QEMU below.

If compilation of your target isn't working even though `cross` supports it, feel free to open an issue on our GitHub or join the [community matrix channel](https://matrix.to/#/#spotifyd:matrix.org) and ask there.

## Using Docker and QEMU

We can also use `docker` to cross compile on every platform and OS that runs `docker` and `qemu`:

1. Setup a docker [custom builder](https://docs.docker.com/build/building/multi-platform/#create-a-custom-builder)

```shell
docker buildx create \
--name container-builder \
--driver docker-container \
--use --bootstrap
```

If you are **not** using Docker-Desktop you might have to install [QEMU](https://docs.docker.com/build/building/multi-platform/#install-qemu-manually)

2. Create a docker `docker-compose.yml`

Here we are building a `arm64` binary, so we set `platform: linux/arm64`

```yaml
services:
build-container:
image: rust:1-bookworm
platform: linux/arm64
command: bash -c "
apt-get update &&
apt-get install -y \
libasound2-dev \
libssl-dev \
jq \
pkg-config &&
wget -O - https://api.github.com/repos/Spotifyd/spotifyd/tarball/$(\
curl -SsL https://api.github.com/repos/Spotifyd/spotifyd/releases/latest \
| jq '.tag_name' -r) \
| tar xzv -C /spotifyd --strip-components=1 &&
cargo build --release &&
cp /spotifyd/target/release/spotifyd /build/"
working_dir: /spotifyd
volumes:
- ./:/build
```

3. Run `docker compose up`

This will copy the build `spotifyd` binary in the current directory.
45 changes: 0 additions & 45 deletions docs/src/installation/cross-compile-using-docker.md

This file was deleted.

30 changes: 0 additions & 30 deletions docs/src/installation/raspberrypi64.md

This file was deleted.

2 changes: 2 additions & 0 deletions docs/src/installation/source.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Building from source

The guide below assumes that you're building `spotifyd` on the system that you want to run it on. If you'd instead prefer to cross-compile, head over to [this section](./cross-compilation.md).

You can also compile `spotifyd` yourself, allowing you to tailor it perfectly to your needs or get the latest fixes. `spotifyd` is written in Rust. You can download the toolchain (compiler and package manager) over at [rustup.rs](https://rustup.rs). Follow their instructions to get started.

> __Note:__ Please make sure that you compile the package using the most recent `stable` version of Rust available through `rustup`. Some distro versions are quite outdated and might result in compilation errors.
Expand Down

0 comments on commit 8c519dd

Please sign in to comment.