diff --git a/config/pkg/ext/ext-fastchart.yml b/config/pkg/ext/ext-fastchart.yml new file mode 100644 index 00000000..0abbc892 --- /dev/null +++ b/config/pkg/ext/ext-fastchart.yml @@ -0,0 +1,20 @@ +ext-fastchart: + type: php-extension + artifact: + source: + type: ghtar + repo: iliaal/fastchart + extract: php-src/ext/fastchart + prefer-stable: true + metadata: + license-files: [LICENSE] + depends: + - freetype + suggests: + - libpng + - libjpeg + - libwebp + php-extension: + os: + - Linux + - Darwin diff --git a/config/pkg/ext/ext-fastjson.yml b/config/pkg/ext/ext-fastjson.yml new file mode 100644 index 00000000..4644e820 --- /dev/null +++ b/config/pkg/ext/ext-fastjson.yml @@ -0,0 +1,14 @@ +ext-fastjson: + type: php-extension + artifact: + source: + type: ghtar + repo: iliaal/fastjson + extract: php-src/ext/fastjson + prefer-stable: true + metadata: + license-files: [LICENSE] + php-extension: + os: + - Linux + - Darwin 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/Library/imagemagick.php b/src/Package/Library/imagemagick.php index fd5de9ed..d423163a 100644 --- a/src/Package/Library/imagemagick.php +++ b/src/Package/Library/imagemagick.php @@ -42,6 +42,9 @@ class imagemagick ->addConfigureArgs( '--disable-openmp', '--without-x', + // implicit --with-gcc-arch + // bleeds host cpu features into built binaries + '--without-gcc-arch', ); // special: linux-static target needs `-static` diff --git a/src/Package/Library/libaom.php b/src/Package/Library/libaom.php index 7e578242..c37c2b7c 100644 --- a/src/Package/Library/libaom.php +++ b/src/Package/Library/libaom.php @@ -9,8 +9,10 @@ use StaticPHP\Attribute\Package\Library; use StaticPHP\Package\LibraryPackage; use StaticPHP\Runtime\Executor\UnixCMakeExecutor; use StaticPHP\Runtime\Executor\WindowsCMakeExecutor; +use StaticPHP\Runtime\SystemTarget; use StaticPHP\Toolchain\Interface\ToolchainInterface; use StaticPHP\Toolchain\ZigToolchain; +use StaticPHP\Util\System\UnixUtil; #[Library('libaom')] class libaom extends LibraryPackage @@ -39,9 +41,19 @@ class libaom extends LibraryPackage $new = trim($extra . ' -D_GNU_SOURCE'); f_putenv("SPC_COMPILER_EXTRA={$new}"); } + $targetCpu = SystemTarget::getTargetArch(); + if (str_starts_with($targetCpu, 'aarch')) { + $targetCpu = str_replace('aarch', 'arm', $targetCpu); + } + if (!UnixUtil::findCommand('nasm') && !UnixUtil::findCommand('yasm')) { + $targetCpu = 'generic'; + } UnixCMakeExecutor::create($this) ->setBuildDir("{$this->getSourceDir()}/builddir") - ->addConfigureArgs('-DAOM_TARGET_CPU=generic') + ->addConfigureArgs( + "-DAOM_TARGET_CPU={$targetCpu}", + '-DCONFIG_RUNTIME_CPU_DETECT=1', + ) ->build(); f_putenv("SPC_COMPILER_EXTRA={$extra}"); $this->patchPkgconfPrefix(['aom.pc']);