From f47daac3cc205e51bbf4ceb371bd26ea25e3ab83 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 20 May 2025 23:04:34 +0700 Subject: [PATCH] cs fix, xml building fails now, unsure why, doesn't seem to import expat_compat.h for some reason --- config/ext.json | 3 +++ src/SPC/builder/Extension.php | 12 +++++++++++- src/SPC/builder/extension/xml.php | 6 +++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/config/ext.json b/config/ext.json index ee1c68db..1c74db74 100644 --- a/config/ext.json +++ b/config/ext.json @@ -77,6 +77,9 @@ ], "ext-depends-windows": [ "xml" + ], + "shared-ext-depends": [ + "xml" ] }, "ds": { diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index aea8ba8c..9322e49b 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -127,6 +127,9 @@ class Extension foreach (Config::getExt($this->name, 'ext-suggests', []) as $name) { $this->addExtensionDependency($name, true); } + foreach (Config::getExt($this->name, 'shared-ext-depends', []) as $name) { + $this->addExtensionDependency($name); + } return $this; } @@ -300,6 +303,13 @@ class Extension logger()->info('extension ' . $this->getName() . ' already built, skipping'); return; } + foreach (Config::getExt($this->name, 'shared-ext-depends', []) as $name) { + $dependencyExt = $this->builder->getExt($name); + if ($dependencyExt === null) { + throw new RuntimeException("extension {$this->name} requires shared extension {$name}"); + } + $dependencyExt->buildShared(); + } match (PHP_OS_FAMILY) { 'Darwin', 'Linux' => $this->buildUnixShared(), default => throw new WrongUsageException(PHP_OS_FAMILY . ' build shared extensions is not supported yet'), @@ -335,7 +345,7 @@ class Extension shell()->cd($this->source_dir) ->setEnv($env) - ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static') + ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static --with-pic') ->execWithEnv('make clean') ->execWithEnv('make -j' . $this->builder->concurrency) ->execWithEnv('make install'); diff --git a/src/SPC/builder/extension/xml.php b/src/SPC/builder/extension/xml.php index 544585ad..b1a8c5f3 100644 --- a/src/SPC/builder/extension/xml.php +++ b/src/SPC/builder/extension/xml.php @@ -26,11 +26,12 @@ class xml extends Extension 'soap' => '--enable-soap', 'xmlreader' => '--enable-xmlreader', 'xmlwriter' => '--enable-xmlwriter', - 'dom' => '--enable-dom', 'simplexml' => '--enable-simplexml', default => throw new RuntimeException('Not accept non-xml extension'), }; - $arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"'; + if (!$shared) { + $arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"'; + } return $arg; } @@ -47,7 +48,6 @@ class xml extends Extension 'soap' => '--enable-soap', 'xmlreader' => '--enable-xmlreader', 'xmlwriter' => '--enable-xmlwriter', - 'dom' => '--with-dom', 'simplexml' => '--with-simplexml', default => throw new RuntimeException('Not accept non-xml extension'), };