|
1 | 1 | param ( |
2 | 2 | [Parameter(Mandatory)] [String] $version, |
| 3 | + [Parameter(Mandatory)] [String] $revision, |
| 4 | + [Parameter(Mandatory)] [String] $baseurl, |
3 | 5 | [Parameter(Mandatory)] [String] $arch, |
4 | 6 | [Parameter(Mandatory)] [String] $ts, |
5 | 7 | [Parameter(Mandatory)] [AllowEmptyCollection()] [Array] $deps |
@@ -45,60 +47,40 @@ if (-not $toolset) { |
45 | 47 | throw "toolset not available" |
46 | 48 | } |
47 | 49 |
|
48 | | -Write-Output "Install PHP SDK ..." |
| 50 | +if (-not (Test-Path "php-sdk")) { |
| 51 | + Write-Output "Install PHP SDK ..." |
49 | 52 |
|
50 | | -$temp = New-TemporaryFile | Rename-Item -NewName {$_.Name + ".zip"} -PassThru |
51 | | -$url = "https://github.com/php/php-sdk-binary-tools/releases/download/php-sdk-2.3.0/php-sdk-binary-tools-php-sdk-2.3.0.zip" |
52 | | -Invoke-WebRequest $url -OutFile $temp |
53 | | -Expand-Archive $temp -DestinationPath "." |
54 | | -Rename-Item "php-sdk-binary-tools-php-sdk-2.3.0" "php-sdk" |
55 | | - |
56 | | -$baseurl = "https://downloads.php.net/~windows/releases/archives" |
57 | | -$releases = @{ |
58 | | - "7.0" = "7.0.33" |
59 | | - "7.1" = "7.1.33" |
60 | | - "7.2" = "7.2.34" |
61 | | - "7.3" = "7.3.33" |
62 | | - "7.4" = "7.4.33" |
63 | | - "8.0" = "8.0.30" |
64 | | -} |
65 | | -$phpversion = $releases.$version |
66 | | -if (-not $phpversion) { |
67 | | - $baseurl = "https://downloads.php.net/~windows/releases" |
68 | | - $url = "$baseurl/releases.json" |
69 | | - $releases = Invoke-WebRequest $url | ConvertFrom-Json |
70 | | - $phpversion = $releases.$version.version |
71 | | - if (-not $phpversion) { |
72 | | - $baseurl = "https://downloads.php.net/~windows/qa" |
73 | | - $url = "$baseurl/releases.json" |
74 | | - $releases = Invoke-WebRequest $url | ConvertFrom-Json |
75 | | - $phpversion = $releases.$version.version |
76 | | - if (-not $phpversion) { |
77 | | - throw "unknown version" |
78 | | - } |
79 | | - } |
| 53 | + $temp = New-TemporaryFile | Rename-Item -NewName {$_.Name + ".zip"} -PassThru |
| 54 | + $url = "https://github.com/php/php-sdk-binary-tools/releases/download/php-sdk-2.3.0/php-sdk-binary-tools-php-sdk-2.3.0.zip" |
| 55 | + Invoke-WebRequest $url -OutFile $temp |
| 56 | + Expand-Archive $temp -DestinationPath "." |
| 57 | + Rename-Item "php-sdk-binary-tools-php-sdk-2.3.0" "php-sdk" |
80 | 58 | } |
81 | 59 |
|
82 | 60 | $tspart = if ($ts -eq "nts") {"nts-Win32"} else {"Win32"} |
83 | 61 |
|
84 | | -Write-Output "Install PHP $phpversion ..." |
| 62 | +if (-not (Test-path "php-bin")) { |
| 63 | + Write-Output "Install PHP $revision ..." |
85 | 64 |
|
86 | | -$temp = New-TemporaryFile | Rename-Item -NewName {$_.Name + ".zip"} -PassThru |
87 | | -$fname = "php-$phpversion-$tspart-$vs-$arch.zip" |
88 | | -$url = "$baseurl/$fname" |
89 | | -Write-Output "Downloading $url ..." |
90 | | -Invoke-WebRequest $url -OutFile $temp |
91 | | -Expand-Archive $temp "php-bin" |
| 65 | + $temp = New-TemporaryFile | Rename-Item -NewName {$_.Name + ".zip"} -PassThru |
| 66 | + $fname = "php-$revision-$tspart-$vs-$arch.zip" |
| 67 | + $url = "$baseurl/$fname" |
| 68 | + Write-Output "Downloading $url ..." |
| 69 | + Invoke-WebRequest $url -OutFile $temp |
| 70 | + Expand-Archive $temp "php-bin" |
| 71 | +} |
92 | 72 |
|
93 | | -Write-Output "Install development pack ..." |
| 73 | +if (-not (Test-Path "php-dev")) { |
| 74 | + Write-Output "Install development pack ..." |
94 | 75 |
|
95 | | -$temp = New-TemporaryFile | Rename-Item -NewName {$_.Name + ".zip"} -PassThru |
96 | | -$fname = "php-devel-pack-$phpversion-$tspart-$vs-$arch.zip" |
97 | | -$url = "$baseurl/$fname" |
98 | | -Write-Output "Downloading $url ..." |
99 | | -Invoke-WebRequest $url -OutFile $temp |
100 | | -Expand-Archive $temp "." |
101 | | -Rename-Item "php-$phpversion-devel-$vs-$arch" "php-dev" |
| 76 | + $temp = New-TemporaryFile | Rename-Item -NewName {$_.Name + ".zip"} -PassThru |
| 77 | + $fname = "php-devel-pack-$revision-$tspart-$vs-$arch.zip" |
| 78 | + $url = "$baseurl/$fname" |
| 79 | + Write-Output "Downloading $url ..." |
| 80 | + Invoke-WebRequest $url -OutFile $temp |
| 81 | + Expand-Archive $temp "." |
| 82 | + Rename-Item "php-$revision-devel-$vs-$arch" "php-dev" |
| 83 | +} |
102 | 84 |
|
103 | 85 | if ($deps.Count -gt 0) { |
104 | 86 | $baseurl = "https://downloads.php.net/~windows/php-sdk/deps" |
|
0 commit comments