Skip to content

Commit

Permalink
Harvest files added by windeployqt dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
J5lx committed Aug 15, 2023
1 parent d428ae7 commit 19e3435
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 163 deletions.
37 changes: 31 additions & 6 deletions .github/actions/create-package/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
trap 'echo "::error::Command failed"' ERR
set -eE

harvest_windeployqt() {
echo "<?xml version='1.0' encoding='utf-8'?>"
echo "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>"
echo " <Fragment>"
echo " <ComponentGroup Id='windeployqt' Directory='INSTALLDIR'>"

while IFS= read -r filepath; do
if [ "${filepath%%_*}" = "translations\\qtbase" -o "${filepath%%_*}" = "translations\\qtmultimedia" -o "${filepath%%_*}" = "vc" ]; then
# windeployqt lists some translation files that it doesn't actually copy, and the MSVC redistributable is handled by the bundle
continue
fi
local subdirectory="$(dirname "${filepath}")"
if [ "${subdirectory}" = "." ]; then
echo " <Component>"
else
echo " <Component Subdirectory='${subdirectory}'>"
fi
echo " <File Source='${filepath}' />"
echo " </Component>"
done

echo " </ComponentGroup>"
echo " </Fragment>"
echo "</Wix>"
}

create_package_linux() {
echo "::group::Set up AppImage contents"
make install INSTALL_ROOT="${PWD}/Pencil2D"
Expand Down Expand Up @@ -100,15 +126,14 @@ create_package_windows() {
mv bin Pencil2D
echo "Remove files"
find \( -name '*.pdb' -o -name '*.ilk' \) -delete
echo "::group::Deploy Qt libraries"
windeployqt Pencil2D/pencil2d.exe
echo "::endgroup::"
echo "Deploy Qt libraries"
windeployqt --list relative Pencil2D/pencil2d.exe | harvest_windeployqt > windeployqt.wxs
echo "Copy OpenSSL DLLs"
local wordsize="${platform#win}"
local xbits="-x${wordsize}"
local _xbits="_x${wordsize}"
cp "${IQTA_TOOLS}\\OpenSSL\\Win${_xbits/32/86}\\bin\\lib"{ssl,crypto}"-1_1${xbits/-x32/}.dll" Pencil2D/
echo "Create Installer"
echo "::group::Create Installer"
env -C ../util/installer qmake CONFIG-=debug_and_release CONFIG+=release
env -C ../util/installer "PATH=${PATH/\/usr\/bin:/}" nmake
local versiondefines="-d Edition=Nightly -d NightlyBuildNumber=$1 -d NightlyBuildTimestamp=$(date +%F)"
Expand All @@ -119,13 +144,13 @@ create_package_windows() {
-d "ProductCode=$(python -c "import uuid; print(str(uuid.uuid5(uuid.NAMESPACE_URL, '-Nhttps://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}')).upper())")" \
$versiondefines \
-out "pencil2d-${platform}-$3.msi" \
../util/installer/pencil2d.wxs
../util/installer/pencil2d.wxs windeployqt.wxs
wix build -arch "x${wordsize/32/86}" -dcl high -sw1133 -b ../util/installer -b Pencil2D \
-ext WixToolset.Util.wixext -ext WixToolset.Bal.wixext \
-d "ProductCode=$(python -c "import uuid; print(str(uuid.uuid5(uuid.NAMESPACE_URL, '-Nhttps://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}')).upper())")" \
$versiondefines \
-out "pencil2d-${platform}-$3.exe" \
../util/installer/pencil2d.bundle.wxs
echo "::endgroup::"
echo "Create ZIP"
local qtsuffix="-qt${INPUT_QT}"
"${WINDIR}\\System32\\tar" caf "pencil2d${qtsuffix/-qt5/}-${platform}-$3.zip" Pencil2D
Expand Down
158 changes: 1 addition & 157 deletions util/installer/pencil2d.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -91,172 +91,16 @@
</Shortcut>
<RegistryValue Root="HKMU" Key="SOFTWARE\Pencil\Pencil" Name="DesktopShortcutPresent" Type="integer" Value="1" />
</Component>
<!-- TODO: Find a way to include the files created by windeployqt automatically -->
<Component Directory="INSTALLDIR">
<File Source="d3dcompiler_47.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="libcrypto-1_1$(OpenSSLSuffix).dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="libEGL.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="libGLESV2.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="libssl-1_1$(OpenSSLSuffix).dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="opengl32sw.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="Qt5Core.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="Qt5Gui.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="Qt5Multimedia.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="Qt5Network.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="Qt5Svg.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="Qt5Widgets.dll" />
</Component>
<Component Directory="INSTALLDIR">
<File Source="Qt5Xml.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="audio">
<File Source="audio\qtaudio_wasapi.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="audio">
<File Source="audio\qtaudio_windows.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="bearer">
<File Source="bearer\qgenericbearer.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="iconengines">
<File Source="iconengines\qsvgicon.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qgif.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qicns.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qico.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qjpeg.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qsvg.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qtga.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qtiff.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qwbmp.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="imageformats">
<File Source="imageformats\qwebp.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="mediaservice">
<File Source="mediaservice\dsengine.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="mediaservice">
<File Source="mediaservice\qtmedia_audioengine.dll"/>
</Component>
<Component Directory="INSTALLDIR" Subdirectory="mediaservice">
<File Source="mediaservice\wmfengine.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="platforms">
<File Source="platforms\qwindows.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="playlistformats">
<File Source="playlistformats\qtmultimedia_m3u.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="plugins">
<File Source="plugins\ffmpeg.exe" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="styles">
<File Source="styles\qwindowsvistastyle.dll" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_ar.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_bg.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_ca.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_cs.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_da.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_de.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_en.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_es.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_fi.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_fr.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_gd.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_he.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_hu.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_it.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_ja.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_ko.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_lv.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_pl.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_ru.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_sk.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_uk.qm" />
</Component>
<Component Directory="INSTALLDIR" Subdirectory="translations">
<File Source="translations\qt_zh_TW.qm" />
</Component>
<ComponentGroupRef Id="windeployqt" />
</Feature>
</Package>
</Wix>

0 comments on commit 19e3435

Please sign in to comment.