Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Build our own Qt 6.8.1 in the appimage build. #217

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion qtox/build_extra_cmake_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "extra-cmake-modules" --supported "win32 win64 macos macos-x86_64 macos-arm64" "$@"
parse_arch --dep "extra-cmake-modules" --supported "linux win32 win64 macos macos-x86_64 macos-arm64" "$@"

"$SCRIPT_DIR/download/download_extra_cmake_modules.sh"

cmake -DCMAKE_INSTALL_PREFIX="$DEP_PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-GNinja \
-B_build \
.
cmake --build _build
Expand Down
53 changes: 53 additions & 0 deletions qtox/build_qtbase_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qtbase" --supported "linux" "$@"

"$SCRIPT_DIR/download/download_qtbase.sh"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

mkdir qtbase/_build && pushd qtbase/_build
../configure -prefix "$DEP_PREFIX/qt" \
-appstore-compliant \
-release \
"-$LIB_TYPE" \
-force-asserts \
-qt-doubleconversion \
-qt-harfbuzz \
-qt-libjpeg \
-qt-libpng \
-qt-pcre \
-qt-zlib \
-feature-wayland \
-feature-zstd \
-no-feature-androiddeployqt \
-no-feature-brotli \
-no-feature-macdeployqt \
-no-feature-printsupport \
-no-feature-qmake \
-no-feature-sql \
-no-glib \
-no-opengl \
-fontconfig \
-dbus-linked \
-openssl-linked \
-opensource -confirm-license \
-pch \
-xcb \
-- \
-DTEST_xcb_syslibs=TRUE \
-Wno-dev
cat config.summary
cmake --build .
cmake --install .
popd
25 changes: 25 additions & 0 deletions qtox/build_qtimageformats_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qtimageformats" --supported "linux" "$@"

"$SCRIPT_DIR/download/download_qtimageformats.sh"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

mkdir qtimageformats/_build && pushd qtimageformats/_build
"$DEP_PREFIX/qt/bin/qt-configure-module" .. \
-- \
-Wno-dev
cmake --build .
cmake --install .
popd
25 changes: 25 additions & 0 deletions qtox/build_qtsvg_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qtsvg" --supported "linux" "$@"

"$SCRIPT_DIR/download/download_qtsvg.sh"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

mkdir qtsvg/_build && pushd qtsvg/_build
"$DEP_PREFIX/qt/bin/qt-configure-module" .. \
-- \
-Wno-dev
cmake --build .
cmake --install .
popd
35 changes: 35 additions & 0 deletions qtox/build_qttools_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qttools" --supported "linux" "$@"

"$SCRIPT_DIR/download/download_qttools.sh"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

mkdir qttools/_build && pushd qttools/_build
"$DEP_PREFIX/qt/bin/qt-configure-module" .. \
-no-feature-assistant \
-no-feature-designer \
-no-feature-kmap2qmap \
-no-feature-pixeltool \
-no-feature-qdbus \
-no-feature-qdoc \
-no-feature-qev \
-no-feature-qtattributionsscanner \
-no-feature-qtdiag \
-no-feature-qtplugininfo \
-- \
-Wno-dev
cmake --build .
cmake --install .
popd
25 changes: 25 additions & 0 deletions qtox/build_qtwayland_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qtwayland" --supported "linux" "$@"

"$SCRIPT_DIR/download/download_qtwayland.sh"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

mkdir qtwayland/_build && pushd qtwayland/_build
"$DEP_PREFIX/qt/bin/qt-configure-module" .. \
-- \
-Wno-dev
cmake --build .
cmake --install .
popd
29 changes: 21 additions & 8 deletions qtox/build_sonnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,38 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "sonnet" --supported "macos-x86_64 macos-arm64" "$@"
parse_arch --dep "sonnet" --supported "linux macos-x86_64 macos-arm64" "$@"

"$SCRIPT_DIR/download/download_sonnet.sh"

