Skip to content

Commit

Permalink
Add support for VS2019 builds (#14)
Browse files Browse the repository at this point in the history
* Add workaround for broken Compiler prefix in archive file name

* Add PHP 8.0 to build matrix

* Fix version compare

* Revert version compare for PHP install func

* Add workaround for PHP8 PSR extension

* Fix placeholder for extension archive name

* Fix typo

* Actualize parser build

* Use image with proper Visual Studio for php 8

* Fix psr extension check

* Add on_failure step

* Disable PSR extension check

* Show php.ini loaded config path

* Use FQN for php

* Disable PSR ext for appveyour test

* Disable build matrix with PHP 8
  • Loading branch information
AlexNDRmac authored Dec 3, 2020
1 parent 00c2ac9 commit 125d831
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 12 deletions.
19 changes: 17 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,21 @@ environment:
BUILD_TYPE: nts-Win32
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

# Temporary disabled, because on Windows with php 8 PSR extension always crashes.
# - PHP_VERSION: 8.0
# VC_VERSION: 16
# BUILD_TYPE: Win32
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019

# - PHP_VERSION: 8.0
# VC_VERSION: 16
# BUILD_TYPE: nts-Win32
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019

PHP_SDK_VERSION: 2.1.9
PECL_PSR_VERSION: 0.6.1
ZEPHIR_PARSER_VERSION: 1.2.0
ZEPHIR_PARSER_RELEASE: 454
ZEPHIR_PARSER_VERSION: 1.3.5
ZEPHIR_PARSER_RELEASE: 538
ZEPHIR_VERSION: 0.11.8

matrix:
Expand Down Expand Up @@ -99,3 +110,7 @@ artifacts:
- path: '.\php-appveyor.zip'
type: zip
name: php-appveyor

on_failure:
- ps: >-
Get-ChildItem -Path "C:\php\ext\"
49 changes: 39 additions & 10 deletions php-appveyor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ function InstallPhp {
$ReleasesPart = "releases/archives"
}

$RemoteUrl = "http://windows.php.net/downloads/{0}/php-{1}-{2}-vc{3}-{4}.zip" -f
$ReleasesPart, $FullVersion, $BuildType, $VC, $Platform
# Workaround for different prefix for compiler version
# For all PHP 7.x - prefix was `vc`
# From PHP 8.0 - prefix changed to `vs`
$CompilerVersion = "vc${VC}"
if ([System.Convert]::ToDecimal($Version) -ge 8.0) {
$CompilerVersion = "vs${VC}"
}

$RemoteUrl = "http://windows.php.net/downloads/{0}/php-{1}-{2}-{3}-{4}.zip" -f
$ReleasesPart, $FullVersion, $BuildType, $CompilerVersion, $Platform

$Archive = "C:\Downloads\php-${FullVersion}-${BuildType}-VC${VC}-${Platform}.zip"
$Archive = "C:\Downloads\php-${FullVersion}-${BuildType}-${CompilerVersion}-${Platform}.zip"

if (-not (Test-Path "${InstallPath}\php.exe")) {
if (-not (Test-Path $Archive)) {
Expand Down Expand Up @@ -96,17 +104,25 @@ function InstallPhpDevPack {
$ReleasesPart = "releases/archives"
}

$RemoteUrl = "http://windows.php.net/downloads/{0}/php-devel-pack-{1}-{2}-vc{3}-{4}.zip" -f
$ReleasesPart, $Version, $BuildType, $VC, $Platform
# Workaround for different prefix for compiler version
# For all PHP 7.x - prefix was `vc`
# From PHP 8.0 - prefix changed to `vs`
$CompilerVersion = "vc${VC}"
if ([System.Convert]::ToDecimal($PhpVersion) -ge 8.0) {
$CompilerVersion = "vs${VC}"
}

$RemoteUrl = "http://windows.php.net/downloads/{0}/php-devel-pack-{1}-{2}-{3}-{4}.zip" -f
$ReleasesPart, $Version, $BuildType, $CompilerVersion, $Platform

$Archive = "C:\Downloads\php-devel-pack-${Version}-${BuildType}-VC${VC}-${Platform}.zip"
$Archive = "C:\Downloads\php-devel-pack-${Version}-${BuildType}-${CompilerVersion}-${Platform}.zip"

if (-not (Test-Path "${InstallPath}\phpize.bat")) {
if (-not (Test-Path $Archive)) {
DownloadFile $RemoteUrl $Archive
}

$UnzipPath = "${Env:Temp}\php-${Version}-devel-VC${VC}-${Platform}"
$UnzipPath = "${Env:Temp}\php-${Version}-devel-${CompilerVersion}-${Platform}"
if (-not (Test-Path "${UnzipPath}\phpize.bat")) {
Expand-Item7zip $Archive $Env:Temp
}
Expand All @@ -133,8 +149,21 @@ function InstallPeclExtension {

SetupPrerequisites

$BaseUri = "https://windows.php.net/downloads/pecl/releases/${Name}/${Version}"
$LocalPart = "php_${Name}-${Version}-${PhpVersion}"
# Workaround for PHP 8 PSR extension
# Because we don't have special archive for php 8
# we must to use latest PSR release for PHP 7.4 :)
# Example:
# https://windows.php.net/downloads/pecl/releases/psr/1.0.1/php_psr-1.0.1-7.4-ts-vc15-x86.zip
$PackageVersion = $Version
$CompatiblePhpVersion = $PhpVersion
if ([System.Convert]::ToDecimal($PhpVersion) -ge 8.0) {
$PackageVersion = "1.0.1"
$CompatiblePhpVersion = "7.4"
$VC = "15"
}

$BaseUri = "https://windows.php.net/downloads/pecl/releases/${Name}/${PackageVersion}"
$LocalPart = "php_${Name}-${PackageVersion}-${CompatiblePhpVersion}"

if ($BuildType -Match "nts-Win32") {
$TS = "nts"
Expand Down Expand Up @@ -271,7 +300,7 @@ function EnablePhpExtension {
$Result = (& "${PhpExe}" --ri "${PrintableName}")
} else {
Write-Debug "Minimal load test using command: ${PhpExe} --ri ${Name}"
$Result = (& "${PhpExe}" --ri $Name)
$Result = (& "${PhpExe}" --ri "${Name}")
}

$ExitCode = $LASTEXITCODE
Expand Down

0 comments on commit 125d831

Please sign in to comment.