Skip to content

Commit

Permalink
feat: add support for Qt6-based builds
Browse files Browse the repository at this point in the history
With Mumble moving to use Qt6 this container was no longer able to build
recent versions successfully. This commit adds support for building
Qt6-based version of mumble-server.

Signed-off-by: Nita Vesa <[email protected]>
  • Loading branch information
WereCatf committed Nov 19, 2024
1 parent e61111b commit 59c9ea5
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 45 deletions.
102 changes: 57 additions & 45 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,76 +1,88 @@
FROM ubuntu:22.04 as base

ADD ./scripts/* /mumble/scripts/
WORKDIR /mumble/scripts

ARG DEBIAN_FRONTEND=noninteractive
ARG MUMBLE_VERSION=latest

RUN apt-get update && apt-get install --no-install-recommends -y \
libcap2 \
libzeroc-ice3.7 \
'^libprotobuf[0-9]+$' \
libavahi-compat-libdnssd1 \
libqt5core5a \
libqt5network5 \
libqt5sql5 \
libqt5sql5-mysql \
libqt5sql5-psql \
libqt5sql5-sqlite \
libqt5xml5 \
libqt5dbus5 \
ca-certificates \
# Workaround for systems like CentOS 7 which won't load libQt5Core.so as expected:
# see also https://stackoverflow.com/a/68897099/
binutils \
&& find /lib* /usr/lib* -name 'libQt5Core.so.*' -exec strip --remove-section=.note.ABI-tag {} \; \
&& apt-get -y purge binutils \
# End of workaround
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
libcap2 \
libzeroc-ice3.7 \
'^libprotobuf[0-9]+$' \
libavahi-compat-libdnssd1 \
ca-certificates \
# Workaround for systems like CentOS 7 which won't load libQt5Core.so as expected:
# see also https://stackoverflow.com/a/68897099/
binutils \
&& /mumble/scripts/install_qt.sh \
&& find /lib* /usr/lib* -name 'libQt?Core.so.*' -exec strip --remove-section=.note.ABI-tag {} \; \
&& apt-get -y purge binutils \
# End of workaround
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /data \
&& rm -Rf /scripts



FROM base as build
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install --no-install-recommends -y \
git cmake build-essential ca-certificates pkg-config \
libssl-dev \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
libboost-dev \
libprotobuf-dev \
protobuf-compiler \
libprotoc-dev \
libcap-dev \
libxi-dev \
libavahi-compat-libdnssd-dev \
libzeroc-ice-dev \
python3 \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ADD ./scripts/* /mumble/scripts/
WORKDIR /mumble/repo

ARG MUMBLE_VERSION=latest
ARG MUMBLE_BUILD_NUMBER=""
ARG MUMBLE_CMAKE_ARGS=""

# Clone the repo, build it and finally copy the default server ini file. Since this file may be at different locations and Docker
# doesn't support conditional copies, we have to ensure that regardless of where the file is located in the repo, it will end
# up at a unique path in our build container to be copied further down.
RUN /mumble/scripts/clone.sh && /mumble/scripts/build.sh \
&& /mumble/scripts/copy_one_of.sh ./scripts/murmur.ini ./auxiliary_files/mumble-server.ini default_config.ini
ARG TARGETARCH
ARG ARCH=${TARGETARCH/arm64/aarch64-linux-gnu}
ARG ARCH=${ARCH/amd64/x86_64-linux-gnu}
ARG ARCH=${ARCH/arm/arm-linux-gnu-eabihf}
ARG ARCH=${ARCH/riscv64/riscv64-linux-gnu}

RUN apt-get update && apt-get install --no-install-recommends -y \
git cmake build-essential ca-certificates pkg-config \
libssl-dev \
libboost-dev \
libprotobuf-dev \
protobuf-compiler \
libprotoc-dev \
libcap-dev \
libxi-dev \
libavahi-compat-libdnssd-dev \
libzeroc-ice-dev \
python3 \
git \
# Clone the repo, build it and finally copy the default server ini file. Since this file may be at different locations and Docker
# doesn't support conditional copies, we have to ensure that regardless of where the file is located in the repo, it will end
# up at a unique path in our build container to be copied further down.
&& /mumble/scripts/clone.sh && /mumble/scripts/install_qt_dev.sh && /mumble/scripts/build.sh \
&& /mumble/scripts/copy_one_of.sh ./scripts/murmur.ini ./auxiliary_files/mumble-server.ini default_config.ini \
&& git clone https://github.com/ncopa/su-exec.git \
&& cd su-exec && make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*



FROM base
ARG MUMBLE_UID=10000
ARG MUMBLE_GID=10000

ARG TARGETARCH
ARG ARCH=${TARGETARCH/arm64/aarch64-linux-gnu}
ARG ARCH=${ARCH/amd64/x86_64-linux-gnu}
ARG ARCH=${ARCH/arm/arm-linux-gnu-eabihf}
ARG ARCH=${ARCH/riscv64/riscv64-linux-gnu}

RUN groupadd --gid $MUMBLE_GID mumble && useradd --uid $MUMBLE_UID --gid $MUMBLE_GID mumble

COPY --from=build /mumble/repo/build/mumble-server /usr/bin/mumble-server
COPY --from=build /mumble/repo/default_config.ini /etc/mumble/bare_config.ini
COPY --from=build --chmod=755 /mumble/repo/su-exec/su-exec /usr/local/bin/su-exec
COPY --from=build /usr/lib/${ARCH}/qt6/plugins/tls /usr/lib/${ARCH}/qt6/plugins/tls

RUN mkdir -p /data && chown -R mumble:mumble /data && chown -R mumble:mumble /etc/mumble
USER mumble
Expand Down
52 changes: 52 additions & 0 deletions scripts/install_qt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

set -e
set -x

apt install --no-install-recommends -y git

git clone --filter=tree:0 https://github.com/mumble-voip/mumble/ repo
cd repo

if [ "${MUMBLE_VERSION}" = "latest" ]
then
MUMBLE_VERSION=""
fi

if ! timestamp=$(git show -s --format=%ct ${MUMBLE_VERSION} 2>/dev/null)
then
echo "Non-existent or malformed MUMBLE_VERSION `${MUMBLE_VERSION}` given, cannot continue!" 1>&2
cd ..
rm -Rf repo
apt -y autoremove --purge git
exit 1
else
# 1726713847 refers to the timestamp of the commit that switched Mumble to use Qt6
if [ ${timestamp} -ge 1726713847 ]
then
apt install --no-install-recommends -y \
libqt6core6 \
libqt6network6 \
libqt6sql6 \
libqt6sql6-mysql \
libqt6sql6-psql \
libqt6sql6-sqlite \
libqt6xml6 \
libqt6dbus6 \
libcrypto++8
else
apt install --no-install-recommends -y \
libqt5core5a \
libqt5network5 \
libqt5sql5 \
libqt5sql5-mysql \
libqt5sql5-psql \
libqt5sql5-sqlite \
libqt5xml5 \
libqt5dbus5
fi
fi
cd ..
rm -Rf repo
apt -y autoremove --purge git
exit 0
32 changes: 32 additions & 0 deletions scripts/install_qt_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e
set -x

if [ "${MUMBLE_VERSION}" = "latest" ]
then
MUMBLE_VERSION=""
fi

if ! timestamp=$(git show -s --format=%ct ${MUMBLE_VERSION} 2>/dev/null)
then
echo "Non-existent or malformed MUMBLE_VERSION `${MUMBLE_VERSION}` given, cannot continue!" 1>&2
exit 1
else
# 1726713847 refers to the timestamp of the commit that switched Mumble to use Qt6
if [ ${timestamp} -ge 1726713847 ]
then
apt install --no-install-recommends -y \
qt6-base-dev \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-qpa-plugins
else
apt install --no-install-recommends -y \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools
fi
fi
mkdir -p /usr/lib/${ARCH}/qt6/plugins/tls
exit 0

0 comments on commit 59c9ea5

Please sign in to comment.