Skip to content

Commit

Permalink
Add AppVeyor configuration for Windows release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedld committed May 5, 2020
1 parent 5844284 commit 0136893
Show file tree
Hide file tree
Showing 11 changed files with 695 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ macosx/Info.plist
macosx/Transmission.app
macosx/en.lproj/*~.nib
po/*.mo
/release
third-party/miniupnp/miniupnpcstrings.h
95 changes: 95 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
version: '{build}'

environment:
AWS_ACCESS_KEY_ID:
secure: JH2KJ09654cSwhYup2MKb80kK60+nezvUmFzBay7tUI=
AWS_SECRET_ACCESS_KEY:
secure: fum5aRKLhJvxh3UQhiQVt2acV4eke8GiGdMhHIW/uuQC7wztj4T9tJWp5IO1U7m4
AWS_S3_BUCKET_NAME:
secure: Bf3x1Iruxg+l3tp+an+g9kWhBexLLw/69gEt9bEu7Zk=

matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TR_ARCH: x86
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TR_ARCH: x64

for:
-
matrix:
only:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019

clone_folder: '%SystemDrive%\%TR_ARCH%-project'

install:
- pwsh: |
$Version = git describe --tags --abbrev=10 --always
if ($Version -ne $Env:APPVEYOR_REPO_BRANCH) {
$version += "-${Env:APPVEYOR_REPO_BRANCH}"
}
$BuildIndex = 0
appveyor UpdateBuild -Version $Version
while ($LastExitCode -ne 0) {
$BuildIndex += 1
appveyor UpdateBuild -Version "${Version}+${BuildIndex}"
}
git submodule update --init --recursive
choco install ActivePerl
choco install nasm
choco install jom
choco install imagemagick.tool
choco install wixtoolset --version 3.11.2
Remove-Item -Path (Join-Path $Env:SystemDrive OpenSSL-Win32) -Recurse
Remove-Item -Path (Join-Path $Env:SystemDrive OpenSSL-Win64) -Recurse
Install-Module -Name SignPath
build_script:
- pwsh: |
$Env:PATH = @(
(Join-Path $Env:SystemDrive Perl64 bin)
(Join-Path $Env:ProgramFiles NASM)
(Join-Path ${Env:ProgramFiles(x86)} 'WiX Toolset v3.11' bin)
$Env:PATH
) -join [System.IO.Path]::PathSeparator
Set-ExecutionPolicy -Scope Process Bypass
try {
& (Join-Path $Env:APPVEYOR_BUILD_FOLDER release windows main.ps1) `
-Mode Build `
-BuildArch $env:TR_ARCH
} catch {
Write-Error ("{1}{0}{2}{0}{3}" -f [Environment]::NewLine, $_.ToString(), $_.InvocationInfo.PositionMessage, $_.ScriptStackTrace) -ErrorAction Continue
exit 1
}
test_script:
- pwsh: |
Set-ExecutionPolicy -Scope Process Bypass
try {
& (Join-Path $Env:APPVEYOR_BUILD_FOLDER release windows main.ps1) `
-Mode Test `
-BuildArch $env:TR_ARCH
} catch {
Write-Error ("{1}{0}{2}{0}{3}" -f [Environment]::NewLine, $_.ToString(), $_.InvocationInfo.PositionMessage, $_.ScriptStackTrace) -ErrorAction Continue
exit 1
}
artifacts:
- path: '*.msi'
- path: '*-pdb.zip'

deploy:
- provider: Webhook
url: https://app.signpath.io/API/v1/8c96c8c9-a72c-4b46-a53c-80aad617f6bc/Integrations/AppVeyor?ProjectKey=transmission&SigningPolicyKey=test-signing
authorization:
secure: PrvcykaHmPgJ0ENht1q58tCfjRcmybiOeHYrvtQtAGsfahWvniAfP66DqHxv872acpyf3FpJn2ETCeszoVuFGA==
on:
APPVEYOR_REPO_TAG: true
41 changes: 41 additions & 0 deletions release/windows/build-curl.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env pwsh

$global:CurlVersion = '7.70.0'

$global:CurlDeps = @(
'OpenSsl'
'Zlib'
)

function global:Build-Curl([string] $PrefixDir, [string] $Arch, [string] $DepsPrefixDir) {
$Filename = "curl-${CurlVersion}.tar.gz"
$Url = "https://curl.haxx.se/download/${Filename}"

$SourceDir = Invoke-DownloadAndUnpack $Url $Filename
$BuildDir = Join-Path $SourceDir .build

$ConfigOptions = @(
'-DCMAKE_BUILD_TYPE=RelWithDebInfo'
"-DCMAKE_INSTALL_PREFIX=${PrefixDir}"
"-DCMAKE_PREFIX_PATH=${DepsPrefixDir}"
'-DCMAKE_USE_OPENSSL=ON'
'-DCURL_WINDOWS_SSPI=OFF'
'-DBUILD_CURL_EXE=OFF'
'-DBUILD_TESTING=OFF'
'-DCURL_DISABLE_DICT=ON'
'-DCURL_DISABLE_GOPHER=ON'
'-DCURL_DISABLE_IMAP=ON'
'-DCURL_DISABLE_SMTP=ON'
'-DCURL_DISABLE_POP3=ON'
'-DCURL_DISABLE_RTSP=ON'
'-DCURL_DISABLE_TFTP=ON'
'-DCURL_DISABLE_TELNET=ON'
'-DCURL_DISABLE_LDAP=ON'
'-DCURL_DISABLE_LDAPS=ON'
'-DENABLE_MANUAL=OFF'
)

Invoke-CMakeBuildAndInstall $SourceDir $BuildDir $ConfigOptions
Invoke-NativeCommand cmake -E remove_directory (Join-Path $PrefixDir lib cmake CURL) # until we support it
Copy-Item -Path (Join-Path $BuildDir lib libcurl.pdb) -Destination (Join-Path $PrefixDir bin)
}
28 changes: 28 additions & 0 deletions release/windows/build-dbus.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env pwsh

$global:DBusVersion = '1.12.16'

$global:DBusDeps = @(
'Expat'
)

function global:Build-DBus([string] $PrefixDir, [string] $Arch, [string] $DepsPrefixDir) {
$Filename = "dbus-${DBusVersion}.tar.gz"
$Url = "https://dbus.freedesktop.org/releases/dbus/${Filename}"

$SourceDir = Invoke-DownloadAndUnpack $Url $Filename
$BuildDir = Join-Path $SourceDir .build

$ConfigOptions = @(
'-DCMAKE_BUILD_TYPE=RelWithDebInfo'
"-DCMAKE_INSTALL_PREFIX=${PrefixDir}"
"-DCMAKE_PREFIX_PATH=${DepsPrefixDir}"
'-DDBUS_BUILD_TESTS=OFF'
)

# Patch to remove "-3" (or whatever) revision suffix part from DLL name since Qt doesn't seem to support that and we don't really need it
Edit-TextFile (Join-Path $SourceDir cmake modules MacrosAutotools.cmake) '^.*_LIBRARY_REVISION.*' ''

Invoke-CMakeBuildAndInstall (Join-Path $SourceDir cmake) $BuildDir $ConfigOptions
Copy-Item -Path (Join-Path $BuildDir bin dbus-1.pdb) -Destination (Join-Path $PrefixDir bin)
}
26 changes: 26 additions & 0 deletions release/windows/build-expat.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env pwsh

$global:ExpatVersion = '2.2.9'

$global:ExpatDeps = @()

function global:Build-Expat([string] $PrefixDir, [string] $Arch, [string] $DepsPrefixDir) {
$Filename = "expat-${ExpatVersion}.tar.bz2"
$Url = "https://github.com/libexpat/libexpat/releases/download/R_$($ExpatVersion.replace(".", "_"))/${Filename}"

$SourceDir = Invoke-DownloadAndUnpack $Url $Filename
$BuildDir = Join-Path $SourceDir .build

$ConfigOptions = @(
'-DCMAKE_BUILD_TYPE=RelWithDebInfo'
"-DCMAKE_INSTALL_PREFIX=${PrefixDir}"
"-DCMAKE_PREFIX_PATH=${DepsPrefixDir}"
'-DEXPAT_BUILD_EXAMPLES=OFF'
'-DEXPAT_BUILD_TESTS=OFF'
'-DEXPAT_BUILD_TOOLS=OFF'
'-DEXPAT_SHARED_LIBS=ON'
)

Invoke-CMakeBuildAndInstall $SourceDir $BuildDir $ConfigOptions
Copy-Item -Path (Join-Path $BuildDir libexpat.pdb) -Destination (Join-Path $PrefixDir bin)
}
31 changes: 31 additions & 0 deletions release/windows/build-openssl.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env pwsh

$global:OpenSslVersion = '1.1.1g'

$global:OpenSslDeps = @()

function global:Build-OpenSsl([string] $PrefixDir, [string] $Arch, [string] $DepsPrefixDir) {
$Filename = "openssl-${OpenSslVersion}.tar.gz"
$Url = "https://www.openssl.org/source/${Filename}"

$SourceDir = Invoke-DownloadAndUnpack $Url $Filename
$BuildDir = $SourceDir

$ConfigName = if ($Arch -eq 'x86') { 'VC-WIN32' } else { 'VC-WIN64A' }
$ConfigOptions = @(
"--prefix=${PrefixDir}"
$ConfigName
'shared'
'no-comp'
'no-dso'
'no-engine'
'no-hw'
'no-stdio'
'no-tests'
)

Push-Location -Path $BuildDir
Invoke-VcEnvCommand perl Configure @ConfigOptions
Invoke-VcEnvCommand jom install_dev
Pop-Location
}
97 changes: 97 additions & 0 deletions release/windows/build-qt.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env pwsh

$global:QtVersion = '5.14.2'

$global:QtDeps = @(
'DBus'
'OpenSsl'
'Zlib'
)

function global:Build-Qt([string] $PrefixDir, [string] $Arch, [string] $DepsPrefixDir) {
$Filename = "qt-everywhere-src-${QtVersion}.zip" # tar.xz has some names truncated (e.g. .../double-conversion.h -> .../double-conv)
$Url = "http://download.qt.io/archive/qt/$($QtVersion -replace '\.\d+$', '')/${QtVersion}/single/${Filename}"

$ArchiveBase = "qt-everywhere-src-${QtVersion}"
$UnpackFlags = @(
(Join-Path $ArchiveBase qtactiveqt '*')
(Join-Path $ArchiveBase qtbase '*')
(Join-Path $ArchiveBase qttools '*')
(Join-Path $ArchiveBase qttranslations '*')
(Join-Path $ArchiveBase qtwinextras '*')
(Join-Path $ArchiveBase .gitmodules)
(Join-Path $ArchiveBase configure.bat)
(Join-Path $ArchiveBase configure.json)
(Join-Path $ArchiveBase qt.pro)
)

$SourceDir = Invoke-DownloadAndUnpack $Url $Filename $UnpackFlags
$BuildDir = Join-Path $SourceDir .build

$ConfigOptions = @(
'-platform'; 'win32-msvc'
'-mp'
# '-ltcg' # error C1002 on VS 2019 16.5.4
'-opensource'
'-confirm-license'
'-prefix'; $PrefixDir
'-release'
'-force-debug-info'
'-dbus'
'-ssl'
'-openssl'
'-system-zlib'
'-qt-pcre'
'-qt-libpng'
'-qt-libjpeg'
'-no-opengl'
'-no-direct2d'
'-no-freetype'
'-no-harfbuzz'
'-no-sql-db2'
'-no-sql-ibase'
'-no-sql-mysql'
'-no-sql-oci'
'-no-sql-odbc'
'-no-sql-psql'
'-no-sql-sqlite'
'-no-sql-sqlite2'
'-no-sql-tds'
'-nomake'; 'examples'
'-nomake'; 'tests'
'-nomake'; 'tools'
'-I'; (Join-Path $DepsPrefixDir include)
'-L'; (Join-Path $DepsPrefixDir lib)
)

if ($env:LDFLAGS) {
# Patch to add our linker flags, mainly /PDBALTPATH
Edit-TextFile (Join-Path $SourceDir qtbase mkspecs win32-msvc qmake.conf) '(^QMAKE_CXXFLAGS\b.*)' "`$1`nQMAKE_LFLAGS += ${env:LDFLAGS}"
}

# No need in GUI tools
Edit-TextFile (Join-Path $SourceDir qttools src src.pro) 'qtHaveModule[(]gui[)]' 'qtHaveModule(hughey)'
Edit-TextFile (Join-Path $SourceDir qttools src src.pro) 'qtHaveModule[(]widgets[)]' 'qtHaveModule(digits)'
Edit-TextFile (Join-Path $SourceDir qttools src linguist linguist.pro) 'qtHaveModule[(]widgets[)]' 'qtHaveModule(digits)'

Invoke-NativeCommand cmake -E remove_directory $BuildDir
$env:PATH = @(
(Join-Path $PrefixDir bin)
(Join-Path $DepsPrefixDir bin)
(Join-Path $BuildDir qtbase lib)
$env:PATH
) -join [System.IO.Path]::PathSeparator

New-Item -Path $BuildDir -ItemType Directory -ErrorAction Ignore | Out-Null
Push-Location -Path $BuildDir
Invoke-VcEnvCommand (Join-Path $SourceDir configure) @ConfigOptions
Invoke-VcEnvCommand jom
Invoke-VcEnvCommand jom install
Pop-Location

# install target doesn't copy PDBs for release DLLs
Get-Childitem -Path (Join-Path $BuildDir qtbase lib) | `
ForEach-Object { if ($_ -is [System.IO.DirectoryInfo] -or $_.Name -like '*.pdb') { Copy-Item -Path $_.FullName -Destination (Join-Path $PrefixDir lib) -Filter '*.pdb' -Recurse -Force } }
Get-Childitem -Path (Join-Path $BuildDir qtbase plugins) | `
ForEach-Object { if ($_ -is [System.IO.DirectoryInfo] -or $_.Name -like '*.pdb') { Copy-Item -Path $_.FullName -Destination (Join-Path $PrefixDir plugins) -Filter '*.pdb' -Recurse -Force } }
}
Loading

0 comments on commit 0136893

Please sign in to comment.