2020-12-08 11:04:40 +01:00
|
|
|
$os = $args[0]
|
2022-09-16 06:29:48 +02:00
|
|
|
$use_webengine = $args[1]
|
2022-09-16 06:57:45 +02:00
|
|
|
$use_qt5 = $args[2]
|
2020-12-08 11:02:20 +01:00
|
|
|
|
2020-12-08 11:24:26 +01:00
|
|
|
echo "We are building for MS Windows."
|
2022-09-16 06:30:20 +02:00
|
|
|
echo "OS: $os; WebEngine: $use_webengine; Qt5: $use_qt5"
|
2020-12-08 12:44:28 +01:00
|
|
|
|
2021-01-06 08:15:12 +01:00
|
|
|
$git_revlist = git rev-list --tags --max-count=1
|
|
|
|
$git_tag = git describe --tags $git_revlist
|
|
|
|
$git_revision = git rev-parse --short HEAD
|
2020-12-08 12:44:28 +01:00
|
|
|
$old_pwd = $pwd.Path
|
|
|
|
|
2020-12-08 13:14:12 +01:00
|
|
|
# Prepare environment.
|
2020-12-08 13:30:49 +01:00
|
|
|
Install-Module Pscx -Scope CurrentUser -AllowClobber -Force
|
|
|
|
Install-Module VSSetup -Scope CurrentUser -AllowClobber -Force
|
2020-12-08 13:46:16 +01:00
|
|
|
Import-VisualStudioVars -Architecture x64
|
2020-12-08 13:14:12 +01:00
|
|
|
|
2021-01-19 19:29:20 +01:00
|
|
|
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
|
2021-01-19 19:27:24 +01:00
|
|
|
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
|
2021-01-19 20:03:53 +01:00
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
2021-01-19 19:27:24 +01:00
|
|
|
|
2021-01-19 20:03:53 +01:00
|
|
|
# Get and prepare needed dependencies.
|
2022-09-16 06:29:48 +02:00
|
|
|
if ($use_qt5 -eq "ON") {
|
2023-03-29 09:02:34 +02:00
|
|
|
$qt_version = "5.15.2"
|
2022-09-16 06:29:48 +02:00
|
|
|
}
|
|
|
|
else {
|
2023-10-25 14:12:35 +02:00
|
|
|
$qt_version = "6.5.3"
|
2022-09-16 06:29:48 +02:00
|
|
|
}
|
|
|
|
|
2023-09-25 07:31:43 +02:00
|
|
|
$is_qt_6 = $qt_version.StartsWith("6")
|
|
|
|
|
2023-10-24 07:05:55 +02:00
|
|
|
$maria_version = "11.1.2"
|
2023-11-13 12:10:58 +01:00
|
|
|
$maria_link = "https://mirror.netcologne.de/mariadb/mariadb-$maria_version/winx64-packages/mariadb-$maria_version-winx64.zip"
|
2021-01-19 20:03:53 +01:00
|
|
|
$maria_output = "maria.zip"
|
2023-10-20 13:12:24 +02:00
|
|
|
|
2023-10-24 07:05:55 +02:00
|
|
|
$cmake_version = "3.27.7"
|
2021-11-18 08:40:28 +01:00
|
|
|
$cmake_link = "https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-windows-x86_64.zip"
|
|
|
|
$cmake_output = "cmake.zip"
|
2021-01-19 19:29:20 +01:00
|
|
|
|
2023-10-20 13:12:24 +02:00
|
|
|
$zlib_version = "1.3"
|
|
|
|
$zlib_link = "https://github.com/madler/zlib/archive/refs/tags/v$zlib_version.zip"
|
|
|
|
$zlib_output = "zlib.zip"
|
|
|
|
|
2021-01-19 20:03:53 +01:00
|
|
|
Invoke-WebRequest -Uri "$maria_link" -OutFile "$maria_output"
|
2023-10-20 13:12:24 +02:00
|
|
|
& ".\resources\scripts\7za\7za.exe" x "$maria_output"
|
2020-12-08 12:44:28 +01:00
|
|
|
|
2021-11-18 08:40:28 +01:00
|
|
|
Invoke-WebRequest -Uri "$cmake_link" -OutFile "$cmake_output"
|
2023-10-20 13:12:24 +02:00
|
|
|
& ".\resources\scripts\7za\7za.exe" x "$cmake_output"
|
|
|
|
|
|
|
|
Invoke-WebRequest -Uri "$zlib_link" -OutFile "$zlib_output"
|
|
|
|
& ".\resources\scripts\7za\7za.exe" x "$zlib_output"
|
2021-11-18 08:40:28 +01:00
|
|
|
|
|
|
|
$cmake_path = "$old_pwd\cmake-$cmake_version-windows-x86_64\bin\cmake.exe"
|
2023-10-20 13:12:24 +02:00
|
|
|
$zlib_path = "$old_pwd\zlib-$zlib_version"
|
2021-11-18 08:40:28 +01:00
|
|
|
|
2021-01-19 20:03:53 +01:00
|
|
|
# Download Qt itself.
|
2021-01-20 08:04:45 +01:00
|
|
|
$qt_path = "$old_pwd\qt"
|
2023-03-30 08:16:22 +02:00
|
|
|
|
|
|
|
# Install "aqtinstall" from its master branch to have latest code.
|
2021-06-22 07:59:05 +02:00
|
|
|
pip3 install -U pip
|
2023-03-30 08:16:22 +02:00
|
|
|
pip3 install -I git+https://github.com/miurahr/aqtinstall
|
2021-11-18 08:40:28 +01:00
|
|
|
|
2023-09-25 07:31:43 +02:00
|
|
|
if ($is_qt_6) {
|
2023-11-14 09:48:36 +01:00
|
|
|
aqt -c 'aqt\settings.ini' install-qt -O "$qt_path" windows desktop $qt_version win64_msvc2019_64 -m qtwebengine qtimageformats qtmultimedia qt5compat qtwebchannel qtpositioning
|
2021-11-19 10:23:50 +01:00
|
|
|
}
|
|
|
|
else {
|
2023-11-14 09:48:36 +01:00
|
|
|
aqt -c 'aqt\settings.ini' install-qt -O "$qt_path" windows desktop $qt_version win64_msvc2019_64 -m qtwebengine
|
2021-11-19 10:23:50 +01:00
|
|
|
}
|
|
|
|
|
2023-11-14 09:48:36 +01:00
|
|
|
aqt -c 'aqt\settings.ini' install-src -O "$qt_path" windows desktop $qt_version --archives qtbase
|
2020-12-08 12:44:28 +01:00
|
|
|
|
2021-01-20 08:04:45 +01:00
|
|
|
$qt_qmake = "$qt_path\$qt_version\msvc2019_64\bin\qmake.exe"
|
|
|
|
$env:PATH = "$qt_path\$qt_version\msvc2019_64\bin\;" + $env:PATH
|
|
|
|
|
2023-09-25 07:31:43 +02:00
|
|
|
if ($is_qt_6) {
|
|
|
|
# Download openssl 3.x.
|
2023-11-14 09:48:36 +01:00
|
|
|
aqt -c 'aqt\settings.ini' install-tool -O "$qt_path" windows desktop tools_opensslv3_x64 qt.tools.opensslv3.win_x64
|
2023-09-25 07:31:43 +02:00
|
|
|
$openssl_base_path = "$qt_path\Tools\OpenSSLv3\Win_x64"
|
|
|
|
}
|
|
|
|
else {
|
2023-09-25 07:45:04 +02:00
|
|
|
# Download openssl 1.x from external source.
|
|
|
|
$openssl_link = "https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1w.zip";
|
|
|
|
$openssl_output = "openssl.zip"
|
|
|
|
Invoke-WebRequest -Uri "$openssl_link" -OutFile "$openssl_output"
|
|
|
|
& ".\resources\scripts\7za\7za.exe" x $openssl_output
|
|
|
|
$openssl_base_path = "$pwd\openssl-1.1\x64"
|
2023-09-25 07:31:43 +02:00
|
|
|
}
|
2020-12-08 12:52:00 +01:00
|
|
|
|
2021-01-19 20:03:53 +01:00
|
|
|
# Build dependencies.
|
2023-10-20 13:12:24 +02:00
|
|
|
|
|
|
|
# MariaDB.
|
2021-01-20 08:04:45 +01:00
|
|
|
$maria_path = "$old_pwd\mariadb-$maria_version-winx64"
|
2021-11-18 08:40:28 +01:00
|
|
|
$qt_sqldrivers_path = "$qt_path\$qt_version\Src\qtbase\src\plugins\sqldrivers"
|
2021-01-20 08:04:45 +01:00
|
|
|
|
|
|
|
cd "$qt_sqldrivers_path"
|
2021-11-19 10:28:53 +01:00
|
|
|
|
2023-09-25 07:31:43 +02:00
|
|
|
if ($is_qt_6) {
|
2021-11-19 10:28:53 +01:00
|
|
|
& $cmake_path -G Ninja -DCMAKE_BUILD_TYPE="Release" -DMySQL_INCLUDE_DIR="$maria_path\include\mysql" -DMySQL_LIBRARY="$maria_path\lib\libmariadb.lib"
|
|
|
|
& $cmake_path --build .
|
2022-02-05 08:06:33 +01:00
|
|
|
|
|
|
|
$with_qt6 = "ON"
|
2021-11-19 10:28:53 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
& $qt_qmake -- MYSQL_INCDIR="$maria_path\include\mysql" MYSQL_LIBDIR="$maria_path\lib"
|
|
|
|
nmake.exe sub-mysql
|
2022-02-05 08:06:33 +01:00
|
|
|
|
|
|
|
$with_qt6 = "OFF"
|
2021-11-19 10:28:53 +01:00
|
|
|
}
|
|
|
|
|
2023-10-20 13:12:24 +02:00
|
|
|
# zlib
|
|
|
|
cd "$zlib_path"
|
|
|
|
nmake.exe -f "win32\Makefile.msc"
|
|
|
|
|
2021-01-20 08:04:45 +01:00
|
|
|
cd "$old_pwd"
|
2021-01-19 20:03:53 +01:00
|
|
|
|
2020-12-08 12:59:10 +01:00
|
|
|
# Build application.
|
2020-12-08 12:52:00 +01:00
|
|
|
mkdir "rssguard-build"
|
|
|
|
cd "rssguard-build"
|
2023-08-29 07:28:16 +02:00
|
|
|
|
2023-10-20 13:12:24 +02:00
|
|
|
& "$cmake_path" ".." -G Ninja -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_VERBOSE_MAKEFILE="ON" -DBUILD_WITH_QT6="$with_qt6" -DREVISION_FROM_GIT="ON" -DUSE_SYSTEM_SQLITE="OFF" -DZLIB_ROOT="$zlib_path" -DENABLE_COMPRESSED_SITEMAP="ON" -DUSE_WEBENGINE="$use_webengine" -DFEEDLY_CLIENT_ID="$env:FEEDLY_CLIENT_ID" -DFEEDLY_CLIENT_SECRET="$env:FEEDLY_CLIENT_SECRET" -DGMAIL_CLIENT_ID="$env:GMAIL_CLIENT_ID" -DGMAIL_CLIENT_SECRET="$env:GMAIL_CLIENT_SECRET"
|
2022-01-31 13:11:48 +05:00
|
|
|
& "$cmake_path" --build .
|
|
|
|
& "$cmake_path" --install . --prefix app
|
2020-12-08 12:52:00 +01:00
|
|
|
|
|
|
|
cd "app"
|
2022-01-31 13:11:48 +05:00
|
|
|
windeployqt.exe --verbose 1 --no-compiler-runtime --no-translations --release rssguard.exe rssguard.dll
|
2020-12-08 12:52:00 +01:00
|
|
|
cd ".."
|
|
|
|
|
|
|
|
# Copy OpenSSL.
|
2021-01-20 08:04:45 +01:00
|
|
|
Copy-Item -Path "$openssl_base_path\bin\libcrypto*.dll" -Destination ".\app\"
|
|
|
|
Copy-Item -Path "$openssl_base_path\bin\libssl*.dll" -Destination ".\app\"
|
2020-12-08 12:52:00 +01:00
|
|
|
|
2021-01-20 08:04:45 +01:00
|
|
|
# Copy MySQL.
|
2022-08-30 10:02:22 +02:00
|
|
|
Copy-Item -Path "$maria_path\lib\libmariadb.dll" -Destination ".\app\"
|
2021-01-20 08:04:45 +01:00
|
|
|
Copy-Item -Path "$qt_sqldrivers_path\plugins\sqldrivers\qsqlmysql.dll" -Destination ".\app\sqldrivers\" -Force
|
2020-12-08 12:52:00 +01:00
|
|
|
|
2023-10-20 13:43:41 +02:00
|
|
|
# Copy zlib.
|
|
|
|
Copy-Item -Path "$zlib_path\zlib1.dll" -Destination ".\app\"
|
|
|
|
|
2023-09-29 09:04:15 +02:00
|
|
|
# Copy debug symbols for devbuilds.
|
|
|
|
if ($git_tag -eq "devbuild") {
|
|
|
|
Copy-Item -Path ".\src\librssguard\rssguard.pdb" -Destination ".\app\"
|
|
|
|
}
|
|
|
|
|
2022-09-16 06:29:48 +02:00
|
|
|
if ($use_webengine -eq "ON") {
|
|
|
|
$packagebase = "rssguard-${git_tag}-${git_revision}-win"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$packagebase = "rssguard-${git_tag}-${git_revision}-nowebengine-win"
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($use_qt5 -eq "ON") {
|
|
|
|
$packagebase += "7"
|
2021-01-06 08:15:12 +01:00
|
|
|
}
|
|
|
|
else {
|
2022-09-16 06:29:48 +02:00
|
|
|
$packagebase += "10"
|
2021-01-06 08:15:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Create 7zip package.
|
2021-01-06 11:14:30 +01:00
|
|
|
& "$old_pwd\resources\scripts\7za\7za.exe" a -t7z -mmt -mx9 "$packagebase.7z" ".\app\*"
|
2021-01-06 08:15:12 +01:00
|
|
|
|
|
|
|
# Create NSIS installation package.
|
|
|
|
& "$old_pwd\resources\scripts\nsis\makensis.exe" "/XOutFile $packagebase.exe" ".\NSIS.template.in"
|
|
|
|
|
2022-01-31 13:11:48 +05:00
|
|
|
ls
|