2017-02-16 21:38:48 +00:00
|
|
|
# Cross compilation environment for librespot
|
|
|
|
# Build the docker image from the root of the project with the following command :
|
|
|
|
# $ docker build -t librespot-cross -f contrib/Dockerfile .
|
|
|
|
#
|
2024-03-11 09:34:20 +00:00
|
|
|
# The resulting image can be used to build librespot for linux x86_64, armhf, armel, mipsel, aarch64
|
2017-02-16 21:38:48 +00:00
|
|
|
# $ docker run -v /tmp/librespot-build:/build librespot-cross
|
|
|
|
#
|
|
|
|
# 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 :
|
2017-02-22 15:02:36 +00:00
|
|
|
# $ docker run -v /tmp/librespot-build:/build librespot-cross cargo build --release --no-default-features --features "alsa-backend"
|
2021-12-14 20:23:13 +00:00
|
|
|
# $ 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
|
|
|
|
|
2017-02-16 21:38:48 +00:00
|
|
|
FROM debian:stretch
|
|
|
|
|
2024-05-30 20:00:13 +00:00
|
|
|
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
|
|
|
|
RUN echo "deb http://archive.debian.org/debian stretch-proposed-updates main" >> /etc/apt/sources.list
|
|
|
|
RUN echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list
|
|
|
|
|
2017-06-08 11:31:06 +00:00
|
|
|
RUN dpkg --add-architecture arm64
|
2017-02-16 21:38:48 +00:00
|
|
|
RUN dpkg --add-architecture armhf
|
|
|
|
RUN dpkg --add-architecture armel
|
2017-03-05 10:03:56 +00:00
|
|
|
RUN dpkg --add-architecture mipsel
|
2017-02-16 21:38:48 +00:00
|
|
|
RUN apt-get update
|
|
|
|
|
2019-07-16 17:36:20 +00:00
|
|
|
RUN apt-get install -y curl git build-essential crossbuild-essential-arm64 crossbuild-essential-armel crossbuild-essential-armhf crossbuild-essential-mipsel pkg-config
|
2017-06-08 11:31:06 +00:00
|
|
|
RUN apt-get install -y libasound2-dev libasound2-dev:arm64 libasound2-dev:armel libasound2-dev:armhf libasound2-dev:mipsel
|
2023-03-25 18:28:47 +00:00
|
|
|
RUN apt-get install -y libpulse0 libpulse0:arm64 libpulse0:armel libpulse0:armhf
|
2017-02-16 21:38:48 +00:00
|
|
|
|
2024-05-30 20:00:13 +00:00
|
|
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.71 -y
|
2017-02-16 21:38:48 +00:00
|
|
|
ENV PATH="/root/.cargo/bin/:${PATH}"
|
2017-06-08 11:31:06 +00:00
|
|
|
RUN rustup target add aarch64-unknown-linux-gnu
|
2017-02-16 21:38:48 +00:00
|
|
|
RUN rustup target add arm-unknown-linux-gnueabi
|
|
|
|
RUN rustup target add arm-unknown-linux-gnueabihf
|
2017-03-05 10:03:56 +00:00
|
|
|
RUN rustup target add mipsel-unknown-linux-gnu
|
2017-02-16 21:38:48 +00:00
|
|
|
|
2017-02-17 10:30:23 +00:00
|
|
|
RUN mkdir /.cargo && \
|
2017-06-08 11:31:06 +00:00
|
|
|
echo '[target.aarch64-unknown-linux-gnu]\nlinker = "aarch64-linux-gnu-gcc"' > /.cargo/config && \
|
|
|
|
echo '[target.arm-unknown-linux-gnueabihf]\nlinker = "arm-linux-gnueabihf-gcc"' >> /.cargo/config && \
|
2017-03-05 10:03:56 +00:00
|
|
|
echo '[target.arm-unknown-linux-gnueabi]\nlinker = "arm-linux-gnueabi-gcc"' >> /.cargo/config && \
|
|
|
|
echo '[target.mipsel-unknown-linux-gnu]\nlinker = "mipsel-linux-gnu-gcc"' >> /.cargo/config
|
2017-02-16 21:38:48 +00:00
|
|
|
|
|
|
|
ENV CARGO_TARGET_DIR /build
|
2017-02-17 10:30:23 +00:00
|
|
|
ENV CARGO_HOME /build/cache
|
2019-07-16 17:36:20 +00:00
|
|
|
ENV PKG_CONFIG_ALLOW_CROSS=1
|
2019-11-01 16:01:58 +00:00
|
|
|
ENV PKG_CONFIG_PATH_aarch64-unknown-linux-gnu=/usr/lib/aarch64-linux-gnu/pkgconfig/
|
|
|
|
ENV PKG_CONFIG_PATH_arm-unknown-linux-gnueabihf=/usr/lib/arm-linux-gnueabihf/pkgconfig/
|
|
|
|
ENV PKG_CONFIG_PATH_arm-unknown-linux-gnueabi=/usr/lib/arm-linux-gnueabi/pkgconfig/
|
|
|
|
ENV PKG_CONFIG_PATH_mipsel-unknown-linux-gnu=/usr/lib/mipsel-linux-gnu/pkgconfig/
|
2017-02-16 21:38:48 +00:00
|
|
|
|
|
|
|
ADD . /src
|
|
|
|
WORKDIR /src
|
|
|
|
CMD ["/src/contrib/docker-build.sh"]
|