Skip to content

Commit 4717442

Browse files
committed
[build] Include Qt license notices in Windows wheels
1 parent 365b4aa commit 4717442

3 files changed

Lines changed: 52 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ jobs:
242242
Add-Content -Path $env:GITHUB_ENV -Value "BAZEL_RULES_QT_DIR=$env:QT_ROOT_DIR"
243243
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $env:QT_ROOT_DIR "bin")
244244
Add-Content -Path $env:GITHUB_PATH -Value "C:\Program Files\Git\usr\bin"
245+
- name: Collect Qt licenses and notices
246+
shell: bash
247+
run: |
248+
qt_prefix=$(cygpath -u "$QT_ROOT_DIR")
249+
bash third_party/qt/build_release.sh --licenses-only "$qt_prefix"
250+
echo "WHEEL_LICENSE_DIR=$(cygpath -m "$qt_prefix/licenses/qt6")" >> "$GITHUB_ENV"
245251
- name: Install bazelisk
246252
shell: pwsh
247253
run: |

docs/content/build.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ Windows release wheels currently bundle the Qt runtime DLLs required by
177177
Procgen (``Qt6Core.dll`` and ``Qt6Gui.dll``) directly next to
178178
``procgen_envpool.pyd``. End users installing the wheel do **not** need a
179179
separate Qt installation at runtime on Windows.
180+
The Qt license texts, SDK component notices, and build configuration are also
181+
included under ``.dist-info/licenses/qt6``. Release builds collect these with
182+
``third_party/qt/build_release.sh --licenses-only "$QT_ROOT_DIR"``.
180183

181184
macOS wheels do not bundle Qt frameworks. Install Homebrew Qt 6 with
182185
``brew install qtbase`` before importing EnvPool; the frameworks are required

third_party/qt/build_release.sh

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@
1515

1616
# Build the shared Qt raster runtime in the target manylinux image, not on the
1717
# host: upstream Qt binaries have a newer glibc baseline, especially on ARM64.
18+
# --licenses-only collects notices for the prebuilt Windows SDK instead.
1819
set -Eeuo pipefail
1920

2021
qt_version=6.11.1
2122
qt_sha256=d9594a31228aa23ad6b531719a29b45f0f3989fe6c136d45767ea179f233c1ac
2223
qt_url="https://download.qt.io/official_releases/qt/6.11/$qt_version/submodules/qtbase-everywhere-src-$qt_version.tar.xz"
24+
licenses_only=false
25+
if [[ ${1:-} == --licenses-only ]]; then
26+
licenses_only=true
27+
shift
28+
: "${1:?--licenses-only requires the installed Qt SDK path}"
29+
fi
2330
prefix=${1:-/opt/envpool-qt6}
2431
work_dir=$(mktemp -d)
2532
trap 'rm -rf "$work_dir"' EXIT
@@ -28,27 +35,37 @@ if [[ -z ${QT_SOURCE_ARCHIVE:-} ]]; then
2835
curl --fail --location --retry 3 --output "$archive" "$qt_url"
2936
fi
3037
printf '%s %s\n' "$qt_sha256" "$archive" | sha256sum --check
31-
tar --no-same-owner -xf "$archive" -C "$work_dir"
3238
source_dir="$work_dir/qtbase-everywhere-src-$qt_version"
33-
mkdir "$work_dir/build"
34-
cd "$work_dir/build"
39+
if [[ $licenses_only == true ]]; then
40+
sdk_version=$("$prefix/bin/qtpaths" --qt-version | tr -d '\r')
41+
if [[ $sdk_version != "$qt_version" ]]; then
42+
echo "Expected Qt $qt_version, found $sdk_version" >&2
43+
exit 1
44+
fi
45+
tar --no-same-owner -xf "$archive" -C "$work_dir" \
46+
"qtbase-everywhere-src-$qt_version/LICENSES"
47+
else
48+
tar --no-same-owner -xf "$archive" -C "$work_dir"
49+
mkdir "$work_dir/build"
50+
cd "$work_dir/build"
3551

