Skip to content

Commit 7ae5d74

Browse files
authored
V3 check/4 (#1159)
2 parents d89add1 + 95be291 commit 7ae5d74

6 files changed

Lines changed: 28 additions & 18 deletions

File tree

‎src/Package/Extension/clickhouse.php‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,14 @@
44

55
namespace Package\Extension;
66

7-
use Package\Target\php;
8-
use StaticPHP\Attribute\Package\BeforeStage;
97
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
108
use StaticPHP\Attribute\Package\Extension;
11-
use StaticPHP\Attribute\PatchDescription;
129
use StaticPHP\Package\PackageInstaller;
1310
use StaticPHP\Package\PhpExtensionPackage;
14-
use StaticPHP\Util\FileSystem;
1511

1612
#[Extension('clickhouse')]
1713
class clickhouse extends PhpExtensionPackage
1814
{
19-
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-clickhouse')]
20-
#[PatchDescription('Replace THIS_DIR=`dirname $0` with PHP_EXT_SRCDIR() in config.m4 so include paths resolve to the ext source dir during PHP main configure (dirname $0 returns "." when run from php-src root).')]
21-
public function patchBeforeBuildconfUnix(): void
22-
{
23-
FileSystem::replaceFileRegex(
24-
"{$this->getSourceDir()}/config.m4",
25-
'/^(\s*)THIS_DIR=.*/m',
26-
'$1THIS_DIR=PHP_EXT_SRCDIR()',
27-
);
28-
}
29-
3015
#[CustomPhpConfigureArg('Darwin')]
3116
#[CustomPhpConfigureArg('Linux')]
3217
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string

‎src/Package/Extension/mongodb.php‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
#[Extension('mongodb')]
1717
class mongodb extends PhpExtensionPackage
1818
{
19+
#[BeforeStage('php', [php::class, 'configureForUnix'], 'ext-mongodb')]
20+
#[PatchDescription('Export PHP_VERSION_ID so mongo-php-driver >= 2.3.3 skips its php-config lookup (in-tree builds have no php-config).')]
21+
public function exportPhpVersionIdForUnix(): void
22+
{
23+
$id = php::getPHPVersionID();
24+
f_putenv("PHP_VERSION_ID={$id}");
25+
}
26+
1927
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-mongodb')]
2028
#[PatchDescription('Add /utf-8 flag to CFLAGS_MONGODB for Windows build to fix compilation error on non-English Windows.')]
2129
public function patchBeforeBuild(): void

‎src/Package/Extension/opcache.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public function getUnixConfigureArg(bool $shared, PackageBuilder $builder): stri
7272
) {
7373
$opcache_jit = ' --disable-opcache-jit';
7474
}
75-
return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit;
75+
// PHP 8.5+ has opcache built-in
76+
if ($phpVersionID < 80500) {
77+
return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit;
78+
}
79+
return trim($opcache_jit);
7680
}
7781
}

‎src/Package/Extension/password_argon2.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function runSmokeTestCliUnix(): void
2727
#[CustomPhpConfigureArg('Darwin')]
2828
public function getConfigureArg(PackageInstaller $installer, PackageBuilder $builder): string
2929
{
30-
if ($installer->getLibraryPackage('openssl') !== null) {
30+
if ($installer->getPhpExtensionPackage('openssl')?->isBuildStatic()) {
3131
if (php::getPHPVersionID() >= 80500 || (php::getPHPVersionID() >= 80400 && !$builder->getOption('enable-zts'))) {
3232
return '--without-password-argon2'; // use --with-openssl-argon2 in openssl extension instead
3333
}

‎src/Package/Extension/pgsql.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class pgsql extends PhpExtensionPackage
2020
public function getUnixConfigureArg(bool $shared, PackageBuilder $builder, PackageInstaller $installer): string
2121
{
2222
if (php::getPHPVersionID() >= 80400) {
23-
$libfiles = new SPCConfigUtil(['libs_only_deps' => true, 'absolute_libs' => true])->getPackageDepsConfig('postgresql', array_keys($installer->getResolvedPackages()), $builder->getOption('with-suggests'))['libs'];
23+
$libfiles = new SPCConfigUtil(['libs_only_deps' => true, 'absolute_libs' => true])->getPackageDepsConfig('postgresql', array_keys($installer->getResolvedPackages()))['libs'];
2424
$libfiles = str_replace("{$builder->getLibDir()}/lib", '-l', $libfiles);
2525
$libfiles = str_replace('.a', '', $libfiles);
2626
return '--with-pgsql' . ($shared ? '=shared' : '') .

‎src/Package/Extension/spx.php‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,27 @@
66

77
use Package\Target\php;
88
use StaticPHP\Attribute\Package\BeforeStage;
9+
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
910
use StaticPHP\Attribute\Package\Extension;
1011
use StaticPHP\Attribute\PatchDescription;
12+
use StaticPHP\Package\PackageInstaller;
1113
use StaticPHP\Package\PhpExtensionPackage;
1214
use StaticPHP\Util\FileSystem;
1315

1416
#[Extension('spx')]
1517
class spx extends PhpExtensionPackage
1618
{
19+
#[CustomPhpConfigureArg('Linux')]
20+
#[CustomPhpConfigureArg('Darwin')]
21+
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
22+
{
23+
$arg = '--enable-SPX' . ($shared ? '=shared' : '');
24+
if ($installer->getLibraryPackage('zlib') !== null) {
25+
$arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH;
26+
}
27+
return $arg;
28+
}
29+
1730
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-spx')]
1831
#[PatchDescription('Fix spx extension compile error when building as static')]
1932
public function patchBeforeBuildconf(): bool

0 commit comments

Comments
 (0)