find . -name CMakeLists.txt -exec sed -i '' -e 's/ MODULE$/ STATIC/g' '{}' ';'
find . -name CMakeLists.txt -exec sed -i '' -e 's/install(TARGETS sonnet_\([^ ]*\) /&EXPORT KF6SonnetTargets/g' '{}' ';'
find . -name CMakeLists.txt -exec sed -i '' -e 's/target_link_libraries(KF6SonnetCore PUBLIC Qt6::Core)/target_link_libraries(KF6SonnetCore PUBLIC Qt6::Core sonnet_hunspell sonnet_nsspellchecker)/' '{}' ';'
if [ "$LIB_TYPE" = "shared" ]; then
CMAKE_CXX_FLAGS=
ENABLE_SHARED=ON
HUNSPELL_LIBRARIES="$(echo /usr/lib/libhunspell*.so)"
else
CMAKE_CXX_FLAGS="-DSONNET_STATIC"
ENABLE_SHARED=OFF
HUNSPELL_LIBRARIES="$(echo "$DEP_PREFIX"/lib/libhunspell*.a)"
find . -name CMakeLists.txt -exec sed -i '' -e 's/ MODULE$/ STATIC/g' '{}' ';'
find . -name CMakeLists.txt -exec sed -i '' -e 's/install(TARGETS sonnet_\([^ ]*\) /&EXPORT KF6SonnetTargets/g' '{}' ';'
find . -name CMakeLists.txt -exec sed -i '' -e 's/target_link_libraries(KF6SonnetCore PUBLIC Qt6::Core)/target_link_libraries(KF6SonnetCore PUBLIC Qt6::Core sonnet_hunspell sonnet_nsspellchecker)/' '{}' ';'
fi

