Files
bun.sh/scripts/download-webkit.ps1
dave caruso 3b25c8637b dx: Fix setup script and contributing docs (#6752)
* Updated Dependencies Script

* demo

* fix submodule hell!!!

* lol

* attmept 2

* install nasm in ci

* setup sh 1

* yeah

* better zlib building

* codegen stuff

* attempt 2 at bun codegen ci

* o

* deps improvements

* generaet part of compile-cpp-only.ps1

* restore these

* good enough for Unix

* remove libuv submodule lol

* pass over docs
2023-10-28 04:46:56 -07:00

42 lines
1.1 KiB
PowerShell

param (
[Parameter(Mandatory)]
[string]$OutDir,
[Parameter(Mandatory)][string]$Tag,
[Parameter(Mandatory)][string]$PackageName
)
$ErrorActionPreference = "Stop"
$Url = "https://github.com/oven-sh/WebKit/releases/download/autobuild-$Tag/$PackageName.tar.gz"
$CacheDir = (mkdir -Force (Join-Path $PSScriptRoot "../.webkit-cache"))
$TarPath = Join-Path $CacheDir "$PackageName-$Tag.tar.gz"
if (Test-Path $OutDir\.tag) {
$CurrentTag = Get-Content -Path (Join-Path $OutDir ".tag")
if ($CurrentTag -eq $Tag) {
return
}
}
Remove-Item $OutDir -ErrorAction SilentlyContinue -Recurse
$null = mkdir -Force $OutDir
try {
Write-Host "-- Downloading WebKit"
if (!(Test-Path $TarPath)) {
try {
Invoke-WebRequest $Url -OutFile $TarPath
} catch {
Write-Error "Failed to fetch WebKit from: $Url"
throw $_
}
}
Push-Location $CacheDir
tar.exe "-xzf" "$PackageName-$Tag.tar.gz" -C (Resolve-Path -Relative $OutDir\..\).replace('\', '/')
Pop-Location
Set-Content -Path (Join-Path $OutDir ".tag") -Value "$Tag"
} catch {
Remove-Item -Force -ErrorAction SilentlyContinue $OutDir
throw $_
}