Skip to content

Commit

Permalink
cleanup: Be more selective about Qt image format plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Jan 8, 2025
1 parent 8ba1545 commit 8195d60
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 91 deletions.
39 changes: 1 addition & 38 deletions qtox/build_qt_windows.sh → qtox/build_qtbase_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qt" --supported "win32 win64" "$@"

"$SCRIPT_DIR/download/download_qt.sh"
"$SCRIPT_DIR/download/download_qtbase.sh"

CROSS_COMPILE="$MINGW_ARCH-w64-mingw32-"
"${CROSS_COMPILE}gcc" --version
Expand Down Expand Up @@ -56,40 +56,3 @@ cat config.summary
cmake --build .
cmake --install .
popd

mkdir qttools/_build && pushd qttools/_build
"$DEP_PREFIX/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 \
-- \
-DCMAKE_CXX_FLAGS="-DQT_MESSAGELOGCONTEXT" \
-Wno-dev
cmake --build .
cmake --install .
popd

mkdir qtsvg/_build && pushd qtsvg/_build
"$DEP_PREFIX/bin/qt-configure-module" .. \
-- \
-DCMAKE_CXX_FLAGS="-DQT_MESSAGELOGCONTEXT" \
-Wno-dev
cmake --build .
cmake --install .
popd

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

# SPDX-License-Identifier: GPL-3.0-or-later AND MIT
# Copyright © 2017-2021 Maxim Biro <nurupo.contributions@gmail.com>
# Copyright © 2021 by The qTox Project Contributors
# Copyright © 2024-2025 The TokTok team

set -euxo pipefail

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

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qt" --supported "win32 win64" "$@"

"$SCRIPT_DIR/download/download_qtimageformats.sh"

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

# SPDX-License-Identifier: GPL-3.0-or-later AND MIT
# Copyright © 2017-2021 Maxim Biro <nurupo.contributions@gmail.com>
# Copyright © 2021 by The qTox Project Contributors
# Copyright © 2024-2025 The TokTok team

set -euxo pipefail

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

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qt" --supported "win32 win64" "$@"

"$SCRIPT_DIR/download/download_qtsvg.sh"

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

# SPDX-License-Identifier: GPL-3.0-or-later AND MIT
# Copyright © 2017-2021 Maxim Biro <nurupo.contributions@gmail.com>
# Copyright © 2021 by The qTox Project Contributors
# Copyright © 2024-2025 The TokTok team

set -euxo pipefail

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

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qt" --supported "win32 win64" "$@"

"$SCRIPT_DIR/download/download_qttools.sh"

mkdir qttools/_build && pushd qttools/_build
"$DEP_PREFIX/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 \
-- \
-DCMAKE_CXX_FLAGS="-DQT_MESSAGELOGCONTEXT" \
-Wno-dev
cmake --build .
cmake --install .
popd
45 changes: 37 additions & 8 deletions qtox/docker/Dockerfile.windows-builder
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ARG SCRIPT_ARCH=$WINEARCH
RUN update-alternatives --set "${ARCH}-w64-mingw32-gcc" "/usr/bin/${ARCH}-w64-mingw32-gcc-posix" \
&& update-alternatives --set "${ARCH}-w64-mingw32-g++" "/usr/bin/${ARCH}-w64-mingw32-g++-posix"

COPY toolchain/windows-${ARCH}-toolchain.cmake /build/windows-toolchain.cmake
COPY --chmod=644 toolchain/windows-${ARCH}-toolchain.cmake /build/windows-toolchain.cmake

COPY download/common.sh /build/download/
COPY build_utils.sh /build/
Expand Down Expand Up @@ -191,12 +191,36 @@ RUN mkdir -p /src/zstd \

COPY download/version_qt.sh /build/download/

COPY download/download_qt.sh /build/download/
COPY build_qt_windows.sh /build/
COPY download/download_qtbase.sh /build/download/
COPY build_qtbase_windows.sh /build/

RUN mkdir -p /src/qt \
&& cd /src/qt \
&& /build/build_qt_windows.sh --arch "$SCRIPT_ARCH" \
&& /build/build_qtbase_windows.sh --arch "$SCRIPT_ARCH" \
&& rm -fr /src/qt

COPY download/download_qttools.sh /build/download/
COPY build_qttools_windows.sh /build/

RUN mkdir -p /src/qt \
&& cd /src/qt \
&& /build/build_qttools_windows.sh --arch "$SCRIPT_ARCH" \
&& rm -fr /src/qt

COPY download/download_qtsvg.sh /build/download/
COPY build_qtsvg_windows.sh /build/

RUN mkdir -p /src/qt \
&& cd /src/qt \
&& /build/build_qtsvg_windows.sh --arch "$SCRIPT_ARCH" \
&& rm -fr /src/qt

COPY download/download_qtimageformats.sh /build/download/
COPY build_qtimageformats_windows.sh /build/

RUN mkdir -p /src/qt \
&& cd /src/qt \
&& /build/build_qtimageformats_windows.sh --arch "$SCRIPT_ARCH" \
&& rm -fr /src/qt

COPY download/download_extra_cmake_modules.sh /build/download/
Expand Down Expand Up @@ -273,14 +297,19 @@ RUN mkdir /export \
&& cp /windows/bin/libzstd.dll /export \
&& cp /windows/lib/libqrencode.dll /export \
&& cp -r /windows/lib/plugins/kf6 /export \
&& cp -r /windows/plugins/iconengines /export \
&& cp -r /windows/plugins/imageformats /export \
&& cp -r /windows/plugins/platforms /export \
&& cp -r /windows/plugins/tls /export

COPY --from=debug-export /debug_export/ /debug_export/
# We're selective about Qt image format plugins for security reasons. We only
# include the ones we've tested (e.g. with fuzzing).
RUN mkdir /export/iconengines \
&& cp /windows/plugins/iconengines/qsvgicon.dll /export/iconengines/ \
&& mkdir /export/imageformats \
&& for fmt in kimg_qoi qgif qjpeg qsvg qwebp; do \
cp "/windows/plugins/imageformats/$fmt.dll" /export/imageformats/; \
done

RUN chmod 0644 /build/windows-toolchain.cmake
COPY --from=debug-export /debug_export/ /debug_export/

WORKDIR /qtox
ENV HOME=/qtox
45 changes: 0 additions & 45 deletions qtox/download/download_qt.sh

This file was deleted.

0 comments on commit 8195d60

Please sign in to comment.