diff --git a/contrib/Dockerfile b/contrib/Dockerfile index 64d306c0..644ab029 100644 --- a/contrib/Dockerfile +++ b/contrib/Dockerfile @@ -8,10 +8,10 @@ # The compiled binaries will be located in /tmp/librespot-build # # If only one architecture is desired, cargo can be invoked directly with the appropriate options : -# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --no-default-features --features alsa-backend -# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features alsa-backend -# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabi --no-default-features --features alsa-backend -# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target aarch64-unknown-linux-gnu --no-default-features --features alsa-backend +# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --no-default-features --features "alsa-backend with-libmdns" +# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features "alsa-backend with-libmdns" +# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target arm-unknown-linux-gnueabi --no-default-features --features "alsa-backend with-libmdns" +# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --target aarch64-unknown-linux-gnu --no-default-features --features "alsa-backend with-libmdns" FROM debian:bookworm @@ -30,6 +30,7 @@ RUN dpkg --add-architecture arm64 && \ crossbuild-essential-armel \ crossbuild-essential-armhf \ curl \ + git \ libasound2-dev \ libasound2-dev:arm64 \ libasound2-dev:armel \ diff --git a/contrib/cross-compile-armv6hf/Dockerfile b/contrib/cross-compile-armv6hf/Dockerfile index c7f73f4c..16694afa 100644 --- a/contrib/cross-compile-armv6hf/Dockerfile +++ b/contrib/cross-compile-armv6hf/Dockerfile @@ -11,20 +11,18 @@ FROM --platform=linux/amd64 ubuntu:18.04 # Install common packages. RUN apt-get update -RUN apt-get install -y -qq git curl build-essential libasound2-dev libssl-dev libpulse-dev libdbus-1-dev +RUN apt-get install -y -qq git curl build-essential cmake clang libclang-dev libasound2-dev libpulse-dev # Install armhf packages. RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main" | tee -a /etc/apt/sources.list RUN apt-get update -RUN apt-get download libasound2:armhf libasound2-dev:armhf libssl-dev:armhf libssl1.1:armhf +RUN apt-get download libasound2:armhf libasound2-dev:armhf RUN mkdir /sysroot && \ dpkg -x libasound2_*.deb /sysroot/ && \ - dpkg -x libssl-dev*.deb /sysroot/ && \ - dpkg -x libssl1.1*.deb /sysroot/ && \ dpkg -x libasound2-dev*.deb /sysroot/ # Install rust. -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y +RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.81 -y ENV PATH="/root/.cargo/bin/:${PATH}" RUN rustup target add arm-unknown-linux-gnueabihf RUN mkdir /.cargo && \ @@ -35,14 +33,11 @@ RUN mkdir /pi && \ git -C /pi clone --depth=1 https://github.com/raspberrypi/tools.git # Build env variables. -ENV CARGO_TARGET_DIR /build -ENV CARGO_HOME /build/cache +ENV CARGO_TARGET_DIR=/build +ENV CARGO_HOME=/build/cache ENV PATH="/pi/tools/arm-bcm2708/arm-linux-gnueabihf/bin:${PATH}" ENV PKG_CONFIG_ALLOW_CROSS=1 ENV PKG_CONFIG_PATH_arm-unknown-linux-gnueabihf=/usr/lib/arm-linux-gnueabihf/pkgconfig/ -ENV C_INCLUDE_PATH=/sysroot/usr/include -ENV OPENSSL_LIB_DIR=/sysroot/usr/lib/arm-linux-gnueabihf -ENV OPENSSL_INCLUDE_DIR=/sysroot/usr/include/arm-linux-gnueabihf ADD . /src WORKDIR /src diff --git a/contrib/cross-compile-armv6hf/docker-build.sh b/contrib/cross-compile-armv6hf/docker-build.sh index ab84175c..76158e44 100755 --- a/contrib/cross-compile-armv6hf/docker-build.sh +++ b/contrib/cross-compile-armv6hf/docker-build.sh @@ -1,14 +1,17 @@ #!/usr/bin/env bash set -eux -PI1_TOOLS_DIR="/pi/tools/arm-bcm2708/arm-linux-gnueabihf" +cargo install --force --locked bindgen-cli + +PI1_TOOLS_DIR=/pi/tools/arm-bcm2708/arm-linux-gnueabihf +PI1_TOOLS_SYSROOT_DIR=$PI1_TOOLS_DIR/arm-linux-gnueabihf/sysroot PI1_LIB_DIRS=( - "$PI1_TOOLS_DIR/arm-linux-gnueabihf/sysroot/lib" - "$PI1_TOOLS_DIR/arm-linux-gnueabihf/sysroot/usr/lib" + "$PI1_TOOLS_SYSROOT_DIR/lib" + "$PI1_TOOLS_SYSROOT_DIR/usr/lib" "/sysroot/usr/lib/arm-linux-gnueabihf" - "/sysroot/lib/arm-linux-gnueabihf" ) export RUSTFLAGS="-C linker=$PI1_TOOLS_DIR/bin/arm-linux-gnueabihf-gcc ${PI1_LIB_DIRS[*]/#/-L}" +export BINDGEN_EXTRA_CLANG_ARGS=--sysroot=$PI1_TOOLS_SYSROOT_DIR -cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features "alsa-backend" +cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features "alsa-backend with-libmdns" diff --git a/contrib/docker-build.sh b/contrib/docker-build.sh index 0d59e341..50b6b3e1 100755 --- a/contrib/docker-build.sh +++ b/contrib/docker-build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eux -cargo build --release --no-default-features --features alsa-backend -cargo build --release --target aarch64-unknown-linux-gnu --no-default-features --features alsa-backend -cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features alsa-backend -cargo build --release --target arm-unknown-linux-gnueabi --no-default-features --features alsa-backend +cargo build --release --no-default-features --features "alsa-backend with-libmdns" +cargo build --release --target aarch64-unknown-linux-gnu --no-default-features --features "alsa-backend with-libmdns" +cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features "alsa-backend with-libmdns" +cargo build --release --target arm-unknown-linux-gnueabi --no-default-features --features "alsa-backend with-libmdns"