From fae1d986ab3196c5dc291f7726b032f4fadcff8b Mon Sep 17 00:00:00 2001 From: acheronfail Date: Thu, 4 Jan 2024 23:45:06 +1030 Subject: [PATCH] fix ci cross-compilation by compiling libpulse ourselves --- Cargo.toml | 10 +-- cross/aarch64-meson.txt | 12 ++++ cross/aarch64-unknown-linux-gnu.Dockerfile | 75 ++++++++++++++++++++++ cross/x86_64-unknown-linux-gnu.Dockerfile | 71 ++++++++++++++++++++ 4 files changed, 161 insertions(+), 7 deletions(-) create mode 100644 cross/aarch64-meson.txt create mode 100644 cross/aarch64-unknown-linux-gnu.Dockerfile create mode 100644 cross/x86_64-unknown-linux-gnu.Dockerfile diff --git a/Cargo.toml b/Cargo.toml index 5ae8155..359f76d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -88,12 +88,8 @@ codegen-units = 1 panic = "abort" # cross configuration -# see: https://github.com/cross-rs/cross/blob/main/docs/cross_toml.md -# FIXME: cross images are based on ubuntu:20.04, but pulse there is still v13, we need v14 -# see: https://github.com/cross-rs/cross/pull/973 [package.metadata.cross.target.aarch64-unknown-linux-gnu] -image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" -pre-build = ["DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential clang dbus dunst i3-wm imagemagick libfaketime libiw-dev libpulse-dev libx11-dev scrot xserver-xephyr xvfb"] +dockerfile = "./cross/aarch64-unknown-linux-gnu.Dockerfile" + [package.metadata.cross.target.x86_64-unknown-linux-gnu] -image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main" -pre-build = ["DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential clang dbus dunst i3-wm imagemagick libfaketime libiw-dev libpulse-dev libx11-dev scrot xserver-xephyr xvfb"] +dockerfile = "./cross/x86_64-unknown-linux-gnu.Dockerfile" diff --git a/cross/aarch64-meson.txt b/cross/aarch64-meson.txt new file mode 100644 index 0000000..abafaa3 --- /dev/null +++ b/cross/aarch64-meson.txt @@ -0,0 +1,12 @@ +[binaries] +c = 'aarch64-linux-gnu-gcc' +cpp = 'aarch64-linux-gnu-g++' +ar = 'aarch64-linux-gnu-ar' +strip = 'aarch64-linux-gnu-strip' +pkgconfig = 'aarch64-linux-gnu-pkg-config' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little' diff --git a/cross/aarch64-unknown-linux-gnu.Dockerfile b/cross/aarch64-unknown-linux-gnu.Dockerfile new file mode 100644 index 0000000..1403c8d --- /dev/null +++ b/cross/aarch64-unknown-linux-gnu.Dockerfile @@ -0,0 +1,75 @@ +FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main + +ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/London + +RUN apt-get install -y \ + build-essential \ + clang \ + dbus \ + dunst \ + i3-wm \ + imagemagick \ + libfaketime \ + libiw-dev \ + libx11-dev \ + scrot \ + xserver-xephyr \ + xvfb + +# NOTE: we build and install libpulse manually ourselves, since the version in +# cross' current image is too low (v13). We need at least v14. +RUN dpkg --add-architecture arm64 +RUN apt-get update && apt-get install -y \ + autopoint \ + bash-completion \ + check:arm64 \ + curl \ + dbus-x11 \ + dpkg-dev \ + g++ \ + gcc \ + gettext \ + git-core \ + libasound2-dev \ + libasyncns-dev \ + libavahi-client-dev \ + libbluetooth-dev \ + libcap-dev:arm64 \ + libdbus-1-dev:arm64 \ + libfftw3-dev \ + libglib2.0-dev \ + libgtk-3-dev \ + libice-dev \ + libjack-dev \ + liblircclient-dev \ + libltdl-dev:arm64 \ + liborc-0.4-dev \ + libsbc-dev:arm64 \ + libsndfile1-dev:arm64 \ + libsoxr-dev \ + libspeexdsp-dev \ + libssl-dev \ + libsystemd-dev \ + libtdb-dev:arm64 \ + libudev-dev \ + libwebrtc-audio-processing-dev \ + libwrap0-dev \ + libx11-xcb-dev \ + libxcb1-dev \ + libxml-parser-perl \ + libxml2-utils \ + libxtst-dev \ + m4 \ + meson \ + ninja-build \ + pkg-config:arm64 \ + python3-setuptools \ + systemd \ + wget +RUN rm -rf /opt/pulseaudio && git clone \ + --depth 1 \ + --branch stable-14.x \ + https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git \ + /opt/pulseaudio +COPY ./cross/aarch64-meson.txt /opt/pulseaudio/aarch64-meson.txt +RUN cd /opt/pulseaudio && meson --cross-file aarch64-meson.txt build && cd build && ninja && ninja install diff --git a/cross/x86_64-unknown-linux-gnu.Dockerfile b/cross/x86_64-unknown-linux-gnu.Dockerfile new file mode 100644 index 0000000..03b156d --- /dev/null +++ b/cross/x86_64-unknown-linux-gnu.Dockerfile @@ -0,0 +1,71 @@ +FROM ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main + +ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/London + +RUN apt-get install -y \ + build-essential \ + clang \ + dbus \ + dunst \ + i3-wm \ + imagemagick \ + libfaketime \ + libiw-dev \ + libx11-dev \ + scrot \ + xserver-xephyr \ + xvfb + +# NOTE: we build and install libpulse manually ourselves, since the version in +# cross' current image is too low (v13). We need at least v14. +RUN apt-get install -y \ + autopoint \ + bash-completion \ + check \ + curl \ + dbus-x11 \ + g++ \ + gcc \ + gettext \ + git-core \ + libasound2-dev \ + libasyncns-dev \ + libavahi-client-dev \ + libbluetooth-dev \ + libcap-dev \ + libfftw3-dev \ + libglib2.0-dev \ + libgtk-3-dev \ + libice-dev \ + libjack-dev \ + liblircclient-dev \ + libltdl-dev \ + liborc-0.4-dev \ + libsbc-dev \ + libsndfile1-dev \ + libsoxr-dev \ + libspeexdsp-dev \ + libssl-dev \ + libsystemd-dev \ + libtdb-dev \ + libudev-dev \ + libwebrtc-audio-processing-dev \ + libwrap0-dev \ + libx11-xcb-dev \ + libxcb1-dev \ + libxml-parser-perl \ + libxml2-utils \ + libxtst-dev \ + m4 \ + meson \ + ninja-build \ + pkg-config \ + python3-setuptools \ + systemd \ + wget +RUN rm -rf /opt/pulseaudio && git clone \ + --depth 1 \ + --branch stable-14.x \ + https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git \ + /opt/pulseaudio +RUN cd /opt/pulseaudio && meson build && cd build && ninja && ninja install