36-
# Procgen uses QImage/QPainter and PNG assets, without windows or text. Keep
37-
# PNG in QtGui and build its small dependencies from Qt's pinned sources;
38-
# disabling ICU and display/font backends avoids a large system runtime stack.
39-
"$source_dir/configure" \
40-
-prefix "$prefix" -libdir lib -release -shared \
41-
-opensource -confirm-license -nomake examples -nomake tests \
42-
-no-feature-network -no-feature-dbus -no-feature-sql \
43-
-no-feature-widgets -no-feature-printsupport -no-feature-testlib \
44-
-no-feature-xml -no-feature-concurrent \
45-
-no-icu -no-glib -no-zstd -no-opengl -no-feature-vulkan \
46-
-no-xcb -no-feature-wayland -no-feature-eglfs -no-feature-linuxfb \
47-
-no-fontconfig -no-freetype -no-harfbuzz -no-libjpeg \
48-
-qt-libpng -qt-zlib -qt-pcre \
49-
-- -DQT_INSTALL_CONFIG_INFO_FILES=ON
50-
cmake --build . --parallel "${CMAKE_BUILD_PARALLEL_LEVEL:-2}"
51-
cmake --install . --strip
52+
# Procgen uses QImage/QPainter and PNG assets, without windows or text. Keep
53+
# PNG in QtGui and build its small dependencies from Qt's pinned sources;
54+
# disabling ICU and display/font backends avoids a large system runtime stack.
55+
"$source_dir/configure" \
56+
-prefix "$prefix" -libdir lib -release -shared \
57+
-opensource -confirm-license -nomake examples -nomake tests \
58+
-no-feature-network -no-feature-dbus -no-feature-sql \
59+
-no-feature-widgets -no-feature-printsupport -no-feature-testlib \
60+
-no-feature-xml -no-feature-concurrent \
61+
-no-icu -no-glib -no-zstd -no-opengl -no-feature-vulkan \
62+
-no-xcb -no-feature-wayland -no-feature-eglfs -no-feature-linuxfb \
63+
-no-fontconfig -no-freetype -no-harfbuzz -no-libjpeg \
64+
-qt-libpng -qt-zlib -qt-pcre \
65+
-- -DQT_INSTALL_CONFIG_INFO_FILES=ON
66+
cmake --build . --parallel "${CMAKE_BUILD_PARALLEL_LEVEL:-2}"
67+
cmake --install . --strip
68+
fi
5269

5370
# Ship upstream license texts and attributions alongside the dynamically
5471
# linked libraries. The SBOM describes the Qt build before auditwheel repair.
@@ -61,12 +78,14 @@ This wheel includes Qt Core and Qt Gui $qt_version, dynamically linked under
6178
LGPL-3.0-only, and the third-party code identified in the Qt build SBOM.
6279
Copyright (C) The Qt Company Ltd. and other contributors.
6380
License texts are in LICENSES/; component copyright notices are in sbom/.
64-
The SBOM describes the upstream build before auditwheel renaming and stripping.
81+
The SBOM describes the upstream build before wheel repair and stripping.
6582
6683
Unmodified corresponding Qt sources: $qt_url
6784
SHA256: $qt_sha256
68-
Build instructions and configuration: third_party/qt/build_release.sh in
69-
https://github.com/sail-sg/envpool
70-
The libraries in envpool.libs can be replaced with compatible modified Qt
71-
libraries; preserve their auditwheel-assigned filenames and dependency names.
85+
Linux build instructions: third_party/qt/build_release.sh in
86+
https://github.com/sail-sg/envpool. Windows uses the upstream Qt SDK.
87+
The build configuration is included here for both platforms.
88+
The libraries in envpool.libs (Linux) or envpool/procgen (Windows) can be
89+
replaced with compatible modified Qt libraries; preserve their filenames
90+
and dependency names, including auditwheel-assigned names on Linux.
7291
EOF

0 commit comments

Comments
 (0)