diff --git a/src/Package/Library/libaom.php b/src/Package/Library/libaom.php index c37c2b7c..7549125d 100644 --- a/src/Package/Library/libaom.php +++ b/src/Package/Library/libaom.php @@ -53,6 +53,10 @@ class libaom extends LibraryPackage ->addConfigureArgs( "-DAOM_TARGET_CPU={$targetCpu}", '-DCONFIG_RUNTIME_CPU_DETECT=1', + '-DENABLE_EXAMPLES=OFF', + '-DENABLE_TESTS=OFF', + '-DENABLE_TOOLS=OFF', + '-DENABLE_DOCS=OFF', ) ->build(); f_putenv("SPC_COMPILER_EXTRA={$extra}"); diff --git a/src/Package/Library/libheif.php b/src/Package/Library/libheif.php index 65545f36..19ad4c61 100644 --- a/src/Package/Library/libheif.php +++ b/src/Package/Library/libheif.php @@ -24,6 +24,17 @@ class libheif 'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")' ); } + // libheif 1.22+ ships a C-incompatible header: `struct heif_bad_pixel` + $heif_properties = $lib->getSourceDir() . '/libheif/api/libheif/heif_properties.h'; + if (file_exists($heif_properties) + && str_contains(file_get_contents($heif_properties), 'struct heif_bad_pixel { uint32_t row; uint32_t column; };') + ) { + FileSystem::replaceFileStr( + $heif_properties, + 'struct heif_bad_pixel { uint32_t row; uint32_t column; };', + 'typedef struct heif_bad_pixel { uint32_t row; uint32_t column; } heif_bad_pixel;' + ); + } } #[BuildFor('Darwin')] diff --git a/src/Package/Target/curl.php b/src/Package/Target/curl.php index 6085feaf..3117a8cd 100644 --- a/src/Package/Target/curl.php +++ b/src/Package/Target/curl.php @@ -93,6 +93,9 @@ class curl if (str_contains(FileSystem::readFile($pc_path), '-lgssapi_krb5')) { FileSystem::replaceFileRegex($pc_path, '/-lcom_err$/m', '-lcom_err -lkrb5support'); } + // FindThreads can put '-lpthread' into INTERFACE_LINK_LIBRARIES; curl's pc generator + // prepends '-l' to each entry, producing '-l-lpthread'. Strip the extra '-l'. + FileSystem::replaceFileRegex($pc_path, '/-l(-l\S+)/', '$1'); shell()->cd("{$lib->getLibDir()}/cmake/CURL/") ->exec("sed -ie 's|\"/lib/libcurl.a\"|\"{$lib->getLibDir()}/libcurl.a\"|g' CURLTargets-release.cmake"); diff --git a/src/Package/Target/php/frankenphp.php b/src/Package/Target/php/frankenphp.php index 663f495e..5df13ccc 100644 --- a/src/Package/Target/php/frankenphp.php +++ b/src/Package/Target/php/frankenphp.php @@ -77,7 +77,7 @@ trait frankenphp // remove self from deps $resolved = array_filter($resolved, fn ($pkg_name) => $pkg_name !== $package->getName()); $config = new SPCConfigUtil()->config($resolved); - $cflags = "{$package->getLibExtraCFlags()} {$config['cflags']} " . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . " -DFRANKENPHP_VERSION={$frankenphp_version}"; + $cflags = "-I{$package->getSourceDir()} {$package->getLibExtraCFlags()} {$config['cflags']} " . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . " -DFRANKENPHP_VERSION={$frankenphp_version}"; $libs = $config['libs']; // Go's gcc driver doesn't automatically link against -lgcov or -lrt. Ugly, but necessary fix. diff --git a/src/StaticPHP/Command/CraftCommand.php b/src/StaticPHP/Command/CraftCommand.php index e187ad73..4bb39327 100644 --- a/src/StaticPHP/Command/CraftCommand.php +++ b/src/StaticPHP/Command/CraftCommand.php @@ -10,8 +10,10 @@ use StaticPHP\Exception\ValidationException; use StaticPHP\Package\PackageBuilder; use StaticPHP\Package\PackageInstaller; use StaticPHP\Registry\PackageLoader; +use StaticPHP\Toolchain\ToolchainManager; use StaticPHP\Util\DependencyResolver; use StaticPHP\Util\FileSystem; +use StaticPHP\Util\GlobalEnvManager; use StaticPHP\Util\Pgo\PgoContext; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Output\OutputInterface; @@ -44,6 +46,10 @@ class CraftCommand extends BaseCommand // apply env array_walk($craft['extra-env'], fn ($v, $k) => f_putenv("{$k}={$v}")); + // re-substitute env.ini's CC=${SPC_DEFAULT_CC} bindings. + ToolchainManager::initToolchain(); + GlobalEnvManager::reapplyOsIni(); + // stash craft for doctor checks that depend on what's being built (e.g. frankenphp → go-xcaddy) ApplicationContext::set('craft', $craft);