diff --git a/src/Package/Extension/clickhouse.php b/src/Package/Extension/clickhouse.php index 3e11975f..f4e6978d 100644 --- a/src/Package/Extension/clickhouse.php +++ b/src/Package/Extension/clickhouse.php @@ -4,29 +4,14 @@ declare(strict_types=1); namespace Package\Extension; -use Package\Target\php; -use StaticPHP\Attribute\Package\BeforeStage; use StaticPHP\Attribute\Package\CustomPhpConfigureArg; use StaticPHP\Attribute\Package\Extension; -use StaticPHP\Attribute\PatchDescription; use StaticPHP\Package\PackageInstaller; use StaticPHP\Package\PhpExtensionPackage; -use StaticPHP\Util\FileSystem; #[Extension('clickhouse')] class clickhouse extends PhpExtensionPackage { - #[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-clickhouse')] - #[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).')] - public function patchBeforeBuildconfUnix(): void - { - FileSystem::replaceFileRegex( - "{$this->getSourceDir()}/config.m4", - '/^(\s*)THIS_DIR=.*/m', - '$1THIS_DIR=PHP_EXT_SRCDIR()', - ); - } - #[CustomPhpConfigureArg('Darwin')] #[CustomPhpConfigureArg('Linux')] public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string diff --git a/src/Package/Extension/mongodb.php b/src/Package/Extension/mongodb.php index 1b417092..6bf72399 100644 --- a/src/Package/Extension/mongodb.php +++ b/src/Package/Extension/mongodb.php @@ -16,6 +16,14 @@ use StaticPHP\Util\FileSystem; #[Extension('mongodb')] class mongodb extends PhpExtensionPackage { + #[BeforeStage('php', [php::class, 'configureForUnix'], 'ext-mongodb')] + #[PatchDescription('Export PHP_VERSION_ID so mongo-php-driver >= 2.3.3 skips its php-config lookup (in-tree builds have no php-config).')] + public function exportPhpVersionIdForUnix(): void + { + $id = php::getPHPVersionID(); + f_putenv("PHP_VERSION_ID={$id}"); + } + #[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-mongodb')] #[PatchDescription('Add /utf-8 flag to CFLAGS_MONGODB for Windows build to fix compilation error on non-English Windows.')] public function patchBeforeBuild(): void diff --git a/src/Package/Extension/opcache.php b/src/Package/Extension/opcache.php index 07758de2..699e124d 100644 --- a/src/Package/Extension/opcache.php +++ b/src/Package/Extension/opcache.php @@ -72,6 +72,10 @@ class opcache extends PhpExtensionPackage ) { $opcache_jit = ' --disable-opcache-jit'; } - return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit; + // PHP 8.5+ has opcache built-in + if ($phpVersionID < 80500) { + return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit; + } + return trim($opcache_jit); } } diff --git a/src/Package/Extension/password_argon2.php b/src/Package/Extension/password_argon2.php index 77122405..efef3d05 100644 --- a/src/Package/Extension/password_argon2.php +++ b/src/Package/Extension/password_argon2.php @@ -27,7 +27,7 @@ class password_argon2 extends PhpExtensionPackage #[CustomPhpConfigureArg('Darwin')] public function getConfigureArg(PackageInstaller $installer, PackageBuilder $builder): string { - if ($installer->getLibraryPackage('openssl') !== null) { + if ($installer->getPhpExtensionPackage('openssl')?->isBuildStatic() || $this->isBuildShared()) { if (php::getPHPVersionID() >= 80500 || (php::getPHPVersionID() >= 80400 && !$builder->getOption('enable-zts'))) { return '--without-password-argon2'; // use --with-openssl-argon2 in openssl extension instead } diff --git a/src/Package/Extension/pgsql.php b/src/Package/Extension/pgsql.php index 6e2b8f0b..b5b22a00 100644 --- a/src/Package/Extension/pgsql.php +++ b/src/Package/Extension/pgsql.php @@ -20,7 +20,7 @@ class pgsql extends PhpExtensionPackage public function getUnixConfigureArg(bool $shared, PackageBuilder $builder, PackageInstaller $installer): string { if (php::getPHPVersionID() >= 80400) { - $libfiles = new SPCConfigUtil(['libs_only_deps' => true, 'absolute_libs' => true])->getPackageDepsConfig('postgresql', array_keys($installer->getResolvedPackages()), $builder->getOption('with-suggests'))['libs']; + $libfiles = new SPCConfigUtil(['libs_only_deps' => true, 'absolute_libs' => true])->getPackageDepsConfig('postgresql', array_keys($installer->getResolvedPackages()))['libs']; $libfiles = str_replace("{$builder->getLibDir()}/lib", '-l', $libfiles); $libfiles = str_replace('.a', '', $libfiles); return '--with-pgsql' . ($shared ? '=shared' : '') . diff --git a/src/Package/Extension/spx.php b/src/Package/Extension/spx.php index bb230ec9..96a8c75d 100644 --- a/src/Package/Extension/spx.php +++ b/src/Package/Extension/spx.php @@ -6,14 +6,27 @@ namespace Package\Extension; use Package\Target\php; use StaticPHP\Attribute\Package\BeforeStage; +use StaticPHP\Attribute\Package\CustomPhpConfigureArg; use StaticPHP\Attribute\Package\Extension; use StaticPHP\Attribute\PatchDescription; +use StaticPHP\Package\PackageInstaller; use StaticPHP\Package\PhpExtensionPackage; use StaticPHP\Util\FileSystem; #[Extension('spx')] class spx extends PhpExtensionPackage { + #[CustomPhpConfigureArg('Linux')] + #[CustomPhpConfigureArg('Darwin')] + public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string + { + $arg = '--enable-SPX' . ($shared ? '=shared' : ''); + if ($installer->getLibraryPackage('zlib') !== null) { + $arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH; + } + return $arg; + } + #[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-spx')] #[PatchDescription('Fix spx extension compile error when building as static')] public function patchBeforeBuildconf(): bool