@@ -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