Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .github/workflows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,50 @@ $ErrorActionPreference = "Stop"

$env:PATH = "C:\php\devel;C:\php\bin;C:\php\deps\bin;$env:PATH"

# Toolset
# $installerDir = Join-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio" 'Installer'
# $vswherePath = Join-Path $installerDir 'vswhere.exe'
# if (-not (Test-Path $vswherePath)) {
# if (-not (Test-Path $installerDir)) {
# New-Item -Path $installerDir -ItemType Directory -Force | Out-Null
# }
# $vsWhereUrl = 'https://github.com/microsoft/vswhere/releases/latest/download/vswhere.exe'
# Invoke-WebRequest -Uri $vsWhereUrl -OutFile $vswherePath -UseBasicParsing
# }
# if($null -eq (Get-Command vswhere -ErrorAction SilentlyContinue)) {
# throw "vswhere is not available"
# }
$MSVCDirectory = vswhere -latest -products * -find "VC\Tools\MSVC"
$selectedToolset = $null
$minor = $null
foreach ($toolset in (Get-ChildItem $MSVCDirectory)) {
$toolsetMajorVersion, $toolsetMinorVersion = $toolset.Name.split(".")[0,1]
$major = 14
switch ($env:VS) {
'vs17' { $minorMin = 30; $minorMax = $null; break }
'vs16' { $minorMin = 20; $minorMax = 29; break }
Default { throw "VS version is not available" }
}
$majorVersionCheck = [int]$major -eq [int]$toolsetMajorVersion
$minorLowerBoundCheck = [int]$toolsetMinorVersion -ge [int]$minorMin
$minorUpperBoundCheck = ($null -eq $minorMax) -or ([int]$toolsetMinorVersion -le [int]$minorMax)
if ($majorVersionCheck -and $minorLowerBoundCheck -and $minorUpperBoundCheck) {
if($null -eq $minor -or [int]$toolsetMinorVersion -gt [int]$minor) {
$selectedToolset = $toolset.Name.Trim()
$minor = $toolsetMinorVersion
}
}
}
if (-not $selectedToolset) {
throw "toolset not available"
}

$task = New-Item 'task.bat' -Force
Add-Content $task 'call phpize 2>&1'
Add-Content $task "call configure --with-php-build=C:\php\deps --enable-$env:PHP_EXT --enable-debug-pack 2>&1"
Add-Content $task 'nmake /nologo 2>&1'
Add-Content $task 'exit %errorlevel%'
& "C:\php\php-sdk-$env:BIN_SDK_VER\phpsdk-$env:VS-$env:ARCH.bat" -t $task
& "C:\php\php-sdk-$env:BIN_SDK_VER\phpsdk-starter.bat" -c $env:VS -a $env:ARCH -s $selectedToolset -t $task
if (-not $?) {
throw "building failed with errorlevel $LastExitCode"
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- php: '8.1'
vs: vs17

runs-on: ${{ matrix.vs == 'vs17' && 'windows-2022' || 'windows-2019' }}
runs-on: windows-latest

env:
PHP_VER: ${{ matrix.php }}
Expand Down
25 changes: 3 additions & 22 deletions lz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ static PHP_MINIT_FUNCTION(lz4)
{
REGISTER_LONG_CONSTANT("LZ4_CLEVEL_MIN", PHP_LZ4_CLEVEL_MIN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LZ4_CLEVEL_MAX", PHP_LZ4_CLEVEL_MAX, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LZ4_VERSION", LZ4_versionNumber(), CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LZ4_VERSION_NUMBER", LZ4_versionNumber(), CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("LZ4_VERSION_TEXT", (char *)LZ4_versionString(), CONST_CS | CONST_PERSISTENT);

#if PHP_MAJOR_VERSION >= 7 && defined(HAVE_APCU_SUPPORT)
apc_register_serializer("lz4",
Expand All @@ -114,27 +115,7 @@ ZEND_MINFO_FUNCTION(lz4)
php_info_print_table_start();
php_info_print_table_row(2, "LZ4 support", "enabled");
php_info_print_table_row(2, "Extension Version", LZ4_EXT_VERSION);
#if !defined(HAVE_LIBLZ4)
/* Bundled library */
php_info_print_table_row(2, "LZ4 Version", LZ4_versionString());
#elif defined(LZ4_VERSION_MAJOR)
/* Recent system library */
{
char buffer[128];

snprintf(buffer, sizeof(buffer), "%d.%d.%d",
LZ4_VERSION_MAJOR, LZ4_VERSION_MINOR, LZ4_VERSION_RELEASE);
php_info_print_table_row(2, "LZ4 headers Version", buffer);

/* LZ4_versionString is not usable, see https://github.com/lz4/lz4/issues/301 */
snprintf(buffer, sizeof(buffer), "%d.%d.%d",
LZ4_versionNumber()/10000, (LZ4_versionNumber()/100)%100, LZ4_versionNumber()%100);
php_info_print_table_row(2, "LZ4 library Version", buffer);
}
#else
/* Old system library */
php_info_print_table_row(2, "LZ4 Version", "system library");
#endif
php_info_print_table_row(2, "LZ4 Version", (char *)LZ4_versionString());
#if PHP_MAJOR_VERSION >= 7 && defined(HAVE_APCU_SUPPORT)
php_info_print_table_row(2, "LZ4 APCu serializer ABI", APC_SERIALIZER_ABI);
#endif
Expand Down
25 changes: 25 additions & 0 deletions lz4.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

namespace {

/**
* @var int
* @cvalue LZ4_CLEVEL_MIN
*/
const LZ4_CLEVEL_MIN = UNKNOWN;

/**
* @var int
* @cvalue LZ4_CLEVEL_MAX
*/
const LZ4_CLEVEL_MAX = UNKNOWN;

/**
* @var string
* @cvalue LZ4_VERSION_TEXT
*/
const LZ4_VERSION_TEXT = UNKNOWN;

/**
* @var int
* @cvalue LZ4_VERSION_NUMBER
*/
const LZ4_VERSION_NUMBER = UNKNOWN;


function lz4_compress(string $data, int $level = 0, string $extra = NULL): string|false {}


Expand Down
2 changes: 1 addition & 1 deletion php_verdep.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PHP_VERDEP_H
#define PHP_VERDEP_H

#ifndef ZED_FE_END
#ifndef ZEND_FE_END
#define ZEND_FE_END { NULL, NULL, NULL, 0, 0 }
#endif

Expand Down