Files
TTDownloader/third_party/prepare.ps1
T
tongtong eb3df9aa3d Add FTP and magnet backends, tracker and proxy settings, and organize client modules
Integrate pinned libcurl, libtorrent and static OpenSSL dependencies with license notices. Enable verified HTTPS trackers and authenticated HTTP/SOCKS5 proxies, add tracker TXT import without arbitrary list caps, and allow resizing the main window.

Organize client sources by responsibility and update Visual Studio projects, filters and tests. Debug and Release builds passed, along with UI, HTTP, tracker import and browser bridge regressions. Full protocol tests have an unresolved intermittent HTTPS tracker wait timeout; Windows 7 runtime validation remains outstanding.
2026-11-27 11:28:30 +08:00

38 lines
3.0 KiB
PowerShell

param([ValidateSet('Debug','Release')][string]$Configuration='Debug')
$ErrorActionPreference='Stop'
$root=$PSScriptRoot
$packages=@(
@('openssl','openssl-3.5.9','https://github.com/openssl/openssl/releases/download/openssl-3.5.9/openssl-3.5.9.tar.gz','603F5602E2EEF00D77FBD429D34DCD5822BB301757A1BC9CDB24C670F1EB859A'),
@('curl','curl-8.23.0','https://curl.se/download/curl-8.23.0.tar.gz','E3DE77CFA6367083C776A26647FC9F633B538C06C3BAA73D931A252AC8F72B49'),
@('libtorrent','libtorrent-rasterbar-2.0.11','https://github.com/arvidn/libtorrent/releases/download/v2.0.11/libtorrent-rasterbar-2.0.11.tar.gz','F0DB58580F4F29ADE6CC40FA4BA80E2C9A70C90265CD77332D3CDEC37ECF1E6D'),
@('boost','boost_1_86_0','https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.gz','2575E74FFC3EF1CD0BABAC2C1EE8BDB5782A0EE672B1912DA40E5B4B591CA01F')
)
$curlName=if($Configuration -eq 'Debug'){'libcurl-d.lib'}else{'libcurl.lib'}
$library=Join-Path $root ('build/lib/'+$Configuration+'/torrent-rasterbar.lib')
$curlLibrary=Join-Path $root ('build/lib/'+$Configuration+'/'+$curlName)
if((Test-Path -LiteralPath $library) -and (Test-Path -LiteralPath $curlLibrary) -and (Test-Path (Join-Path $root ('openssl/'+$Configuration+'/lib/libssl.lib'))) -and (Test-Path (Join-Path $root ('openssl/'+$Configuration+'/lib/libcrypto.lib'))) -and (Test-Path (Join-Path $root ('openssl/'+$Configuration+'/include/openssl/configuration.h')))) {
if((Get-Item -LiteralPath $library).LastWriteTime -gt (Get-Item (Join-Path $root 'CMakeLists.txt')).LastWriteTime -and
(Get-Item -LiteralPath $curlLibrary).LastWriteTime -gt (Get-Item (Join-Path $root 'CMakeLists.txt')).LastWriteTime) { exit 0 }
}
New-Item -ItemType Directory -Force (Join-Path $root 'sources') | Out-Null
foreach($package in $packages) {
$archive=Join-Path $root ('sources/'+$package[0]+'.tar.gz')
if(!(Test-Path -LiteralPath $archive)) { Invoke-WebRequest -Uri $package[2] -OutFile $archive -UseBasicParsing }
$hashAlgorithm=[System.Security.Cryptography.SHA256]::Create()
$archiveStream=[System.IO.File]::OpenRead($archive)
try { $sourceHash=[BitConverter]::ToString($hashAlgorithm.ComputeHash($archiveStream)).Replace('-','') }
finally { $archiveStream.Dispose(); $hashAlgorithm.Dispose() }
if($sourceHash -ne $package[3]) { throw "Source checksum mismatch: $archive" }
if(!(Test-Path -LiteralPath (Join-Path $root $package[1]))) {
if($package[0] -eq 'boost') { & tar -xzf $archive -C $root boost_1_86_0/boost boost_1_86_0/LICENSE_1_0.txt }
else { & tar -xzf $archive -C $root }
if($LASTEXITCODE) { throw 'Source extraction failed' }
}
}
& (Join-Path $root 'build-openssl.ps1') -Configuration Release
if($Configuration -eq 'Debug') { & (Join-Path $root 'build-openssl.ps1') -Configuration Debug }
& cmake -S $root -B (Join-Path $root 'build') -A x64
if($LASTEXITCODE) { throw 'Dependency configure failed' }
& cmake --build (Join-Path $root 'build') --config $Configuration --target torrent-rasterbar libcurl_static --parallel 4
if($LASTEXITCODE) { throw 'Dependency build failed' }