Skip to content

Commit 390a762

Browse files
authored
fix php_source_dir and custom-ini build failure (#1230)
2 parents 5e71d0c + b171bb9 commit 390a762

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎src/Package/Target/php.php‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function beforeBuild(PackageBuilder $builder, Package $package): void
383383
logger()->info("Adding hardcoded INI [{$source_name} = {$ini_value}]");
384384
}
385385
if (!empty($custom_ini)) {
386-
ApplicationContext::invoke([SourcePatcher::class, 'patchHardcodedINI'], [$package->getSourceDir(), $custom_ini]);
386+
ApplicationContext::invoke([SourcePatcher::class, 'patchHardcodedINI'], ['php_source_dir' => $package->getSourceDir(), 'ini' => $custom_ini]);
387387
}
388388

389389
// Patch StaticPHP version
@@ -425,6 +425,17 @@ public function syncExtensionSources(PackageInstaller $installer): void
425425
continue;
426426
}
427427
$ext_dir = FileSystem::convertPath(SOURCE_PATH . '/php-src/ext/' . $ext->getExtensionName());
428+
// shared-only extensions are built by phpize in their own source root and are
429+
// never compiled in-tree, so they do not belong in php-src/ext - unlink them from there
430+
if (!$ext->isBuildStatic() && !$ext->isBuildWithPhp()) {
431+
if (FileSystem::isLink($ext_dir)) {
432+
logger()->debug("Extension [{$ext->getName()}] is shared-only, unlinking {$ext_dir}.");
433+
FileSystem::removeLink($ext_dir);
434+
} elseif (is_dir($ext_dir) && file_exists("{$ext_dir}/.spc-ext-sync")) {
435+
FileSystem::removeDir($ext_dir);
436+
}
437+
continue;
438+
}
428439
// already in place: bundled with php-src (getBuildDir prefers it for static
429440
// builds), extracted directly in-tree, or a correct link/junction
430441
if (realpath($ext_dir) === realpath($source_root)) {

0 commit comments

Comments
 (0)