export PATH="$DEP_PREFIX/qt/bin:$PATH"
"$DEP_PREFIX/qt/bin/qt-cmake" \
-DCMAKE_INSTALL_PREFIX="$DEP_PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_SHARED_LIBS="$ENABLE_SHARED" \
-DBUILD_DESIGNERPLUGIN=OFF \
-DSONNET_USE_QML=OFF \
-DHUNSPELL_LIBRARIES="$(echo "$DEP_PREFIX"/lib/libhunspell*.a)" \
-DCMAKE_CXX_FLAGS="-DSONNET_STATIC -DQT_MESSAGELOGCONTEXT" \
-DHUNSPELL_LIBRARIES="$HUNSPELL_LIBRARIES" \
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -DQT_MESSAGELOGCONTEXT" \
-B_build \
-GNinja \
-Wno-dev \
.
cmake --build _build
cmake --install _build
mv "$DEP_PREFIX/include/KF6/SonnetUi/Sonnet" "$DEP_PREFIX/include/KF6/SonnetUi/sonnet"
if [ -d "$DEP_PREFIX/include/KF6/SonnetUi/Sonnet" ]; then
mv "$DEP_PREFIX/include/KF6/SonnetUi/Sonnet" "$DEP_PREFIX/include/KF6/SonnetUi/sonnet"
fi
1 change: 1 addition & 0 deletions qtox/build_toxcore_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build_toxcore() {
-DBOOTSTRAP_DAEMON=OFF \
-DMIN_LOGGER_LEVEL=DEBUG \
-DCMAKE_BUILD_TYPE=Release \
-GNinja \
-B_build \
.

Expand Down
16 changes: 16 additions & 0 deletions qtox/build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ assert_supported() {

parse_arch() {
LIB_TYPE=shared
EXTRA_ARGS=()

while (($# > 0)); do
case $1 in
Expand All @@ -54,6 +55,11 @@ parse_arch() {
usage
exit 1
;;
--)
shift 1
EXTRA_ARGS=("$@")
break
;;
*)
echo "Unexpected argument $1"
usage
Expand Down Expand Up @@ -88,6 +94,16 @@ parse_arch() {
CROSS_CXXFLAG="-mmacosx-version-min=$MACOS_MINIMUM_SUPPORTED_VERSION"
MAKE_JOBS="$(sysctl -n hw.ncpu)"
CMAKE_TOOLCHAIN_FILE=""
elif [ "$SCRIPT_ARCH" == "linux" ]; then
DEP_PREFIX="/work"
mkdir -p "$DEP_PREFIX"
HOST_OPTION=''
CROSS_LDFLAG=""
CROSS_CFLAG=""
CROSS_CPPFLAG=""
CROSS_CXXFLAG=""
MAKE_JOBS="$(nproc)"
CMAKE_TOOLCHAIN_FILE=""
else
echo "Unexpected arch $SCRIPT_ARCH"
usage
Expand Down
91 changes: 78 additions & 13 deletions qtox/docker/Dockerfile.alpine-appimage
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,105 @@ FROM alpine:3.21
RUN ["apk", "add", \
"alsa-plugins", \
"alsa-plugins-pulse", \
"at-spi2-core-dev", \
"bash", \
"ccache", \
"clang", \
"cmake", \
"compiler-rt", \
"coreutils", \
"curl", \
"dbus-dev", \
"ffmpeg-dev", \
"fontconfig-dev", \
"git", \
"gzip", \
"hunspell-dev", \
"libexif-dev", \
"libnotify-dev", \
"libinput-dev", \
"libqrencode-dev", \
"libsodium-dev", \
"libvpx-dev", \
"libxkbcommon-dev", \
"libxscrnsaver-dev", \
"openal-soft-dev", \
"openssl-dev", \
"opus-dev", \
"qt6-qtbase-dev", \
"qt6-qtsvg-dev", \
"qt6-qttools", \
"qt6-qttools-dev", \
"samurai", \
"sonnet-dev", \
"sqlcipher-dev"]
"sqlcipher-dev", \
"xcb-util-cursor-dev", \
"xcb-util-keysyms-dev", \
"xcb-util-wm-dev", \
"wayland-dev", \
"zstd-dev"]

ENV CC=clang CXX=clang++

WORKDIR /work/c-toxcore
RUN git clone --recurse-submodules https://github.com/TokTok/c-toxcore /work/c-toxcore \
&& git checkout v0.2.20 \
&& cmake -B_build -H. -GNinja \
&& cmake --build _build --target install \
&& rm -rf /work/c-toxcore
ARG SCRIPT_ARCH=linux

COPY download/common.sh /build/download/common.sh
COPY build_utils.sh /build/build_utils.sh

COPY download/download_qtbase.sh /build/download/download_qtbase.sh
COPY build_qtbase_linux.sh /build/build_qtbase_linux.sh

RUN mkdir -p /src/qt && \
cd /src/qt && \
/build/build_qtbase_linux.sh --arch ${SCRIPT_ARCH} --libtype shared && \
rm -fr /src/qt

COPY download/download_qttools.sh /build/download/download_qttools.sh
COPY build_qttools_linux.sh /build/build_qttools_linux.sh

RUN mkdir -p /src/qt && \
cd /src/qt && \
/build/build_qttools_linux.sh --arch ${SCRIPT_ARCH} --libtype shared && \
rm -fr /src/qt

COPY download/download_qtsvg.sh /build/download/download_qtsvg.sh
COPY build_qtsvg_linux.sh /build/build_qtsvg_linux.sh

RUN mkdir -p /src/qt && \
cd /src/qt && \
/build/build_qtsvg_linux.sh --arch ${SCRIPT_ARCH} --libtype shared && \
rm -fr /src/qt

COPY download/download_qtimageformats.sh /build/download/download_qtimageformats.sh
COPY build_qtimageformats_linux.sh /build/build_qtimageformats_linux.sh

RUN mkdir -p /src/qt && \
cd /src/qt && \
/build/build_qtimageformats_linux.sh --arch ${SCRIPT_ARCH} --libtype shared && \
rm -fr /src/qt

COPY download/download_qtwayland.sh /build/download/download_qtwayland.sh
COPY build_qtwayland_linux.sh /build/build_qtwayland_linux.sh

RUN mkdir -p /src/qt && \
cd /src/qt && \
/build/build_qtwayland_linux.sh --arch ${SCRIPT_ARCH} --libtype shared && \
rm -fr /src/qt

COPY download/download_extra_cmake_modules.sh /build/download/download_extra_cmake_modules.sh
COPY build_extra_cmake_modules.sh /build/build_extra_cmake_modules.sh
RUN mkdir -p /src/tox && \
cd /src/tox && \
/build/build_extra_cmake_modules.sh --arch ${SCRIPT_ARCH} && \
rm -fr /src/tox

COPY download/download_sonnet.sh /build/download/download_sonnet.sh
COPY build_sonnet.sh /build/build_sonnet.sh
RUN mkdir -p /src/tox && \
cd /src/tox && \
/build/build_sonnet.sh && \
rm -fr /src/tox

COPY download/download_toxcore.sh /build/download/download_toxcore.sh
COPY build_toxcore_linux.sh /build/build_toxcore_linux.sh
RUN mkdir -p /src/tox && \
cd /src/tox && \
/build/build_toxcore_linux.sh && \
rm -fr /src/tox

WORKDIR /qtox
ENV HOME=/qtox
Loading
Loading