From 2c13eb257be68efc9c22812da3729816d7995968 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 30 Apr 2025 21:46:27 +0700 Subject: [PATCH 001/204] static compilation is not quite working yet --- config/env.ini | 4 ++-- config/source.json | 2 +- src/SPC/builder/extension/spx.php | 13 +------------ src/SPC/command/BuildPHPCommand.php | 6 +++--- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/config/env.ini b/config/env.ini index f70ad0a2e..4fd1a28a7 100644 --- a/config/env.ini +++ b/config/env.ini @@ -68,7 +68,7 @@ CXX=${SPC_LINUX_DEFAULT_CXX} AR=${SPC_LINUX_DEFAULT_AR} LD=ld.gold ; default compiler flags, used in CMake toolchain file, openssl and pkg-config build -SPC_DEFAULT_C_FLAGS="-fPIC" +SPC_DEFAULT_C_FLAGS="-fPIC -std=c11" SPC_DEFAULT_CXX_FLAGS= ; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated) SPC_EXTRA_LIBS= @@ -97,7 +97,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; LIBS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-ident -fPIE -fPIC" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -fPIE -fPIC -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-ident" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm" ; EXTRA_LDFLAGS_PROGRAM for `make` php diff --git a/config/source.json b/config/source.json index a4b25cb8d..2beea67c5 100644 --- a/config/source.json +++ b/config/source.json @@ -859,7 +859,7 @@ "spx": { "type": "git", "rev": "master", - "url": "https://github.com/static-php/php-spx.git", + "url": "https://github.com/NoiseByNorthwest/php-spx.git", "path": "php-src/ext/spx", "license": { "type": "file", diff --git a/src/SPC/builder/extension/spx.php b/src/SPC/builder/extension/spx.php index dc341e396..ef9e95bf4 100644 --- a/src/SPC/builder/extension/spx.php +++ b/src/SPC/builder/extension/spx.php @@ -5,25 +5,14 @@ namespace SPC\builder\extension; use SPC\builder\Extension; -use SPC\exception\WrongUsageException; use SPC\util\CustomExt; #[CustomExt('spx')] class spx extends Extension { - /** - * @throws WrongUsageException - */ - public function validate(): void - { - if ($this->builder->getOption('enable-zts')) { - throw new WrongUsageException('ext-spx is not thread safe, do not build it with ZTS builds'); - } - } - public function getUnixConfigureArg(bool $shared = false): string { - $arg = '--enable-spx'; + $arg = '--enable-SPX'; if ($this->builder->getExt('zlib') === null) { $arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH; } diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 49067b0b8..0cf64f67d 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -73,7 +73,7 @@ public function handle(): int } $static_and_shared = array_intersect($static_extensions, $shared_extensions); if (!empty($static_and_shared)) { - $this->output->writeln('Building extensions [' . implode(',', $static_and_shared) . '] as both static and shared\, tests may not be accurate or fail.'); + $this->output->writeln('Building extensions [' . implode(',', $static_and_shared) . '] as both static and shared, tests may not be accurate or fail.'); } if ($rule === BUILD_TARGET_NONE) { @@ -128,7 +128,6 @@ public function handle(): int $include_suggest_lib = $this->getOption('with-suggested-libs'); [$extensions, $libraries, $not_included] = DependencyUtil::getExtsAndLibs(array_merge($static_extensions, $shared_extensions), $libraries, $include_suggest_ext, $include_suggest_lib); $display_libs = array_filter($libraries, fn ($lib) => in_array(Config::getLib($lib, 'type', 'lib'), ['lib', 'package'])); - $display_extensions = array_map(fn ($ext) => in_array($ext, $shared_extensions) ? "*{$ext}" : $ext, $extensions); // separate static and shared extensions from $extensions // filter rule: including shared extensions if they are in $static_extensions or $shared_extensions @@ -138,7 +137,8 @@ public function handle(): int $indent_texts = [ 'Build OS' => PHP_OS_FAMILY . ' (' . php_uname('m') . ')', 'Build SAPI' => $builder->getBuildTypeName($rule), - 'Extensions (' . count($extensions) . ')' => implode(',', $display_extensions), + 'Extensions (' . count($extensions) . ')' => implode(',', $extensions), + 'Shared Extensions (' . count($shared_extensions) . ')' => implode(',', $shared_extensions), 'Libraries (' . count($libraries) . ')' => implode(',', $display_libs), 'Strip Binaries' => $builder->getOption('no-strip') ? 'no' : 'yes', 'Enable ZTS' => $builder->getOption('enable-zts') ? 'yes' : 'no', From b3dacf9c5ad9eeb4783cf0c51ea3e72df02211f1 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 6 May 2025 16:22:37 +0700 Subject: [PATCH 002/204] lowercase --- src/SPC/builder/extension/spx.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/spx.php b/src/SPC/builder/extension/spx.php index ef9e95bf4..a797a1268 100644 --- a/src/SPC/builder/extension/spx.php +++ b/src/SPC/builder/extension/spx.php @@ -12,7 +12,7 @@ class spx extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - $arg = '--enable-SPX'; + $arg = '--enable-spx'; if ($this->builder->getExt('zlib') === null) { $arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH; } From f5fffafd43028e73964d5d5df08c028771fc80af Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 14:45:51 +0700 Subject: [PATCH 003/204] =?UTF-8?q?format=20setEnv=C2=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SPC/builder/linux/library/libffi.php | 6 +++++- src/SPC/builder/linux/library/openssl.php | 6 +++++- src/SPC/builder/macos/library/openssl.php | 6 +++++- src/SPC/builder/unix/library/brotli.php | 6 +++++- src/SPC/builder/unix/library/bzip2.php | 6 +++++- src/SPC/builder/unix/library/freetype.php | 6 +++++- src/SPC/builder/unix/library/gmp.php | 6 +++++- src/SPC/builder/unix/library/gmssl.php | 6 +++++- src/SPC/builder/unix/library/libargon2.php | 6 +++++- src/SPC/builder/unix/library/libavif.php | 6 +++++- src/SPC/builder/unix/library/libcares.php | 6 +++++- src/SPC/builder/unix/library/libevent.php | 6 +++++- src/SPC/builder/unix/library/libiconv.php | 6 +++++- src/SPC/builder/unix/library/liblz4.php | 6 +++++- src/SPC/builder/unix/library/libtiff.php | 6 +++++- src/SPC/builder/unix/library/ncurses.php | 6 +++++- src/SPC/builder/unix/library/nghttp2.php | 6 +++++- src/SPC/builder/unix/library/onig.php | 6 +++++- src/SPC/builder/unix/library/pkgconfig.php | 6 +++++- src/SPC/builder/unix/library/readline.php | 6 +++++- src/SPC/builder/unix/library/sqlite.php | 6 +++++- src/SPC/builder/unix/library/zlib.php | 6 +++++- 22 files changed, 110 insertions(+), 22 deletions(-) diff --git a/src/SPC/builder/linux/library/libffi.php b/src/SPC/builder/linux/library/libffi.php index 9d1c2d792..d7421425d 100644 --- a/src/SPC/builder/linux/library/libffi.php +++ b/src/SPC/builder/linux/library/libffi.php @@ -21,7 +21,11 @@ public function build(): void $arch = getenv('SPC_ARCH'); shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--enable-static ' . diff --git a/src/SPC/builder/linux/library/openssl.php b/src/SPC/builder/linux/library/openssl.php index 5c07ec7e3..55a238f9a 100644 --- a/src/SPC/builder/linux/library/openssl.php +++ b/src/SPC/builder/linux/library/openssl.php @@ -65,7 +65,11 @@ public function build(): void $clang_postfix = SystemUtil::getCCType(getenv('CC')) === 'clang' ? '-clang' : ''; shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags() ?: $this->builder->arch_c_flags, 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( "{$env} ./Configure no-shared {$extra} " . '--prefix=/ ' . diff --git a/src/SPC/builder/macos/library/openssl.php b/src/SPC/builder/macos/library/openssl.php index e0e3919f0..28796d7c7 100644 --- a/src/SPC/builder/macos/library/openssl.php +++ b/src/SPC/builder/macos/library/openssl.php @@ -50,7 +50,11 @@ protected function build(): void $arch = getenv('SPC_ARCH'); shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->exec( "./Configure no-shared {$extra} " . '--prefix=/ ' . // use prefix=/ diff --git a/src/SPC/builder/unix/library/brotli.php b/src/SPC/builder/unix/library/brotli.php index 9e764fcb7..44be934d5 100644 --- a/src/SPC/builder/unix/library/brotli.php +++ b/src/SPC/builder/unix/library/brotli.php @@ -18,7 +18,11 @@ protected function build(): void { FileSystem::resetDir($this->source_dir . '/build-dir'); shell()->cd($this->source_dir . '/build-dir') - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( 'cmake ' . '-DCMAKE_BUILD_TYPE=Release ' . diff --git a/src/SPC/builder/unix/library/bzip2.php b/src/SPC/builder/unix/library/bzip2.php index 0241fb1b0..284783c9f 100644 --- a/src/SPC/builder/unix/library/bzip2.php +++ b/src/SPC/builder/unix/library/bzip2.php @@ -17,7 +17,11 @@ public function patchBeforeBuild(): bool protected function build(): void { shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv("make PREFIX='" . BUILD_ROOT_PATH . "' clean") ->execWithEnv("make -j{$this->builder->concurrency} {$this->builder->getEnvString()} PREFIX='" . BUILD_ROOT_PATH . "' libbz2.a") ->exec('cp libbz2.a ' . BUILD_LIB_PATH) diff --git a/src/SPC/builder/unix/library/freetype.php b/src/SPC/builder/unix/library/freetype.php index 42e8f91cd..6fb24212f 100644 --- a/src/SPC/builder/unix/library/freetype.php +++ b/src/SPC/builder/unix/library/freetype.php @@ -23,7 +23,11 @@ protected function build(): void $extra_libs .= $this->builder->getLib('brotli') ? '-DFT_DISABLE_BROTLI=OFF ' : '-DFT_DISABLE_BROTLI=ON '; FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( "cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON " . '-DBUILD_SHARED_LIBS=OFF ' . diff --git a/src/SPC/builder/unix/library/gmp.php b/src/SPC/builder/unix/library/gmp.php index 49b207fb8..c74251d64 100644 --- a/src/SPC/builder/unix/library/gmp.php +++ b/src/SPC/builder/unix/library/gmp.php @@ -16,7 +16,11 @@ trait gmp protected function build(): void { shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags() ?: $this->builder->arch_c_flags, 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--enable-static --disable-shared ' . diff --git a/src/SPC/builder/unix/library/gmssl.php b/src/SPC/builder/unix/library/gmssl.php index 1d946621b..792a1c93e 100644 --- a/src/SPC/builder/unix/library/gmssl.php +++ b/src/SPC/builder/unix/library/gmssl.php @@ -20,7 +20,11 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF ..") ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); diff --git a/src/SPC/builder/unix/library/libargon2.php b/src/SPC/builder/unix/library/libargon2.php index e91b71f0e..e2dba6875 100644 --- a/src/SPC/builder/unix/library/libargon2.php +++ b/src/SPC/builder/unix/library/libargon2.php @@ -11,7 +11,11 @@ trait libargon2 protected function build() { shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->exec("make PREFIX='' clean") ->execWithEnv("make -j{$this->builder->concurrency} PREFIX=''") ->execWithEnv("make install PREFIX='' DESTDIR=" . BUILD_ROOT_PATH); diff --git a/src/SPC/builder/unix/library/libavif.php b/src/SPC/builder/unix/library/libavif.php index c2aaafcdd..ddcf1d577 100644 --- a/src/SPC/builder/unix/library/libavif.php +++ b/src/SPC/builder/unix/library/libavif.php @@ -22,7 +22,11 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DAVIF_LIBYUV=OFF ..") ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); diff --git a/src/SPC/builder/unix/library/libcares.php b/src/SPC/builder/unix/library/libcares.php index d99cc685e..94871927f 100644 --- a/src/SPC/builder/unix/library/libcares.php +++ b/src/SPC/builder/unix/library/libcares.php @@ -25,7 +25,11 @@ public function patchBeforeBuild(): bool protected function build(): void { shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv('./configure --prefix= --enable-static --disable-shared --disable-tests --with-pic') ->execWithEnv("make -j {$this->builder->concurrency}") ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); diff --git a/src/SPC/builder/unix/library/libevent.php b/src/SPC/builder/unix/library/libevent.php index 2e80f32e7..bd070fd58 100644 --- a/src/SPC/builder/unix/library/libevent.php +++ b/src/SPC/builder/unix/library/libevent.php @@ -44,7 +44,11 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( 'cmake ' . '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . diff --git a/src/SPC/builder/unix/library/libiconv.php b/src/SPC/builder/unix/library/libiconv.php index a587c4726..710e74259 100644 --- a/src/SPC/builder/unix/library/libiconv.php +++ b/src/SPC/builder/unix/library/libiconv.php @@ -11,7 +11,11 @@ protected function build(): void [,,$destdir] = SEPARATED_PATH; shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--enable-static ' . diff --git a/src/SPC/builder/unix/library/liblz4.php b/src/SPC/builder/unix/library/liblz4.php index 45e803bfb..39c24512c 100644 --- a/src/SPC/builder/unix/library/liblz4.php +++ b/src/SPC/builder/unix/library/liblz4.php @@ -18,7 +18,11 @@ public function patchBeforeBuild(): bool protected function build(): void { shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv("make PREFIX='' clean") ->execWithEnv("make -j{$this->builder->concurrency} PREFIX=''") ->execWithEnv("make install PREFIX='' DESTDIR=" . BUILD_ROOT_PATH); diff --git a/src/SPC/builder/unix/library/libtiff.php b/src/SPC/builder/unix/library/libtiff.php index 5d2cb4c10..b4ed21ad7 100644 --- a/src/SPC/builder/unix/library/libtiff.php +++ b/src/SPC/builder/unix/library/libtiff.php @@ -23,7 +23,11 @@ protected function build(): void $extra_libs .= ' --disable-lzma --disable-zstd --disable-webp --disable-libdeflate'; $shell = shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--enable-static --disable-shared ' . diff --git a/src/SPC/builder/unix/library/ncurses.php b/src/SPC/builder/unix/library/ncurses.php index a44ac175b..0297afe22 100644 --- a/src/SPC/builder/unix/library/ncurses.php +++ b/src/SPC/builder/unix/library/ncurses.php @@ -12,7 +12,11 @@ protected function build(): void { $filelist = FileSystem::scanDirFiles(BUILD_BIN_PATH, relative: true); shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--enable-static ' . diff --git a/src/SPC/builder/unix/library/nghttp2.php b/src/SPC/builder/unix/library/nghttp2.php index 8f764c2a8..cd0c488f2 100644 --- a/src/SPC/builder/unix/library/nghttp2.php +++ b/src/SPC/builder/unix/library/nghttp2.php @@ -36,7 +36,11 @@ protected function build(): void [,,$destdir] = SEPARATED_PATH; shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--enable-static ' . diff --git a/src/SPC/builder/unix/library/onig.php b/src/SPC/builder/unix/library/onig.php index 60ea84fa6..56f724130 100644 --- a/src/SPC/builder/unix/library/onig.php +++ b/src/SPC/builder/unix/library/onig.php @@ -18,7 +18,11 @@ protected function build(): void [,,$destdir] = SEPARATED_PATH; shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags() ?: $this->builder->arch_c_flags, 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv('./configure --enable-static --disable-shared --prefix=') ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/pkgconfig.php b/src/SPC/builder/unix/library/pkgconfig.php index b489bbbad..9478d9ea7 100644 --- a/src/SPC/builder/unix/library/pkgconfig.php +++ b/src/SPC/builder/unix/library/pkgconfig.php @@ -14,7 +14,11 @@ protected function build(): void $ldflags = !($this instanceof LinuxLibraryBase) || getenv('SPC_LIBC') === 'glibc' ? '' : '--static'; shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => "{$this->getLibExtraCFlags()} {$cflags}", 'LDFLAGS' => "{$this->getLibExtraLdFlags()} {$ldflags}", 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => "{$this->getLibExtraCFlags()} {$cflags}", + 'LDFLAGS' => "{$this->getLibExtraLdFlags()} {$ldflags}", + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--disable-shared ' . diff --git a/src/SPC/builder/unix/library/readline.php b/src/SPC/builder/unix/library/readline.php index d0369c1a5..0e881e7cd 100644 --- a/src/SPC/builder/unix/library/readline.php +++ b/src/SPC/builder/unix/library/readline.php @@ -16,7 +16,11 @@ trait readline protected function build(): void { shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv( './configure ' . '--enable-static=yes ' . diff --git a/src/SPC/builder/unix/library/sqlite.php b/src/SPC/builder/unix/library/sqlite.php index ee8147029..7f9f31bda 100644 --- a/src/SPC/builder/unix/library/sqlite.php +++ b/src/SPC/builder/unix/library/sqlite.php @@ -9,7 +9,11 @@ trait sqlite protected function build(): void { shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv('./configure --enable-static --disable-shared --prefix=') ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/zlib.php b/src/SPC/builder/unix/library/zlib.php index f764de916..42c462590 100644 --- a/src/SPC/builder/unix/library/zlib.php +++ b/src/SPC/builder/unix/library/zlib.php @@ -18,7 +18,11 @@ protected function build(): void [,,$destdir] = SEPARATED_PATH; shell()->cd($this->source_dir) - ->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()]) + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->execWithEnv('./configure --static --prefix=') ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") From 2897fdda04b0729aaef343a180a50aabdf507eff Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 14:47:54 +0700 Subject: [PATCH 004/204] fix icu for relocatable objects (required by libphp.so building) --- src/SPC/builder/linux/library/icu.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/SPC/builder/linux/library/icu.php b/src/SPC/builder/linux/library/icu.php index 519c07348..0543c0d81 100644 --- a/src/SPC/builder/linux/library/icu.php +++ b/src/SPC/builder/linux/library/icu.php @@ -14,13 +14,19 @@ class icu extends LinuxLibraryBase protected function build(): void { - $cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1 -fPIC -fPIE -fno-ident"'; - $cxxflags = 'CXXFLAGS="-std=c++17"'; + $cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1 -DPIC -fPIC"'; + $cxxflags = 'CXXFLAGS="-std=c++17 -fPIC -fno-ident"'; $ldflags = getenv('SPC_LIBC') !== 'glibc' ? 'LDFLAGS="-static"' : ''; shell()->cd($this->source_dir . '/source') - ->exec( + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) + ->execWithEnv( "{$cppflags} {$cxxflags} {$ldflags} " . './runConfigureICU Linux ' . + '--enable-pic ' . '--enable-static ' . '--disable-shared ' . '--with-data-packaging=static ' . @@ -33,9 +39,9 @@ protected function build(): void '--enable-samples=no ' . '--prefix=' . BUILD_ROOT_PATH ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install'); + ->execWithEnv('make clean') + ->execWithEnv("make -j{$this->builder->concurrency}") + ->execWithEnv('make install'); $this->patchPkgconfPrefix(['icu-i18n.pc', 'icu-io.pc', 'icu-uc.pc'], PKGCONF_PATCH_PREFIX); FileSystem::removeDir(BUILD_LIB_PATH . '/icu'); From 03b634b9614efa00bad51708e7ed6086f80c7f6d Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 15:29:12 +0700 Subject: [PATCH 005/204] fix libsodium with -fPIC too --- src/SPC/builder/unix/library/libsodium.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/libsodium.php b/src/SPC/builder/unix/library/libsodium.php index b24d52b7a..c6bc6168e 100644 --- a/src/SPC/builder/unix/library/libsodium.php +++ b/src/SPC/builder/unix/library/libsodium.php @@ -9,10 +9,15 @@ trait libsodium protected function build(): void { shell()->cd($this->source_dir) - ->exec('./configure --enable-static --disable-shared --prefix=') - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) + ->execWithEnv('./configure --with-pic --enable-static --disable-shared --prefix=') + ->execWithEnv('make clean') + ->execWithEnv("make -j{$this->builder->concurrency}") + ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libsodium.pc'], PKGCONF_PATCH_PREFIX); } From 23ae3f60f3ccf8418308b45de6997077a4d3d1d8 Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 15:35:13 +0700 Subject: [PATCH 006/204] remove unused option --- src/SPC/builder/linux/library/icu.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SPC/builder/linux/library/icu.php b/src/SPC/builder/linux/library/icu.php index 0543c0d81..ddcfe1b29 100644 --- a/src/SPC/builder/linux/library/icu.php +++ b/src/SPC/builder/linux/library/icu.php @@ -26,7 +26,6 @@ protected function build(): void ->execWithEnv( "{$cppflags} {$cxxflags} {$ldflags} " . './runConfigureICU Linux ' . - '--enable-pic ' . '--enable-static ' . '--disable-shared ' . '--with-data-packaging=static ' . From 6fe8b591ceeba17a78cbc009b12a79cf87593fcf Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 19:52:30 +0700 Subject: [PATCH 007/204] ld library path for shared extension building --- .gitignore | 3 +++ src/SPC/builder/Extension.php | 1 + 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 0560542f0..9d9289f66 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ docker/source/ # default source extract directory /source/ +# built by shared embed tests +/locale/ + # default source download directory /downloads/ diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index a3d08f092..928940549 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -297,6 +297,7 @@ public function buildUnixShared(): void 'CFLAGS' => $config['cflags'], 'LDFLAGS' => $config['ldflags'], 'LIBS' => $config['libs'], + 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; // prepare configure args shell()->cd($this->source_dir) From 9557c9ef21789e5a0eee13698958a37d1c61650e Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 21:50:35 +0700 Subject: [PATCH 008/204] remove static target for zip --- config/ext.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/ext.json b/config/ext.json index 1df91d3b1..a3018b2f9 100644 --- a/config/ext.json +++ b/config/ext.json @@ -1055,9 +1055,6 @@ "support": { "BSD": "wip" }, - "target": [ - "static" - ], "type": "builtin", "arg-type": "with-prefix", "arg-type-windows": "enable", From 22001792cd7a5c6a306aa2c8bd9eaf375c3db8de Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 21:51:18 +0700 Subject: [PATCH 009/204] remove static target for swoole --- config/ext.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/config/ext.json b/config/ext.json index a3018b2f9..47acef966 100644 --- a/config/ext.json +++ b/config/ext.json @@ -124,10 +124,6 @@ "Linux": "partial", "BSD": "wip" }, - "target": [ - "static", - "shared" - ], "notes": true, "arg-type": "custom", "type": "builtin", @@ -781,9 +777,6 @@ "Windows": "no", "BSD": "wip" }, - "target": [ - "static" - ], "notes": true, "type": "external", "source": "swoole", From b402b735d63a4de8bfa43c94314e2997ed10a5de Mon Sep 17 00:00:00 2001 From: henderkes Date: Thu, 15 May 2025 23:30:07 +0700 Subject: [PATCH 010/204] fix copy command with BUILD_MODULES_CONSTANT --- src/SPC/builder/Extension.php | 13 +++++++++++-- src/SPC/builder/extension/opcache.php | 11 +++++++++++ src/SPC/builder/extension/xdebug.php | 5 ++++- src/SPC/builder/unix/UnixBuilderBase.php | 4 ++-- src/globals/internal-env.php | 7 +++++++ 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 928940549..2ab50f989 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -194,7 +194,7 @@ public function patchBeforeMake(): bool */ public function runSharedExtensionCheckUnix(): void { - [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "extension=' . BUILD_LIB_PATH . '/' . $this->getName() . '.so" --ri ' . $this->getName()); + [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "extension=' . BUILD_MODULES_PATH . '/' . $this->getName() . '.so" --ri ' . $this->getName()); if ($ret !== 0) { throw new RuntimeException($this->getName() . '.so failed to load'); } @@ -308,7 +308,16 @@ public function buildUnixShared(): void ->execWithEnv('make -j' . $this->builder->concurrency); // copy shared library - copy($this->source_dir . '/modules/' . $this->getDistName() . '.so', BUILD_LIB_PATH . '/' . $this->getDistName() . '.so'); + FileSystem::createDir(BUILD_MODULES_PATH); + $extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so'; + $sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so'; + if (file_exists($extensionDirFile)) { + copy($extensionDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); + } elseif (file_exists($sourceDirFile)) { + copy($sourceDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); + } else { + throw new RuntimeException('extension ' . $this->getName() . ' built successfully, but into an unexpected location.'); + } // check shared extension with php-cli if (file_exists(BUILD_BIN_PATH . '/php')) { $this->runSharedExtensionCheckUnix(); diff --git a/src/SPC/builder/extension/opcache.php b/src/SPC/builder/extension/opcache.php index 5d9dda0ad..5f406e16f 100644 --- a/src/SPC/builder/extension/opcache.php +++ b/src/SPC/builder/extension/opcache.php @@ -24,6 +24,17 @@ public function validate(): void } } + public function runSharedExtensionCheckUnix(): void + { + [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -v'); + if ($ret !== 0) { + throw new RuntimeException('opcache.so failed to load.'); + } + if (!str_contains(join($out), 'with Zend OPcache')) { + throw new RuntimeException('opcache.so failed to load.'); + } + } + public function patchBeforeBuildconf(): bool { if (file_exists(SOURCE_PATH . '/php-src/.opcache_patched')) { diff --git a/src/SPC/builder/extension/xdebug.php b/src/SPC/builder/extension/xdebug.php index ed5920563..6b945f495 100644 --- a/src/SPC/builder/extension/xdebug.php +++ b/src/SPC/builder/extension/xdebug.php @@ -13,9 +13,12 @@ class xdebug extends Extension { public function runSharedExtensionCheckUnix(): void { - [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "zend_extension=' . BUILD_LIB_PATH . '/xdebug.so" --ri xdebug'); + [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -v'); if ($ret !== 0) { throw new RuntimeException('xdebug.so failed to load.'); } + if (!str_contains(join($out), 'with Xdebug')) { + throw new RuntimeException('xdebug.so failed to load.'); + } } } diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index 4c8df333c..9ffca22a0 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -223,8 +223,8 @@ protected function deployBinary(int $type): bool default => throw new RuntimeException('Deployment does not accept type ' . $type), }; logger()->info('Deploying ' . $this->getBuildTypeName($type) . ' file'); - FileSystem::createDir(BUILD_ROOT_PATH . '/bin'); - shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg(BUILD_ROOT_PATH . '/bin/')); + FileSystem::createDir(BUILD_BIN_PATH); + shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg(BUILD_BIN_PATH)); return true; } diff --git a/src/globals/internal-env.php b/src/globals/internal-env.php index 34b1ed997..1046848e0 100644 --- a/src/globals/internal-env.php +++ b/src/globals/internal-env.php @@ -9,10 +9,17 @@ use SPC\store\FileSystem; use SPC\util\GlobalEnvManager; +// output path for everything, other paths are defined relative to this by default define('BUILD_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_ROOT_PATH')) ? $a : (WORKING_DIR . '/buildroot'))); +// output path for header files for development define('BUILD_INCLUDE_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_INCLUDE_PATH')) ? $a : (BUILD_ROOT_PATH . '/include'))); +// output path for libraries and for libphp.so, if building shared embed define('BUILD_LIB_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_LIB_PATH')) ? $a : (BUILD_ROOT_PATH . '/lib'))); +// output path for binaries define('BUILD_BIN_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_BIN_PATH')) ? $a : (BUILD_ROOT_PATH . '/bin'))); +// output path for shared extensions +define('BUILD_MODULES_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_MODULES_PATH')) ? $a : (BUILD_ROOT_PATH . '/modules'))); + define('PKG_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('PKG_ROOT_PATH')) ? $a : (WORKING_DIR . '/pkgroot'))); define('SOURCE_PATH', FileSystem::convertPath(is_string($a = getenv('SOURCE_PATH')) ? $a : (WORKING_DIR . '/source'))); define('DOWNLOAD_PATH', FileSystem::convertPath(is_string($a = getenv('DOWNLOAD_PATH')) ? $a : (WORKING_DIR . '/downloads'))); From 1ae27c7b5a7292d8b5f5246812c41db2be6bdd7d Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 16 May 2025 00:24:18 +0700 Subject: [PATCH 011/204] oopsie --- src/SPC/builder/extension/xdebug.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/xdebug.php b/src/SPC/builder/extension/xdebug.php index 6b945f495..367eb4202 100644 --- a/src/SPC/builder/extension/xdebug.php +++ b/src/SPC/builder/extension/xdebug.php @@ -13,7 +13,7 @@ class xdebug extends Extension { public function runSharedExtensionCheckUnix(): void { - [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -v'); + [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "zend_extension=' . BUILD_MODULES_PATH . '/xdebug.so" -v'); if ($ret !== 0) { throw new RuntimeException('xdebug.so failed to load.'); } From 872673655ee531d66b737583a2d9e97fed6dc1c2 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 16 May 2025 00:26:23 +0700 Subject: [PATCH 012/204] oopsie in opcache --- src/SPC/builder/extension/opcache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/opcache.php b/src/SPC/builder/extension/opcache.php index 5f406e16f..ec468cb80 100644 --- a/src/SPC/builder/extension/opcache.php +++ b/src/SPC/builder/extension/opcache.php @@ -26,7 +26,7 @@ public function validate(): void public function runSharedExtensionCheckUnix(): void { - [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -v'); + [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "zend_extension=' . BUILD_MODULES_PATH . '/opcache.so" -v'); if ($ret !== 0) { throw new RuntimeException('opcache.so failed to load.'); } From 76a9be2167c22357a06994c60a3f9a0396b2c9a2 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 17 May 2025 19:00:57 +0700 Subject: [PATCH 013/204] fix shared bz2 build --- src/SPC/builder/Extension.php | 4 ++++ src/SPC/builder/extension/bz2.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 2ab50f989..43e0a5e8a 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -275,6 +275,10 @@ public function validate(): void */ public function buildShared(): void { + if (file_exists(BUILD_MODULES_PATH . '/' . $this->getName() . '.so')) { + logger()->info('extension ' . $this->getName() . ' already built, skipping'); + return; + } match (PHP_OS_FAMILY) { 'Darwin', 'Linux' => $this->buildUnixShared(), default => throw new WrongUsageException(PHP_OS_FAMILY . ' build shared extensions is not supported yet'), diff --git a/src/SPC/builder/extension/bz2.php b/src/SPC/builder/extension/bz2.php index 88f22e568..ee3f2996b 100644 --- a/src/SPC/builder/extension/bz2.php +++ b/src/SPC/builder/extension/bz2.php @@ -24,4 +24,9 @@ public function patchBeforeConfigure(): bool FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lbz2/', $this->getLibFilesString() . $frameworks); return true; } + + public function getUnixConfigureArg(bool $shared = false): string + { + return $shared ? '--with-bz2=' . BUILD_ROOT_PATH : ''; + } } From 05e9129a66f7f4208e73e7bffda3c2b17ebf879a Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 17 May 2025 19:01:32 +0700 Subject: [PATCH 014/204] refactor dom out to its own extension, fails shared build --- src/SPC/builder/extension/dom.php | 72 +++++++++++++++++++++++++++++++ src/SPC/builder/extension/xml.php | 1 - 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/SPC/builder/extension/dom.php diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php new file mode 100644 index 000000000..bb2f659fd --- /dev/null +++ b/src/SPC/builder/extension/dom.php @@ -0,0 +1,72 @@ +builder))->config([$this->getName()]); + $env = [ + 'CFLAGS' => $config['cflags'] . ' -I' . SOURCE_PATH . '/php-src', + 'LDFLAGS' => $config['ldflags'], + 'LIBS' => $config['libs'], + 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, + ]; + // prepare configure args + shell()->cd($this->source_dir) + ->setEnv($env) + ->execWithEnv(BUILD_BIN_PATH . '/phpize') + ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static') + ->execWithEnv('make clean') + ->execWithEnv('make -j' . $this->builder->concurrency); + + // copy shared library + FileSystem::createDir(BUILD_MODULES_PATH); + $extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so'; + $sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so'; + if (file_exists($extensionDirFile)) { + copy($extensionDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); + } elseif (file_exists($sourceDirFile)) { + copy($sourceDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); + } else { + throw new RuntimeException('extension ' . $this->getName() . ' built successfully, but into an unexpected location.'); + } + // check shared extension with php-cli + if (file_exists(BUILD_BIN_PATH . '/php')) { + $this->runSharedExtensionCheckUnix(); + } + } +} diff --git a/src/SPC/builder/extension/xml.php b/src/SPC/builder/extension/xml.php index fc8bfc4d5..544585ad0 100644 --- a/src/SPC/builder/extension/xml.php +++ b/src/SPC/builder/extension/xml.php @@ -13,7 +13,6 @@ #[CustomExt('soap')] #[CustomExt('xmlreader')] #[CustomExt('xmlwriter')] -#[CustomExt('dom')] #[CustomExt('simplexml')] class xml extends Extension { From c1e91e1ccb56c552d632bc76351fea1338861e1e Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 17 May 2025 22:40:30 +0700 Subject: [PATCH 015/204] sockets doesn't install header?! --- src/SPC/builder/Extension.php | 10 ++++++++++ src/SPC/builder/extension/sockets.php | 21 +++++++++++++++++++++ src/SPC/builder/unix/library/gmp.php | 2 +- src/SPC/command/BuildPHPCommand.php | 4 +++- src/SPC/store/SourcePatcher.php | 9 +++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/SPC/builder/extension/sockets.php diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 43e0a5e8a..81f8cac9e 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -423,4 +423,14 @@ private function getLibraryDependencies(bool $recursive = false): array return $deps; } + + /** + * Patch code before shared extension ./configure + * If you need to patch some code, overwrite this + * return true if you patched something, false if not + */ + public function patchBeforeSharedBuild(): bool + { + return false; + } } diff --git a/src/SPC/builder/extension/sockets.php b/src/SPC/builder/extension/sockets.php new file mode 100644 index 000000000..a09014156 --- /dev/null +++ b/src/SPC/builder/extension/sockets.php @@ -0,0 +1,21 @@ +execWithEnv( './configure ' . - '--enable-static --disable-shared ' . + '--enable-static --disable-shared --with-pic ' . '--prefix=' ) ->execWithEnv('make clean') diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 49067b0b8..8226b045a 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -208,7 +208,9 @@ public function handle(): int SourcePatcher::patchSPCVersionToPHP($this->getApplication()->getVersion()); // start to build - $builder->buildPHP($rule); + // $builder->buildPHP($rule); + + SourcePatcher::patchBeforeSharedBuild($builder); // build dynamic extensions if needed if (!empty($shared_extensions)) { diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index b5de166f5..24ba666cc 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -78,6 +78,15 @@ public static function patchBeforeBuildconf(BuilderBase $builder): void } } + public static function patchBeforeSharedBuild(BuilderBase $builder): void + { + foreach ($builder->getExts() as $ext) { + if ($ext->patchBeforeSharedBuild() === true) { + logger()->info('Extension [' . $ext->getName() . '] patched before shared build'); + } + } + } + /** * Source patcher runner before configure * From eab8c27e4ab54888d5adc2fd3e4de5832c5fbad5 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 17 May 2025 22:43:34 +0700 Subject: [PATCH 016/204] shared dom ext requires xml --- config/ext.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index 47acef966..9c36a35e2 100644 --- a/config/ext.json +++ b/config/ext.json @@ -75,7 +75,7 @@ "libxml2", "zlib" ], - "ext-depends-windows": [ + "ext-depends": [ "xml" ] }, From f88c10d4aa24dd9f237bdd773cb9f1c9c8454307 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 08:57:07 +0700 Subject: [PATCH 017/204] restore buildphp command --- config/ext.json | 11 ++++++++++- src/SPC/builder/Extension.php | 20 ++++++++++---------- src/SPC/command/BuildPHPCommand.php | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/config/ext.json b/config/ext.json index 9c36a35e2..d051526ad 100644 --- a/config/ext.json +++ b/config/ext.json @@ -75,7 +75,7 @@ "libxml2", "zlib" ], - "ext-depends": [ + "ext-depends-windows": [ "xml" ] }, @@ -410,6 +410,9 @@ }, "mysqli": { "type": "builtin", + "target": [ + "static" + ], "arg-type": "with", "ext-depends": [ "mysqlnd" @@ -417,6 +420,9 @@ }, "mysqlnd": { "type": "builtin", + "target": [ + "static" + ], "arg-type-windows": "with", "lib-depends": [ "zlib" @@ -450,6 +456,9 @@ "openssl": { "notes": true, "type": "builtin", + "target": [ + "static" + ], "arg-type": "custom", "arg-type-windows": "with", "lib-depends": [ diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 81f8cac9e..808d8c54b 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -188,6 +188,16 @@ public function patchBeforeMake(): bool return false; } + /** + * Patch code before shared extension ./configure + * If you need to patch some code, overwrite this + * return true if you patched something, false if not + */ + public function patchBeforeSharedBuild(): bool + { + return false; + } + /** * Run shared extension check when cli is enabled * @throws RuntimeException @@ -423,14 +433,4 @@ private function getLibraryDependencies(bool $recursive = false): array return $deps; } - - /** - * Patch code before shared extension ./configure - * If you need to patch some code, overwrite this - * return true if you patched something, false if not - */ - public function patchBeforeSharedBuild(): bool - { - return false; - } } diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 8226b045a..1da60f63a 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -208,7 +208,7 @@ public function handle(): int SourcePatcher::patchSPCVersionToPHP($this->getApplication()->getVersion()); // start to build - // $builder->buildPHP($rule); + $builder->buildPHP($rule); SourcePatcher::patchBeforeSharedBuild($builder); From 2ff300970a8ce1a3791fa006b7aa31d2ea7507d7 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 12:19:26 +0700 Subject: [PATCH 018/204] -fPIC for unixodbc --- src/SPC/builder/unix/library/unixodbc.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/unixodbc.php b/src/SPC/builder/unix/library/unixodbc.php index f89eb0a44..be7e92972 100644 --- a/src/SPC/builder/unix/library/unixodbc.php +++ b/src/SPC/builder/unix/library/unixodbc.php @@ -16,19 +16,25 @@ trait unixodbc protected function build(): void { shell()->cd($this->source_dir) - ->exec( + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) + ->execWithEnv( './configure ' . '--enable-static --disable-shared ' . '--disable-debug ' . + '--with-pic ' . '--disable-dependency-tracking ' . '--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' . '--with-included-ltdl ' . '--enable-gui=no ' . '--prefix=' ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->execWithEnv('make clean') + ->execWithEnv("make -j{$this->builder->concurrency}") + ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']); $this->cleanLaFiles(); } From 1fbd2c1adcffbd8a834d87b4a79c296e5ca4974b Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 12:46:55 +0700 Subject: [PATCH 019/204] -fPIC for postgresql CFLAGS, but it's still erroring out --- src/SPC/builder/unix/library/postgresql.php | 27 ++++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 7885eca3a..43efca385 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -42,7 +42,7 @@ protected function build(): void if (!empty($output[1][0])) { $cppflags = $output[1][0]; $macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : ''; - $envs .= " CPPFLAGS=\"{$cppflags} -fPIC -fPIE -fno-ident{$macos_15_bug_cflags}\""; + $envs .= " CPPFLAGS=\"{$cppflags} -DPIC -fpic -fPIC -fPIE -fno-ident{$macos_15_bug_cflags}\""; } $output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}"); $error_exec_cnt += $output[0] === 0 ? 0 : 1; @@ -78,9 +78,15 @@ protected function build(): void throw new RuntimeException('Unsupported version for postgresql: ' . $version . ' !'); } + $env = [ + 'CFLAGS' => $this->getLibExtraCFlags() . ' -DPIC -fpic', + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]; // configure shell()->cd($this->source_dir . '/build') - ->exec( + ->setEnv($env) + ->execWithEnv( "{$envs} ../configure " . "--prefix={$builddir} " . '--disable-thread-safety ' . @@ -89,6 +95,7 @@ protected function build(): void '--with-readline ' . '--with-libxml ' . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . + // ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . '--without-ldap ' . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . @@ -98,16 +105,12 @@ protected function build(): void '--without-pam ' . '--without-bonjour ' . '--without-tcl ' - ); - // ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . - - // build - shell()->cd($this->source_dir . '/build') - ->exec($envs . ' make -C src/bin/pg_config install') - ->exec($envs . ' make -C src/include install') - ->exec($envs . ' make -C src/common install') - ->exec($envs . ' make -C src/port install') - ->exec($envs . ' make -C src/interfaces/libpq install'); + ) + ->execWithEnv($envs . ' make -C src/bin/pg_config install') + ->execWithEnv($envs . ' make -C src/include install') + ->execWithEnv($envs . ' make -C src/common install') + ->execWithEnv($envs . ' make -C src/port install') + ->execWithEnv($envs . ' make -C src/interfaces/libpq install'); // remove dynamic libs shell()->cd($this->source_dir . '/build') From bdd764218b4be21c81b36af96faa41ad288edfa1 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 12:53:49 +0700 Subject: [PATCH 020/204] install headers and modules from shared extensions --- src/SPC/builder/BuilderBase.php | 10 ++++++++++ src/SPC/builder/Extension.php | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 59f371efc..3d5648ef0 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -233,8 +233,15 @@ public function proveExts(array $static_extensions, array $shared_extensions = [ */ abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE); + /** + * @throws WrongUsageException + * @throws RuntimeException + * @throws FileSystemException + */ public function buildSharedExts(): void { + FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir="', 'extension_dir="' . BUILD_MODULES_PATH . '"'); + FileSystem::createDir(BUILD_MODULES_PATH); foreach ($this->getExts() as $ext) { if (!$ext->isBuildShared()) { continue; @@ -242,6 +249,9 @@ public function buildSharedExts(): void logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); $ext->buildShared(); } + if (getenv('EXTENSION_DIR')) { + FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir="', 'extension_dir="' . getenv('EXTENSION_DIR') . '"'); + } } /** diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 808d8c54b..1402bc584 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -319,10 +319,10 @@ public function buildUnixShared(): void ->execWithEnv(BUILD_BIN_PATH . '/phpize') ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static') ->execWithEnv('make clean') - ->execWithEnv('make -j' . $this->builder->concurrency); + ->execWithEnv('make -j' . $this->builder->concurrency) + ->execWithEnv('make install'); // copy shared library - FileSystem::createDir(BUILD_MODULES_PATH); $extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so'; $sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so'; if (file_exists($extensionDirFile)) { From ea7c145c62a98e536c53359db065d318cd9687fb Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 15:52:15 +0700 Subject: [PATCH 021/204] libxml2 pic... --- src/SPC/builder/linux/library/libxml2.php | 12 +++++++++--- src/SPC/builder/unix/library/postgresql.php | 10 ++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/linux/library/libxml2.php b/src/SPC/builder/linux/library/libxml2.php index 6f42d6722..6d9470aea 100644 --- a/src/SPC/builder/linux/library/libxml2.php +++ b/src/SPC/builder/linux/library/libxml2.php @@ -24,13 +24,19 @@ public function build(): void FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') - ->exec( + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) + ->execWithEnv( 'cmake ' . '-DCMAKE_BUILD_TYPE=Release ' . '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . '-DCMAKE_INSTALL_LIBDIR=' . BUILD_LIB_PATH . ' ' . "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DIconv_IS_BUILT_IN=OFF ' . '-DLIBXML2_WITH_ICONV=ON ' . "-DLIBXML2_WITH_ZLIB={$enable_zlib} " . @@ -41,8 +47,8 @@ public function build(): void '-DLIBXML2_WITH_TESTS=OFF ' . '..' ) - ->exec("cmake --build . -j {$this->builder->concurrency}") - ->exec('make install'); + ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") + ->execWithEnv('make install'); FileSystem::replaceFileStr( BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc', diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 43efca385..5a0da5de3 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -39,10 +39,12 @@ protected function build(): void $output = shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}"); $error_exec_cnt += $output[0] === 0 ? 0 : 1; + $macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : ''; + $cflags = ''; if (!empty($output[1][0])) { - $cppflags = $output[1][0]; - $macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : ''; - $envs .= " CPPFLAGS=\"{$cppflags} -DPIC -fpic -fPIC -fPIE -fno-ident{$macos_15_bug_cflags}\""; + $cflags = $output[1][0]; + $envs .= ' CPPFLAGS="-DPIC"'; + $cflags = "{$cflags} -fno-ident{$macos_15_bug_cflags}"; } $output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}"); $error_exec_cnt += $output[0] === 0 ? 0 : 1; @@ -79,7 +81,7 @@ protected function build(): void } $env = [ - 'CFLAGS' => $this->getLibExtraCFlags() . ' -DPIC -fpic', + 'CFLAGS' => $this->getLibExtraCFlags() . ' ' . $cflags, 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]; From 117923791ae1f6439ef56f6441e4ce649b9764e3 Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 18 May 2025 17:46:55 +0700 Subject: [PATCH 022/204] Update test-extensions.php --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 2739d3ac8..e2f0ca120 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,7 +51,7 @@ // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'xdebug', + 'Linux' => 'xdebug,intl,pgsql', 'Windows', 'Darwin' => '', }; From f708907d99b682ed98bec7037c6f916070c24777 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 17:59:02 +0700 Subject: [PATCH 023/204] zstd pic --- src/SPC/builder/linux/library/libpng.php | 5 ++--- src/SPC/builder/unix/library/zstd.php | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/linux/library/libpng.php b/src/SPC/builder/linux/library/libpng.php index 56daee553..16fdca60b 100644 --- a/src/SPC/builder/linux/library/libpng.php +++ b/src/SPC/builder/linux/library/libpng.php @@ -45,12 +45,11 @@ public function build(): void ->exec('chmod +x ./configure') ->exec('chmod +x ./install-sh') ->setEnv([ - 'CFLAGS' => trim($this->getLibExtraCFlags() . ' ' . $this->builder->arch_c_flags), - 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags() . ' -L' . BUILD_LIB_PATH, 'LIBS' => $this->getLibExtraLibs(), ]) ->execWithEnv( - 'LDFLAGS="-L' . BUILD_LIB_PATH . '" ' . './configure ' . '--disable-shared ' . '--enable-static ' . diff --git a/src/SPC/builder/unix/library/zstd.php b/src/SPC/builder/unix/library/zstd.php index 1990f6585..939567f21 100644 --- a/src/SPC/builder/unix/library/zstd.php +++ b/src/SPC/builder/unix/library/zstd.php @@ -18,11 +18,17 @@ protected function build(): void { FileSystem::resetDir($this->source_dir . '/build/cmake/build'); shell()->cd($this->source_dir . '/build/cmake/build') + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) ->exec( 'cmake ' . "{$this->builder->makeCmakeArgs()} " . '-DZSTD_BUILD_STATIC=ON ' . '-DZSTD_BUILD_SHARED=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '..' ) ->exec("cmake --build . -j {$this->builder->concurrency}") From 6b50700d8c4fae4b138e40e4f3439e2f87420378 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 18:24:09 +0700 Subject: [PATCH 024/204] remove dom extra cake --- src/SPC/builder/extension/dom.php | 34 ------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php index bb2f659fd..819a7787f 100644 --- a/src/SPC/builder/extension/dom.php +++ b/src/SPC/builder/extension/dom.php @@ -35,38 +35,4 @@ public function getWindowsConfigureArg(): string { return '--with-dom --with-libxml'; } - - public function buildUnixShared(): void - { - $config = (new SPCConfigUtil($this->builder))->config([$this->getName()]); - $env = [ - 'CFLAGS' => $config['cflags'] . ' -I' . SOURCE_PATH . '/php-src', - 'LDFLAGS' => $config['ldflags'], - 'LIBS' => $config['libs'], - 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, - ]; - // prepare configure args - shell()->cd($this->source_dir) - ->setEnv($env) - ->execWithEnv(BUILD_BIN_PATH . '/phpize') - ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static') - ->execWithEnv('make clean') - ->execWithEnv('make -j' . $this->builder->concurrency); - - // copy shared library - FileSystem::createDir(BUILD_MODULES_PATH); - $extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so'; - $sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so'; - if (file_exists($extensionDirFile)) { - copy($extensionDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); - } elseif (file_exists($sourceDirFile)) { - copy($sourceDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); - } else { - throw new RuntimeException('extension ' . $this->getName() . ' built successfully, but into an unexpected location.'); - } - // check shared extension with php-cli - if (file_exists(BUILD_BIN_PATH . '/php')) { - $this->runSharedExtensionCheckUnix(); - } - } } From 81474336c10a54ddc3f9c07339fe5ca5c2cc728e Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 18 May 2025 18:29:43 +0700 Subject: [PATCH 025/204] Update dom.php --- src/SPC/builder/extension/dom.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php index 819a7787f..a08fcd81f 100644 --- a/src/SPC/builder/extension/dom.php +++ b/src/SPC/builder/extension/dom.php @@ -8,7 +8,6 @@ use SPC\exception\RuntimeException; use SPC\store\FileSystem; use SPC\util\CustomExt; -use SPC\util\SPCConfigUtil; #[CustomExt('dom')] class dom extends Extension From 54ff71798c9a8624019bdce6f62d6c532c9b2dab Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 18 May 2025 21:48:43 +0700 Subject: [PATCH 026/204] patch intl standard to c++17 --- src/SPC/builder/extension/intl.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/SPC/builder/extension/intl.php b/src/SPC/builder/extension/intl.php index 8130b5d34..819aee695 100644 --- a/src/SPC/builder/extension/intl.php +++ b/src/SPC/builder/extension/intl.php @@ -23,4 +23,9 @@ public function patchBeforeBuildconf(): bool } return true; } + + public function patchBeforeSharedBuild(): bool + { + return $this->patchBeforeBuildconf(); + } } From bff99fa53712134a9eacc437eec3c611a74ed081 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 19 May 2025 13:15:03 +0700 Subject: [PATCH 027/204] fix imagick shared build --- src/SPC/builder/unix/library/imagemagick.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index 56da92e5f..345cf6f04 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -80,5 +80,17 @@ protected function build(): void 'includearchdir=${prefix}/include/ImageMagick-7' ); } + $filelist = [ + 'libMagick++-7.Q16HDRI.la', + 'libMagickCore-7.Q16HDRI.la', + 'libMagickWand-7.Q16HDRI.la', + ]; + foreach ($filelist as $file) { + FileSystem::replaceFileStr( + BUILD_LIB_PATH . '/' . $file, + ' /lib/', + ' ' . BUILD_LIB_PATH . '/', + ); + } } } From 5bd53ed7142bfc770629e630802a81d257d3a61e Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 19 May 2025 13:23:19 +0700 Subject: [PATCH 028/204] skip php rebuild if we're only building shared libphp.so --- src/SPC/builder/linux/LinuxBuilder.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index e38714f1a..c06267d74 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -106,6 +106,18 @@ public function makeAutoconfArgs(string $name, array $libSpecs): string */ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void { + if ($build_target === BUILD_TARGET_EMBED && + file_exists(BUILD_BIN_PATH . '/php-config') && + file_exists(BUILD_BIN_PATH . '/phpize') + ) { + $embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static'; + if ($embed_type === 'shared' && file_exists(BUILD_LIB_PATH . '/libphp.so')) { + return; + } + if (file_exists(BUILD_LIB_PATH . '/libphp.a')) { + return; + } + } // ---------- Update extra-libs ---------- $extra_libs = getenv('SPC_EXTRA_LIBS') ?: ''; // bloat means force-load all static libraries, even if they are not used From 7ba194810147bd476a438be205b2a2b36a741b60 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 19 May 2025 16:30:34 +0700 Subject: [PATCH 029/204] fix pdo_sqlsrv --- src/SPC/builder/Extension.php | 10 ------ src/SPC/builder/extension/pdo_sqlsrv.php | 40 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 src/SPC/builder/extension/pdo_sqlsrv.php diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 1402bc584..d25f1f12c 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -322,16 +322,6 @@ public function buildUnixShared(): void ->execWithEnv('make -j' . $this->builder->concurrency) ->execWithEnv('make install'); - // copy shared library - $extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so'; - $sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so'; - if (file_exists($extensionDirFile)) { - copy($extensionDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); - } elseif (file_exists($sourceDirFile)) { - copy($sourceDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so'); - } else { - throw new RuntimeException('extension ' . $this->getName() . ' built successfully, but into an unexpected location.'); - } // check shared extension with php-cli if (file_exists(BUILD_BIN_PATH . '/php')) { $this->runSharedExtensionCheckUnix(); diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php new file mode 100644 index 000000000..bc1aacf59 --- /dev/null +++ b/src/SPC/builder/extension/pdo_sqlsrv.php @@ -0,0 +1,40 @@ +builder))->config([$this->getName()]); + $env = [ + 'CFLAGS' => $config['cflags'], + 'CXXFLAGS' => $config['cflags'], + 'LDFLAGS' => $config['ldflags'], + 'LIBS' => $config['libs'], + 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, + ]; + // prepare configure args + shell()->cd($this->source_dir) + ->setEnv($env) + ->execWithEnv(BUILD_BIN_PATH . '/phpize') + ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static') + ->execWithEnv('make clean') + ->execWithEnv('make -j' . $this->builder->concurrency) + ->execWithEnv('make install'); + + // check shared extension with php-cli + if (file_exists(BUILD_BIN_PATH . '/php')) { + $this->runSharedExtensionCheckUnix(); + } + } +} From 683371adaa54500f5b0b1a516dbf396c0cba658a Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 20 May 2025 07:46:07 +0700 Subject: [PATCH 030/204] fix phar --- src/SPC/builder/extension/pdo_sqlsrv.php | 2 -- src/SPC/builder/extension/phar.php | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/SPC/builder/extension/phar.php diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php index bc1aacf59..195eaffee 100644 --- a/src/SPC/builder/extension/pdo_sqlsrv.php +++ b/src/SPC/builder/extension/pdo_sqlsrv.php @@ -5,8 +5,6 @@ namespace SPC\builder\extension; use SPC\builder\Extension; -use SPC\exception\FileSystemException; -use SPC\store\FileSystem; use SPC\util\CustomExt; use SPC\util\SPCConfigUtil; diff --git a/src/SPC/builder/extension/phar.php b/src/SPC/builder/extension/phar.php new file mode 100644 index 000000000..a3563e07f --- /dev/null +++ b/src/SPC/builder/extension/phar.php @@ -0,0 +1,23 @@ +source_dir . '/config.m4', + ['$ext_dir/phar.1', '$ext_dir/phar.phar.1'], + ['${ext_dir}phar.1', '${ext_dir}phar.phar.1'] + ); + return true; + } +} From 38dfcdabd08fa1195ddf0f553a54a022273b749c Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 20 May 2025 08:06:49 +0700 Subject: [PATCH 031/204] fix rdkafka --- src/SPC/builder/extension/rdkafka.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SPC/builder/extension/rdkafka.php b/src/SPC/builder/extension/rdkafka.php index 50610325f..7af34d720 100644 --- a/src/SPC/builder/extension/rdkafka.php +++ b/src/SPC/builder/extension/rdkafka.php @@ -33,4 +33,12 @@ public function getConfigureArg(): string $pkgconf_libs = trim(implode('', $pkgconf_libs)); return '--with-rdkafka=' . BUILD_ROOT_PATH . ' LIBS="' . $pkgconf_libs . '"'; } + + public function getUnixConfigureArg(bool $shared = false): string + { + if ($shared) { + return '--with-rdkafka=' . BUILD_ROOT_PATH; + } + return parent::getUnixConfigureArg($shared); + } } From 14a0e1a6ccd147eadd41866b4976c0cf42432e71 Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 20 May 2025 08:24:28 +0700 Subject: [PATCH 032/204] fix macos --- src/SPC/builder/extension/phar.php | 4 ++++ src/SPC/builder/extension/readline.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/SPC/builder/extension/phar.php b/src/SPC/builder/extension/phar.php index a3563e07f..2bffea454 100644 --- a/src/SPC/builder/extension/phar.php +++ b/src/SPC/builder/extension/phar.php @@ -5,6 +5,7 @@ namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\builder\linux\LinuxBuilder; use SPC\store\FileSystem; use SPC\util\CustomExt; @@ -13,6 +14,9 @@ class phar extends Extension { public function patchBeforeSharedBuild(): bool { + if (!$this->builder instanceof LinuxBuilder) { + return false; + } FileSystem::replaceFileStr( $this->source_dir . '/config.m4', ['$ext_dir/phar.1', '$ext_dir/phar.phar.1'], diff --git a/src/SPC/builder/extension/readline.php b/src/SPC/builder/extension/readline.php index c66e7afa6..120fa42fa 100644 --- a/src/SPC/builder/extension/readline.php +++ b/src/SPC/builder/extension/readline.php @@ -24,4 +24,9 @@ public function patchBeforeConfigure(): bool ); return true; } + + public function getUnixConfigureArg(bool $shared = false): string + { + return '--without-libedit --with-readline=' . BUILD_ROOT_PATH; + } } From 20b6870f903ce97bd6a08dbb099905f4e962095d Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 20 May 2025 09:14:13 +0700 Subject: [PATCH 033/204] rewrite extension_dir --- src/SPC/builder/BuilderBase.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 3d5648ef0..3b38019ee 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -4,6 +4,7 @@ namespace SPC\builder; +use PharIo\FileSystem\File; use SPC\exception\ExceptionHandler; use SPC\exception\FileSystemException; use SPC\exception\InterruptException; @@ -240,7 +241,16 @@ abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE); */ public function buildSharedExts(): void { - FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir="', 'extension_dir="' . BUILD_MODULES_PATH . '"'); + $lines = file(BUILD_BIN_PATH . '/php-config'); + $extension_dir_line = null; + foreach ($lines as $key => $value) { + if (str_starts_with($value, 'extension_dir=')) { + $lines[$key] = 'extension_dir="' . BUILD_MODULES_PATH . '"' . PHP_EOL; + $extension_dir_line = $value; + break; + } + } + file_put_contents(BUILD_BIN_PATH . '/php-config', implode('', $lines)); FileSystem::createDir(BUILD_MODULES_PATH); foreach ($this->getExts() as $ext) { if (!$ext->isBuildShared()) { @@ -249,9 +259,7 @@ public function buildSharedExts(): void logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); $ext->buildShared(); } - if (getenv('EXTENSION_DIR')) { - FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir="', 'extension_dir="' . getenv('EXTENSION_DIR') . '"'); - } + FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir=', $extension_dir_line); } /** From 545a653c0d1e0a2b8fdfd3df4b1dbcd1ec8e81ff Mon Sep 17 00:00:00 2001 From: henderkes Date: Tue, 20 May 2025 09:20:20 +0700 Subject: [PATCH 034/204] better phar handling --- src/SPC/builder/extension/phar.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/extension/phar.php b/src/SPC/builder/extension/phar.php index 2bffea454..7396ba837 100644 --- a/src/SPC/builder/extension/phar.php +++ b/src/SPC/builder/extension/phar.php @@ -12,16 +12,26 @@ #[CustomExt('phar')] class phar extends Extension { - public function patchBeforeSharedBuild(): bool + public function buildUnixShared(): void { if (!$this->builder instanceof LinuxBuilder) { - return false; + parent::buildUnixShared(); + return; } + FileSystem::replaceFileStr( $this->source_dir . '/config.m4', ['$ext_dir/phar.1', '$ext_dir/phar.phar.1'], ['${ext_dir}phar.1', '${ext_dir}phar.phar.1'] ); - return true; + try { + parent::buildUnixShared(); + } finally { + FileSystem::replaceFileStr( + $this->source_dir . '/config.m4', + ['${ext_dir}phar.1', '${ext_dir}phar.phar.1'], + ['$ext_dir/phar.1', '$ext_dir/phar.phar.1'] + ); + } } } From 1e50dac5a693a92b816bf33f5aeda9b9d8e6a9e3 Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 20 May 2025 10:50:41 +0700 Subject: [PATCH 035/204] Update BuildPHPCommand.php fix printed path --- src/SPC/command/BuildPHPCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 1da60f63a..edeb7c47f 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -248,7 +248,7 @@ public function handle(): int } if (!empty($shared_extensions)) { foreach ($shared_extensions as $ext) { - $path = FileSystem::convertPath("{$build_root_path}/lib/{$ext}.so"); + $path = FileSystem::convertPath("{$build_root_path}/modules/{$ext}.so"); logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}"); } } From 93c692862490c705b04e83a71245f37ea1cf84ad Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 20 May 2025 20:00:37 +0700 Subject: [PATCH 036/204] fix readline --- src/SPC/builder/Extension.php | 22 ++++++++++++++++++++-- src/SPC/builder/extension/mbregex.php | 5 +++++ src/SPC/builder/extension/mbstring.php | 11 +++++++++++ src/SPC/builder/extension/readline.php | 18 ++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index d25f1f12c..aea8ba8c6 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -9,6 +9,7 @@ use SPC\exception\WrongUsageException; use SPC\store\Config; use SPC\store\FileSystem; +use SPC\store\SourcePatcher; use SPC\util\SPCConfigUtil; class Extension @@ -189,7 +190,7 @@ public function patchBeforeMake(): bool } /** - * Patch code before shared extension ./configure + * Patch code before shared extension phpize * If you need to patch some code, overwrite this * return true if you patched something, false if not */ @@ -198,6 +199,16 @@ public function patchBeforeSharedBuild(): bool return false; } + /** + * Patch code before shared extension ./configure + * If you need to patch some code, overwrite this + * return true if you patched something, false if not + */ + public function patchBeforeSharedConfigure(): bool + { + return false; + } + /** * Run shared extension check when cli is enabled * @throws RuntimeException @@ -316,7 +327,14 @@ public function buildUnixShared(): void // prepare configure args shell()->cd($this->source_dir) ->setEnv($env) - ->execWithEnv(BUILD_BIN_PATH . '/phpize') + ->execWithEnv(BUILD_BIN_PATH . '/phpize'); + + if ($this->patchBeforeSharedConfigure()) { + logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure'); + } + + 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('make clean') ->execWithEnv('make -j' . $this->builder->concurrency) diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index 4bf285445..492c4fbb9 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -21,6 +21,11 @@ public function getConfigureArg(): string return ''; } + public function buildUnixShared(): void + { + print('mbregex is already built as part of mbstring, skipping build' . PHP_EOL); + } + /** * mbregex is not an extension, we need to overwrite the default check. */ diff --git a/src/SPC/builder/extension/mbstring.php b/src/SPC/builder/extension/mbstring.php index 5fcb88bdd..aa86ee53b 100644 --- a/src/SPC/builder/extension/mbstring.php +++ b/src/SPC/builder/extension/mbstring.php @@ -20,4 +20,15 @@ public function getConfigureArg(): string } return $arg; } + + public function getUnixConfigureArg(bool $shared = false): string + { + $arg = '--enable-mbstring'; + if ($this->builder->getExt('mbregex') === null) { + $arg .= ' --disable-mbregex'; + } else { + $arg .= ' --enable-mbregex'; + } + return $arg; + } } diff --git a/src/SPC/builder/extension/readline.php b/src/SPC/builder/extension/readline.php index 120fa42fa..71c82a8bc 100644 --- a/src/SPC/builder/extension/readline.php +++ b/src/SPC/builder/extension/readline.php @@ -29,4 +29,22 @@ public function getUnixConfigureArg(bool $shared = false): string { return '--without-libedit --with-readline=' . BUILD_ROOT_PATH; } + + public function patchBeforeSharedConfigure(): bool + { + FileSystem::replaceFileStr($this->source_dir . '/configure', + 'test "$PHP_LIBEDIT" = "no" && PHP_LIBEDIT=yes', + '' + ); + return true; + } + + public function buildUnixShared(): void + { + if (!file_exists(BUILD_BIN_PATH . '/php') || !file_exists(BUILD_INCLUDE_PATH . '/php/sapi/cli/cli.h')) { + logger()->warning('CLI mode is not enabled, skipping readline build'); + return; + } + parent::buildUnixShared(); + } } From a9f81dd38ed3c69958ba59181922972bd730e45b Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 20 May 2025 20:03:02 +0700 Subject: [PATCH 037/204] remove -fpic and -fpie (-fPIC and -fPIE are still there) --- config/env.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/env.ini b/config/env.ini index f70ad0a2e..1a1fbaa79 100644 --- a/config/env.ini +++ b/config/env.ini @@ -97,7 +97,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; LIBS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-ident -fPIE -fPIC" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-ident -fPIE -fPIC" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm" ; EXTRA_LDFLAGS_PROGRAM for `make` php From 03ca3f4f59951a2f438edfccfb04989b371513b5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 20 May 2025 22:19:09 +0700 Subject: [PATCH 038/204] why do we have prefix= calls instead of prefix=BUILD_ROOT_DIR? --- config/ext.json | 3 - src/SPC/builder/extension/curl.php | 73 ++++++++++++++++++++ src/SPC/builder/macos/library/libpng.php | 1 + src/SPC/builder/traits/UnixLibraryTrait.php | 17 +++++ src/SPC/builder/unix/library/imagemagick.php | 11 +-- src/SPC/builder/unix/library/ldap.php | 1 + 6 files changed, 94 insertions(+), 12 deletions(-) diff --git a/config/ext.json b/config/ext.json index d051526ad..ee1c68db2 100644 --- a/config/ext.json +++ b/config/ext.json @@ -456,9 +456,6 @@ "openssl": { "notes": true, "type": "builtin", - "target": [ - "static" - ], "arg-type": "custom", "arg-type-windows": "with", "lib-depends": [ diff --git a/src/SPC/builder/extension/curl.php b/src/SPC/builder/extension/curl.php index d4f8b078c..5ed224f64 100644 --- a/src/SPC/builder/extension/curl.php +++ b/src/SPC/builder/extension/curl.php @@ -5,6 +5,7 @@ namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\builder\linux\LinuxBuilder; use SPC\builder\macos\MacOSBuilder; use SPC\exception\FileSystemException; use SPC\exception\WrongUsageException; @@ -54,4 +55,76 @@ public function patchBeforeConfigure(): bool FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lcurl/', $this->getLibFilesString() . $frameworks); return true; } + + public function patchBeforeSharedConfigure(): bool + { + $file = SOURCE_PATH . '/php-src/ext/curl/config.m4'; + $content = FileSystem::readFile($file); + + // Inject patch before it + $patch = ' save_LIBS="$LIBS" + LIBS="$LIBS $CURL_LIBS" +'; + // Check if already patched + if (str_contains($content, $patch)) { + return false; // Already patched + } + + // Match the line containing PHP_CHECK_LIBRARY for curl + $pattern = '/(PHP_CHECK_LIBRARY\(\[curl],\s*\[curl_easy_perform],)/'; + + + // Restore LIBS after the check — append this just after the macro block + $restore = ' + LIBS="$save_LIBS"'; + + // Apply patch + $patched = preg_replace_callback($pattern, function ($matches) use ($patch) { + return $patch . $matches[1]; + }, $content, 1); + + // Inject restore after the matching PHP_CHECK_LIBRARY block + $patched = preg_replace( + '/(PHP_CHECK_LIBRARY\(\[curl],\s*\[curl_easy_perform],.*?\)\n)/s', + "$1$restore\n", + $patched, + 1 + ); + + if ($patched === null) { + throw new \RuntimeException("Failed to patch config.m4 due to a regex error"); + } + + FileSystem::writeFile($file, $patched); + return true; + } + + + public function getUnixConfigureArg(bool $shared = false): string + { + return '--with-curl'; + } + + public function buildUnixShared(): void + { + if (!$this->builder instanceof LinuxBuilder) { + parent::buildUnixShared(); + return; + } + + FileSystem::replaceFileStr( + $this->source_dir . '/config.m4', + ['$ext_dir/phar.1', '$ext_dir/phar.phar.1'], + ['${ext_dir}phar.1', '${ext_dir}phar.phar.1'] + ); + try { + parent::buildUnixShared(); + } finally { + FileSystem::replaceFileStr( + $this->source_dir . '/config.m4', + ['${ext_dir}phar.1', '${ext_dir}phar.phar.1'], + ['$ext_dir/phar.1', '$ext_dir/phar.phar.1'] + ); + } + } } diff --git a/src/SPC/builder/macos/library/libpng.php b/src/SPC/builder/macos/library/libpng.php index b61cc8988..f273bff6b 100644 --- a/src/SPC/builder/macos/library/libpng.php +++ b/src/SPC/builder/macos/library/libpng.php @@ -59,6 +59,7 @@ protected function build(): void ->cd(BUILD_LIB_PATH) ->exec('ln -sf libpng16.a libpng.a'); $this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX); + $this->patchLaDependencyPrefix(['libpng16.la']); $this->cleanLaFiles(); } } diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index 8e69f6d32..45de0cf40 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -84,6 +84,23 @@ public function patchPkgconfPrefix(array $files, int $patch_option = PKGCONF_PAT } } + public function patchLaDependencyPrefix(array $files): void + { + logger()->info('Patching library [' . static::NAME . '] la files'); + foreach ($files as $name) { + $realpath = realpath(BUILD_LIB_PATH . '/' . $name); + if ($realpath === false) { + throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !'); + } + logger()->debug('Patching ' . $realpath); + // replace prefix + $file = FileSystem::readFile($realpath); + $file = str_replace(' /lib/', ' ' . BUILD_LIB_PATH . '/', $file); + $file = preg_replace("/^libdir=.*$/m", "libdir='" . BUILD_LIB_PATH . "'", $file); + FileSystem::writeFile($realpath, $file); + } + } + /** * remove libtool archive files * diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index 345cf6f04..deb1e4021 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -80,17 +80,10 @@ protected function build(): void 'includearchdir=${prefix}/include/ImageMagick-7' ); } - $filelist = [ + $this->patchLaDependencyPrefix([ 'libMagick++-7.Q16HDRI.la', 'libMagickCore-7.Q16HDRI.la', 'libMagickWand-7.Q16HDRI.la', - ]; - foreach ($filelist as $file) { - FileSystem::replaceFileStr( - BUILD_LIB_PATH . '/' . $file, - ' /lib/', - ' ' . BUILD_LIB_PATH . '/', - ); - } + ]); } } diff --git a/src/SPC/builder/unix/library/ldap.php b/src/SPC/builder/unix/library/ldap.php index 2831f0940..93f889f09 100644 --- a/src/SPC/builder/unix/library/ldap.php +++ b/src/SPC/builder/unix/library/ldap.php @@ -50,5 +50,6 @@ protected function build(): void ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']); + $this->patchLaDependencyPrefix(['libldap.la', 'liblber.la']); } } From f47daac3cc205e51bbf4ceb371bd26ea25e3ab83 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 20 May 2025 23:04:34 +0700 Subject: [PATCH 039/204] 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 ee1c68db2..1c74db745 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 aea8ba8c6..9322e49b3 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -127,6 +127,9 @@ public function checkDependency(): static 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 @@ public function buildShared(): void 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 @@ public function buildUnixShared(): void 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 544585ad0..b1a8c5f35 100644 --- a/src/SPC/builder/extension/xml.php +++ b/src/SPC/builder/extension/xml.php @@ -26,11 +26,12 @@ public function getUnixConfigureArg(bool $shared = false): string '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 @@ public function getWindowsConfigureArg(): string 'soap' => '--enable-soap', 'xmlreader' => '--enable-xmlreader', 'xmlwriter' => '--enable-xmlwriter', - 'dom' => '--with-dom', 'simplexml' => '--with-simplexml', default => throw new RuntimeException('Not accept non-xml extension'), }; From fa285ecc82060159ec1b045ad7b77dfb46014b32 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 20 May 2025 23:16:36 +0700 Subject: [PATCH 040/204] more patching, xml still not working though --- src/SPC/builder/unix/library/gettext.php | 1 + src/SPC/builder/unix/library/libiconv.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/SPC/builder/unix/library/gettext.php b/src/SPC/builder/unix/library/gettext.php index 69736c364..166225601 100644 --- a/src/SPC/builder/unix/library/gettext.php +++ b/src/SPC/builder/unix/library/gettext.php @@ -37,5 +37,6 @@ protected function build(): void ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install'); + $this->patchLaDependencyPrefix(['libintl.la']); } } diff --git a/src/SPC/builder/unix/library/libiconv.php b/src/SPC/builder/unix/library/libiconv.php index 710e74259..722976468 100644 --- a/src/SPC/builder/unix/library/libiconv.php +++ b/src/SPC/builder/unix/library/libiconv.php @@ -30,5 +30,6 @@ protected function build(): void if (file_exists(BUILD_BIN_PATH . '/iconv')) { unlink(BUILD_BIN_PATH . '/iconv'); } + $this->patchLaDependencyPrefix(['libiconv.la']); } } From c43423a7d0868e658ab1ca5e804b9a40b22c6a23 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 11:19:28 +0700 Subject: [PATCH 041/204] replace root cause of the automatic enable --- src/SPC/builder/extension/readline.php | 9 --------- src/SPC/builder/linux/LinuxBuilder.php | 1 + src/SPC/builder/unix/UnixBuilderBase.php | 1 + 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/SPC/builder/extension/readline.php b/src/SPC/builder/extension/readline.php index 71c82a8bc..dc4d15f7c 100644 --- a/src/SPC/builder/extension/readline.php +++ b/src/SPC/builder/extension/readline.php @@ -30,15 +30,6 @@ public function getUnixConfigureArg(bool $shared = false): string return '--without-libedit --with-readline=' . BUILD_ROOT_PATH; } - public function patchBeforeSharedConfigure(): bool - { - FileSystem::replaceFileStr($this->source_dir . '/configure', - 'test "$PHP_LIBEDIT" = "no" && PHP_LIBEDIT=yes', - '' - ); - return true; - } - public function buildUnixShared(): void { if (!file_exists(BUILD_BIN_PATH . '/php') || !file_exists(BUILD_INCLUDE_PATH . '/php/sapi/cli/cli.h')) { diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index c06267d74..2db05b5e5 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -184,6 +184,7 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void shell()->cd(SOURCE_PATH . '/php-src') ->exec( getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' . + '--prefix=' . BUILD_ROOT_PATH . ' ' . ($enable_cli ? '--enable-cli ' : '--disable-cli ') . ($enable_fpm ? '--enable-fpm ' . ($this->getLib('libacl') !== null ? '--with-fpm-acl ' : '') : '--disable-fpm ') . ($enable_embed ? "--enable-embed={$embed_type} " : '--disable-embed ') . diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index 9ffca22a0..48c826013 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -250,6 +250,7 @@ protected function patchPhpScripts(): void logger()->debug('Patching phpize prefix'); FileSystem::replaceFileStr(BUILD_BIN_PATH . '/phpize', "prefix=''", "prefix='" . BUILD_ROOT_PATH . "'"); FileSystem::replaceFileStr(BUILD_BIN_PATH . '/phpize', 's##', 's#/usr/local#'); + FileSystem::replaceFileStr(BUILD_LIB_PATH . '/php/build/phpize.m4', 'test "[$]$1" = "no" && $1=yes', '# test "[$]$1" = "no" && $1=yes'); } // patch php-config if (file_exists(BUILD_BIN_PATH . '/php-config')) { From 95a2f4600bb0b2f183829d5723566e2eff7c939a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 12:01:00 +0700 Subject: [PATCH 042/204] rework building of shared extensions so that builtin extensions are built at php-src/configure -> make time --- config/env.ini | 2 +- src/SPC/builder/BuilderBase.php | 18 ++++++++++--- src/SPC/builder/Extension.php | 36 +++++++++++-------------- src/SPC/builder/extension/amqp.php | 2 +- src/SPC/builder/extension/dba.php | 2 +- src/SPC/builder/extension/dom.php | 2 +- src/SPC/builder/extension/ffi.php | 2 +- src/SPC/builder/extension/glfw.php | 2 +- src/SPC/builder/extension/ldap.php | 5 ++++ src/SPC/builder/extension/mbregex.php | 2 +- src/SPC/builder/extension/mbstring.php | 2 +- src/SPC/builder/extension/openssl.php | 2 +- src/SPC/builder/extension/pdo_odbc.php | 2 +- src/SPC/builder/extension/pdo_pgsql.php | 2 +- src/SPC/builder/extension/pgsql.php | 2 +- src/SPC/builder/extension/rdkafka.php | 2 +- src/SPC/builder/extension/redis.php | 2 +- src/SPC/builder/extension/swow.php | 2 +- src/SPC/builder/extension/xlswriter.php | 2 +- src/SPC/builder/extension/xml.php | 2 +- src/SPC/builder/linux/LinuxBuilder.php | 2 +- 21 files changed, 53 insertions(+), 42 deletions(-) diff --git a/config/env.ini b/config/env.ini index 1a1fbaa79..499526459 100644 --- a/config/env.ini +++ b/config/env.ini @@ -81,7 +81,7 @@ SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime ; buildconf command SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force" ; configure command -SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg --with-pic" +SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --enable-shared=yes --enable-static=no --disable-all --disable-cgi --disable-phpdbg --with-pic" ; make command SPC_CMD_PREFIX_PHP_MAKE="make -j${CPU_COUNT}" ; embed type for php, static (libphp.a) or shared (libphp.so) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 3b38019ee..d32651f6a 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -256,6 +256,10 @@ public function buildSharedExts(): void if (!$ext->isBuildShared()) { continue; } + if (Config::getExt($ext->getName(), 'type') === 'builtin') { + logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)'); + continue; + } logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); $ext->buildShared(); } @@ -272,9 +276,17 @@ public function buildSharedExts(): void public function makeStaticExtensionArgs(): string { $ret = []; - foreach ($this->getExts(false) as $ext) { - logger()->info($ext->getName() . ' is using ' . $ext->getConfigureArg()); - $ret[] = trim($ext->getConfigureArg()); + foreach ($this->getExts() as $ext) { + $arg = $ext->getConfigureArg(); + if ($ext->isBuildShared()) { + if (Config::getExt($ext->getName(), 'type') === 'builtin') { + $arg = $ext->getConfigureArg(true); + } else { + continue; + } + } + logger()->info($ext->getName() . ' is using ' . $arg); + $ret[] = trim($arg); } logger()->debug('Using configure: ' . implode(' ', $ret)); return implode(' ', $ret); diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 9322e49b3..6b00bfae5 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -9,7 +9,6 @@ use SPC\exception\WrongUsageException; use SPC\store\Config; use SPC\store\FileSystem; -use SPC\store\SourcePatcher; use SPC\util\SPCConfigUtil; class Extension @@ -60,20 +59,15 @@ public function __construct(protected string $name, protected BuilderBase $build * @throws FileSystemException * @throws WrongUsageException */ - public function getConfigureArg(): string + public function getConfigureArg(bool $shared = false): string { - $arg = $this->getEnableArg(); - switch (PHP_OS_FAMILY) { - case 'Windows': - $arg .= $this->getWindowsConfigureArg(); - break; - case 'Darwin': - case 'Linux': - case 'BSD': - $arg .= $this->getUnixConfigureArg(); - break; - } - return $arg; + return match (PHP_OS_FAMILY) { + 'Windows' => $this->getWindowsConfigureArg($shared), + 'Darwin', + 'Linux', + 'BSD' => $this->getUnixConfigureArg($shared), + default => throw new WrongUsageException(PHP_OS_FAMILY . ' build is not supported yet'), + }; } /** @@ -82,13 +76,13 @@ public function getConfigureArg(): string * @throws FileSystemException * @throws WrongUsageException */ - public function getEnableArg(): string + public function getEnableArg(bool $shared = false): string { $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { 'enable' => '--enable-' . $_name . ' ', - 'with' => '--with-' . $_name . ' ', - 'with-prefix' => '--with-' . $_name . '="' . BUILD_ROOT_PATH . '" ', + 'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ', + 'with-prefix' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . '"' . BUILD_ROOT_PATH . '" ', 'none', 'custom' => '', default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-prefix] ."), }; @@ -151,15 +145,15 @@ public function getDistName(): string return $this->name; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { - return ''; + return $this->getEnableArg(); // Windows is not supported yet } public function getUnixConfigureArg(bool $shared = false): string { - return ''; + return $this->getEnableArg($shared); } /** @@ -345,7 +339,7 @@ public function buildUnixShared(): void shell()->cd($this->source_dir) ->setEnv($env) - ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static --with-pic') + ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic') ->execWithEnv('make clean') ->execWithEnv('make -j' . $this->builder->concurrency) ->execWithEnv('make install'); diff --git a/src/SPC/builder/extension/amqp.php b/src/SPC/builder/extension/amqp.php index 8fbfea248..40a6131c9 100644 --- a/src/SPC/builder/extension/amqp.php +++ b/src/SPC/builder/extension/amqp.php @@ -28,7 +28,7 @@ public function getUnixConfigureArg(bool $shared = false): string return '--with-amqp --with-librabbitmq-dir=' . BUILD_ROOT_PATH; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg($shared = false): string { return '--with-amqp'; } diff --git a/src/SPC/builder/extension/dba.php b/src/SPC/builder/extension/dba.php index bd7388f36..ec5a4d86d 100644 --- a/src/SPC/builder/extension/dba.php +++ b/src/SPC/builder/extension/dba.php @@ -16,7 +16,7 @@ public function getUnixConfigureArg(bool $shared = false): string return '--enable-dba' . $qdbm; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { $qdbm = $this->builder->getLib('qdbm') ? ' --with-qdbm' : ''; return '--with-dba' . $qdbm; diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php index a08fcd81f..2d69ac640 100644 --- a/src/SPC/builder/extension/dom.php +++ b/src/SPC/builder/extension/dom.php @@ -30,7 +30,7 @@ public function patchBeforeBuildconf(): bool return true; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg($shared = false): string { return '--with-dom --with-libxml'; } diff --git a/src/SPC/builder/extension/ffi.php b/src/SPC/builder/extension/ffi.php index 51c3efac1..1d55397bc 100644 --- a/src/SPC/builder/extension/ffi.php +++ b/src/SPC/builder/extension/ffi.php @@ -15,7 +15,7 @@ public function getUnixConfigureArg(bool $shared = false): string return '--with-ffi --enable-zend-signals'; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { return '--with-ffi'; } diff --git a/src/SPC/builder/extension/glfw.php b/src/SPC/builder/extension/glfw.php index 444b5d93a..3ebb5228b 100644 --- a/src/SPC/builder/extension/glfw.php +++ b/src/SPC/builder/extension/glfw.php @@ -35,7 +35,7 @@ public function getUnixConfigureArg(bool $shared = false): string return '--enable-glfw --with-glfw-dir=' . BUILD_ROOT_PATH; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { return '--enable-glfw=static'; } diff --git a/src/SPC/builder/extension/ldap.php b/src/SPC/builder/extension/ldap.php index 4616bea85..18db78c1b 100644 --- a/src/SPC/builder/extension/ldap.php +++ b/src/SPC/builder/extension/ldap.php @@ -20,4 +20,9 @@ public function patchBeforeConfigure(): bool } return true; } + + public function getUnixConfigureArg(bool $shared = false): string + { + return '--with-ldap=' . BUILD_ROOT_PATH; + } } diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index 492c4fbb9..b7d174ff8 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -16,7 +16,7 @@ public function getDistName(): string return 'mbstring'; } - public function getConfigureArg(): string + public function getConfigureArg(bool $shared = false): string { return ''; } diff --git a/src/SPC/builder/extension/mbstring.php b/src/SPC/builder/extension/mbstring.php index aa86ee53b..422495099 100644 --- a/src/SPC/builder/extension/mbstring.php +++ b/src/SPC/builder/extension/mbstring.php @@ -10,7 +10,7 @@ #[CustomExt('mbstring')] class mbstring extends Extension { - public function getConfigureArg(): string + public function getConfigureArg(bool $shared = false): string { $arg = '--enable-mbstring'; if ($this->builder->getExt('mbregex') === null) { diff --git a/src/SPC/builder/extension/openssl.php b/src/SPC/builder/extension/openssl.php index add1aedef..fc4831f30 100644 --- a/src/SPC/builder/extension/openssl.php +++ b/src/SPC/builder/extension/openssl.php @@ -26,6 +26,6 @@ public function patchBeforeMake(): bool public function getUnixConfigureArg(bool $shared = false): string { $openssl_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : ' --with-openssl-dir=' . BUILD_ROOT_PATH; - return '--with-openssl=' . BUILD_ROOT_PATH . $openssl_dir; + return '--with-openssl=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $openssl_dir; } } diff --git a/src/SPC/builder/extension/pdo_odbc.php b/src/SPC/builder/extension/pdo_odbc.php index e436f3819..ac1b74561 100644 --- a/src/SPC/builder/extension/pdo_odbc.php +++ b/src/SPC/builder/extension/pdo_odbc.php @@ -22,7 +22,7 @@ public function getUnixConfigureArg(bool $shared = false): string return '--with-pdo-odbc=unixODBC,' . BUILD_ROOT_PATH; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { return '--with-pdo-odbc'; } diff --git a/src/SPC/builder/extension/pdo_pgsql.php b/src/SPC/builder/extension/pdo_pgsql.php index e29014cb5..b1ca1a813 100644 --- a/src/SPC/builder/extension/pdo_pgsql.php +++ b/src/SPC/builder/extension/pdo_pgsql.php @@ -10,7 +10,7 @@ #[CustomExt('pdo_pgsql')] class pdo_pgsql extends Extension { - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { return '--with-pdo-pgsql=yes'; } diff --git a/src/SPC/builder/extension/pgsql.php b/src/SPC/builder/extension/pgsql.php index 1c63f1635..e4ac8ebb5 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -45,7 +45,7 @@ public function getUnixConfigureArg(bool $shared = false): string * @throws WrongUsageException * @throws RuntimeException */ - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { if ($this->builder->getPHPVersionID() >= 80400) { return '--with-pgsql'; diff --git a/src/SPC/builder/extension/rdkafka.php b/src/SPC/builder/extension/rdkafka.php index 7af34d720..9f28c6270 100644 --- a/src/SPC/builder/extension/rdkafka.php +++ b/src/SPC/builder/extension/rdkafka.php @@ -27,7 +27,7 @@ public function patchBeforeMake(): bool return true; } - public function getConfigureArg(): string + public function getConfigureArg(bool $shared = false): string { $pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1]; $pkgconf_libs = trim(implode('', $pkgconf_libs)); diff --git a/src/SPC/builder/extension/redis.php b/src/SPC/builder/extension/redis.php index 0b60075c9..75158ad70 100644 --- a/src/SPC/builder/extension/redis.php +++ b/src/SPC/builder/extension/redis.php @@ -24,7 +24,7 @@ public function getUnixConfigureArg(bool $shared = false): string return $arg; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { $arg = '--enable-redis'; $arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session'; diff --git a/src/SPC/builder/extension/swow.php b/src/SPC/builder/extension/swow.php index 27576635c..390ec27fe 100644 --- a/src/SPC/builder/extension/swow.php +++ b/src/SPC/builder/extension/swow.php @@ -18,7 +18,7 @@ public function validate(): void } } - public function getConfigureArg(): string + public function getConfigureArg(bool $shared = false): string { $arg = '--enable-swow'; $arg .= $this->builder->getLib('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl'; diff --git a/src/SPC/builder/extension/xlswriter.php b/src/SPC/builder/extension/xlswriter.php index 2ceb8e5cd..878168adf 100644 --- a/src/SPC/builder/extension/xlswriter.php +++ b/src/SPC/builder/extension/xlswriter.php @@ -20,7 +20,7 @@ public function getUnixConfigureArg(bool $shared = false): string return $arg; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { return '--with-xlswriter'; } diff --git a/src/SPC/builder/extension/xml.php b/src/SPC/builder/extension/xml.php index b1a8c5f35..d36df7584 100644 --- a/src/SPC/builder/extension/xml.php +++ b/src/SPC/builder/extension/xml.php @@ -41,7 +41,7 @@ public function patchBeforeBuildconf(): bool return true; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { $arg = match ($this->name) { 'xml' => '--with-xml', diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 2db05b5e5..9b901460a 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -184,7 +184,6 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void shell()->cd(SOURCE_PATH . '/php-src') ->exec( getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' . - '--prefix=' . BUILD_ROOT_PATH . ' ' . ($enable_cli ? '--enable-cli ' : '--disable-cli ') . ($enable_fpm ? '--enable-fpm ' . ($this->getLib('libacl') !== null ? '--with-fpm-acl ' : '') : '--disable-fpm ') . ($enable_embed ? "--enable-embed={$embed_type} " : '--disable-embed ') . @@ -323,6 +322,7 @@ protected function buildEmbed(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') + ->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = ' . BUILD_MODULES_PATH . '|" Makefile') ->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install"); $this->patchPhpScripts(); } From 495e868a7122d2be8b7ce9376ec1f4f6f905a675 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 13:19:51 +0700 Subject: [PATCH 043/204] rework configure args --- config/ext.json | 15 +++++++++------ src/SPC/builder/BuilderBase.php | 6 +++++- src/SPC/builder/extension/bz2.php | 5 ----- src/SPC/builder/extension/curl.php | 7 +------ src/SPC/builder/extension/dba.php | 2 +- src/SPC/builder/extension/dom.php | 2 +- src/SPC/builder/extension/ffi.php | 2 +- src/SPC/builder/extension/gd.php | 2 +- src/SPC/builder/extension/ldap.php | 5 ----- src/SPC/builder/extension/mbstring.php | 2 +- src/SPC/builder/extension/xml.php | 4 +--- src/SPC/builder/linux/LinuxBuilder.php | 2 +- src/SPC/builder/unix/library/libxslt.php | 1 + src/SPC/store/SourcePatcher.php | 2 +- 14 files changed, 24 insertions(+), 33 deletions(-) diff --git a/config/ext.json b/config/ext.json index 1c74db745..89f17dc7d 100644 --- a/config/ext.json +++ b/config/ext.json @@ -79,6 +79,9 @@ "xml" ], "shared-ext-depends": [ + "libxml", + "xmlreader", + "xmlwriter", "xml" ] }, @@ -413,22 +416,22 @@ }, "mysqli": { "type": "builtin", - "target": [ - "static" - ], "arg-type": "with", "ext-depends": [ "mysqlnd" + ], + "target": [ + "static" ] }, "mysqlnd": { "type": "builtin", - "target": [ - "static" - ], "arg-type-windows": "with", "lib-depends": [ "zlib" + ], + "target": [ + "static" ] }, "oci8": { diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index d32651f6a..0e4c0603d 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -257,7 +257,11 @@ public function buildSharedExts(): void continue; } if (Config::getExt($ext->getName(), 'type') === 'builtin') { - logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)'); + if (file_exists(BUILD_MODULES_PATH . '/' . $ext->getName() . '.so')) { + logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)'); + continue; + } + logger()->warning('Shared extension [' . $ext->getName() . '] was built statically by php-src/configure'); continue; } logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); diff --git a/src/SPC/builder/extension/bz2.php b/src/SPC/builder/extension/bz2.php index ee3f2996b..88f22e568 100644 --- a/src/SPC/builder/extension/bz2.php +++ b/src/SPC/builder/extension/bz2.php @@ -24,9 +24,4 @@ public function patchBeforeConfigure(): bool FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lbz2/', $this->getLibFilesString() . $frameworks); return true; } - - public function getUnixConfigureArg(bool $shared = false): string - { - return $shared ? '--with-bz2=' . BUILD_ROOT_PATH : ''; - } } diff --git a/src/SPC/builder/extension/curl.php b/src/SPC/builder/extension/curl.php index 5ed224f64..0fd2b90b7 100644 --- a/src/SPC/builder/extension/curl.php +++ b/src/SPC/builder/extension/curl.php @@ -53,6 +53,7 @@ public function patchBeforeConfigure(): bool { $frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : ''; FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lcurl/', $this->getLibFilesString() . $frameworks); + $this->patchBeforeSharedConfigure(); return true; } @@ -99,12 +100,6 @@ public function patchBeforeSharedConfigure(): bool return true; } - - public function getUnixConfigureArg(bool $shared = false): string - { - return '--with-curl'; - } - public function buildUnixShared(): void { if (!$this->builder instanceof LinuxBuilder) { diff --git a/src/SPC/builder/extension/dba.php b/src/SPC/builder/extension/dba.php index ec5a4d86d..4a69c0a51 100644 --- a/src/SPC/builder/extension/dba.php +++ b/src/SPC/builder/extension/dba.php @@ -12,7 +12,7 @@ class dba extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - $qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . BUILD_ROOT_PATH) : ''; + $qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH) : ''; return '--enable-dba' . $qdbm; } diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php index 2d69ac640..46dae9e21 100644 --- a/src/SPC/builder/extension/dom.php +++ b/src/SPC/builder/extension/dom.php @@ -17,7 +17,7 @@ class dom extends Extension */ public function getUnixConfigureArg(bool $shared = false): string { - $arg = '--enable-dom'; + $arg = '--enable-dom' . ($shared ? '=shared' : ''); if (!$shared) { $arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"'; } diff --git a/src/SPC/builder/extension/ffi.php b/src/SPC/builder/extension/ffi.php index 1d55397bc..985477232 100644 --- a/src/SPC/builder/extension/ffi.php +++ b/src/SPC/builder/extension/ffi.php @@ -12,7 +12,7 @@ class ffi extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - return '--with-ffi --enable-zend-signals'; + return '--with-ffi' . ($shared ? '=shared' : '') . ' --enable-zend-signals'; } public function getWindowsConfigureArg(bool $shared = false): string diff --git a/src/SPC/builder/extension/gd.php b/src/SPC/builder/extension/gd.php index f872733b6..677b15229 100644 --- a/src/SPC/builder/extension/gd.php +++ b/src/SPC/builder/extension/gd.php @@ -12,7 +12,7 @@ class gd extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - $arg = '--enable-gd'; + $arg = '--enable-gd' . ($shared ? '=shared' : ''); $arg .= $this->builder->getLib('freetype') ? ' --with-freetype' : ''; $arg .= $this->builder->getLib('libjpeg') ? ' --with-jpeg' : ''; $arg .= $this->builder->getLib('libwebp') ? ' --with-webp' : ''; diff --git a/src/SPC/builder/extension/ldap.php b/src/SPC/builder/extension/ldap.php index 18db78c1b..4616bea85 100644 --- a/src/SPC/builder/extension/ldap.php +++ b/src/SPC/builder/extension/ldap.php @@ -20,9 +20,4 @@ public function patchBeforeConfigure(): bool } return true; } - - public function getUnixConfigureArg(bool $shared = false): string - { - return '--with-ldap=' . BUILD_ROOT_PATH; - } } diff --git a/src/SPC/builder/extension/mbstring.php b/src/SPC/builder/extension/mbstring.php index 422495099..697ad3fed 100644 --- a/src/SPC/builder/extension/mbstring.php +++ b/src/SPC/builder/extension/mbstring.php @@ -23,7 +23,7 @@ public function getConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string { - $arg = '--enable-mbstring'; + $arg = '--enable-mbstring' . ($shared ? '=shared' : ''); if ($this->builder->getExt('mbregex') === null) { $arg .= ' --disable-mbregex'; } else { diff --git a/src/SPC/builder/extension/xml.php b/src/SPC/builder/extension/xml.php index d36df7584..3c8b5dff4 100644 --- a/src/SPC/builder/extension/xml.php +++ b/src/SPC/builder/extension/xml.php @@ -29,9 +29,7 @@ public function getUnixConfigureArg(bool $shared = false): string 'simplexml' => '--enable-simplexml', default => throw new RuntimeException('Not accept non-xml extension'), }; - if (!$shared) { - $arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"'; - } + $arg .= ($shared ? '=shared' : '' ) . ' --with-libxml="' . BUILD_ROOT_PATH . '"'; return $arg; } diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 9b901460a..0a827c852 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -322,7 +322,7 @@ protected function buildEmbed(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = ' . BUILD_MODULES_PATH . '|" Makefile') + ->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile') ->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install"); $this->patchPhpScripts(); } diff --git a/src/SPC/builder/unix/library/libxslt.php b/src/SPC/builder/unix/library/libxslt.php index 799c87c22..6de23e3ea 100644 --- a/src/SPC/builder/unix/library/libxslt.php +++ b/src/SPC/builder/unix/library/libxslt.php @@ -47,5 +47,6 @@ protected function build(): void ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH)); $this->patchPkgconfPrefix(['libexslt.pc']); + $this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']); } } diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 24ba666cc..0c02e155c 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -95,7 +95,7 @@ public static function patchBeforeSharedBuild(BuilderBase $builder): void */ public static function patchBeforeConfigure(BuilderBase $builder): void { - foreach ($builder->getExts(false) as $ext) { + foreach ($builder->getExts() as $ext) { if ($ext->patchBeforeConfigure() === true) { logger()->info('Extension [' . $ext->getName() . '] patched before configure'); } From 7698ceb10857051cd9a84fdfa55b40821bdb8c30 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 14:10:56 +0700 Subject: [PATCH 044/204] fixes for more configure args --- config/ext.json | 16 ++++++------- src/SPC/builder/Extension.php | 2 +- src/SPC/builder/extension/dba.php | 2 +- src/SPC/builder/extension/dom.php | 4 +--- src/SPC/builder/extension/mbstring.php | 2 +- src/SPC/builder/extension/odbc.php | 2 +- src/SPC/builder/extension/pdo_odbc.php | 2 +- src/SPC/builder/extension/pgsql.php | 4 ++-- src/SPC/builder/extension/readline.php | 2 +- src/SPC/builder/extension/sqlsrv.php | 32 ++++++++++++++++++++++++++ src/SPC/builder/extension/xhprof.php | 32 ++++++++++++++++++++++++++ src/SPC/command/BuildPHPCommand.php | 6 ++++- 12 files changed, 86 insertions(+), 20 deletions(-) diff --git a/config/ext.json b/config/ext.json index 89f17dc7d..290a079b6 100644 --- a/config/ext.json +++ b/config/ext.json @@ -77,12 +77,6 @@ ], "ext-depends-windows": [ "xml" - ], - "shared-ext-depends": [ - "libxml", - "xmlreader", - "xmlwriter", - "xml" ] }, "ds": { @@ -331,13 +325,16 @@ }, "type": "builtin", "arg-type": "none", - "ext-depends": [ - "xml" + "target": [ + "static" ] }, "mbregex": { "type": "builtin", "arg-type": "custom", + "target": [ + "static" + ], "ext-depends": [ "mbstring" ], @@ -1083,6 +1080,9 @@ "arg-type-windows": "enable", "lib-depends": [ "zlib" + ], + "target": [ + "static" ] }, "zstd": { diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 6b00bfae5..3152dd3eb 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -80,7 +80,7 @@ public function getEnableArg(bool $shared = false): string { $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { - 'enable' => '--enable-' . $_name . ' ', + 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ', 'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ', 'with-prefix' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . '"' . BUILD_ROOT_PATH . '" ', 'none', 'custom' => '', diff --git a/src/SPC/builder/extension/dba.php b/src/SPC/builder/extension/dba.php index 4a69c0a51..abda5651e 100644 --- a/src/SPC/builder/extension/dba.php +++ b/src/SPC/builder/extension/dba.php @@ -13,7 +13,7 @@ class dba extends Extension public function getUnixConfigureArg(bool $shared = false): string { $qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH) : ''; - return '--enable-dba' . $qdbm; + return '--enable-dba' . ($shared ? '=shared' : '') . $qdbm; } public function getWindowsConfigureArg(bool $shared = false): string diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php index 46dae9e21..fb1a4e158 100644 --- a/src/SPC/builder/extension/dom.php +++ b/src/SPC/builder/extension/dom.php @@ -18,9 +18,7 @@ class dom extends Extension public function getUnixConfigureArg(bool $shared = false): string { $arg = '--enable-dom' . ($shared ? '=shared' : ''); - if (!$shared) { - $arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"'; - } + $arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"'; return $arg; } diff --git a/src/SPC/builder/extension/mbstring.php b/src/SPC/builder/extension/mbstring.php index 697ad3fed..3576877f7 100644 --- a/src/SPC/builder/extension/mbstring.php +++ b/src/SPC/builder/extension/mbstring.php @@ -12,7 +12,7 @@ class mbstring extends Extension { public function getConfigureArg(bool $shared = false): string { - $arg = '--enable-mbstring'; + $arg = '--enable-mbstring' . ($shared ? '=shared' : ''); if ($this->builder->getExt('mbregex') === null) { $arg .= ' --disable-mbregex'; } else { diff --git a/src/SPC/builder/extension/odbc.php b/src/SPC/builder/extension/odbc.php index ac5c3e8f0..278b5865a 100644 --- a/src/SPC/builder/extension/odbc.php +++ b/src/SPC/builder/extension/odbc.php @@ -12,6 +12,6 @@ class odbc extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - return '--with-unixODBC=' . BUILD_ROOT_PATH; + return '--with-unixODBC=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } } diff --git a/src/SPC/builder/extension/pdo_odbc.php b/src/SPC/builder/extension/pdo_odbc.php index ac1b74561..c47144fe5 100644 --- a/src/SPC/builder/extension/pdo_odbc.php +++ b/src/SPC/builder/extension/pdo_odbc.php @@ -19,7 +19,7 @@ public function patchBeforeBuildconf(): bool public function getUnixConfigureArg(bool $shared = false): string { - return '--with-pdo-odbc=unixODBC,' . BUILD_ROOT_PATH; + return '--with-pdo-odbc=' . ($shared ? 'shared,' : '') . 'unixODBC,' . BUILD_ROOT_PATH; } public function getWindowsConfigureArg(bool $shared = false): string diff --git a/src/SPC/builder/extension/pgsql.php b/src/SPC/builder/extension/pgsql.php index e4ac8ebb5..b45ba6671 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -36,9 +36,9 @@ public function patchBeforeConfigure(): bool public function getUnixConfigureArg(bool $shared = false): string { if ($this->builder->getPHPVersionID() >= 80400) { - return '--with-pgsql PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon"'; + return '--with-pgsql' . ($shared ? '=shared' : '') . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon"'; } - return '--with-pgsql=' . BUILD_ROOT_PATH; + return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } /** diff --git a/src/SPC/builder/extension/readline.php b/src/SPC/builder/extension/readline.php index dc4d15f7c..5cb5eff31 100644 --- a/src/SPC/builder/extension/readline.php +++ b/src/SPC/builder/extension/readline.php @@ -27,7 +27,7 @@ public function patchBeforeConfigure(): bool public function getUnixConfigureArg(bool $shared = false): string { - return '--without-libedit --with-readline=' . BUILD_ROOT_PATH; + return '--without-libedit --with-readline=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } public function buildUnixShared(): void diff --git a/src/SPC/builder/extension/sqlsrv.php b/src/SPC/builder/extension/sqlsrv.php index edf5d919b..22aef95b4 100644 --- a/src/SPC/builder/extension/sqlsrv.php +++ b/src/SPC/builder/extension/sqlsrv.php @@ -7,6 +7,7 @@ use SPC\builder\Extension; use SPC\store\FileSystem; use SPC\util\CustomExt; +use SPC\util\SPCConfigUtil; #[CustomExt('sqlsrv')] class sqlsrv extends Extension @@ -33,4 +34,35 @@ public function patchBeforeConfigure(): bool } return false; } + + public function buildUnixShared(): void + { + $config = (new SPCConfigUtil($this->builder))->config([$this->getName()]); + $env = [ + 'CFLAGS' => $config['cflags'], + 'CXXFLAGS' => $config['cflags'], + 'LDFLAGS' => $config['ldflags'], + 'LIBS' => $config['libs'], + 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, + ]; + // prepare configure args + shell()->cd($this->source_dir) + ->setEnv($env) + ->execWithEnv(BUILD_BIN_PATH . '/phpize'); + + if ($this->patchBeforeSharedConfigure()) { + logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure'); + } + + shell()->cd($this->source_dir) + ->setEnv($env) + ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic') + ->execWithEnv('make clean') + ->execWithEnv('make -j' . $this->builder->concurrency) + ->execWithEnv('make install'); + + // check shared extension with php-cli + if (file_exists(BUILD_BIN_PATH . '/php')) { + $this->runSharedExtensionCheckUnix(); + } } } diff --git a/src/SPC/builder/extension/xhprof.php b/src/SPC/builder/extension/xhprof.php index c3d98aac3..118a34cd0 100644 --- a/src/SPC/builder/extension/xhprof.php +++ b/src/SPC/builder/extension/xhprof.php @@ -7,6 +7,7 @@ use SPC\builder\Extension; use SPC\store\FileSystem; use SPC\util\CustomExt; +use SPC\util\SPCConfigUtil; #[CustomExt('xhprof')] class xhprof extends Extension @@ -30,4 +31,35 @@ public function patchBeforeBuildconf(): bool } return false; } + + public function buildUnixShared(): void + { + $config = (new SPCConfigUtil($this->builder))->config([$this->getName()]); + $env = [ + 'CFLAGS' => $config['cflags'], + 'LDFLAGS' => $config['ldflags'], + 'LIBS' => $config['libs'], + 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, + ]; + // prepare configure args + shell()->cd($this->source_dir . '/extension') + ->setEnv($env) + ->execWithEnv(BUILD_BIN_PATH . '/phpize'); + + if ($this->patchBeforeSharedConfigure()) { + logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure'); + } + + shell()->cd($this->source_dir . '/extension') + ->setEnv($env) + ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic') + ->execWithEnv('make clean') + ->execWithEnv('make -j' . $this->builder->concurrency) + ->execWithEnv('make install'); + + // check shared extension with php-cli + if (file_exists(BUILD_BIN_PATH . '/php')) { + $this->runSharedExtensionCheckUnix(); + } + } } diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index edeb7c47f..cd83c1c8a 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -249,7 +249,11 @@ public function handle(): int if (!empty($shared_extensions)) { foreach ($shared_extensions as $ext) { $path = FileSystem::convertPath("{$build_root_path}/modules/{$ext}.so"); - logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}"); + if (file_exists("{$build_root_path}/modules/{$ext}.so")) { + logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}"); + } else { + logger()->warning("Shared extension [{$ext}] not found, please check!"); + } } } From 3f8d297fb131ed1e66aa7ff7f42fd2c98f1396a1 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 14:15:58 +0700 Subject: [PATCH 045/204] linter --- src/SPC/builder/Extension.php | 2 +- src/SPC/builder/extension/curl.php | 5 ++--- src/SPC/builder/extension/mbregex.php | 5 ----- src/SPC/builder/extension/sqlsrv.php | 3 ++- src/SPC/builder/extension/xml.php | 2 +- src/SPC/builder/traits/UnixLibraryTrait.php | 4 ++-- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 3152dd3eb..0cda99b66 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -336,7 +336,7 @@ public function buildUnixShared(): void if ($this->patchBeforeSharedConfigure()) { logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure'); } - + shell()->cd($this->source_dir) ->setEnv($env) ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic') diff --git a/src/SPC/builder/extension/curl.php b/src/SPC/builder/extension/curl.php index 0fd2b90b7..4779e67c7 100644 --- a/src/SPC/builder/extension/curl.php +++ b/src/SPC/builder/extension/curl.php @@ -74,7 +74,6 @@ public function patchBeforeSharedConfigure(): bool // Match the line containing PHP_CHECK_LIBRARY for curl $pattern = '/(PHP_CHECK_LIBRARY\(\[curl],\s*\[curl_easy_perform],)/'; - // Restore LIBS after the check — append this just after the macro block $restore = ' LIBS="$save_LIBS"'; @@ -87,13 +86,13 @@ public function patchBeforeSharedConfigure(): bool // Inject restore after the matching PHP_CHECK_LIBRARY block $patched = preg_replace( '/(PHP_CHECK_LIBRARY\(\[curl],\s*\[curl_easy_perform],.*?\)\n)/s', - "$1$restore\n", + "$1{$restore}\n", $patched, 1 ); if ($patched === null) { - throw new \RuntimeException("Failed to patch config.m4 due to a regex error"); + throw new \RuntimeException('Failed to patch config.m4 due to a regex error'); } FileSystem::writeFile($file, $patched); diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index b7d174ff8..1f169e1a3 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -21,11 +21,6 @@ public function getConfigureArg(bool $shared = false): string return ''; } - public function buildUnixShared(): void - { - print('mbregex is already built as part of mbstring, skipping build' . PHP_EOL); - } - /** * mbregex is not an extension, we need to overwrite the default check. */ diff --git a/src/SPC/builder/extension/sqlsrv.php b/src/SPC/builder/extension/sqlsrv.php index 22aef95b4..f6cd21a06 100644 --- a/src/SPC/builder/extension/sqlsrv.php +++ b/src/SPC/builder/extension/sqlsrv.php @@ -64,5 +64,6 @@ public function buildUnixShared(): void // check shared extension with php-cli if (file_exists(BUILD_BIN_PATH . '/php')) { $this->runSharedExtensionCheckUnix(); - } } + } + } } diff --git a/src/SPC/builder/extension/xml.php b/src/SPC/builder/extension/xml.php index 3c8b5dff4..bd64d346d 100644 --- a/src/SPC/builder/extension/xml.php +++ b/src/SPC/builder/extension/xml.php @@ -29,7 +29,7 @@ public function getUnixConfigureArg(bool $shared = false): string 'simplexml' => '--enable-simplexml', default => throw new RuntimeException('Not accept non-xml extension'), }; - $arg .= ($shared ? '=shared' : '' ) . ' --with-libxml="' . BUILD_ROOT_PATH . '"'; + $arg .= ($shared ? '=shared' : '') . ' --with-libxml="' . BUILD_ROOT_PATH . '"'; return $arg; } diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index 45de0cf40..962f257f3 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -95,8 +95,8 @@ public function patchLaDependencyPrefix(array $files): void logger()->debug('Patching ' . $realpath); // replace prefix $file = FileSystem::readFile($realpath); - $file = str_replace(' /lib/', ' ' . BUILD_LIB_PATH . '/', $file); - $file = preg_replace("/^libdir=.*$/m", "libdir='" . BUILD_LIB_PATH . "'", $file); + $file = str_replace(' /lib/', ' ' . BUILD_LIB_PATH . '/', $file); + + $file = preg_replace('/^libdir=.*$/m', "libdir='" . BUILD_LIB_PATH . "'", $file); FileSystem::writeFile($realpath, $file); } } From d349627fa15b8a93c2fecb069762e651c6235515 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 14:29:49 +0700 Subject: [PATCH 046/204] linter --- config/ext.json | 3 +++ src/SPC/builder/extension/readline.php | 2 +- src/SPC/builder/traits/UnixLibraryTrait.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/ext.json b/config/ext.json index 290a079b6..eaa27d1b0 100644 --- a/config/ext.json +++ b/config/ext.json @@ -643,6 +643,9 @@ "arg-type": "with-prefix", "lib-depends": [ "readline" + ], + "target": [ + "static" ] }, "redis": { diff --git a/src/SPC/builder/extension/readline.php b/src/SPC/builder/extension/readline.php index 5cb5eff31..dc4d15f7c 100644 --- a/src/SPC/builder/extension/readline.php +++ b/src/SPC/builder/extension/readline.php @@ -27,7 +27,7 @@ public function patchBeforeConfigure(): bool public function getUnixConfigureArg(bool $shared = false): string { - return '--without-libedit --with-readline=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; + return '--without-libedit --with-readline=' . BUILD_ROOT_PATH; } public function buildUnixShared(): void diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index 962f257f3..869bf5310 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -96,7 +96,7 @@ public function patchLaDependencyPrefix(array $files): void // replace prefix $file = FileSystem::readFile($realpath); $file = str_replace(' /lib/', ' ' . BUILD_LIB_PATH . '/', $file); - + $file = preg_replace('/^libdir=.*$/m', "libdir='" . BUILD_LIB_PATH . "'", $file); + $file = preg_replace('/^libdir=.*$/m', "libdir='" . BUILD_LIB_PATH . "'", $file); FileSystem::writeFile($realpath, $file); } } From 11c116480f75c61705a3c3307a783c5ba23338fc Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 17:57:53 +0700 Subject: [PATCH 047/204] fix spx --- config/ext.json | 5 ++- src/SPC/builder/BuilderBase.php | 28 ++++++++++------- src/SPC/builder/Extension.php | 35 +++++++++++++++++++-- src/SPC/builder/extension/mbregex.php | 3 +- src/SPC/builder/extension/spx.php | 8 +++++ src/SPC/builder/traits/UnixLibraryTrait.php | 3 +- src/SPC/builder/unix/UnixBuilderBase.php | 2 +- 7 files changed, 67 insertions(+), 17 deletions(-) diff --git a/config/ext.json b/config/ext.json index eaa27d1b0..629b753f8 100644 --- a/config/ext.json +++ b/config/ext.json @@ -95,7 +95,10 @@ "ev": { "type": "external", "source": "ev", - "arg-type-windows": "with" + "arg-type-windows": "with", + "shared-ext-depends": [ + "sockets" + ] }, "event": { "support": { diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 0e4c0603d..2e0fe3ecc 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -252,20 +252,26 @@ public function buildSharedExts(): void } file_put_contents(BUILD_BIN_PATH . '/php-config', implode('', $lines)); FileSystem::createDir(BUILD_MODULES_PATH); - foreach ($this->getExts() as $ext) { - if (!$ext->isBuildShared()) { - continue; - } - if (Config::getExt($ext->getName(), 'type') === 'builtin') { - if (file_exists(BUILD_MODULES_PATH . '/' . $ext->getName() . '.so')) { - logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)'); + try { + foreach ($this->getExts() as $ext) { + if (!$ext->isBuildShared()) { + continue; + } + if (Config::getExt($ext->getName(), 'type') === 'builtin') { + if (file_exists(BUILD_MODULES_PATH . '/' . $ext->getName() . '.so')) { + logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)'); + continue; + } + logger()->warning('Shared extension [' . $ext->getName() . '] was built statically by php-src/configure'); continue; } - logger()->warning('Shared extension [' . $ext->getName() . '] was built statically by php-src/configure'); - continue; + logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); + $ext->buildShared(); } - logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); - $ext->buildShared(); + } + catch (RuntimeException $e) { + FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir=', $extension_dir_line); + throw $e; } FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir=', $extension_dir_line); } diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 0cda99b66..e79c3db99 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -221,6 +221,36 @@ public function runSharedExtensionCheckUnix(): void } } + public function getRequiredSharedExtensions(): string + { + $loaded = []; + $order = []; + + $resolve = function ($extension) use (&$resolve, &$loaded, &$order) { + if (isset($loaded[$extension->getName()])) { + return; + } + $loaded[$extension->getName()] = true; + + foreach ($this->dependencies as $dependency) { + $resolve($dependency); + } + + $order[] = $extension; + }; + + $resolve($this); + + $ret = ''; + foreach ($order as $ext) { + if ($ext instanceof Extension && $ext->isBuildShared()) { + $ret .= ' -d "extension=' . BUILD_MODULES_PATH . '/' . $ext->getName() . '.so"'; + } + } + + return $ret; + } + /** * @throws RuntimeException */ @@ -229,7 +259,8 @@ public function runCliCheckUnix(): void // Run compile check if build target is cli // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php // If check failed, throw RuntimeException - [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n --ri "' . $this->getDistName() . '"', false); + $sharedExtensions = $this->getRequiredSharedExtensions(); + [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); } @@ -242,7 +273,7 @@ public function runCliCheckUnix(): void file_get_contents(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php') ); - [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n -r "' . trim($test) . '"'); + [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedExtensions . ' -r "' . trim($test) . '"'); if ($ret !== 0) { if ($this->builder->getOption('debug')) { var_dump($out); diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index 1f169e1a3..a26e7024f 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -26,7 +26,8 @@ public function getConfigureArg(bool $shared = false): string */ public function runCliCheckUnix(): void { - [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n --ri "mbstring" | grep regex', false); + $sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? ' -d "extension=' . BUILD_MODULES_PATH . '/mbstring.so"' : ''; + [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedext . ' --ri "mbstring" | grep regex', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !'); } diff --git a/src/SPC/builder/extension/spx.php b/src/SPC/builder/extension/spx.php index a797a1268..dccf131cb 100644 --- a/src/SPC/builder/extension/spx.php +++ b/src/SPC/builder/extension/spx.php @@ -5,6 +5,7 @@ namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\store\FileSystem; use SPC\util\CustomExt; #[CustomExt('spx')] @@ -18,4 +19,11 @@ public function getUnixConfigureArg(bool $shared = false): string } return $arg; } + + public function patchBeforeSharedConfigure(): bool + { + FileSystem::replaceFileStr($this->source_dir . '/config.m4', 'PHP_ARG_ENABLE(SPX-DEV,', 'PHP_ARG_ENABLE(spx-dev,'); + FileSystem::replaceFileStr($this->source_dir . '/config.m4', 'PHP_ARG_ENABLE(SPX,', 'PHP_ARG_ENABLE(spx,'); + return true; + } } diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index 869bf5310..2d71c8ebc 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -95,7 +95,8 @@ public function patchLaDependencyPrefix(array $files): void logger()->debug('Patching ' . $realpath); // replace prefix $file = FileSystem::readFile($realpath); - $file = str_replace(' /lib/', ' ' . BUILD_LIB_PATH . '/', $file); + $file = str_replace( + ' /lib/', ' ' . BUILD_LIB_PATH . '/', $file); $file = preg_replace('/^libdir=.*$/m', "libdir='" . BUILD_LIB_PATH . "'", $file); FileSystem::writeFile($realpath, $file); } diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index 48c826013..b92c2b7e1 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -146,7 +146,7 @@ protected function sanityCheck(int $build_target): void throw new RuntimeException("cli failed sanity check: ret[{$ret}]. out[{$raw_output}]"); } - foreach ($this->getExts(false) as $ext) { + foreach ($this->getExts() as $ext) { logger()->debug('testing ext: ' . $ext->getName()); $ext->runCliCheckUnix(); } From 3ff31d20cf519c484a35641f80a20b21e790b2a0 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 17:58:11 +0700 Subject: [PATCH 048/204] fix undefined references to brotlicommon functions in gd.so --- src/SPC/builder/BuilderBase.php | 3 +-- src/SPC/builder/traits/UnixLibraryTrait.php | 5 ++++- src/SPC/builder/unix/library/brotli.php | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 2e0fe3ecc..caece5867 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -268,8 +268,7 @@ public function buildSharedExts(): void logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); $ext->buildShared(); } - } - catch (RuntimeException $e) { + } catch (RuntimeException $e) { FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir=', $extension_dir_line); throw $e; } diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index 2d71c8ebc..74d8fd374 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -96,7 +96,10 @@ public function patchLaDependencyPrefix(array $files): void // replace prefix $file = FileSystem::readFile($realpath); $file = str_replace( - ' /lib/', ' ' . BUILD_LIB_PATH . '/', $file); + ' /lib/', + ' ' . BUILD_LIB_PATH . '/', + $file + ); $file = preg_replace('/^libdir=.*$/m', "libdir='" . BUILD_LIB_PATH . "'", $file); FileSystem::writeFile($realpath, $file); } diff --git a/src/SPC/builder/unix/library/brotli.php b/src/SPC/builder/unix/library/brotli.php index 44be934d5..30c862d2c 100644 --- a/src/SPC/builder/unix/library/brotli.php +++ b/src/SPC/builder/unix/library/brotli.php @@ -36,6 +36,8 @@ protected function build(): void ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); $this->patchPkgconfPrefix(['libbrotlicommon.pc', 'libbrotlidec.pc', 'libbrotlienc.pc']); + FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/libbrotlidec.pc', 'Libs: -L${libdir} -lbrotlidec', 'Libs: -L${libdir} -lbrotlidec -lbrotlicommon'); + FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/libbrotlienc.pc', 'Libs: -L${libdir} -lbrotlienc', 'Libs: -L${libdir} -lbrotlidec -lbrotlicommon'); shell()->cd(BUILD_ROOT_PATH . '/lib')->exec('ln -sf libbrotlicommon.a libbrotli.a'); foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) { if (str_starts_with($filename, 'libbrotli') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) { From fc7df585bdd6908a2b2ad779932f546d4eb12955 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 18:01:41 +0700 Subject: [PATCH 049/204] msgpack requires session --- config/ext.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index 629b753f8..02d778ce0 100644 --- a/config/ext.json +++ b/config/ext.json @@ -412,7 +412,10 @@ "type": "external", "source": "msgpack", "arg-type-unix": "with", - "arg-type-win": "enable" + "arg-type-win": "enable", + "shared-ext-depends": [ + "sockets" + ] }, "mysqli": { "type": "builtin", From af51469b6285dcda7b76819a3aa5fbe4278d71c5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 18:04:38 +0700 Subject: [PATCH 050/204] session, not sockets... --- config/ext.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index 02d778ce0..af3c48bc1 100644 --- a/config/ext.json +++ b/config/ext.json @@ -414,7 +414,7 @@ "arg-type-unix": "with", "arg-type-win": "enable", "shared-ext-depends": [ - "sockets" + "session" ] }, "mysqli": { From b376d1682fc5ade4ef8ec61269cd1cf967cf3005 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 18:35:48 +0700 Subject: [PATCH 051/204] remove runSharedExtensionCheckUnix --- src/SPC/builder/BuilderBase.php | 5 ++++ src/SPC/builder/Extension.php | 35 ++++++++---------------- src/SPC/builder/extension/opcache.php | 16 ++++------- src/SPC/builder/extension/pdo_sqlsrv.php | 5 ---- src/SPC/builder/extension/sqlsrv.php | 5 ---- src/SPC/builder/extension/xdebug.php | 11 ++------ src/SPC/builder/extension/xhprof.php | 5 ---- src/SPC/builder/freebsd/BSDBuilder.php | 3 ++ src/SPC/builder/linux/LinuxBuilder.php | 3 ++ src/SPC/builder/macos/MacOSBuilder.php | 6 ++++ src/SPC/builder/unix/UnixBuilderBase.php | 10 +++++-- src/SPC/command/BuildPHPCommand.php | 2 ++ 12 files changed, 45 insertions(+), 61 deletions(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index caece5867..08c580ea4 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -234,6 +234,11 @@ public function proveExts(array $static_extensions, array $shared_extensions = [ */ abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE); + /** + * Test PHP + */ + abstract public function testPHP(int $build_target = BUILD_TARGET_NONE); + /** * @throws WrongUsageException * @throws RuntimeException diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index e79c3db99..a0a1e6d29 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -206,21 +206,6 @@ public function patchBeforeSharedConfigure(): bool return false; } - /** - * Run shared extension check when cli is enabled - * @throws RuntimeException - */ - public function runSharedExtensionCheckUnix(): void - { - [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "extension=' . BUILD_MODULES_PATH . '/' . $this->getName() . '.so" --ri ' . $this->getName()); - if ($ret !== 0) { - throw new RuntimeException($this->getName() . '.so failed to load'); - } - if ($this->isBuildStatic()) { - logger()->warning($this->getName() . '.so test succeeded, but has little significance since it is also compiled in statically.'); - } - } - public function getRequiredSharedExtensions(): string { $loaded = []; @@ -244,7 +229,11 @@ public function getRequiredSharedExtensions(): string $ret = ''; foreach ($order as $ext) { if ($ext instanceof Extension && $ext->isBuildShared()) { - $ret .= ' -d "extension=' . BUILD_MODULES_PATH . '/' . $ext->getName() . '.so"'; + if ($ext->isZendExtension()) { + $ret .= ' -d "zend_extension=' . BUILD_MODULES_PATH . '/' . $ext->getName() . '.so"'; + } else { + $ret .= ' -d "extension=' . BUILD_MODULES_PATH . '/' . $ext->getName() . '.so"'; + } } } @@ -260,7 +249,7 @@ public function runCliCheckUnix(): void // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php // If check failed, throw RuntimeException $sharedExtensions = $this->getRequiredSharedExtensions(); - [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"', false); + [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); } @@ -273,7 +262,7 @@ public function runCliCheckUnix(): void file_get_contents(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php') ); - [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedExtensions . ' -r "' . trim($test) . '"'); + [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' -r "' . trim($test) . '"'); if ($ret !== 0) { if ($this->builder->getOption('debug')) { var_dump($out); @@ -374,11 +363,6 @@ public function buildUnixShared(): void ->execWithEnv('make clean') ->execWithEnv('make -j' . $this->builder->concurrency) ->execWithEnv('make install'); - - // check shared extension with php-cli - if (file_exists(BUILD_BIN_PATH . '/php')) { - $this->runSharedExtensionCheckUnix(); - } } /** @@ -449,6 +433,11 @@ protected function addExtensionDependency(string $name, bool $optional = false): } } + protected function isZendExtension(): bool + { + return false; + } + private function getLibraryDependencies(bool $recursive = false): array { $ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase); diff --git a/src/SPC/builder/extension/opcache.php b/src/SPC/builder/extension/opcache.php index ec468cb80..865bf4878 100644 --- a/src/SPC/builder/extension/opcache.php +++ b/src/SPC/builder/extension/opcache.php @@ -24,17 +24,6 @@ public function validate(): void } } - public function runSharedExtensionCheckUnix(): void - { - [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "zend_extension=' . BUILD_MODULES_PATH . '/opcache.so" -v'); - if ($ret !== 0) { - throw new RuntimeException('opcache.so failed to load.'); - } - if (!str_contains(join($out), 'with Zend OPcache')) { - throw new RuntimeException('opcache.so failed to load.'); - } - } - public function patchBeforeBuildconf(): bool { if (file_exists(SOURCE_PATH . '/php-src/.opcache_patched')) { @@ -62,4 +51,9 @@ public function getDistName(): string { return 'Zend Opcache'; } + + protected function isZendExtension(): bool + { + return true; + } } diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php index 195eaffee..751669030 100644 --- a/src/SPC/builder/extension/pdo_sqlsrv.php +++ b/src/SPC/builder/extension/pdo_sqlsrv.php @@ -29,10 +29,5 @@ public function buildUnixShared(): void ->execWithEnv('make clean') ->execWithEnv('make -j' . $this->builder->concurrency) ->execWithEnv('make install'); - - // check shared extension with php-cli - if (file_exists(BUILD_BIN_PATH . '/php')) { - $this->runSharedExtensionCheckUnix(); - } } } diff --git a/src/SPC/builder/extension/sqlsrv.php b/src/SPC/builder/extension/sqlsrv.php index f6cd21a06..55a2b6a09 100644 --- a/src/SPC/builder/extension/sqlsrv.php +++ b/src/SPC/builder/extension/sqlsrv.php @@ -60,10 +60,5 @@ public function buildUnixShared(): void ->execWithEnv('make clean') ->execWithEnv('make -j' . $this->builder->concurrency) ->execWithEnv('make install'); - - // check shared extension with php-cli - if (file_exists(BUILD_BIN_PATH . '/php')) { - $this->runSharedExtensionCheckUnix(); - } } } diff --git a/src/SPC/builder/extension/xdebug.php b/src/SPC/builder/extension/xdebug.php index 367eb4202..90f225aed 100644 --- a/src/SPC/builder/extension/xdebug.php +++ b/src/SPC/builder/extension/xdebug.php @@ -5,20 +5,13 @@ namespace SPC\builder\extension; use SPC\builder\Extension; -use SPC\exception\RuntimeException; use SPC\util\CustomExt; #[CustomExt('xdebug')] class xdebug extends Extension { - public function runSharedExtensionCheckUnix(): void + protected function isZendExtension(): bool { - [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "zend_extension=' . BUILD_MODULES_PATH . '/xdebug.so" -v'); - if ($ret !== 0) { - throw new RuntimeException('xdebug.so failed to load.'); - } - if (!str_contains(join($out), 'with Xdebug')) { - throw new RuntimeException('xdebug.so failed to load.'); - } + return str_contains($this->builder->getExt('zend')->getName(), 'xdebug'); } } diff --git a/src/SPC/builder/extension/xhprof.php b/src/SPC/builder/extension/xhprof.php index 118a34cd0..589ac5831 100644 --- a/src/SPC/builder/extension/xhprof.php +++ b/src/SPC/builder/extension/xhprof.php @@ -56,10 +56,5 @@ public function buildUnixShared(): void ->execWithEnv('make clean') ->execWithEnv('make -j' . $this->builder->concurrency) ->execWithEnv('make install'); - - // check shared extension with php-cli - if (file_exists(BUILD_BIN_PATH . '/php')) { - $this->runSharedExtensionCheckUnix(); - } } } diff --git a/src/SPC/builder/freebsd/BSDBuilder.php b/src/SPC/builder/freebsd/BSDBuilder.php index b2e246b3d..7c10881f1 100644 --- a/src/SPC/builder/freebsd/BSDBuilder.php +++ b/src/SPC/builder/freebsd/BSDBuilder.php @@ -145,7 +145,10 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void } $this->buildEmbed(); } + } + public function testPHP(int $build_target = BUILD_TARGET_NONE) + { if (php_uname('m') === $this->getOption('arch')) { $this->emitPatchPoint('before-sanity-check'); $this->sanityCheck($build_target); diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 0a827c852..0a8149077 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -222,7 +222,10 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void } $this->buildEmbed(); } + } + public function testPHP(int $build_target = BUILD_TARGET_NONE) + { $this->emitPatchPoint('before-sanity-check'); $this->sanityCheck($build_target); } diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 9f9ad684e..7d82f191b 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -209,6 +209,12 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void $this->sanityCheck($build_target); } + public function testPHP(int $build_target = BUILD_TARGET_NONE) + { + $this->emitPatchPoint('before-sanity-check'); + $this->sanityCheck($build_target); + } + /** * Build cli sapi * diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index b92c2b7e1..d645a68f0 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -138,9 +138,9 @@ public function proveLibs(array $sorted_libraries): void protected function sanityCheck(int $build_target): void { // sanity check for php-cli - if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI) { + if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI || file_exists(BUILD_BIN_PATH . '/php')) { logger()->info('running cli sanity check'); - [$ret, $output] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n -r "echo \"hello\";"'); + [$ret, $output] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -r "echo \"hello\";"'); $raw_output = implode('', $output); if ($ret !== 0 || trim($raw_output) !== 'hello') { throw new RuntimeException("cli failed sanity check: ret[{$ret}]. out[{$raw_output}]"); @@ -173,7 +173,11 @@ protected function sanityCheck(int $build_target): void } // sanity check for embed - if (($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED) { + if (($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED || + file_exists(BUILD_BIN_PATH . '/php-config') && + file_exists(BUILD_BIN_PATH . '/phpize') && + (file_exists(BUILD_LIB_PATH . '/libphp.a') || file_exists(BUILD_LIB_PATH . '/libphp.so')) + ) { logger()->info('running embed sanity check'); $sample_file_path = SOURCE_PATH . '/embed-test'; if (!is_dir($sample_file_path)) { diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 550fad3f1..6c64995cb 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -218,6 +218,8 @@ public function handle(): int $builder->buildSharedExts(); } + $builder->testPHP($rule); + // compile stopwatch :P $time = round(microtime(true) - START_TIME, 3); logger()->info(''); From b68d71b7b76e10d6b9b29d662c7087648fb40105 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 19:22:15 +0700 Subject: [PATCH 052/204] testPHP in windowsbuilder --- src/SPC/builder/windows/WindowsBuilder.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/builder/windows/WindowsBuilder.php b/src/SPC/builder/windows/WindowsBuilder.php index 7a604ca86..c76431438 100644 --- a/src/SPC/builder/windows/WindowsBuilder.php +++ b/src/SPC/builder/windows/WindowsBuilder.php @@ -146,7 +146,10 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void // logger()->info('building embed'); $this->buildEmbed(); } + } + public function testPHP(int $build_target = BUILD_TARGET_NONE) + { $this->sanityCheck($build_target); } From e3d7969b960bf108a70735c094c07a134cf9bb15 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 20:03:21 +0700 Subject: [PATCH 053/204] select all quick button --- docs/.vitepress/components/CliGenerator.vue | 23 +++++++++++++++++++++ src/SPC/builder/extension/pgsql.php | 7 ++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/.vitepress/components/CliGenerator.vue b/docs/.vitepress/components/CliGenerator.vue index e3537d87c..4c8d096a7 100644 --- a/docs/.vitepress/components/CliGenerator.vue +++ b/docs/.vitepress/components/CliGenerator.vue @@ -30,6 +30,7 @@
{{ I18N[lang].selectCommon }}
+
{{ I18N[lang].selectAll }}
{{ I18N[lang].selectNone }}
@@ -246,6 +247,7 @@ const I18N = { no: '否', resultShow: '结果展示', selectCommon: '选择常用扩展', + selectAll: '选择全部', selectNone: '全部取消选择', useZTS: '是否编译线程安全版', hardcodedINI: '硬编码 INI 选项', @@ -280,6 +282,7 @@ const I18N = { no: 'No', resultShow: 'Result', selectCommon: 'Select common extensions', + selectAll: 'Select all', selectNone: 'Unselect all', useZTS: 'Enable ZTS', hardcodedINI: 'Hardcoded INI options', @@ -331,6 +334,26 @@ const selectCommon = () => { ]; }; +const selectAll = () => { + checkedExts.value = [ + 'amqp', 'apcu', 'ast', 'bcmath', 'bz2', 'calendar', 'ctype', 'curl', + 'dba', 'dio', 'dom', 'ds', 'ev', 'event', 'exif', 'ffi', 'fileinfo', + 'filter', 'ftp', 'gd', 'gettext', 'gmp', 'gmssl', 'grpc', 'iconv', + 'igbinary', 'imagick', 'imap', 'inotify', 'intl', 'ldap', 'libxml', + 'mbregex', 'mbstring', 'memcache', 'mongodb', 'msgpack', 'mysqli', + 'mysqlnd', 'odbc', 'opcache', 'openssl', 'opentelemetry', 'parallel', + 'password-argon2', 'pcntl', 'pdo', 'pdo_mysql', 'pdo_odbc', + 'pdo_pgsql', 'pdo_sqlite', 'pdo_sqlsrv', 'pgsql', 'phar', 'posix', + 'protobuf', 'rar', 'rdkafka', 'readline', 'redis', 'session', 'shmop', + 'simdjson', 'simplexml', 'snappy', 'soap', 'sockets', 'sodium', 'spx', + 'sqlite3', 'sqlsrv', 'ssh2', 'swoole', 'swoole-hook-mysql', + 'swoole-hook-pgsql', 'swoole-hook-sqlite', 'swow', 'sysvmsg', + 'sysvsem', 'sysvshm', 'tidy', 'tokenizer', 'uuid', 'uv', 'xdebug', + 'xhprof', 'xlswriter', 'xml', 'xmlreader', 'xmlwriter', 'xsl', 'yac', + 'zip', 'zlib', + ]; +}; + const extList = computed(() => { return checkedExts.value.join(','); }); diff --git a/src/SPC/builder/extension/pgsql.php b/src/SPC/builder/extension/pgsql.php index b45ba6671..a70c1fb72 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -36,7 +36,12 @@ public function patchBeforeConfigure(): bool public function getUnixConfigureArg(bool $shared = false): string { if ($this->builder->getPHPVersionID() >= 80400) { - return '--with-pgsql' . ($shared ? '=shared' : '') . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon"'; + $libfiles = $this->getLibFilesString(); + $libfiles = str_replace(BUILD_LIB_PATH . '/lib', '-l', $libfiles); + $libfiles = str_replace('.a', '', $libfiles); + return '--with-pgsql' . ($shared ? '=shared' : '') . + ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . + ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' ' . $libfiles . '"'; } return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } From 4a442825567c9423bada46fd16ef9fb1d2029ecf Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 20:12:12 +0700 Subject: [PATCH 054/204] shoehorn the lot in, I don't know how to fix this otherwise --- src/SPC/builder/extension/pgsql.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/pgsql.php b/src/SPC/builder/extension/pgsql.php index a70c1fb72..a659ae72e 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -39,9 +39,12 @@ public function getUnixConfigureArg(bool $shared = false): string $libfiles = $this->getLibFilesString(); $libfiles = str_replace(BUILD_LIB_PATH . '/lib', '-l', $libfiles); $libfiles = str_replace('.a', '', $libfiles); + $libfiles = str_replace(' -lpq', '', $libfiles); + $libfiles = str_replace(' -lpgport', '', $libfiles); + $libfiles = str_replace(' -lpgcommon', '', $libfiles); return '--with-pgsql' . ($shared ? '=shared' : '') . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . - ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' ' . $libfiles . '"'; + ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -Wl,--whole-archive -lpq -lpgport -lpgcommon -Wl,--no-whole-archive ' . $libfiles . '"'; } return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } From 64b6f98ce7e38d14c06984a7586da48c22697c07 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 21 May 2025 20:43:10 +0700 Subject: [PATCH 055/204] the flag doesn't fix it, the problem is something else --- src/SPC/builder/extension/pgsql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/pgsql.php b/src/SPC/builder/extension/pgsql.php index a659ae72e..df852f4b7 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -44,7 +44,7 @@ public function getUnixConfigureArg(bool $shared = false): string $libfiles = str_replace(' -lpgcommon', '', $libfiles); return '--with-pgsql' . ($shared ? '=shared' : '') . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . - ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -Wl,--whole-archive -lpq -lpgport -lpgcommon -Wl,--no-whole-archive ' . $libfiles . '"'; + ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon ' . $libfiles . '"'; } return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } From c29ca9722f995e3243d57152c72e29396a41bea3 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 12:26:25 +0700 Subject: [PATCH 056/204] add -lbrotlienc to curl --- src/SPC/builder/unix/library/curl.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index c37dedf6f..be9351b5c 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -65,6 +65,26 @@ protected function build(): void ->execWithEnv('make install'); // patch pkgconf $this->patchPkgconfPrefix(['libcurl.pc']); + FileSystem::replaceFileStr( + BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', + '-lbrolienc -lbrotlidec -lbrotlicommon', + '-lbrotlidec -lbrotlicommon' + ); + FileSystem::replaceFileStr( + BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', + '-lbrotlidec -lbrotlicommon', + '-lbrolienc -lbrotlidec -lbrotlicommon' + ); + FileSystem::replaceFileStr( + BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', + 'libbrotlienc,libbrotlidec,libbrotlicommon', + 'libbrotlidec,libbrotlicommon' + ); + FileSystem::replaceFileStr( + BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', + 'libbrotlidec,libbrotlicommon', + 'libbrotlienc,libbrotlidec,libbrotlicommon' + ); shell()->cd(BUILD_LIB_PATH . '/cmake/CURL/') ->exec("sed -ie 's|\"/lib/libcurl.a\"|\"" . BUILD_LIB_PATH . "/libcurl.a\"|g' CURLTargets-release.cmake"); } From 310be957b667837492a50bd0529ec96ec9783e6a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 12:27:01 +0700 Subject: [PATCH 057/204] new build-with-php key for extensions --- config/ext.json | 21 ++++++++++++++++----- src/SPC/builder/BuilderBase.php | 16 +++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/config/ext.json b/config/ext.json index af3c48bc1..1cf99d1fa 100644 --- a/config/ext.json +++ b/config/ext.json @@ -370,6 +370,9 @@ "ext-depends": [ "zlib", "session" + ], + "shared-ext-depends": [ + "session" ] }, "memcached": { @@ -388,6 +391,9 @@ "ext-depends": [ "session", "zlib" + ], + "shared-ext-depends": [ + "session" ] }, "mongodb": { @@ -692,7 +698,8 @@ ], "ext-depends-windows": [ "xml" - ] + ], + "build-with-php": true }, "snappy": { "support": { @@ -912,7 +919,8 @@ ] }, "tokenizer": { - "type": "builtin" + "type": "builtin", + "build-with-php": true }, "uuid": { "support": { @@ -995,7 +1003,8 @@ ], "ext-depends-windows": [ "iconv" - ] + ], + "build-with-php": true }, "xmlreader": { "support": { @@ -1009,7 +1018,8 @@ "ext-depends-windows": [ "xml", "dom" - ] + ], + "build-with-php": true }, "xmlwriter": { "support": { @@ -1022,7 +1032,8 @@ ], "ext-depends-windows": [ "xml" - ] + ], + "build-with-php": true }, "xsl": { "support": { diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 08c580ea4..599ccdc67 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -262,15 +262,17 @@ public function buildSharedExts(): void if (!$ext->isBuildShared()) { continue; } - if (Config::getExt($ext->getName(), 'type') === 'builtin') { + if (Config::getExt($ext->getName(), 'type') === 'builtin' || Config::getExt($ext->getName(), 'build-with-php') === true) { if (file_exists(BUILD_MODULES_PATH . '/' . $ext->getName() . '.so')) { logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)'); continue; } - logger()->warning('Shared extension [' . $ext->getName() . '] was built statically by php-src/configure'); - continue; + if (Config::getExt($ext->getName(), 'build-with-php') === true) { + logger()->warning('Shared extension [' . $ext->getName() . '] did not build with php-src/configure (' . $ext->getName() . '.so)'); + logger()->warning('Try deleting your build and source folders and running `spc build`` again.'); + continue; + } } - logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)'); $ext->buildShared(); } } catch (RuntimeException $e) { @@ -293,7 +295,11 @@ public function makeStaticExtensionArgs(): string foreach ($this->getExts() as $ext) { $arg = $ext->getConfigureArg(); if ($ext->isBuildShared()) { - if (Config::getExt($ext->getName(), 'type') === 'builtin') { + if ( + (Config::getExt($ext->getName(), 'type') === 'builtin' && + !file_exists(SOURCE_PATH . '/php-src/ext/' . $ext->getName() . '/config.m4')) || + Config::getExt($ext->getName(), 'build-with-php') === true + ) { $arg = $ext->getConfigureArg(true); } else { continue; From 3713ae8c93eee3b3e270cf004c540cd439050967 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 12:27:41 +0700 Subject: [PATCH 058/204] extra dependencies for extensions --- src/SPC/builder/Extension.php | 26 +++++++++++++++++---- src/SPC/builder/extension/spx.php | 10 +------- src/SPC/builder/extension/xdebug.php | 2 +- src/SPC/store/SourcePatcher.php | 2 +- src/SPC/util/SPCConfigUtil.php | 35 ++++++++++++++++++++++++---- 5 files changed, 56 insertions(+), 19 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index a0a1e6d29..8d975837a 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -313,6 +313,7 @@ public function validate(): void */ public function buildShared(): void { + logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)'); if (file_exists(BUILD_MODULES_PATH . '/' . $this->getName() . '.so')) { logger()->info('extension ' . $this->getName() . ' already built, skipping'); return; @@ -322,7 +323,10 @@ public function buildShared(): void if ($dependencyExt === null) { throw new RuntimeException("extension {$this->name} requires shared extension {$name}"); } - $dependencyExt->buildShared(); + if ($dependencyExt->isBuildShared()) { + logger()->info('extension ' . $this->getName() . ' requires shared extension ' . $name); + $dependencyExt->buildShared(); + } } match (PHP_OS_FAMILY) { 'Darwin', 'Linux' => $this->buildUnixShared(), @@ -341,11 +345,25 @@ public function buildShared(): void */ public function buildUnixShared(): void { - $config = (new SPCConfigUtil($this->builder))->config([$this->getName()]); + $config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true); + $sharedLibs = ''; + $staticLibs = ''; + foreach (explode('-l', $config['libs']) as $lib) { + $lib = trim($lib); + if ($lib === '') { + continue; + } + $static_lib = 'lib' . $lib . '.a'; + if (file_exists(BUILD_LIB_PATH . '/' . $static_lib)) { + $staticLibs .= ' -l' . $lib; + } else { + $sharedLibs .= ' -l' . $lib; + } + } $env = [ 'CFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'], - 'LIBS' => $config['libs'], + 'LDFLAGS' => $config['ldflags'] . ' -Wl,--allow-multiple-definition', + 'LIBS' => '-Wl,-Bstatic ' . $staticLibs . ' -Wl,-Bdynamic ' . $sharedLibs, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; // prepare configure args diff --git a/src/SPC/builder/extension/spx.php b/src/SPC/builder/extension/spx.php index dccf131cb..ef9e95bf4 100644 --- a/src/SPC/builder/extension/spx.php +++ b/src/SPC/builder/extension/spx.php @@ -5,7 +5,6 @@ namespace SPC\builder\extension; use SPC\builder\Extension; -use SPC\store\FileSystem; use SPC\util\CustomExt; #[CustomExt('spx')] @@ -13,17 +12,10 @@ class spx extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - $arg = '--enable-spx'; + $arg = '--enable-SPX'; if ($this->builder->getExt('zlib') === null) { $arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH; } return $arg; } - - public function patchBeforeSharedConfigure(): bool - { - FileSystem::replaceFileStr($this->source_dir . '/config.m4', 'PHP_ARG_ENABLE(SPX-DEV,', 'PHP_ARG_ENABLE(spx-dev,'); - FileSystem::replaceFileStr($this->source_dir . '/config.m4', 'PHP_ARG_ENABLE(SPX,', 'PHP_ARG_ENABLE(spx,'); - return true; - } } diff --git a/src/SPC/builder/extension/xdebug.php b/src/SPC/builder/extension/xdebug.php index 90f225aed..cdfeea8c7 100644 --- a/src/SPC/builder/extension/xdebug.php +++ b/src/SPC/builder/extension/xdebug.php @@ -12,6 +12,6 @@ class xdebug extends Extension { protected function isZendExtension(): bool { - return str_contains($this->builder->getExt('zend')->getName(), 'xdebug'); + return true; } } diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 0c02e155c..f78928dec 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -43,7 +43,7 @@ public static function init(): void */ public static function patchBeforeBuildconf(BuilderBase $builder): void { - foreach ($builder->getExts(false) as $ext) { + foreach ($builder->getExts() as $ext) { if ($ext->patchBeforeBuildconf() === true) { logger()->info('Extension [' . $ext->getName() . '] patched before buildconf'); } diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index e0b92a2e7..4b2fd19ae 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -11,6 +11,7 @@ use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; use SPC\store\Config; +use SPC\store\FileSystem; use Symfony\Component\Console\Input\ArgvInput; class SPCConfigUtil @@ -42,7 +43,7 @@ public function __construct(?BuilderBase $builder = null) * @throws WrongUsageException * @throws \Throwable */ - public function config(array $extensions = [], array $libraries = [], bool $include_suggest_ext = false, bool $include_suggest_lib = false): array + public function config(array $extensions = [], array $libraries = [], bool $include_suggest_ext = false, bool $include_suggest_lib = false, $with_dependencies = false): array { [$extensions, $libraries] = DependencyUtil::getExtsAndLibs($extensions, $libraries, $include_suggest_ext, $include_suggest_lib); @@ -54,7 +55,7 @@ public function config(array $extensions = [], array $libraries = [], bool $incl } ob_get_clean(); $ldflags = $this->getLdflagsString(); - $libs = $this->getLibsString($libraries); + $libs = $this->getLibsString($libraries, $with_dependencies); $cflags = $this->getIncludesString(); // embed @@ -97,13 +98,39 @@ private function getLdflagsString(): string return '-L' . BUILD_LIB_PATH; } - private function getLibsString(array $libraries): string + private function getLibsString(array $libraries, bool $withDependencies = false): string { $short_name = []; foreach (array_reverse($libraries) as $library) { $libs = Config::getLib($library, 'static-libs', []); foreach ($libs as $lib) { - $short_name[] = $this->getShortLibName($lib); + if ($withDependencies) { + $noExt = str_replace('.a', '', $lib); + $requiredLibs = []; + $pkgconfFile = BUILD_LIB_PATH . "/pkgconfig/{$noExt}.pc"; + if (file_exists($pkgconfFile)) { + $lines = file($pkgconfFile); + foreach ($lines as $value) { + if (str_starts_with($value, 'Libs')) { + $items = explode(' ', $value); + foreach ($items as $item) { + $item = trim($item); + if (str_starts_with($item, '-l')) { + $requiredLibs[] = $item; + } + } + } + } + } + foreach ($requiredLibs as $requiredLib) { + if (!in_array($requiredLib, $short_name)) { + $short_name[] = $requiredLib; + } + } + } + else { + $short_name[] = $this->getShortLibName($lib); + } } if (PHP_OS_FAMILY !== 'Darwin') { continue; From 4b8412dfdb44f995b088784f1402b7959c05bf74 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 12:28:00 +0700 Subject: [PATCH 059/204] shared for imagick --- src/SPC/builder/extension/imagick.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index a4cb93868..f91892451 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -24,6 +24,6 @@ public function patchBeforeMake(): bool public function getUnixConfigureArg(bool $shared = false): string { $disable_omp = getenv('SPC_LIBC') === 'musl' ? '' : ' ac_cv_func_omp_pause_resource_all=no'; - return '--with-imagick=' . BUILD_ROOT_PATH . $disable_omp; + return '--with-imagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp; } } From b91c83b6cd325dcd29d6b26242c92a51b43c433e Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 12:29:19 +0700 Subject: [PATCH 060/204] linter --- src/SPC/util/SPCConfigUtil.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 4b2fd19ae..d8ddabf5c 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -11,7 +11,6 @@ use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; use SPC\store\Config; -use SPC\store\FileSystem; use Symfony\Component\Console\Input\ArgvInput; class SPCConfigUtil @@ -32,6 +31,7 @@ public function __construct(?BuilderBase $builder = null) * @param array $libraries Additional library name list * @param bool $include_suggest_ext Include suggested extensions * @param bool $include_suggest_lib Include suggested libraries + * @param mixed $with_dependencies * @return array{ * cflags: string, * ldflags: string, @@ -127,8 +127,7 @@ private function getLibsString(array $libraries, bool $withDependencies = false) $short_name[] = $requiredLib; } } - } - else { + } else { $short_name[] = $this->getShortLibName($lib); } } From 6a86b28977589a62f94f9d53c9788327e30d9d7c Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 12:44:48 +0700 Subject: [PATCH 061/204] fix case of nonexistent pc --- src/SPC/util/SPCConfigUtil.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index d8ddabf5c..a89c4947e 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -122,6 +122,9 @@ private function getLibsString(array $libraries, bool $withDependencies = false) } } } + else { + $requiredLibs[] = $this->getShortLibName($lib); + } foreach ($requiredLibs as $requiredLib) { if (!in_array($requiredLib, $short_name)) { $short_name[] = $requiredLib; From bc002d500eb4c6bd34eb060bc71f79282c2d133c Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 12:45:06 +0700 Subject: [PATCH 062/204] linter again --- src/SPC/util/SPCConfigUtil.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index a89c4947e..0a059463f 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -121,8 +121,7 @@ private function getLibsString(array $libraries, bool $withDependencies = false) } } } - } - else { + } else { $requiredLibs[] = $this->getShortLibName($lib); } foreach ($requiredLibs as $requiredLib) { From 396d4b341f89d4a83870b0831894f039e1990362 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 13:01:36 +0700 Subject: [PATCH 063/204] broli, hahahaha --- src/SPC/builder/unix/library/curl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index be9351b5c..ab8a8bd71 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -67,13 +67,13 @@ protected function build(): void $this->patchPkgconfPrefix(['libcurl.pc']); FileSystem::replaceFileStr( BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', - '-lbrolienc -lbrotlidec -lbrotlicommon', + '-lbrotlienc -lbrotlidec -lbrotlicommon', '-lbrotlidec -lbrotlicommon' ); FileSystem::replaceFileStr( BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', '-lbrotlidec -lbrotlicommon', - '-lbrolienc -lbrotlidec -lbrotlicommon' + '-lbrotlienc -lbrotlidec -lbrotlicommon' ); FileSystem::replaceFileStr( BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', From 0afe0e5f46f62120ceb03e521564b7e67a3bc779 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 15:46:42 +0700 Subject: [PATCH 064/204] last problems (?) --- config/ext.json | 9 ++++++--- src/SPC/builder/Extension.php | 2 +- src/SPC/builder/extension/intl.php | 2 -- src/SPC/builder/extension/memcache.php | 2 +- src/SPC/builder/extension/memcached.php | 2 +- src/SPC/builder/extension/sockets.php | 21 --------------------- 6 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 src/SPC/builder/extension/sockets.php diff --git a/config/ext.json b/config/ext.json index 1cf99d1fa..d48646aee 100644 --- a/config/ext.json +++ b/config/ext.json @@ -373,7 +373,8 @@ ], "shared-ext-depends": [ "session" - ] + ], + "build-with-php": true }, "memcached": { "support": { @@ -677,7 +678,8 @@ ] }, "session": { - "type": "builtin" + "type": "builtin", + "build-with-php": true }, "shmop": { "type": "builtin" @@ -973,7 +975,8 @@ "source": "xhprof", "ext-depends": [ "ctype" - ] + ], + "build-with-php": true }, "xlswriter": { "support": { diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 8d975837a..b8dc8c4cc 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -362,7 +362,7 @@ public function buildUnixShared(): void } $env = [ 'CFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'] . ' -Wl,--allow-multiple-definition', + 'LDFLAGS' => $config['ldflags'], 'LIBS' => '-Wl,-Bstatic ' . $staticLibs . ' -Wl,-Bdynamic ' . $sharedLibs, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; diff --git a/src/SPC/builder/extension/intl.php b/src/SPC/builder/extension/intl.php index 819aee695..5676a4897 100644 --- a/src/SPC/builder/extension/intl.php +++ b/src/SPC/builder/extension/intl.php @@ -18,8 +18,6 @@ public function patchBeforeBuildconf(): bool // Also need to use clang++ -std=c++17 to force override the default C++ standard if (is_string($env = getenv('CXX')) && !str_contains($env, 'std=c++17')) { f_putenv('CXX=' . $env . ' -std=c++17'); - } else { - f_putenv('CXX=clang++ -std=c++17'); } return true; } diff --git a/src/SPC/builder/extension/memcache.php b/src/SPC/builder/extension/memcache.php index 4625cae25..479744fdd 100644 --- a/src/SPC/builder/extension/memcache.php +++ b/src/SPC/builder/extension/memcache.php @@ -14,7 +14,7 @@ class memcache extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - return '--enable-memcache --with-zlib-dir=' . BUILD_ROOT_PATH; + return '--enable-memcache' . ($shared ? '=shared' : '') . ' --with-zlib-dir=' . BUILD_ROOT_PATH; } /** diff --git a/src/SPC/builder/extension/memcached.php b/src/SPC/builder/extension/memcached.php index 9c4339543..12c2c1930 100644 --- a/src/SPC/builder/extension/memcached.php +++ b/src/SPC/builder/extension/memcached.php @@ -14,6 +14,6 @@ public function getUnixConfigureArg(bool $shared = false): string { $rootdir = BUILD_ROOT_PATH; $zlib_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : "--with-zlib-dir={$rootdir}"; - return "--enable-memcached {$zlib_dir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json"; + return "--enable-memcached" . ($shared ? '=shared' : '') . " {$zlib_dir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json"; } } diff --git a/src/SPC/builder/extension/sockets.php b/src/SPC/builder/extension/sockets.php deleted file mode 100644 index a09014156..000000000 --- a/src/SPC/builder/extension/sockets.php +++ /dev/null @@ -1,21 +0,0 @@ - Date: Thu, 22 May 2025 16:04:29 +0700 Subject: [PATCH 065/204] linter --- src/SPC/builder/extension/memcached.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/memcached.php b/src/SPC/builder/extension/memcached.php index 12c2c1930..8ea8b81e5 100644 --- a/src/SPC/builder/extension/memcached.php +++ b/src/SPC/builder/extension/memcached.php @@ -14,6 +14,6 @@ public function getUnixConfigureArg(bool $shared = false): string { $rootdir = BUILD_ROOT_PATH; $zlib_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : "--with-zlib-dir={$rootdir}"; - return "--enable-memcached" . ($shared ? '=shared' : '') . " {$zlib_dir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json"; + return '--enable-memcached' . ($shared ? '=shared' : '') . " {$zlib_dir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json"; } } From 2a70b998e37e573f2bc41a0e48a5b0ddca03e068 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 16:07:52 +0700 Subject: [PATCH 066/204] change to count of Static Extensions --- src/SPC/command/BuildPHPCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 6c64995cb..478ca2915 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -137,7 +137,7 @@ public function handle(): int $indent_texts = [ 'Build OS' => PHP_OS_FAMILY . ' (' . php_uname('m') . ')', 'Build SAPI' => $builder->getBuildTypeName($rule), - 'Extensions (' . count($extensions) . ')' => implode(',', $extensions), + 'Static Extensions (' . count($static_extensions) . ')' => implode(',', $extensions), 'Shared Extensions (' . count($shared_extensions) . ')' => implode(',', $shared_extensions), 'Libraries (' . count($libraries) . ')' => implode(',', $display_libs), 'Strip Binaries' => $builder->getOption('no-strip') ? 'no' : 'yes', From 835fc1e360e64b36a70903c601b65f863b121087 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 16:08:09 +0700 Subject: [PATCH 067/204] oops --- src/SPC/command/BuildPHPCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 478ca2915..cd8314385 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -137,7 +137,7 @@ public function handle(): int $indent_texts = [ 'Build OS' => PHP_OS_FAMILY . ' (' . php_uname('m') . ')', 'Build SAPI' => $builder->getBuildTypeName($rule), - 'Static Extensions (' . count($static_extensions) . ')' => implode(',', $extensions), + 'Static Extensions (' . count($static_extensions) . ')' => implode(',', $static_extensions), 'Shared Extensions (' . count($shared_extensions) . ')' => implode(',', $shared_extensions), 'Libraries (' . count($libraries) . ')' => implode(',', $display_libs), 'Strip Binaries' => $builder->getOption('no-strip') ? 'no' : 'yes', From c2d5afc4e9db6ab34af0873ca4872115568f25d9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 16:48:22 +0700 Subject: [PATCH 068/204] mysqli and mysqlnd can also be built shared --- config/ext.json | 11 +++++------ src/SPC/builder/Extension.php | 7 ++++--- src/SPC/builder/extension/mbregex.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/ext.json b/config/ext.json index d48646aee..bd98ac43a 100644 --- a/config/ext.json +++ b/config/ext.json @@ -430,8 +430,8 @@ "ext-depends": [ "mysqlnd" ], - "target": [ - "static" + "shared-ext-depends": [ + "mysqlnd" ] }, "mysqlnd": { @@ -439,9 +439,6 @@ "arg-type-windows": "with", "lib-depends": [ "zlib" - ], - "target": [ - "static" ] }, "oci8": { @@ -682,7 +679,8 @@ "build-with-php": true }, "shmop": { - "type": "builtin" + "type": "builtin", + "build-with-php": true }, "simdjson": { "type": "external", @@ -792,6 +790,7 @@ "arg-type": "with-prefix", "arg-type-windows": "with", "lib-depends": [ + "openssl", "libssh2" ], "ext-depends-windows": [ diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index b8dc8c4cc..f25b82a77 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -230,9 +230,9 @@ public function getRequiredSharedExtensions(): string foreach ($order as $ext) { if ($ext instanceof Extension && $ext->isBuildShared()) { if ($ext->isZendExtension()) { - $ret .= ' -d "zend_extension=' . BUILD_MODULES_PATH . '/' . $ext->getName() . '.so"'; + $ret .= " -d \"zend_extension={$ext->getName()}\""; } else { - $ret .= ' -d "extension=' . BUILD_MODULES_PATH . '/' . $ext->getName() . '.so"'; + $ret .= " -d \"extension={$ext->getName()}\""; } } } @@ -249,7 +249,8 @@ public function runCliCheckUnix(): void // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php // If check failed, throw RuntimeException $sharedExtensions = $this->getRequiredSharedExtensions(); - [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"', false); + putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); + [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); } diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index a26e7024f..5990b3a65 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -26,7 +26,7 @@ public function getConfigureArg(bool $shared = false): string */ public function runCliCheckUnix(): void { - $sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? ' -d "extension=' . BUILD_MODULES_PATH . '/mbstring.so"' : ''; + $sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? ' -d "extension=mbstring.so"' : ''; [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedext . ' --ri "mbstring" | grep regex', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !'); From 51891478e4612f306dbfb72495a1a887db238aac Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 22 May 2025 16:51:03 +0700 Subject: [PATCH 069/204] shared ssh2 wants openssl if mysqli or mysqlnd aren't built in --- config/ext.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index bd98ac43a..dc69bf369 100644 --- a/config/ext.json +++ b/config/ext.json @@ -790,9 +790,11 @@ "arg-type": "with-prefix", "arg-type-windows": "with", "lib-depends": [ - "openssl", "libssh2" ], + "shared-ext-depends": [ + "openssl" + ], "ext-depends-windows": [ "openssl", "zlib" From 15dc672bcf4edb3a34511ba3e0d1aedc2cae42f8 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 23 May 2025 10:00:31 +0700 Subject: [PATCH 070/204] remove shared-ext-depends --- config/ext.json | 18 +++--------------- src/SPC/builder/Extension.php | 16 ++++++---------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/config/ext.json b/config/ext.json index dc69bf369..b9fc28a5c 100644 --- a/config/ext.json +++ b/config/ext.json @@ -96,7 +96,7 @@ "type": "external", "source": "ev", "arg-type-windows": "with", - "shared-ext-depends": [ + "ext-depends": [ "sockets" ] }, @@ -371,9 +371,6 @@ "zlib", "session" ], - "shared-ext-depends": [ - "session" - ], "build-with-php": true }, "memcached": { @@ -392,9 +389,6 @@ "ext-depends": [ "session", "zlib" - ], - "shared-ext-depends": [ - "session" ] }, "mongodb": { @@ -420,7 +414,7 @@ "source": "msgpack", "arg-type-unix": "with", "arg-type-win": "enable", - "shared-ext-depends": [ + "ext-depends": [ "session" ] }, @@ -429,9 +423,6 @@ "arg-type": "with", "ext-depends": [ "mysqlnd" - ], - "shared-ext-depends": [ - "mysqlnd" ] }, "mysqlnd": { @@ -792,10 +783,7 @@ "lib-depends": [ "libssh2" ], - "shared-ext-depends": [ - "openssl" - ], - "ext-depends-windows": [ + "ext-depends": [ "openssl", "zlib" ] diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index f25b82a77..6fd8b52f2 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -121,9 +121,6 @@ public function checkDependency(): static 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; } @@ -319,14 +316,13 @@ public function buildShared(): void 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}"); + foreach ($this->dependencies as $dependency) { + if (!$dependency instanceof Extension) { + continue; } - if ($dependencyExt->isBuildShared()) { - logger()->info('extension ' . $this->getName() . ' requires shared extension ' . $name); - $dependencyExt->buildShared(); + if (!$dependency->isBuildStatic()) { + logger()->info('extension ' . $this->getName() . ' requires extension ' . $dependency->getName()); + $dependency->buildShared(); } } match (PHP_OS_FAMILY) { From ed35b653907aefe005fd9b407fde83a637ba15d5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 23 May 2025 12:09:57 +0700 Subject: [PATCH 071/204] build all static exts no matter if we're also building shared versions --- src/SPC/builder/BuilderBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index 599ccdc67..b011a8022 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -128,7 +128,7 @@ public function getExts(bool $including_shared = true): array if ($including_shared) { return $this->exts; } - return array_filter($this->exts, fn ($ext) => !$ext->isBuildShared()); + return array_filter($this->exts, fn ($ext) => $ext->isBuildStatic()); } /** From 4ce7374ac9695ddb3ebea403d251f4e1ac1891ab Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 09:37:15 +0700 Subject: [PATCH 072/204] move zend extension check into config --- config/ext.json | 6 ++++-- src/SPC/builder/Extension.php | 7 +------ src/SPC/builder/extension/opcache.php | 5 ----- src/SPC/builder/extension/xdebug.php | 17 ----------------- 4 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 src/SPC/builder/extension/xdebug.php diff --git a/config/ext.json b/config/ext.json index b9fc28a5c..0dca824bf 100644 --- a/config/ext.json +++ b/config/ext.json @@ -455,7 +455,8 @@ }, "opcache": { "type": "builtin", - "arg-type-unix": "custom" + "arg-type-unix": "custom", + "zend-extension": true }, "openssl": { "notes": true, @@ -952,7 +953,8 @@ "Darwin": "partial", "Linux": "partial" }, - "notes": true + "notes": true, + "zend-extension": true }, "xhprof": { "support": { diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 6fd8b52f2..22c35d333 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -226,7 +226,7 @@ public function getRequiredSharedExtensions(): string $ret = ''; foreach ($order as $ext) { if ($ext instanceof Extension && $ext->isBuildShared()) { - if ($ext->isZendExtension()) { + if (Config::getExt($ext->getName(), 'zend_extension', false) === true) { $ret .= " -d \"zend_extension={$ext->getName()}\""; } else { $ret .= " -d \"extension={$ext->getName()}\""; @@ -448,11 +448,6 @@ protected function addExtensionDependency(string $name, bool $optional = false): } } - protected function isZendExtension(): bool - { - return false; - } - private function getLibraryDependencies(bool $recursive = false): array { $ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase); diff --git a/src/SPC/builder/extension/opcache.php b/src/SPC/builder/extension/opcache.php index 865bf4878..5d9dda0ad 100644 --- a/src/SPC/builder/extension/opcache.php +++ b/src/SPC/builder/extension/opcache.php @@ -51,9 +51,4 @@ public function getDistName(): string { return 'Zend Opcache'; } - - protected function isZendExtension(): bool - { - return true; - } } diff --git a/src/SPC/builder/extension/xdebug.php b/src/SPC/builder/extension/xdebug.php deleted file mode 100644 index cdfeea8c7..000000000 --- a/src/SPC/builder/extension/xdebug.php +++ /dev/null @@ -1,17 +0,0 @@ - Date: Sun, 25 May 2025 09:37:15 +0700 Subject: [PATCH 073/204] \$SPC_CMD_PREFIX_PHP_MAKE -> $SPC_CMD_PREFIX_PHP_MAKE --- src/SPC/builder/linux/LinuxBuilder.php | 9 ++++++--- src/SPC/builder/macos/MacOSBuilder.php | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 0a8149077..324bce325 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -239,9 +239,10 @@ public function testPHP(int $build_target = BUILD_TARGET_NONE) protected function buildCli(): void { $vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars()); + $SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make'; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("\$SPC_CMD_PREFIX_PHP_MAKE {$vars} cli"); + ->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} cli"); if ($this->getOption('with-upx-pack')) { shell()->cd(SOURCE_PATH . '/php-src/sapi/cli') @@ -277,10 +278,11 @@ protected function buildMicro(): void // patch fake cli for micro $vars['EXTRA_CFLAGS'] .= $enable_fake_cli; $vars = SystemUtil::makeEnvVarString($vars); + $SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make'; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("\$SPC_CMD_PREFIX_PHP_MAKE {$vars} micro"); + ->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} micro"); $this->processMicroUPX(); @@ -300,9 +302,10 @@ protected function buildMicro(): void protected function buildFpm(): void { $vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars()); + $SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make'; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("\$SPC_CMD_PREFIX_PHP_MAKE {$vars} fpm"); + ->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} fpm"); if ($this->getOption('with-upx-pack')) { shell()->cd(SOURCE_PATH . '/php-src/sapi/fpm') diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 7d82f191b..855330456 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -226,7 +226,8 @@ protected function buildCli(): void $vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars()); $shell = shell()->cd(SOURCE_PATH . '/php-src'); - $shell->exec("\$SPC_CMD_PREFIX_PHP_MAKE {$vars} cli"); + $SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make'; + $shell->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} cli"); if (!$this->getOption('no-strip', false)) { $shell->exec('dsymutil -f sapi/cli/php')->exec('strip sapi/cli/php'); } From a9d5dcf4a22808224508cb5694bfc248ac522960 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 10:47:32 +0700 Subject: [PATCH 074/204] fixer --- src/SPC/builder/linux/LinuxBuilder.php | 6 +++--- src/SPC/builder/macos/MacOSBuilder.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 324bce325..0e0ac409e 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -242,7 +242,7 @@ protected function buildCli(): void $SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make'; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} cli"); + ->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cli"); if ($this->getOption('with-upx-pack')) { shell()->cd(SOURCE_PATH . '/php-src/sapi/cli') @@ -282,7 +282,7 @@ protected function buildMicro(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} micro"); + ->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} micro"); $this->processMicroUPX(); @@ -305,7 +305,7 @@ protected function buildFpm(): void $SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make'; shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') - ->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} fpm"); + ->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} fpm"); if ($this->getOption('with-upx-pack')) { shell()->cd(SOURCE_PATH . '/php-src/sapi/fpm') diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 855330456..cb2bac744 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -227,7 +227,7 @@ protected function buildCli(): void $shell = shell()->cd(SOURCE_PATH . '/php-src'); $SPC_CMD_PREFIX_PHP_MAKE = getenv('SPC_CMD_PREFIX_PHP_MAKE') ?: 'make'; - $shell->exec("$SPC_CMD_PREFIX_PHP_MAKE {$vars} cli"); + $shell->exec("{$SPC_CMD_PREFIX_PHP_MAKE} {$vars} cli"); if (!$this->getOption('no-strip', false)) { $shell->exec('dsymutil -f sapi/cli/php')->exec('strip sapi/cli/php'); } From f83715c370502a153e90ad15bceaf87a3104548f Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 10:52:46 +0700 Subject: [PATCH 075/204] add function description --- src/SPC/builder/Extension.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 22c35d333..ca627b9d9 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -203,6 +203,15 @@ public function patchBeforeSharedConfigure(): bool return false; } + /** + * @return string + * returns a command line string with all required shared extensions to load + * i.e.; pdo_pgsql would return: + * + * `-d "extension=pgsql" -d "extension=pdo_pgsql"` + * @throws FileSystemException + * @throws WrongUsageException + */ public function getRequiredSharedExtensions(): string { $loaded = []; From a8987d48edc9a53a76c2b654860c5b0396968032 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 11:00:38 +0700 Subject: [PATCH 076/204] the what now? --- src/SPC/builder/Extension.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index ca627b9d9..b997fe0a0 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -205,8 +205,8 @@ public function patchBeforeSharedConfigure(): bool /** * @return string - * returns a command line string with all required shared extensions to load - * i.e.; pdo_pgsql would return: + * returns a command line string with all required shared extensions to load + * i.e.; pdo_pgsql would return: * * `-d "extension=pgsql" -d "extension=pdo_pgsql"` * @throws FileSystemException From 9665473669feee84c218dc188d64463632729931 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 11:02:54 +0700 Subject: [PATCH 077/204] revert env --- config/env.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/env.ini b/config/env.ini index 499526459..e50c28bb8 100644 --- a/config/env.ini +++ b/config/env.ini @@ -81,7 +81,7 @@ SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime ; buildconf command SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force" ; configure command -SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --enable-shared=yes --enable-static=no --disable-all --disable-cgi --disable-phpdbg --with-pic" +SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --disable-shared --enable-static --disable-all --disable-cgi --disable-phpdbg --with-pic" ; make command SPC_CMD_PREFIX_PHP_MAKE="make -j${CPU_COUNT}" ; embed type for php, static (libphp.a) or shared (libphp.so) From 14ca782672927cbd3b0dd0bc5e397d99bb62a92d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 11:07:44 +0700 Subject: [PATCH 078/204] rename method --- src/SPC/builder/Extension.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index b997fe0a0..06c892a89 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -212,7 +212,7 @@ public function patchBeforeSharedConfigure(): bool * @throws FileSystemException * @throws WrongUsageException */ - public function getRequiredSharedExtensions(): string + public function getSharedExtensionLoadString(): string { $loaded = []; $order = []; @@ -254,7 +254,7 @@ public function runCliCheckUnix(): void // Run compile check if build target is cli // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php // If check failed, throw RuntimeException - $sharedExtensions = $this->getRequiredSharedExtensions(); + $sharedExtensions = $this->getSharedExtensionLoadString(); putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); if ($ret !== 0) { From 234df8d11fad4b23fc51a1f426b9e97f1891e81e Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 11:48:52 +0700 Subject: [PATCH 079/204] update spx, works static and shared --- config/source.json | 2 +- src/SPC/builder/extension/spx.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/source.json b/config/source.json index 2beea67c5..dcf2ec581 100644 --- a/config/source.json +++ b/config/source.json @@ -859,7 +859,7 @@ "spx": { "type": "git", "rev": "master", - "url": "https://github.com/NoiseByNorthwest/php-spx.git", + "url": "https://github.com/henderkes/php-spx.git", "path": "php-src/ext/spx", "license": { "type": "file", diff --git a/src/SPC/builder/extension/spx.php b/src/SPC/builder/extension/spx.php index ef9e95bf4..9e3ead3a3 100644 --- a/src/SPC/builder/extension/spx.php +++ b/src/SPC/builder/extension/spx.php @@ -12,7 +12,7 @@ class spx extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - $arg = '--enable-SPX'; + $arg = '--enable-spx' . ($shared ? '=shared' : ''); if ($this->builder->getExt('zlib') === null) { $arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH; } From c972a94876009fed6e340f3f0353b50a56f515dc Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 15:52:11 +0700 Subject: [PATCH 080/204] another way where static extensions would be excluded if also compiled shared --- src/SPC/builder/BuilderBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index b011a8022..433d0b97f 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -294,7 +294,7 @@ public function makeStaticExtensionArgs(): string $ret = []; foreach ($this->getExts() as $ext) { $arg = $ext->getConfigureArg(); - if ($ext->isBuildShared()) { + if ($ext->isBuildShared() && !$ext->isBuildStatic()) { if ( (Config::getExt($ext->getName(), 'type') === 'builtin' && !file_exists(SOURCE_PATH . '/php-src/ext/' . $ext->getName() . '/config.m4')) || From 3662e079ac5d464e97b60b082b1a1c10da52b8b6 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 17:26:48 +0700 Subject: [PATCH 081/204] fix spc doctor command, gettext is installed by default, but doesn't provide all required autopoint stuff - check for gettextize instead, which is only installed with the gettext-devel package --- src/SPC/doctor/item/LinuxToolCheckList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index 03702a841..bde532896 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -47,7 +47,7 @@ class LinuxToolCheckList private const PROVIDED_COMMAND = [ 'binutils-gold' => 'ld.gold', 'base-devel' => 'automake', - 'gettext-devel' => 'gettext', + 'gettext-devel' => 'gettextize', ]; /** @noinspection PhpUnused */ From d833d8946ca25805cffd2014938874f2851f8cce Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 18:03:07 +0700 Subject: [PATCH 082/204] fixes on arch64 --- src/SPC/builder/extension/amqp.php | 2 +- src/SPC/builder/extension/spx.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/extension/amqp.php b/src/SPC/builder/extension/amqp.php index 40a6131c9..7e0ea2dec 100644 --- a/src/SPC/builder/extension/amqp.php +++ b/src/SPC/builder/extension/amqp.php @@ -25,7 +25,7 @@ public function patchBeforeMake(): bool public function getUnixConfigureArg(bool $shared = false): string { - return '--with-amqp --with-librabbitmq-dir=' . BUILD_ROOT_PATH; + return '--with-amqp' . ($shared ? '=shared' : '') . ' --with-librabbitmq-dir=' . BUILD_ROOT_PATH; } public function getWindowsConfigureArg($shared = false): string diff --git a/src/SPC/builder/extension/spx.php b/src/SPC/builder/extension/spx.php index 9e3ead3a3..8436b96f3 100644 --- a/src/SPC/builder/extension/spx.php +++ b/src/SPC/builder/extension/spx.php @@ -13,7 +13,7 @@ class spx extends Extension public function getUnixConfigureArg(bool $shared = false): string { $arg = '--enable-spx' . ($shared ? '=shared' : ''); - if ($this->builder->getExt('zlib') === null) { + if ($this->builder->getLib('zlib') !== null) { $arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH; } return $arg; From e2ea10d2eb47042af5f95d259f140a29b4e643c1 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 18:29:34 +0700 Subject: [PATCH 083/204] set extension dir before --- src/SPC/builder/extension/mbregex.php | 3 ++- src/SPC/builder/extension/swoole_hook_mysql.php | 3 ++- src/SPC/builder/extension/swoole_hook_pgsql.php | 4 +++- src/SPC/builder/extension/swoole_hook_sqlite.php | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index 5990b3a65..cdff2903e 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -26,7 +26,8 @@ public function getConfigureArg(bool $shared = false): string */ public function runCliCheckUnix(): void { - $sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? ' -d "extension=mbstring.so"' : ''; + $sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? ' -d "extension=mbstring"' : ''; + putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedext . ' --ri "mbstring" | grep regex', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !'); diff --git a/src/SPC/builder/extension/swoole_hook_mysql.php b/src/SPC/builder/extension/swoole_hook_mysql.php index e9684872a..b7c9b8c12 100644 --- a/src/SPC/builder/extension/swoole_hook_mysql.php +++ b/src/SPC/builder/extension/swoole_hook_mysql.php @@ -29,7 +29,8 @@ public function runCliCheckUnix(): void if ($this->builder->getExt('swoole') === null) { return; } - [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n --ri "swoole"', false); + putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); + [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n'. $this->getSharedExtensionLoadString() . ' --ri "swoole"', false); $out = implode('', $out); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); diff --git a/src/SPC/builder/extension/swoole_hook_pgsql.php b/src/SPC/builder/extension/swoole_hook_pgsql.php index 113b8eb67..68661bd5a 100644 --- a/src/SPC/builder/extension/swoole_hook_pgsql.php +++ b/src/SPC/builder/extension/swoole_hook_pgsql.php @@ -37,7 +37,9 @@ public function runCliCheckUnix(): void if ($this->builder->getExt('swoole') === null) { return; } - [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n --ri "swoole"', false); + $sharedExtensions = $this->getSharedExtensionLoadString(); + putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); + [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); $out = implode('', $out); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); diff --git a/src/SPC/builder/extension/swoole_hook_sqlite.php b/src/SPC/builder/extension/swoole_hook_sqlite.php index 7948dd291..cb217539b 100644 --- a/src/SPC/builder/extension/swoole_hook_sqlite.php +++ b/src/SPC/builder/extension/swoole_hook_sqlite.php @@ -37,7 +37,9 @@ public function runCliCheckUnix(): void if ($this->builder->getExt('swoole') === null) { return; } - [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n --ri "swoole"', false); + $sharedExtensions = $this->getSharedExtensionLoadString(); + putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); + [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); $out = implode('', $out); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); From 92acb95a58940b829971344325e1436ef93f907f Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 25 May 2025 18:39:11 +0700 Subject: [PATCH 084/204] linter --- src/SPC/builder/extension/swoole_hook_mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/swoole_hook_mysql.php b/src/SPC/builder/extension/swoole_hook_mysql.php index b7c9b8c12..55a58af3b 100644 --- a/src/SPC/builder/extension/swoole_hook_mysql.php +++ b/src/SPC/builder/extension/swoole_hook_mysql.php @@ -30,7 +30,7 @@ public function runCliCheckUnix(): void return; } putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); - [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n'. $this->getSharedExtensionLoadString() . ' --ri "swoole"', false); + [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $this->getSharedExtensionLoadString() . ' --ri "swoole"', false); $out = implode('', $out); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); From b68701f51bc636edb7210f069ef7ca7f97d32ba7 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 27 May 2025 12:18:31 +0700 Subject: [PATCH 085/204] updated the static-php spx --- config/source.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/source.json b/config/source.json index dcf2ec581..a4b25cb8d 100644 --- a/config/source.json +++ b/config/source.json @@ -859,7 +859,7 @@ "spx": { "type": "git", "rev": "master", - "url": "https://github.com/henderkes/php-spx.git", + "url": "https://github.com/static-php/php-spx.git", "path": "php-src/ext/spx", "license": { "type": "file", From 4299abf68b083035e5db00b1f4046491e8195ef7 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 30 May 2025 15:38:06 +0800 Subject: [PATCH 086/204] Update vitepress version, fix selecting all options --- docs/.vitepress/components/CliGenerator.vue | 23 +- package.json | 2 +- yarn.lock | 1554 ++++++++++--------- 3 files changed, 858 insertions(+), 721 deletions(-) diff --git a/docs/.vitepress/components/CliGenerator.vue b/docs/.vitepress/components/CliGenerator.vue index 4c8d096a7..14a14af7a 100644 --- a/docs/.vitepress/components/CliGenerator.vue +++ b/docs/.vitepress/components/CliGenerator.vue @@ -45,6 +45,7 @@

TIP

{{ I18N[lang].depTips }}

+

{{ I18N[lang].depTips2 }}

{{ I18N[lang].buildTarget }}

@@ -263,6 +264,7 @@ const I18N = { selectedSystem: '选择操作系统', buildLibs: '要构建的库', depTips: '选择扩展后,不可选中的项目为必需的依赖,编译的依赖库列表中可选的为现有扩展和依赖库的可选依赖。选择可选依赖后,将生成 --with-libs 参数。', + depTips2: '无法同时构建所有扩展,因为有些扩展之间相互冲突。请根据需要选择扩展。', microUnavailable: 'micro 不支持 PHP 7.4 及更早版本!', windowsSAPIUnavailable: 'Windows 目前不支持 fpm、embed 构建!', useUPX: '是否开启 UPX 压缩(减小二进制体积)', @@ -298,6 +300,7 @@ const I18N = { selectedSystem: 'Select Build OS', buildLibs: 'Select Dependencies', depTips: 'After selecting the extensions, the unselectable items are essential dependencies. In the compiled dependencies list, optional dependencies consist of existing extensions and optional dependencies of libraries. Optional dependencies will be added in --with-libs parameter.', + depTips2: 'It is not possible to build all extensions at the same time, as some extensions conflict with each other. Please select the extensions you need.', microUnavailable: 'Micro does not support PHP 7.4 and earlier versions!', windowsSAPIUnavailable: 'Windows does not support fpm and embed build!', useUPX: 'Enable UPX compression (reduce binary size)', @@ -335,23 +338,7 @@ const selectCommon = () => { }; const selectAll = () => { - checkedExts.value = [ - 'amqp', 'apcu', 'ast', 'bcmath', 'bz2', 'calendar', 'ctype', 'curl', - 'dba', 'dio', 'dom', 'ds', 'ev', 'event', 'exif', 'ffi', 'fileinfo', - 'filter', 'ftp', 'gd', 'gettext', 'gmp', 'gmssl', 'grpc', 'iconv', - 'igbinary', 'imagick', 'imap', 'inotify', 'intl', 'ldap', 'libxml', - 'mbregex', 'mbstring', 'memcache', 'mongodb', 'msgpack', 'mysqli', - 'mysqlnd', 'odbc', 'opcache', 'openssl', 'opentelemetry', 'parallel', - 'password-argon2', 'pcntl', 'pdo', 'pdo_mysql', 'pdo_odbc', - 'pdo_pgsql', 'pdo_sqlite', 'pdo_sqlsrv', 'pgsql', 'phar', 'posix', - 'protobuf', 'rar', 'rdkafka', 'readline', 'redis', 'session', 'shmop', - 'simdjson', 'simplexml', 'snappy', 'soap', 'sockets', 'sodium', 'spx', - 'sqlite3', 'sqlsrv', 'ssh2', 'swoole', 'swoole-hook-mysql', - 'swoole-hook-pgsql', 'swoole-hook-sqlite', 'swow', 'sysvmsg', - 'sysvsem', 'sysvshm', 'tidy', 'tokenizer', 'uuid', 'uv', 'xdebug', - 'xhprof', 'xlswriter', 'xml', 'xmlreader', 'xmlwriter', 'xsl', 'yac', - 'zip', 'zlib', - ]; + checkedExts.value = extFilter.value; }; const extList = computed(() => { @@ -381,7 +368,7 @@ const checkedTargets = ref(['cli']); const selectedEnv = ref('spc'); // chosen php version -const selectedPhpVersion = ref('8.2'); +const selectedPhpVersion = ref('8.4'); // chosen debug const debug = ref(0); diff --git a/package.json b/package.json index 4b4487159..da1bbb880 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "docs:preview": "vitepress preview docs" }, "devDependencies": { - "vitepress": "^1.0.0-rc.35", + "vitepress": "^2.0.0-alpha.5", "vue": "^3.2.47" } } diff --git a/yarn.lock b/yarn.lock index 1e18c1b2d..3e357ce9c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,819 +2,969 @@ # yarn lockfile v1 -"@algolia/autocomplete-core@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.9.3.tgz#1d56482a768c33aae0868c8533049e02e8961be7" - integrity sha512-009HdfugtGCdC4JdXUbVJClA0q0zh24yyePn+KUGk3rP7j8FEe/m5Yo/z65gn6nP/cM39PxpzqKrL7A6fP6PPw== - dependencies: - "@algolia/autocomplete-plugin-algolia-insights" "1.9.3" - "@algolia/autocomplete-shared" "1.9.3" - -"@algolia/autocomplete-plugin-algolia-insights@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.9.3.tgz#9b7f8641052c8ead6d66c1623d444cbe19dde587" - integrity sha512-a/yTUkcO/Vyy+JffmAnTWbr4/90cLzw+CC3bRbhnULr/EM0fGNvM13oQQ14f2moLMcVDyAx/leczLlAOovhSZg== - dependencies: - "@algolia/autocomplete-shared" "1.9.3" - -"@algolia/autocomplete-preset-algolia@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.9.3.tgz#64cca4a4304cfcad2cf730e83067e0c1b2f485da" - integrity sha512-d4qlt6YmrLMYy95n5TB52wtNDr6EgAIPH81dvvvW8UmuWRgxEtY0NJiPwl/h95JtG2vmRM804M0DSwMCNZlzRA== - dependencies: - "@algolia/autocomplete-shared" "1.9.3" - -"@algolia/autocomplete-shared@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-shared/-/autocomplete-shared-1.9.3.tgz#2e22e830d36f0a9cf2c0ccd3c7f6d59435b77dfa" - integrity sha512-Wnm9E4Ye6Rl6sTTqjoymD+l8DjSTHsHboVRYrKgEt8Q7UHm9nYbqhN/i0fhUYA3OAEH7WA8x3jfpnmJm3rKvaQ== - -"@algolia/cache-browser-local-storage@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.24.0.tgz#97bc6d067a9fd932b9c922faa6b7fd6e546e1348" - integrity sha512-t63W9BnoXVrGy9iYHBgObNXqYXM3tYXCjDSHeNwnsc324r4o5UiVKUiAB4THQ5z9U5hTj6qUvwg/Ez43ZD85ww== - dependencies: - "@algolia/cache-common" "4.24.0" - -"@algolia/cache-common@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/cache-common/-/cache-common-4.24.0.tgz#81a8d3a82ceb75302abb9b150a52eba9960c9744" - integrity sha512-emi+v+DmVLpMGhp0V9q9h5CdkURsNmFC+cOS6uK9ndeJm9J4TiqSvPYVu+THUP8P/S08rxf5x2P+p3CfID0Y4g== - -"@algolia/cache-in-memory@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/cache-in-memory/-/cache-in-memory-4.24.0.tgz#ffcf8872f3a10cb85c4f4641bdffd307933a6e44" - integrity sha512-gDrt2so19jW26jY3/MkFg5mEypFIPbPoXsQGQWAi6TrCPsNOSEYepBMPlucqWigsmEy/prp5ug2jy/N3PVG/8w== - dependencies: - "@algolia/cache-common" "4.24.0" - -"@algolia/client-account@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.24.0.tgz#eba7a921d828e7c8c40a32d4add21206c7fe12f1" - integrity sha512-adcvyJ3KjPZFDybxlqnf+5KgxJtBjwTPTeyG2aOyoJvx0Y8dUQAEOEVOJ/GBxX0WWNbmaSrhDURMhc+QeevDsA== - dependencies: - "@algolia/client-common" "4.24.0" - "@algolia/client-search" "4.24.0" - "@algolia/transporter" "4.24.0" - -"@algolia/client-analytics@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-4.24.0.tgz#9d2576c46a9093a14e668833c505ea697a1a3e30" - integrity sha512-y8jOZt1OjwWU4N2qr8G4AxXAzaa8DBvyHTWlHzX/7Me1LX8OayfgHexqrsL4vSBcoMmVw2XnVW9MhL+Y2ZDJXg== - dependencies: - "@algolia/client-common" "4.24.0" - "@algolia/client-search" "4.24.0" - "@algolia/requester-common" "4.24.0" - "@algolia/transporter" "4.24.0" - -"@algolia/client-common@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.24.0.tgz#77c46eee42b9444a1d1c1583a83f7df4398a649d" - integrity sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA== - dependencies: - "@algolia/requester-common" "4.24.0" - "@algolia/transporter" "4.24.0" - -"@algolia/client-personalization@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-4.24.0.tgz#8b47789fb1cb0f8efbea0f79295b7c5a3850f6ae" - integrity sha512-l5FRFm/yngztweU0HdUzz1rC4yoWCFo3IF+dVIVTfEPg906eZg5BOd1k0K6rZx5JzyyoP4LdmOikfkfGsKVE9w== - dependencies: - "@algolia/client-common" "4.24.0" - "@algolia/requester-common" "4.24.0" - "@algolia/transporter" "4.24.0" - -"@algolia/client-search@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.24.0.tgz#75e6c02d33ef3e0f34afd9962c085b856fc4a55f" - integrity sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA== - dependencies: - "@algolia/client-common" "4.24.0" - "@algolia/requester-common" "4.24.0" - "@algolia/transporter" "4.24.0" - -"@algolia/logger-common@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.24.0.tgz#28d439976019ec0a46ba7a1a739ef493d4ef8123" - integrity sha512-LLUNjkahj9KtKYrQhFKCzMx0BY3RnNP4FEtO+sBybCjJ73E8jNdaKJ/Dd8A/VA4imVHP5tADZ8pn5B8Ga/wTMA== - -"@algolia/logger-console@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/logger-console/-/logger-console-4.24.0.tgz#c6ff486036cd90b81d07a95aaba04461da7e1c65" - integrity sha512-X4C8IoHgHfiUROfoRCV+lzSy+LHMgkoEEU1BbKcsfnV0i0S20zyy0NLww9dwVHUWNfPPxdMU+/wKmLGYf96yTg== - dependencies: - "@algolia/logger-common" "4.24.0" - -"@algolia/recommend@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/recommend/-/recommend-4.24.0.tgz#8a3f78aea471ee0a4836b78fd2aad4e9abcaaf34" - integrity sha512-P9kcgerfVBpfYHDfVZDvvdJv0lEoCvzNlOy2nykyt5bK8TyieYyiD0lguIJdRZZYGre03WIAFf14pgE+V+IBlw== - dependencies: - "@algolia/cache-browser-local-storage" "4.24.0" - "@algolia/cache-common" "4.24.0" - "@algolia/cache-in-memory" "4.24.0" - "@algolia/client-common" "4.24.0" - "@algolia/client-search" "4.24.0" - "@algolia/logger-common" "4.24.0" - "@algolia/logger-console" "4.24.0" - "@algolia/requester-browser-xhr" "4.24.0" - "@algolia/requester-common" "4.24.0" - "@algolia/requester-node-http" "4.24.0" - "@algolia/transporter" "4.24.0" - -"@algolia/requester-browser-xhr@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.24.0.tgz#313c5edab4ed73a052e75803855833b62dd19c16" - integrity sha512-Z2NxZMb6+nVXSjF13YpjYTdvV3032YTBSGm2vnYvYPA6mMxzM3v5rsCiSspndn9rzIW4Qp1lPHBvuoKJV6jnAA== - dependencies: - "@algolia/requester-common" "4.24.0" - -"@algolia/requester-common@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.24.0.tgz#1c60c198031f48fcdb9e34c4057a3ea987b9a436" - integrity sha512-k3CXJ2OVnvgE3HMwcojpvY6d9kgKMPRxs/kVohrwF5WMr2fnqojnycZkxPoEg+bXm8fi5BBfFmOqgYztRtHsQA== - -"@algolia/requester-node-http@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.24.0.tgz#4461593714031d02aa7da221c49df675212f482f" - integrity sha512-JF18yTjNOVYvU/L3UosRcvbPMGT9B+/GQWNWnenIImglzNVGpyzChkXLnrSf6uxwVNO6ESGu6oN8MqcGQcjQJw== - dependencies: - "@algolia/requester-common" "4.24.0" - -"@algolia/transporter@4.24.0": - version "4.24.0" - resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.24.0.tgz#226bb1f8af62430374c1972b2e5c8580ab275102" - integrity sha512-86nI7w6NzWxd1Zp9q3413dRshDqAzSbsQjhcDhPIatEFiZrL1/TjnHL8S7jVKFePlIMzDsZWXAXwXzcok9c5oA== - dependencies: - "@algolia/cache-common" "4.24.0" - "@algolia/logger-common" "4.24.0" - "@algolia/requester-common" "4.24.0" - -"@babel/parser@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.7.tgz#9a5226f92f0c5c8ead550b750f5608e766c8ce85" - integrity sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw== - -"@docsearch/css@3.6.0", "@docsearch/css@^3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@docsearch/css/-/css-3.6.0.tgz#0e9f56f704b3a34d044d15fd9962ebc1536ba4fb" - integrity sha512-+sbxb71sWre+PwDK7X2T8+bhS6clcVMLwBPznX45Qu6opJcgRjAp7gYSDzVFp187J+feSj5dNBN1mJoi6ckkUQ== - -"@docsearch/js@^3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@docsearch/js/-/js-3.6.0.tgz#f9e46943449b9092d874944f7a80bcc071004cfb" - integrity sha512-QujhqINEElrkIfKwyyyTfbsfMAYCkylInLYMRqHy7PHc8xTBQCow73tlo/Kc7oIwBrCLf0P3YhjlOeV4v8hevQ== - dependencies: - "@docsearch/react" "3.6.0" +"@algolia/autocomplete-core@1.17.9": + version "1.17.9" + resolved "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.17.9.tgz" + integrity sha512-O7BxrpLDPJWWHv/DLA9DRFWs+iY1uOJZkqUwjS5HSZAGcl0hIVCQ97LTLewiZmZ402JYUrun+8NqFP+hCknlbQ== + dependencies: + "@algolia/autocomplete-plugin-algolia-insights" "1.17.9" + "@algolia/autocomplete-shared" "1.17.9" + +"@algolia/autocomplete-plugin-algolia-insights@1.17.9": + version "1.17.9" + resolved "https://registry.npmjs.org/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.17.9.tgz" + integrity sha512-u1fEHkCbWF92DBeB/KHeMacsjsoI0wFhjZtlCq2ddZbAehshbZST6Hs0Avkc0s+4UyBGbMDnSuXHLuvRWK5iDQ== + dependencies: + "@algolia/autocomplete-shared" "1.17.9" + +"@algolia/autocomplete-preset-algolia@1.17.9": + version "1.17.9" + resolved "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.17.9.tgz" + integrity sha512-Na1OuceSJeg8j7ZWn5ssMu/Ax3amtOwk76u4h5J4eK2Nx2KB5qt0Z4cOapCsxot9VcEN11ADV5aUSlQF4RhGjQ== + dependencies: + "@algolia/autocomplete-shared" "1.17.9" + +"@algolia/autocomplete-shared@1.17.9": + version "1.17.9" + resolved "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.17.9.tgz" + integrity sha512-iDf05JDQ7I0b7JEA/9IektxN/80a2MZ1ToohfmNS3rfeuQnIKI3IJlIafD0xu4StbtQTghx9T3Maa97ytkXenQ== + +"@algolia/client-abtesting@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.25.0.tgz" + integrity sha512-1pfQulNUYNf1Tk/svbfjfkLBS36zsuph6m+B6gDkPEivFmso/XnRgwDvjAx80WNtiHnmeNjIXdF7Gos8+OLHqQ== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/client-analytics@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.25.0.tgz" + integrity sha512-AFbG6VDJX/o2vDd9hqncj1B6B4Tulk61mY0pzTtzKClyTDlNP0xaUiEKhl6E7KO9I/x0FJF5tDCm0Hn6v5x18A== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/client-common@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.25.0.tgz" + integrity sha512-il1zS/+Rc6la6RaCdSZ2YbJnkQC6W1wiBO8+SH+DE6CPMWBU6iDVzH0sCKSAtMWl9WBxoN6MhNjGBnCv9Yy2bA== + +"@algolia/client-insights@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.25.0.tgz" + integrity sha512-blbjrUH1siZNfyCGeq0iLQu00w3a4fBXm0WRIM0V8alcAPo7rWjLbMJMrfBtzL9X5ic6wgxVpDADXduGtdrnkw== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/client-personalization@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.25.0.tgz" + integrity sha512-aywoEuu1NxChBcHZ1pWaat0Plw7A8jDMwjgRJ00Mcl7wGlwuPt5dJ/LTNcg3McsEUbs2MBNmw0ignXBw9Tbgow== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/client-query-suggestions@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.25.0.tgz" + integrity sha512-a/W2z6XWKjKjIW1QQQV8PTTj1TXtaKx79uR3NGBdBdGvVdt24KzGAaN7sCr5oP8DW4D3cJt44wp2OY/fZcPAVA== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/client-search@>= 4.9.1 < 6", "@algolia/client-search@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.25.0.tgz" + integrity sha512-9rUYcMIBOrCtYiLX49djyzxqdK9Dya/6Z/8sebPn94BekT+KLOpaZCuc6s0Fpfq7nx5J6YY5LIVFQrtioK9u0g== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/ingestion@1.25.0": + version "1.25.0" + resolved "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.25.0.tgz" + integrity sha512-jJeH/Hk+k17Vkokf02lkfYE4A+EJX+UgnMhTLR/Mb+d1ya5WhE+po8p5a/Nxb6lo9OLCRl6w3Hmk1TX1e9gVbQ== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/monitoring@1.25.0": + version "1.25.0" + resolved "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.25.0.tgz" + integrity sha512-Ls3i1AehJ0C6xaHe7kK9vPmzImOn5zBg7Kzj8tRYIcmCWVyuuFwCIsbuIIz/qzUf1FPSWmw0TZrGeTumk2fqXg== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/recommend@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.25.0.tgz" + integrity sha512-79sMdHpiRLXVxSjgw7Pt4R1aNUHxFLHiaTDnN2MQjHwJ1+o3wSseb55T9VXU4kqy3m7TUme3pyRhLk5ip/S4Mw== + dependencies: + "@algolia/client-common" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +"@algolia/requester-browser-xhr@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.25.0.tgz" + integrity sha512-JLaF23p1SOPBmfEqozUAgKHQrGl3z/Z5RHbggBu6s07QqXXcazEsub5VLonCxGVqTv6a61AAPr8J1G5HgGGjEw== + dependencies: + "@algolia/client-common" "5.25.0" + +"@algolia/requester-fetch@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.25.0.tgz" + integrity sha512-rtzXwqzFi1edkOF6sXxq+HhmRKDy7tz84u0o5t1fXwz0cwx+cjpmxu/6OQKTdOJFS92JUYHsG51Iunie7xbqfQ== + dependencies: + "@algolia/client-common" "5.25.0" + +"@algolia/requester-node-http@5.25.0": + version "5.25.0" + resolved "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.25.0.tgz" + integrity sha512-ZO0UKvDyEFvyeJQX0gmZDQEvhLZ2X10K+ps6hViMo1HgE2V8em00SwNsQ+7E/52a+YiBkVWX61pJJJE44juDMQ== + dependencies: + "@algolia/client-common" "5.25.0" + +"@babel/helper-string-parser@^7.27.1": + version "7.27.1" + resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz" + integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== + +"@babel/helper-validator-identifier@^7.27.1": + version "7.27.1" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz" + integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== + +"@babel/parser@^7.27.2": + version "7.27.3" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.27.3.tgz" + integrity sha512-xyYxRj6+tLNDTWi0KCBcZ9V7yg3/lwL9DWh9Uwh/RIVlIfFidggcgxKX3GCXwCiswwcGRawBKbEg2LG/Y8eJhw== + dependencies: + "@babel/types" "^7.27.3" + +"@babel/types@^7.27.3": + version "7.27.3" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.27.3.tgz" + integrity sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw== + dependencies: + "@babel/helper-string-parser" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" + +"@docsearch/css@^3.9.0", "@docsearch/css@3.9.0": + version "3.9.0" + resolved "https://registry.npmjs.org/@docsearch/css/-/css-3.9.0.tgz" + integrity sha512-cQbnVbq0rrBwNAKegIac/t6a8nWoUAn8frnkLFW6YARaRmAQr5/Eoe6Ln2fqkUCZ40KpdrKbpSAmgrkviOxuWA== + +"@docsearch/js@^3.9.0": + version "3.9.0" + resolved "https://registry.npmjs.org/@docsearch/js/-/js-3.9.0.tgz" + integrity sha512-4bKHcye6EkLgRE8ze0vcdshmEqxeiJM77M0JXjef7lrYZfSlMunrDOCqyLjiZyo1+c0BhUqA2QpFartIjuHIjw== + dependencies: + "@docsearch/react" "3.9.0" preact "^10.0.0" -"@docsearch/react@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@docsearch/react/-/react-3.6.0.tgz#b4f25228ecb7fc473741aefac592121e86dd2958" - integrity sha512-HUFut4ztcVNmqy9gp/wxNbC7pTOHhgVVkHVGCACTuLhUKUhKAF9KYHJtMiLUJxEqiFLQiuri1fWF8zqwM/cu1w== - dependencies: - "@algolia/autocomplete-core" "1.9.3" - "@algolia/autocomplete-preset-algolia" "1.9.3" - "@docsearch/css" "3.6.0" - algoliasearch "^4.19.1" - -"@esbuild/aix-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" - integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== - -"@esbuild/android-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" - integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== - -"@esbuild/android-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" - integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== - -"@esbuild/android-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" - integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== - -"@esbuild/darwin-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" - integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== - -"@esbuild/darwin-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" - integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== - -"@esbuild/freebsd-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" - integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== - -"@esbuild/freebsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" - integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== - -"@esbuild/linux-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" - integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== - -"@esbuild/linux-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" - integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== - -"@esbuild/linux-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" - integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== - -"@esbuild/linux-loong64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" - integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== - -"@esbuild/linux-mips64el@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" - integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== - -"@esbuild/linux-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" - integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== - -"@esbuild/linux-riscv64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" - integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== - -"@esbuild/linux-s390x@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" - integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== - -"@esbuild/linux-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz#6d8f0c768e070e64309af8004bb94e68ab2bb3b0" - integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== - -"@esbuild/netbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" - integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== - -"@esbuild/openbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" - integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== - -"@esbuild/sunos-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" - integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== - -"@esbuild/win32-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" - integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== - -"@esbuild/win32-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" - integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== - -"@esbuild/win32-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" - integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== - -"@jridgewell/sourcemap-codec@^1.4.15": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== - -"@rollup/rollup-android-arm-eabi@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz#bbd0e616b2078cd2d68afc9824d1fadb2f2ffd27" - integrity sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ== - -"@rollup/rollup-android-arm64@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz#97255ef6384c5f73f4800c0de91f5f6518e21203" - integrity sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA== - -"@rollup/rollup-darwin-arm64@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz#b6dd74e117510dfe94541646067b0545b42ff096" - integrity sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w== - -"@rollup/rollup-darwin-x64@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz#e07d76de1cec987673e7f3d48ccb8e106d42c05c" - integrity sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA== - -"@rollup/rollup-linux-arm-gnueabihf@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz#9f1a6d218b560c9d75185af4b8bb42f9f24736b8" - integrity sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA== - -"@rollup/rollup-linux-arm-musleabihf@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz#53618b92e6ffb642c7b620e6e528446511330549" - integrity sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A== - -"@rollup/rollup-linux-arm64-gnu@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz#99a7ba5e719d4f053761a698f7b52291cefba577" - integrity sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw== - -"@rollup/rollup-linux-arm64-musl@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz#f53db99a45d9bc00ce94db8a35efa7c3c144a58c" - integrity sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ== - -"@rollup/rollup-linux-powerpc64le-gnu@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz#cbb0837408fe081ce3435cf3730e090febafc9bf" - integrity sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA== - -"@rollup/rollup-linux-riscv64-gnu@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz#8ed09c1d1262ada4c38d791a28ae0fea28b80cc9" - integrity sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg== - -"@rollup/rollup-linux-s390x-gnu@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz#938138d3c8e0c96f022252a28441dcfb17afd7ec" - integrity sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg== - -"@rollup/rollup-linux-x64-gnu@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz#1a7481137a54740bee1ded4ae5752450f155d942" - integrity sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w== - -"@rollup/rollup-linux-x64-musl@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz#f1186afc601ac4f4fc25fac4ca15ecbee3a1874d" - integrity sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg== - -"@rollup/rollup-win32-arm64-msvc@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz#ed6603e93636a96203c6915be4117245c1bd2daf" - integrity sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA== - -"@rollup/rollup-win32-ia32-msvc@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz#14e0b404b1c25ebe6157a15edb9c46959ba74c54" - integrity sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg== - -"@rollup/rollup-win32-x64-msvc@4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz#5d694d345ce36b6ecf657349e03eb87297e68da4" - integrity sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g== - -"@shikijs/core@1.10.0", "@shikijs/core@^1.6.2": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@shikijs/core/-/core-1.10.0.tgz#ec3356ace7cb8b41f6baee0116f036fca85054cc" - integrity sha512-BZcr6FCmPfP6TXaekvujZcnkFmJHZ/Yglu97r/9VjzVndQA56/F4WjUKtJRQUnK59Wi7p/UTAOekMfCJv7jnYg== - -"@shikijs/transformers@^1.6.2": - version "1.10.0" - resolved "https://registry.yarnpkg.com/@shikijs/transformers/-/transformers-1.10.0.tgz#327a8d63d0d0fd5237ee41c4444376723b7c5a2c" - integrity sha512-5Eu/kuJu7/CzAjFlTJkyyPoLTLSVQZ31Ps81cjIeR/3PDJ2RUuX1/R8d0qFziBKToym1LXbNiXoJQq0mg5+Cwg== - dependencies: - shiki "1.10.0" - -"@types/estree@1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" - integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== - -"@types/linkify-it@^5": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-5.0.0.tgz#21413001973106cda1c3a9b91eedd4ccd5469d76" - integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q== +"@docsearch/react@3.9.0": + version "3.9.0" + resolved "https://registry.npmjs.org/@docsearch/react/-/react-3.9.0.tgz" + integrity sha512-mb5FOZYZIkRQ6s/NWnM98k879vu5pscWqTLubLFBO87igYYT4VzVazh4h5o/zCvTIZgEt3PvsCOMOswOUo9yHQ== + dependencies: + "@algolia/autocomplete-core" "1.17.9" + "@algolia/autocomplete-preset-algolia" "1.17.9" + "@docsearch/css" "3.9.0" + algoliasearch "^5.14.2" + +"@esbuild/darwin-arm64@0.25.5": + version "0.25.5" + resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz" + integrity sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ== -"@types/markdown-it@^14.1.1": - version "14.1.1" - resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-14.1.1.tgz#06bafb7a4e3f77b62b1f308acf7df76687887e0b" - integrity sha512-4NpsnpYl2Gt1ljyBGrKMxFYAYvpqbnnkgP/i/g+NLpjEUa3obn1XJCur9YbEXKDAkaXqsR1LbDnGEJ0MmKFxfg== +"@iconify-json/simple-icons@^1.2.32": + version "1.2.36" + resolved "https://registry.npmjs.org/@iconify-json/simple-icons/-/simple-icons-1.2.36.tgz" + integrity sha512-ZMpVdoW/7hhbt2aHVSvudjH8eSVNNjKkAAjwAQHgiuPUiIfbvNakVin+H9uhUz4N9TbDT/nanzV/4Slb+6dDXw== dependencies: - "@types/linkify-it" "^5" - "@types/mdurl" "^2" + "@iconify/types" "*" -"@types/mdurl@^2": +"@iconify/types@*": version "2.0.0" - resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-2.0.0.tgz#d43878b5b20222682163ae6f897b20447233bdfd" - integrity sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg== - -"@types/web-bluetooth@^0.0.20": - version "0.0.20" - resolved "https://registry.yarnpkg.com/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz#f066abfcd1cbe66267cdbbf0de010d8a41b41597" - integrity sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow== - -"@vitejs/plugin-vue@^5.0.5": - version "5.0.5" - resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-5.0.5.tgz#e3dc11e427d4b818b7e3202766ad156e3d5e2eaa" - integrity sha512-LOjm7XeIimLBZyzinBQ6OSm3UBCNVCpLkxGC0oWmm2YPzVZoxMsdvNVimLTBzpAnR9hl/yn1SHGuRfe6/Td9rQ== - -"@vue/compiler-core@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.4.31.tgz#b51a76f1b30e9b5eba0553264dff0f171aedb7c6" - integrity sha512-skOiodXWTV3DxfDhB4rOf3OGalpITLlgCeOwb+Y9GJpfQ8ErigdBUHomBzvG78JoVE8MJoQsb+qhZiHfKeNeEg== - dependencies: - "@babel/parser" "^7.24.7" - "@vue/shared" "3.4.31" + resolved "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz" + integrity sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg== + +"@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.0" + resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@rollup/rollup-darwin-arm64@4.41.1": + version "4.41.1" + resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.41.1.tgz" + integrity sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w== + +"@shikijs/core@^3.2.2", "@shikijs/core@3.4.2": + version "3.4.2" + resolved "https://registry.npmjs.org/@shikijs/core/-/core-3.4.2.tgz" + integrity sha512-AG8vnSi1W2pbgR2B911EfGqtLE9c4hQBYkv/x7Z+Kt0VxhgQKcW7UNDVYsu9YxwV6u+OJrvdJrMq6DNWoBjihQ== + dependencies: + "@shikijs/types" "3.4.2" + "@shikijs/vscode-textmate" "^10.0.2" + "@types/hast" "^3.0.4" + hast-util-to-html "^9.0.5" + +"@shikijs/engine-javascript@3.4.2": + version "3.4.2" + resolved "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.4.2.tgz" + integrity sha512-1/adJbSMBOkpScCE/SB6XkjJU17ANln3Wky7lOmrnpl+zBdQ1qXUJg2GXTYVHRq+2j3hd1DesmElTXYDgtfSOQ== + dependencies: + "@shikijs/types" "3.4.2" + "@shikijs/vscode-textmate" "^10.0.2" + oniguruma-to-es "^4.3.3" + +"@shikijs/engine-oniguruma@3.4.2": + version "3.4.2" + resolved "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.4.2.tgz" + integrity sha512-zcZKMnNndgRa3ORja6Iemsr3DrLtkX3cAF7lTJkdMB6v9alhlBsX9uNiCpqofNrXOvpA3h6lHcLJxgCIhVOU5Q== + dependencies: + "@shikijs/types" "3.4.2" + "@shikijs/vscode-textmate" "^10.0.2" + +"@shikijs/langs@3.4.2": + version "3.4.2" + resolved "https://registry.npmjs.org/@shikijs/langs/-/langs-3.4.2.tgz" + integrity sha512-H6azIAM+OXD98yztIfs/KH5H4PU39t+SREhmM8LaNXyUrqj2mx+zVkr8MWYqjceSjDw9I1jawm1WdFqU806rMA== + dependencies: + "@shikijs/types" "3.4.2" + +"@shikijs/themes@3.4.2": + version "3.4.2" + resolved "https://registry.npmjs.org/@shikijs/themes/-/themes-3.4.2.tgz" + integrity sha512-qAEuAQh+brd8Jyej2UDDf+b4V2g1Rm8aBIdvt32XhDPrHvDkEnpb7Kzc9hSuHUxz0Iuflmq7elaDuQAP9bHIhg== + dependencies: + "@shikijs/types" "3.4.2" + +"@shikijs/transformers@^3.2.2": + version "3.4.2" + resolved "https://registry.npmjs.org/@shikijs/transformers/-/transformers-3.4.2.tgz" + integrity sha512-I5baLVi/ynLEOZoWSAMlACHNnG+yw5HDmse0oe+GW6U1u+ULdEB3UHiVWaHoJSSONV7tlcVxuaMy74sREDkSvg== + dependencies: + "@shikijs/core" "3.4.2" + "@shikijs/types" "3.4.2" + +"@shikijs/types@^3.2.2", "@shikijs/types@3.4.2": + version "3.4.2" + resolved "https://registry.npmjs.org/@shikijs/types/-/types-3.4.2.tgz" + integrity sha512-zHC1l7L+eQlDXLnxvM9R91Efh2V4+rN3oMVS2swCBssbj2U/FBwybD1eeLaq8yl/iwT+zih8iUbTBCgGZOYlVg== + dependencies: + "@shikijs/vscode-textmate" "^10.0.2" + "@types/hast" "^3.0.4" + +"@shikijs/vscode-textmate@^10.0.2": + version "10.0.2" + resolved "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz" + integrity sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg== + +"@types/estree@1.0.7": + version "1.0.7" + resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz" + integrity sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ== + +"@types/hast@^3.0.0", "@types/hast@^3.0.4": + version "3.0.4" + resolved "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz" + integrity sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ== + dependencies: + "@types/unist" "*" + +"@types/mdast@^4.0.0": + version "4.0.4" + resolved "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz" + integrity sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA== + dependencies: + "@types/unist" "*" + +"@types/unist@*", "@types/unist@^3.0.0": + version "3.0.3" + resolved "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz" + integrity sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q== + +"@types/web-bluetooth@^0.0.21": + version "0.0.21" + resolved "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz" + integrity sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA== + +"@ungap/structured-clone@^1.0.0": + version "1.3.0" + resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz" + integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== + +"@vitejs/plugin-vue@^5.2.3": + version "5.2.4" + resolved "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.4.tgz" + integrity sha512-7Yx/SXSOcQq5HiiV3orevHUFn+pmMB4cgbEkDYgnkUWb0WfeQ/wa2yFv6D5ICiCQOVpjA7vYDXrC7AGO8yjDHA== + +"@vue/compiler-core@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.16.tgz" + integrity sha512-AOQS2eaQOaaZQoL1u+2rCJIKDruNXVBZSiUD3chnUrsoX5ZTQMaCvXlWNIfxBJuU15r1o7+mpo5223KVtIhAgQ== + dependencies: + "@babel/parser" "^7.27.2" + "@vue/shared" "3.5.16" entities "^4.5.0" estree-walker "^2.0.2" - source-map-js "^1.2.0" - -"@vue/compiler-dom@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.4.31.tgz#30961ca847f5d6ad18ffa26236c219f61b195f6b" - integrity sha512-wK424WMXsG1IGMyDGyLqB+TbmEBFM78hIsOJ9QwUVLGrcSk0ak6zYty7Pj8ftm7nEtdU/DGQxAXp0/lM/2cEpQ== - dependencies: - "@vue/compiler-core" "3.4.31" - "@vue/shared" "3.4.31" - -"@vue/compiler-sfc@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.4.31.tgz#cc6bfccda17df8268cc5440842277f61623c591f" - integrity sha512-einJxqEw8IIJxzmnxmJBuK2usI+lJonl53foq+9etB2HAzlPjAS/wa7r0uUpXw5ByX3/0uswVSrjNb17vJm1kQ== - dependencies: - "@babel/parser" "^7.24.7" - "@vue/compiler-core" "3.4.31" - "@vue/compiler-dom" "3.4.31" - "@vue/compiler-ssr" "3.4.31" - "@vue/shared" "3.4.31" + source-map-js "^1.2.1" + +"@vue/compiler-dom@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.16.tgz" + integrity sha512-SSJIhBr/teipXiXjmWOVWLnxjNGo65Oj/8wTEQz0nqwQeP75jWZ0n4sF24Zxoht1cuJoWopwj0J0exYwCJ0dCQ== + dependencies: + "@vue/compiler-core" "3.5.16" + "@vue/shared" "3.5.16" + +"@vue/compiler-sfc@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.16.tgz" + integrity sha512-rQR6VSFNpiinDy/DVUE0vHoIDUF++6p910cgcZoaAUm3POxgNOOdS/xgoll3rNdKYTYPnnbARDCZOyZ+QSe6Pw== + dependencies: + "@babel/parser" "^7.27.2" + "@vue/compiler-core" "3.5.16" + "@vue/compiler-dom" "3.5.16" + "@vue/compiler-ssr" "3.5.16" + "@vue/shared" "3.5.16" estree-walker "^2.0.2" - magic-string "^0.30.10" - postcss "^8.4.38" - source-map-js "^1.2.0" + magic-string "^0.30.17" + postcss "^8.5.3" + source-map-js "^1.2.1" -"@vue/compiler-ssr@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.4.31.tgz#f62ffecdf15bacb883d0099780cf9a1e3654bfc4" - integrity sha512-RtefmITAje3fJ8FSg1gwgDhdKhZVntIVbwupdyZDSifZTRMiWxWehAOTCc8/KZDnBOcYQ4/9VWxsTbd3wT0hAA== +"@vue/compiler-ssr@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.16.tgz" + integrity sha512-d2V7kfxbdsjrDSGlJE7my1ZzCXViEcqN6w14DOsDrUCHEA6vbnVCpRFfrc4ryCP/lCKzX2eS1YtnLE/BuC9f/A== dependencies: - "@vue/compiler-dom" "3.4.31" - "@vue/shared" "3.4.31" + "@vue/compiler-dom" "3.5.16" + "@vue/shared" "3.5.16" -"@vue/devtools-api@^7.2.1": - version "7.3.5" - resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-7.3.5.tgz#afd9f3bca50cfff96aebeea3cc3853fd127267f7" - integrity sha512-BSdBBu5hOIv+gBJC9jzYMh5bC27FQwjWLSb8fVAniqlL9gvsqvK27xTgczMf+hgctlszMYQnRm3bpY/j8vhPqw== +"@vue/devtools-api@^7.7.5": + version "7.7.6" + resolved "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.6.tgz" + integrity sha512-b2Xx0KvXZObePpXPYHvBRRJLDQn5nhKjXh7vUhMEtWxz1AYNFOVIsh5+HLP8xDGL7sy+Q7hXeUxPHB/KgbtsPw== dependencies: - "@vue/devtools-kit" "^7.3.5" + "@vue/devtools-kit" "^7.7.6" -"@vue/devtools-kit@^7.3.5": - version "7.3.5" - resolved "https://registry.yarnpkg.com/@vue/devtools-kit/-/devtools-kit-7.3.5.tgz#66669ee94da6c927fc28255477f65aae3f616316" - integrity sha512-wwfi10gJ1HMtjzcd8aIOnzBHlIRqsYDgcDyrKvkeyc0Gbcoe7UrkXRVHZUOtcxxoplHA0PwpT6wFg0uUCmi8Ww== +"@vue/devtools-kit@^7.7.6": + version "7.7.6" + resolved "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.6.tgz" + integrity sha512-geu7ds7tem2Y7Wz+WgbnbZ6T5eadOvozHZ23Atk/8tksHMFOFylKi1xgGlQlVn0wlkEf4hu+vd5ctj1G4kFtwA== dependencies: - "@vue/devtools-shared" "^7.3.5" - birpc "^0.2.17" + "@vue/devtools-shared" "^7.7.6" + birpc "^2.3.0" hookable "^5.5.3" mitt "^3.0.1" perfect-debounce "^1.0.0" speakingurl "^14.0.1" - superjson "^2.2.1" + superjson "^2.2.2" -"@vue/devtools-shared@^7.3.5": - version "7.3.5" - resolved "https://registry.yarnpkg.com/@vue/devtools-shared/-/devtools-shared-7.3.5.tgz#4c4020df6d71ab058518a8f3a272fc7f2682c5d8" - integrity sha512-Rqii3VazmWTi67a86rYopi61n5Ved05EybJCwyrfoO9Ok3MaS/4yRFl706ouoISMlyrASJFEzM0/AiDA6w4f9A== +"@vue/devtools-shared@^7.7.6": + version "7.7.6" + resolved "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.6.tgz" + integrity sha512-yFEgJZ/WblEsojQQceuyK6FzpFDx4kqrz2ohInxNj5/DnhoX023upTv4OD6lNPLAA5LLkbwPVb10o/7b+Y4FVA== dependencies: rfdc "^1.4.1" -"@vue/reactivity@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.4.31.tgz#eda80e90c4f9d7659efe1f5ed99c2dfdc9e93d77" - integrity sha512-VGkTani8SOoVkZNds1PfJ/T1SlAIOf8E58PGAhIOUDYPC4GAmFA2u/E14TDAFcf3vVDKunc4QqCe/SHr8xC65Q== +"@vue/reactivity@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.16.tgz" + integrity sha512-FG5Q5ee/kxhIm1p2bykPpPwqiUBV3kFySsHEQha5BJvjXdZTUfmya7wP7zC39dFuZAcf/PD5S4Lni55vGLMhvA== dependencies: - "@vue/shared" "3.4.31" + "@vue/shared" "3.5.16" -"@vue/runtime-core@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.4.31.tgz#ad3a41ad76385c0429e3e4dbefb81918494e10cf" - integrity sha512-LDkztxeUPazxG/p8c5JDDKPfkCDBkkiNLVNf7XZIUnJ+66GVGkP+TIh34+8LtPisZ+HMWl2zqhIw0xN5MwU1cw== +"@vue/runtime-core@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.16.tgz" + integrity sha512-bw5Ykq6+JFHYxrQa7Tjr+VSzw7Dj4ldR/udyBZbq73fCdJmyy5MPIFR9IX/M5Qs+TtTjuyUTCnmK3lWWwpAcFQ== dependencies: - "@vue/reactivity" "3.4.31" - "@vue/shared" "3.4.31" + "@vue/reactivity" "3.5.16" + "@vue/shared" "3.5.16" -"@vue/runtime-dom@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.4.31.tgz#bae7ad844f944af33699c73581bc36125bab96ce" - integrity sha512-2Auws3mB7+lHhTFCg8E9ZWopA6Q6L455EcU7bzcQ4x6Dn4cCPuqj6S2oBZgN2a8vJRS/LSYYxwFFq2Hlx3Fsaw== +"@vue/runtime-dom@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.16.tgz" + integrity sha512-T1qqYJsG2xMGhImRUV9y/RseB9d0eCYZQ4CWca9ztCuiPj/XWNNN+lkNBuzVbia5z4/cgxdL28NoQCvC0Xcfww== dependencies: - "@vue/reactivity" "3.4.31" - "@vue/runtime-core" "3.4.31" - "@vue/shared" "3.4.31" + "@vue/reactivity" "3.5.16" + "@vue/runtime-core" "3.5.16" + "@vue/shared" "3.5.16" csstype "^3.1.3" -"@vue/server-renderer@3.4.31": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.4.31.tgz#bbe990f793c36d62d05bdbbaf142511d53e159fd" - integrity sha512-D5BLbdvrlR9PE3by9GaUp1gQXlCNadIZytMIb8H2h3FMWJd4oUfkUTEH2wAr3qxoRz25uxbTcbqd3WKlm9EHQA== - dependencies: - "@vue/compiler-ssr" "3.4.31" - "@vue/shared" "3.4.31" - -"@vue/shared@3.4.31", "@vue/shared@^3.4.27": - version "3.4.31" - resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.4.31.tgz#af9981f57def2c3f080c14bf219314fc0dc808a0" - integrity sha512-Yp3wtJk//8cO4NItOPpi3QkLExAr/aLBGZMmTtW9WpdwBCJpRM6zj9WgWktXAl8IDIozwNMByT45JP3tO3ACWA== - -"@vueuse/core@10.11.0", "@vueuse/core@^10.10.0": - version "10.11.0" - resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-10.11.0.tgz#b042585a8bf98bb29c177b33999bd0e3fcd9e65d" - integrity sha512-x3sD4Mkm7PJ+pcq3HX8PLPBadXCAlSDR/waK87dz0gQE+qJnaaFhc/dZVfJz+IUYzTMVGum2QlR7ImiJQN4s6g== - dependencies: - "@types/web-bluetooth" "^0.0.20" - "@vueuse/metadata" "10.11.0" - "@vueuse/shared" "10.11.0" - vue-demi ">=0.14.8" - -"@vueuse/integrations@^10.10.0": - version "10.11.0" - resolved "https://registry.yarnpkg.com/@vueuse/integrations/-/integrations-10.11.0.tgz#ce2746587172af9ab8faa713f42e619609ed0de1" - integrity sha512-Pp6MtWEIr+NDOccWd8j59Kpjy5YDXogXI61Kb1JxvSfVBO8NzFQkmrKmSZz47i+ZqHnIzxaT38L358yDHTncZg== - dependencies: - "@vueuse/core" "10.11.0" - "@vueuse/shared" "10.11.0" - vue-demi ">=0.14.8" - -"@vueuse/metadata@10.11.0": - version "10.11.0" - resolved "https://registry.yarnpkg.com/@vueuse/metadata/-/metadata-10.11.0.tgz#27be47cf115ee98e947a1bfcd0b1b5b35d785fb6" - integrity sha512-kQX7l6l8dVWNqlqyN3ePW3KmjCQO3ZMgXuBMddIu83CmucrsBfXlH+JoviYyRBws/yLTQO8g3Pbw+bdIoVm4oQ== - -"@vueuse/shared@10.11.0": - version "10.11.0" - resolved "https://registry.yarnpkg.com/@vueuse/shared/-/shared-10.11.0.tgz#be09262b2c5857069ed3dadd1680f22c4cb6f984" - integrity sha512-fyNoIXEq3PfX1L3NkNhtVQUSRtqYwJtJg+Bp9rIzculIZWHTkKSysujrOk2J+NrRulLTQH9+3gGSfYLWSEWU1A== - dependencies: - vue-demi ">=0.14.8" - -algoliasearch@^4.19.1: - version "4.24.0" - resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.24.0.tgz#b953b3e2309ef8f25da9de311b95b994ac918275" - integrity sha512-bf0QV/9jVejssFBmz2HQLxUadxk574t4iwjCKp5E7NBzwKkrDEhKPISIIjAU/p6K5qDx3qoeh4+26zWN1jmw3g== - dependencies: - "@algolia/cache-browser-local-storage" "4.24.0" - "@algolia/cache-common" "4.24.0" - "@algolia/cache-in-memory" "4.24.0" - "@algolia/client-account" "4.24.0" - "@algolia/client-analytics" "4.24.0" - "@algolia/client-common" "4.24.0" - "@algolia/client-personalization" "4.24.0" - "@algolia/client-search" "4.24.0" - "@algolia/logger-common" "4.24.0" - "@algolia/logger-console" "4.24.0" - "@algolia/recommend" "4.24.0" - "@algolia/requester-browser-xhr" "4.24.0" - "@algolia/requester-common" "4.24.0" - "@algolia/requester-node-http" "4.24.0" - "@algolia/transporter" "4.24.0" - -birpc@^0.2.17: - version "0.2.17" - resolved "https://registry.yarnpkg.com/birpc/-/birpc-0.2.17.tgz#d0bdb90d4d063061156637f03b7b0adea1779734" - integrity sha512-+hkTxhot+dWsLpp3gia5AkVHIsKlZybNT5gIYiDlNzJrmYPcTM9k5/w2uaj3IPpd7LlEYpmCj4Jj1nC41VhDFg== +"@vue/server-renderer@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.16.tgz" + integrity sha512-BrX0qLiv/WugguGsnQUJiYOE0Fe5mZTwi6b7X/ybGB0vfrPH9z0gD/Y6WOR1sGCgX4gc25L1RYS5eYQKDMoNIg== + dependencies: + "@vue/compiler-ssr" "3.5.16" + "@vue/shared" "3.5.16" + +"@vue/shared@^3.5.13", "@vue/shared@3.5.16": + version "3.5.16" + resolved "https://registry.npmjs.org/@vue/shared/-/shared-3.5.16.tgz" + integrity sha512-c/0fWy3Jw6Z8L9FmTyYfkpM5zklnqqa9+a6dz3DvONRKW2NEbh46BP0FHuLFSWi2TnQEtp91Z6zOWNrU6QiyPg== + +"@vueuse/core@^13.1.0", "@vueuse/core@13.3.0": + version "13.3.0" + resolved "https://registry.npmjs.org/@vueuse/core/-/core-13.3.0.tgz" + integrity sha512-uYRz5oEfebHCoRhK4moXFM3NSCd5vu2XMLOq/Riz5FdqZMy2RvBtazdtL3gEcmDyqkztDe9ZP/zymObMIbiYSg== + dependencies: + "@types/web-bluetooth" "^0.0.21" + "@vueuse/metadata" "13.3.0" + "@vueuse/shared" "13.3.0" + +"@vueuse/integrations@^13.1.0": + version "13.3.0" + resolved "https://registry.npmjs.org/@vueuse/integrations/-/integrations-13.3.0.tgz" + integrity sha512-h5mGRYPbiTZTFP/AKELLPGnUDBly7z7Qd1pgEQlT3ItQ0NlZM0vB+8SOQycpSBOBlgg72Zgw+mi2r+4O/G8RuQ== + dependencies: + "@vueuse/core" "13.3.0" + "@vueuse/shared" "13.3.0" + +"@vueuse/metadata@13.3.0": + version "13.3.0" + resolved "https://registry.npmjs.org/@vueuse/metadata/-/metadata-13.3.0.tgz" + integrity sha512-42IzJIOYCKIb0Yjv1JfaKpx8JlCiTmtCWrPxt7Ja6Wzoq0h79+YVXmBV03N966KEmDEESTbp5R/qO3AB5BDnGw== + +"@vueuse/shared@13.3.0": + version "13.3.0" + resolved "https://registry.npmjs.org/@vueuse/shared/-/shared-13.3.0.tgz" + integrity sha512-L1QKsF0Eg9tiZSFXTgodYnu0Rsa2P0En2LuLrIs/jgrkyiDuJSsPZK+tx+wU0mMsYHUYEjNsuE41uqqkuR8VhA== + +algoliasearch@^5.14.2, "algoliasearch@>= 4.9.1 < 6": + version "5.25.0" + resolved "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.25.0.tgz" + integrity sha512-n73BVorL4HIwKlfJKb4SEzAYkR3Buwfwbh+MYxg2mloFph2fFGV58E90QTzdbfzWrLn4HE5Czx/WTjI8fcHaMg== + dependencies: + "@algolia/client-abtesting" "5.25.0" + "@algolia/client-analytics" "5.25.0" + "@algolia/client-common" "5.25.0" + "@algolia/client-insights" "5.25.0" + "@algolia/client-personalization" "5.25.0" + "@algolia/client-query-suggestions" "5.25.0" + "@algolia/client-search" "5.25.0" + "@algolia/ingestion" "1.25.0" + "@algolia/monitoring" "1.25.0" + "@algolia/recommend" "5.25.0" + "@algolia/requester-browser-xhr" "5.25.0" + "@algolia/requester-fetch" "5.25.0" + "@algolia/requester-node-http" "5.25.0" + +birpc@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/birpc/-/birpc-2.3.0.tgz" + integrity sha512-ijbtkn/F3Pvzb6jHypHRyve2QApOCZDR25D/VnkY2G/lBNcXCTsnsCxgY4k4PkVB7zfwzYbY3O9Lcqe3xufS5g== + +ccount@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz" + integrity sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg== + +character-entities-html4@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz" + integrity sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA== + +character-entities-legacy@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz" + integrity sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ== + +comma-separated-tokens@^2.0.0: + version "2.0.3" + resolved "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz" + integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== copy-anything@^3.0.2: version "3.0.5" - resolved "https://registry.yarnpkg.com/copy-anything/-/copy-anything-3.0.5.tgz#2d92dce8c498f790fa7ad16b01a1ae5a45b020a0" + resolved "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz" integrity sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w== dependencies: is-what "^4.1.8" csstype@^3.1.3: version "3.1.3" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" + resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz" integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== +dequal@^2.0.0: + version "2.0.3" + resolved "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz" + integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== + +devlop@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz" + integrity sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA== + dependencies: + dequal "^2.0.0" + entities@^4.5.0: version "4.5.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" + resolved "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz" integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== -esbuild@^0.21.3: - version "0.21.5" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.5.tgz#9ca301b120922959b766360d8ac830da0d02997d" - integrity sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw== +esbuild@^0.25.0: + version "0.25.5" + resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz" + integrity sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ== optionalDependencies: - "@esbuild/aix-ppc64" "0.21.5" - "@esbuild/android-arm" "0.21.5" - "@esbuild/android-arm64" "0.21.5" - "@esbuild/android-x64" "0.21.5" - "@esbuild/darwin-arm64" "0.21.5" - "@esbuild/darwin-x64" "0.21.5" - "@esbuild/freebsd-arm64" "0.21.5" - "@esbuild/freebsd-x64" "0.21.5" - "@esbuild/linux-arm" "0.21.5" - "@esbuild/linux-arm64" "0.21.5" - "@esbuild/linux-ia32" "0.21.5" - "@esbuild/linux-loong64" "0.21.5" - "@esbuild/linux-mips64el" "0.21.5" - "@esbuild/linux-ppc64" "0.21.5" - "@esbuild/linux-riscv64" "0.21.5" - "@esbuild/linux-s390x" "0.21.5" - "@esbuild/linux-x64" "0.21.5" - "@esbuild/netbsd-x64" "0.21.5" - "@esbuild/openbsd-x64" "0.21.5" - "@esbuild/sunos-x64" "0.21.5" - "@esbuild/win32-arm64" "0.21.5" - "@esbuild/win32-ia32" "0.21.5" - "@esbuild/win32-x64" "0.21.5" + "@esbuild/aix-ppc64" "0.25.5" + "@esbuild/android-arm" "0.25.5" + "@esbuild/android-arm64" "0.25.5" + "@esbuild/android-x64" "0.25.5" + "@esbuild/darwin-arm64" "0.25.5" + "@esbuild/darwin-x64" "0.25.5" + "@esbuild/freebsd-arm64" "0.25.5" + "@esbuild/freebsd-x64" "0.25.5" + "@esbuild/linux-arm" "0.25.5" + "@esbuild/linux-arm64" "0.25.5" + "@esbuild/linux-ia32" "0.25.5" + "@esbuild/linux-loong64" "0.25.5" + "@esbuild/linux-mips64el" "0.25.5" + "@esbuild/linux-ppc64" "0.25.5" + "@esbuild/linux-riscv64" "0.25.5" + "@esbuild/linux-s390x" "0.25.5" + "@esbuild/linux-x64" "0.25.5" + "@esbuild/netbsd-arm64" "0.25.5" + "@esbuild/netbsd-x64" "0.25.5" + "@esbuild/openbsd-arm64" "0.25.5" + "@esbuild/openbsd-x64" "0.25.5" + "@esbuild/sunos-x64" "0.25.5" + "@esbuild/win32-arm64" "0.25.5" + "@esbuild/win32-ia32" "0.25.5" + "@esbuild/win32-x64" "0.25.5" estree-walker@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + resolved "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== -focus-trap@^7.5.4: - version "7.5.4" - resolved "https://registry.yarnpkg.com/focus-trap/-/focus-trap-7.5.4.tgz#6c4e342fe1dae6add9c2aa332a6e7a0bbd495ba2" - integrity sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w== +fdir@^6.4.4: + version "6.4.5" + resolved "https://registry.npmjs.org/fdir/-/fdir-6.4.5.tgz" + integrity sha512-4BG7puHpVsIYxZUbiUE3RqGloLaSSwzYie5jvasC4LWuBWzZawynvYouhjbQKw2JuIGYdm0DzIxl8iVidKlUEw== + +focus-trap@^7, focus-trap@^7.6.4: + version "7.6.5" + resolved "https://registry.npmjs.org/focus-trap/-/focus-trap-7.6.5.tgz" + integrity sha512-7Ke1jyybbbPZyZXFxEftUtxFGLMpE2n6A+z//m4CRDlj0hW+o3iYSmh8nFlYMurOiJVDmJRilUQtJr08KfIxlg== dependencies: tabbable "^6.2.0" fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== +hast-util-to-html@^9.0.5: + version "9.0.5" + resolved "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz" + integrity sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw== + dependencies: + "@types/hast" "^3.0.0" + "@types/unist" "^3.0.0" + ccount "^2.0.0" + comma-separated-tokens "^2.0.0" + hast-util-whitespace "^3.0.0" + html-void-elements "^3.0.0" + mdast-util-to-hast "^13.0.0" + property-information "^7.0.0" + space-separated-tokens "^2.0.0" + stringify-entities "^4.0.0" + zwitch "^2.0.4" + +hast-util-whitespace@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz" + integrity sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw== + dependencies: + "@types/hast" "^3.0.0" + hookable@^5.5.3: version "5.5.3" - resolved "https://registry.yarnpkg.com/hookable/-/hookable-5.5.3.tgz#6cfc358984a1ef991e2518cb9ed4a778bbd3215d" + resolved "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz" integrity sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ== +html-void-elements@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz" + integrity sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg== + is-what@^4.1.8: version "4.1.16" - resolved "https://registry.yarnpkg.com/is-what/-/is-what-4.1.16.tgz#1ad860a19da8b4895ad5495da3182ce2acdd7a6f" + resolved "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz" integrity sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A== -magic-string@^0.30.10: - version "0.30.10" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.10.tgz#123d9c41a0cb5640c892b041d4cfb3bd0aa4b39e" - integrity sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ== +magic-string@^0.30.17: + version "0.30.17" + resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz" + integrity sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA== dependencies: - "@jridgewell/sourcemap-codec" "^1.4.15" + "@jridgewell/sourcemap-codec" "^1.5.0" mark.js@8.11.1: version "8.11.1" - resolved "https://registry.yarnpkg.com/mark.js/-/mark.js-8.11.1.tgz#180f1f9ebef8b0e638e4166ad52db879beb2ffc5" + resolved "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz" integrity sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ== -minisearch@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/minisearch/-/minisearch-6.3.0.tgz#985a2f1ca3c73c2d65af94f0616bfe57164b0b6b" - integrity sha512-ihFnidEeU8iXzcVHy74dhkxh/dn8Dc08ERl0xwoMMGqp4+LvRSCgicb+zGqWthVokQKvCSxITlh3P08OzdTYCQ== +mdast-util-to-hast@^13.0.0: + version "13.2.0" + resolved "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz" + integrity sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA== + dependencies: + "@types/hast" "^3.0.0" + "@types/mdast" "^4.0.0" + "@ungap/structured-clone" "^1.0.0" + devlop "^1.0.0" + micromark-util-sanitize-uri "^2.0.0" + trim-lines "^3.0.0" + unist-util-position "^5.0.0" + unist-util-visit "^5.0.0" + vfile "^6.0.0" + +micromark-util-character@^2.0.0: + version "2.1.1" + resolved "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz" + integrity sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q== + dependencies: + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-util-encode@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz" + integrity sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw== + +micromark-util-sanitize-uri@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz" + integrity sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-encode "^2.0.0" + micromark-util-symbol "^2.0.0" + +micromark-util-symbol@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz" + integrity sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q== + +micromark-util-types@^2.0.0: + version "2.0.2" + resolved "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz" + integrity sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA== + +minisearch@^7.1.2: + version "7.1.2" + resolved "https://registry.npmjs.org/minisearch/-/minisearch-7.1.2.tgz" + integrity sha512-R1Pd9eF+MD5JYDDSPAp/q1ougKglm14uEkPMvQ/05RGmx6G9wvmLTrTI/Q5iPNJLYqNdsDQ7qTGIcNWR+FrHmA== mitt@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1" + resolved "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz" integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw== -nanoid@^3.3.7: - version "3.3.7" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" - integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== +nanoid@^3.3.11: + version "3.3.11" + resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz" + integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w== + +oniguruma-parser@^0.12.1: + version "0.12.1" + resolved "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz" + integrity sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w== + +oniguruma-to-es@^4.3.3: + version "4.3.3" + resolved "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.3.tgz" + integrity sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg== + dependencies: + oniguruma-parser "^0.12.1" + regex "^6.0.1" + regex-recursion "^6.0.2" perfect-debounce@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/perfect-debounce/-/perfect-debounce-1.0.0.tgz#9c2e8bc30b169cc984a58b7d5b28049839591d2a" + resolved "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz" integrity sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA== -picocolors@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" - integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + +"picomatch@^3 || ^4", picomatch@^4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz" + integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== -postcss@^8.4.38: - version "8.4.39" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.39.tgz#aa3c94998b61d3a9c259efa51db4b392e1bde0e3" - integrity sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw== +postcss@^8, postcss@^8.5.3: + version "8.5.4" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.5.4.tgz" + integrity sha512-QSa9EBe+uwlGTFmHsPKokv3B/oEMQZxfqW0QqNCyhpa6mB1afzulwn8hihglqAb2pOw+BJgNlmXQ8la2VeHB7w== dependencies: - nanoid "^3.3.7" - picocolors "^1.0.1" - source-map-js "^1.2.0" + nanoid "^3.3.11" + picocolors "^1.1.1" + source-map-js "^1.2.1" preact@^10.0.0: version "10.22.0" - resolved "https://registry.yarnpkg.com/preact/-/preact-10.22.0.tgz#a50f38006ae438d255e2631cbdaf7488e6dd4e16" + resolved "https://registry.npmjs.org/preact/-/preact-10.22.0.tgz" integrity sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw== +property-information@^7.0.0: + version "7.1.0" + resolved "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz" + integrity sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ== + +regex-recursion@^6.0.2: + version "6.0.2" + resolved "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz" + integrity sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg== + dependencies: + regex-utilities "^2.3.0" + +regex-utilities@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz" + integrity sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng== + +regex@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/regex/-/regex-6.0.1.tgz" + integrity sha512-uorlqlzAKjKQZ5P+kTJr3eeJGSVroLKoHmquUj4zHWuR+hEyNqlXsSKlYYF5F4NI6nl7tWCs0apKJ0lmfsXAPA== + dependencies: + regex-utilities "^2.3.0" + rfdc@^1.4.1: version "1.4.1" - resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca" + resolved "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz" integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA== -rollup@^4.13.0: - version "4.18.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.18.0.tgz#497f60f0c5308e4602cf41136339fbf87d5f5dda" - integrity sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg== +rollup@^4.34.9: + version "4.41.1" + resolved "https://registry.npmjs.org/rollup/-/rollup-4.41.1.tgz" + integrity sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw== dependencies: - "@types/estree" "1.0.5" + "@types/estree" "1.0.7" optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.18.0" - "@rollup/rollup-android-arm64" "4.18.0" - "@rollup/rollup-darwin-arm64" "4.18.0" - "@rollup/rollup-darwin-x64" "4.18.0" - "@rollup/rollup-linux-arm-gnueabihf" "4.18.0" - "@rollup/rollup-linux-arm-musleabihf" "4.18.0" - "@rollup/rollup-linux-arm64-gnu" "4.18.0" - "@rollup/rollup-linux-arm64-musl" "4.18.0" - "@rollup/rollup-linux-powerpc64le-gnu" "4.18.0" - "@rollup/rollup-linux-riscv64-gnu" "4.18.0" - "@rollup/rollup-linux-s390x-gnu" "4.18.0" - "@rollup/rollup-linux-x64-gnu" "4.18.0" - "@rollup/rollup-linux-x64-musl" "4.18.0" - "@rollup/rollup-win32-arm64-msvc" "4.18.0" - "@rollup/rollup-win32-ia32-msvc" "4.18.0" - "@rollup/rollup-win32-x64-msvc" "4.18.0" + "@rollup/rollup-android-arm-eabi" "4.41.1" + "@rollup/rollup-android-arm64" "4.41.1" + "@rollup/rollup-darwin-arm64" "4.41.1" + "@rollup/rollup-darwin-x64" "4.41.1" + "@rollup/rollup-freebsd-arm64" "4.41.1" + "@rollup/rollup-freebsd-x64" "4.41.1" + "@rollup/rollup-linux-arm-gnueabihf" "4.41.1" + "@rollup/rollup-linux-arm-musleabihf" "4.41.1" + "@rollup/rollup-linux-arm64-gnu" "4.41.1" + "@rollup/rollup-linux-arm64-musl" "4.41.1" + "@rollup/rollup-linux-loongarch64-gnu" "4.41.1" + "@rollup/rollup-linux-powerpc64le-gnu" "4.41.1" + "@rollup/rollup-linux-riscv64-gnu" "4.41.1" + "@rollup/rollup-linux-riscv64-musl" "4.41.1" + "@rollup/rollup-linux-s390x-gnu" "4.41.1" + "@rollup/rollup-linux-x64-gnu" "4.41.1" + "@rollup/rollup-linux-x64-musl" "4.41.1" + "@rollup/rollup-win32-arm64-msvc" "4.41.1" + "@rollup/rollup-win32-ia32-msvc" "4.41.1" + "@rollup/rollup-win32-x64-msvc" "4.41.1" fsevents "~2.3.2" -shiki@1.10.0, shiki@^1.6.2: - version "1.10.0" - resolved "https://registry.yarnpkg.com/shiki/-/shiki-1.10.0.tgz#304ab080a12458abc78eb0cb83eb0f7ace546215" - integrity sha512-YD2sXQ+TMD/F9BimV9Jn0wj35pqOvywvOG/3PB6hGHyGKlM7TJ9tyJ02jOb2kF8F0HfJwKNYrh3sW7jEcuRlXA== - dependencies: - "@shikijs/core" "1.10.0" - -source-map-js@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" - integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== +"search-insights@>= 1 < 3": + version "2.17.3" + resolved "https://registry.npmjs.org/search-insights/-/search-insights-2.17.3.tgz" + integrity sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ== + +shiki@^3.2.2: + version "3.4.2" + resolved "https://registry.npmjs.org/shiki/-/shiki-3.4.2.tgz" + integrity sha512-wuxzZzQG8kvZndD7nustrNFIKYJ1jJoWIPaBpVe2+KHSvtzMi4SBjOxrigs8qeqce/l3U0cwiC+VAkLKSunHQQ== + dependencies: + "@shikijs/core" "3.4.2" + "@shikijs/engine-javascript" "3.4.2" + "@shikijs/engine-oniguruma" "3.4.2" + "@shikijs/langs" "3.4.2" + "@shikijs/themes" "3.4.2" + "@shikijs/types" "3.4.2" + "@shikijs/vscode-textmate" "^10.0.2" + "@types/hast" "^3.0.4" + +source-map-js@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== + +space-separated-tokens@^2.0.0: + version "2.0.2" + resolved "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz" + integrity sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q== speakingurl@^14.0.1: version "14.0.1" - resolved "https://registry.yarnpkg.com/speakingurl/-/speakingurl-14.0.1.tgz#f37ec8ddc4ab98e9600c1c9ec324a8c48d772a53" + resolved "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz" integrity sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ== -superjson@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/superjson/-/superjson-2.2.1.tgz#9377a7fa80fedb10c851c9dbffd942d4bcf79733" - integrity sha512-8iGv75BYOa0xRJHK5vRLEjE2H/i4lulTjzpUXic3Eg8akftYjkmQDa8JARQ42rlczXyFR3IeRoeFCc7RxHsYZA== +stringify-entities@^4.0.0: + version "4.0.4" + resolved "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz" + integrity sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg== + dependencies: + character-entities-html4 "^2.0.0" + character-entities-legacy "^3.0.0" + +superjson@^2.2.2: + version "2.2.2" + resolved "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz" + integrity sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q== dependencies: copy-anything "^3.0.2" tabbable@^6.2.0: version "6.2.0" - resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-6.2.0.tgz#732fb62bc0175cfcec257330be187dcfba1f3b97" + resolved "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz" integrity sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew== -vite@^5.2.12: - version "5.3.2" - resolved "https://registry.yarnpkg.com/vite/-/vite-5.3.2.tgz#2f0a8531c71060467ed3e0a205a203f269b6d9c8" - integrity sha512-6lA7OBHBlXUxiJxbO5aAY2fsHHzDr1q7DvXYnyZycRs2Dz+dXBWuhpWHvmljTRTpQC2uvGmUFFkSHF2vGo90MA== +tinyglobby@^0.2.13: + version "0.2.14" + resolved "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz" + integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ== + dependencies: + fdir "^6.4.4" + picomatch "^4.0.2" + +trim-lines@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz" + integrity sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg== + +unist-util-is@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz" + integrity sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw== dependencies: - esbuild "^0.21.3" - postcss "^8.4.38" - rollup "^4.13.0" + "@types/unist" "^3.0.0" + +unist-util-position@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz" + integrity sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA== + dependencies: + "@types/unist" "^3.0.0" + +unist-util-stringify-position@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz" + integrity sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ== + dependencies: + "@types/unist" "^3.0.0" + +unist-util-visit-parents@^6.0.0: + version "6.0.1" + resolved "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz" + integrity sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + +unist-util-visit@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz" + integrity sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + unist-util-visit-parents "^6.0.0" + +vfile-message@^4.0.0: + version "4.0.2" + resolved "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz" + integrity sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-stringify-position "^4.0.0" + +vfile@^6.0.0: + version "6.0.3" + resolved "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz" + integrity sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q== + dependencies: + "@types/unist" "^3.0.0" + vfile-message "^4.0.0" + +"vite@^5.0.0 || ^6.0.0", vite@^6.3.2: + version "6.3.5" + resolved "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz" + integrity sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ== + dependencies: + esbuild "^0.25.0" + fdir "^6.4.4" + picomatch "^4.0.2" + postcss "^8.5.3" + rollup "^4.34.9" + tinyglobby "^0.2.13" optionalDependencies: fsevents "~2.3.3" -vitepress@^1.0.0-rc.35: - version "1.2.3" - resolved "https://registry.yarnpkg.com/vitepress/-/vitepress-1.2.3.tgz#a507d2f5e86c1fbcdb5ec2212f1db4828504df34" - integrity sha512-GvEsrEeNLiDE1+fuwDAYJCYLNZDAna+EtnXlPajhv/MYeTjbNK6Bvyg6NoTdO1sbwuQJ0vuJR99bOlH53bo6lg== - dependencies: - "@docsearch/css" "^3.6.0" - "@docsearch/js" "^3.6.0" - "@shikijs/core" "^1.6.2" - "@shikijs/transformers" "^1.6.2" - "@types/markdown-it" "^14.1.1" - "@vitejs/plugin-vue" "^5.0.5" - "@vue/devtools-api" "^7.2.1" - "@vue/shared" "^3.4.27" - "@vueuse/core" "^10.10.0" - "@vueuse/integrations" "^10.10.0" - focus-trap "^7.5.4" +vitepress@^2.0.0-alpha.5: + version "2.0.0-alpha.5" + resolved "https://registry.npmjs.org/vitepress/-/vitepress-2.0.0-alpha.5.tgz" + integrity sha512-fhuGpJ4CETS/lrAHjKu3m88HwesZvAjZLFeIRr9Jejmewyogn1tm2L6lsVg7PWxPmOGoMfihzl3+L6jg6hrTnA== + dependencies: + "@docsearch/css" "^3.9.0" + "@docsearch/js" "^3.9.0" + "@iconify-json/simple-icons" "^1.2.32" + "@shikijs/core" "^3.2.2" + "@shikijs/transformers" "^3.2.2" + "@shikijs/types" "^3.2.2" + "@vitejs/plugin-vue" "^5.2.3" + "@vue/devtools-api" "^7.7.5" + "@vue/shared" "^3.5.13" + "@vueuse/core" "^13.1.0" + "@vueuse/integrations" "^13.1.0" + focus-trap "^7.6.4" mark.js "8.11.1" - minisearch "^6.3.0" - shiki "^1.6.2" - vite "^5.2.12" - vue "^3.4.27" - -vue-demi@>=0.14.8: - version "0.14.8" - resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.8.tgz#00335e9317b45e4a68d3528aaf58e0cec3d5640a" - integrity sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q== - -vue@^3.2.47, vue@^3.4.27: - version "3.4.31" - resolved "https://registry.yarnpkg.com/vue/-/vue-3.4.31.tgz#83a3c4dab8302b0e974b0d4b92a2f6a6378ae797" - integrity sha512-njqRrOy7W3YLAlVqSKpBebtZpDVg21FPoaq1I7f/+qqBThK9ChAIjkRWgeP6Eat+8C+iia4P3OYqpATP21BCoQ== - dependencies: - "@vue/compiler-dom" "3.4.31" - "@vue/compiler-sfc" "3.4.31" - "@vue/runtime-dom" "3.4.31" - "@vue/server-renderer" "3.4.31" - "@vue/shared" "3.4.31" + minisearch "^7.1.2" + shiki "^3.2.2" + vite "^6.3.2" + vue "^3.5.13" + +vue@^3.2.25, vue@^3.2.47, vue@^3.5.0, vue@^3.5.13, vue@3.5.16: + version "3.5.16" + resolved "https://registry.npmjs.org/vue/-/vue-3.5.16.tgz" + integrity sha512-rjOV2ecxMd5SiAmof2xzh2WxntRcigkX/He4YFJ6WdRvVUrbt6DxC1Iujh10XLl8xCDRDtGKMeO3D+pRQ1PP9w== + dependencies: + "@vue/compiler-dom" "3.5.16" + "@vue/compiler-sfc" "3.5.16" + "@vue/runtime-dom" "3.5.16" + "@vue/server-renderer" "3.5.16" + "@vue/shared" "3.5.16" + +zwitch@^2.0.4: + version "2.0.4" + resolved "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz" + integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A== From 3867b9933de3eb1978b9998e63dd857f9eb96f15 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 30 May 2025 16:18:34 +0700 Subject: [PATCH 087/204] update doc for spx extension --- docs/en/guide/extension-notes.md | 3 +-- docs/zh/guide/extension-notes.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/en/guide/extension-notes.md b/docs/en/guide/extension-notes.md index 83c0b7877..946fd1238 100644 --- a/docs/en/guide/extension-notes.md +++ b/docs/en/guide/extension-notes.md @@ -149,8 +149,7 @@ Parallel is only supported on PHP 8.0 ZTS and above. ## spx -1. The [SPX extension](https://github.com/NoiseByNorthwest/php-spx) only supports NTS mode. -2. SPX does not support Windows, and the official repository does not support static compilation. static-php-cli uses a [modified version](https://github.com/static-php/php-spx). +1. SPX does not support Windows, and the official repository does not support static compilation. static-php-cli uses a [modified version](https://github.com/static-php/php-spx). ## mimalloc diff --git a/docs/zh/guide/extension-notes.md b/docs/zh/guide/extension-notes.md index 762d2df9c..3bba17bb0 100644 --- a/docs/zh/guide/extension-notes.md +++ b/docs/zh/guide/extension-notes.md @@ -139,8 +139,7 @@ parallel 扩展只支持 PHP 8.0 及以上版本,并只支持 ZTS 构建(`-- ## spx -1. [SPX 扩展](https://github.com/NoiseByNorthwest/php-spx) 只支持非线程模式。 -2. SPX 目前不支持 Windows,且官方仓库也不支持静态编译,static-php-cli 使用了 [修改版本](https://github.com/static-php/php-spx)。 +1. SPX 目前不支持 Windows,且官方仓库也不支持静态编译,static-php-cli 使用了 [修改版本](https://github.com/static-php/php-spx)。 ## mimalloc From 5382362168558b6707783946bd8da7f94053a797 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 30 May 2025 20:41:17 +0700 Subject: [PATCH 088/204] only disable openmp for rh devtoolset-10 --- src/SPC/builder/extension/imagick.php | 2 +- src/SPC/builder/unix/library/imagemagick.php | 7 +++++-- src/SPC/util/SPCConfigUtil.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index f91892451..6478a5b7c 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -12,7 +12,7 @@ class imagick extends Extension { public function patchBeforeMake(): bool { - if (getenv('SPC_LIBC') !== 'musl') { + if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) { return false; } // imagick with calls omp_pause_all which requires -lgomp, on non-musl we build imagick without openmp diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index deb1e4021..61c79e49c 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -18,8 +18,11 @@ trait imagemagick */ protected function build(): void { - // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC -fPIE so we can't use openmp without depending on libgomp.so - $openmp = getenv('SPC_LIBC') === 'musl' ? '--enable-openmp' : '--disable-openmp'; + $openmp = '--enable-openmp'; + // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so + if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) { + $openmp = '--disable-openmp'; + } $extra = "--without-jxl --without-x {$openmp} "; $required_libs = ''; $optional_libs = [ diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 0a059463f..9f75b41fc 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -144,7 +144,7 @@ private function getLibsString(array $libraries, bool $withDependencies = false) } } // patch: imagick (imagemagick wrapper) for linux needs libgomp - if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') { + if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Linux' && !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10'))) { $short_name[] = '-lgomp'; } return implode(' ', $short_name); From 2a5915f4b609110a7b23531f3380e61f8acb9062 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 30 May 2025 21:21:50 +0700 Subject: [PATCH 089/204] patched this in ext-spx before, do it here instead --- src/SPC/builder/extension/spx.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/SPC/builder/extension/spx.php b/src/SPC/builder/extension/spx.php index 8436b96f3..f5e736d58 100644 --- a/src/SPC/builder/extension/spx.php +++ b/src/SPC/builder/extension/spx.php @@ -5,6 +5,7 @@ namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\store\FileSystem; use SPC\util\CustomExt; #[CustomExt('spx')] @@ -18,4 +19,14 @@ public function getUnixConfigureArg(bool $shared = false): string } return $arg; } + + public function patchBeforeConfigure(): bool + { + FileSystem::replaceFileStr( + $this->source_dir . '/Makefile.frag', + '@cp -r assets/web-ui/*', + '@cp -r ' . $this->source_dir . '/assets/web-ui/*', + ); + return true; + } } From 614772131497d6b8cbdbf9d9d2cb9f0d53dea32e Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 30 May 2025 22:26:43 +0700 Subject: [PATCH 090/204] dont disable openmp macro --- src/SPC/builder/extension/imagick.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index 6478a5b7c..7b0e20f9d 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -23,7 +23,7 @@ public function patchBeforeMake(): bool public function getUnixConfigureArg(bool $shared = false): string { - $disable_omp = getenv('SPC_LIBC') === 'musl' ? '' : ' ac_cv_func_omp_pause_resource_all=no'; + $disable_omp = !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) ? '' : ' ac_cv_func_omp_pause_resource_all=no'; return '--with-imagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp; } } From 78b2a89b0acef2dda4c3a30bb93cd36a7284ebc5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 14:03:17 +0700 Subject: [PATCH 091/204] --with-pic for libpng --- src/SPC/builder/linux/library/libpng.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/linux/library/libpng.php b/src/SPC/builder/linux/library/libpng.php index 16fdca60b..6bc4df2bb 100644 --- a/src/SPC/builder/linux/library/libpng.php +++ b/src/SPC/builder/linux/library/libpng.php @@ -53,6 +53,7 @@ public function build(): void './configure ' . '--disable-shared ' . '--enable-static ' . + '--with-pic ' . '--enable-hardware-optimizations ' . '--with-zlib-prefix="' . BUILD_ROOT_PATH . '" ' . $optimizations . From 4c124770ed689bd91ddf579081ae48fec1f70640 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 14:06:00 +0700 Subject: [PATCH 092/204] --with-pic for libffi --- src/SPC/builder/linux/library/libffi.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/linux/library/libffi.php b/src/SPC/builder/linux/library/libffi.php index d7421425d..aa4cd662a 100644 --- a/src/SPC/builder/linux/library/libffi.php +++ b/src/SPC/builder/linux/library/libffi.php @@ -30,6 +30,7 @@ public function build(): void './configure ' . '--enable-static ' . '--disable-shared ' . + '--with-pic ' . "--host={$arch}-unknown-linux " . "--target={$arch}-unknown-linux " . '--prefix= ' . From 764fdd4d08111fa98a4337545a3a69431b766382 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 14:09:35 +0700 Subject: [PATCH 093/204] --enable-pic for gettext --- src/SPC/builder/unix/library/gettext.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/gettext.php b/src/SPC/builder/unix/library/gettext.php index 166225601..42bbae54b 100644 --- a/src/SPC/builder/unix/library/gettext.php +++ b/src/SPC/builder/unix/library/gettext.php @@ -26,6 +26,7 @@ protected function build(): void './configure ' . '--enable-static ' . '--disable-shared ' . + '--enable-pic ' . '--disable-java ' . '--disable-c++ ' . $zts . From 4c64707138ca0b4484770c2dd6c2e8c50c1d6696 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 14:19:04 +0700 Subject: [PATCH 094/204] -ldl and --with-pic for imagemagick --- src/SPC/builder/unix/library/gettext.php | 4 +++- src/SPC/builder/unix/library/imagemagick.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/gettext.php b/src/SPC/builder/unix/library/gettext.php index 42bbae54b..01c125197 100644 --- a/src/SPC/builder/unix/library/gettext.php +++ b/src/SPC/builder/unix/library/gettext.php @@ -16,10 +16,12 @@ protected function build(): void $cflags = $this->builder->getOption('enable-zts') ? '-lpthread -D_REENTRANT' : ''; $ldflags = $this->builder->getOption('enable-zts') ? '-lpthread' : ''; + $ldl = $this->builder->getLib('libgomp') && getenv('SPC_LIBC') === 'glibc' ? '-ldl' : ''; + shell()->cd($this->source_dir) ->setEnv([ 'CFLAGS' => "{$this->getLibExtraCFlags()} {$cflags}", - 'LDFLAGS' => $this->getLibExtraLdFlags() ?: $ldflags, + 'LDFLAGS' => trim($this->getLibExtraLdFlags() . ' ' . $ldflags . ' ' . $ldl), 'LIBS' => $this->getLibExtraLibs(), ]) ->execWithEnv( diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index 61c79e49c..78bcced90 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -58,7 +58,7 @@ protected function build(): void ]) ->execWithEnv( './configure ' . - '--enable-static --disable-shared ' . + '--enable-static --disable-shared --with-pic ' . $extra . '--prefix=' ) From 8767181a8068a1ee0601db877ce2d3181dc31a62 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 14:21:55 +0700 Subject: [PATCH 095/204] --with-pic for ldap --- src/SPC/builder/unix/library/ldap.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/ldap.php b/src/SPC/builder/unix/library/ldap.php index 93f889f09..6f8790f10 100644 --- a/src/SPC/builder/unix/library/ldap.php +++ b/src/SPC/builder/unix/library/ldap.php @@ -38,6 +38,7 @@ protected function build(): void ' ./configure ' . '--enable-static ' . '--disable-shared ' . + '--with-pic ' . '--disable-slapd ' . '--without-systemd ' . '--without-cyrus-sasl ' . From 2dbcbc69636f8a904b03bc93746394a761d80a58 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 14:35:59 +0700 Subject: [PATCH 096/204] --with-pic and --enable-pic for other libraries that support them --- src/SPC/builder/extension/pdo_sqlsrv.php | 2 +- src/SPC/builder/freebsd/library/openssl.php | 7 ++++++- src/SPC/builder/unix/library/libacl.php | 2 +- src/SPC/builder/unix/library/libiconv.php | 1 + src/SPC/builder/unix/library/libjpeg.php | 1 + src/SPC/builder/unix/library/libtiff.php | 2 +- src/SPC/builder/unix/library/libxslt.php | 1 + src/SPC/builder/unix/library/nghttp2.php | 1 + src/SPC/builder/unix/library/onig.php | 2 +- src/SPC/builder/unix/library/sqlite.php | 2 +- src/SPC/builder/unix/library/xz.php | 1 + 11 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php index 751669030..ed501bb26 100644 --- a/src/SPC/builder/extension/pdo_sqlsrv.php +++ b/src/SPC/builder/extension/pdo_sqlsrv.php @@ -25,7 +25,7 @@ public function buildUnixShared(): void shell()->cd($this->source_dir) ->setEnv($env) ->execWithEnv(BUILD_BIN_PATH . '/phpize') - ->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/freebsd/library/openssl.php b/src/SPC/builder/freebsd/library/openssl.php index fb029a77f..3c62ba2eb 100644 --- a/src/SPC/builder/freebsd/library/openssl.php +++ b/src/SPC/builder/freebsd/library/openssl.php @@ -49,7 +49,12 @@ protected function build(): void } shell()->cd($this->source_dir) - ->exec( + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs() . " {$ex_lib}", + ]) + ->execWithEnv( "./Configure no-shared {$extra} " . '--prefix=/ ' . // use prefix=/ "--libdir={$lib} " . diff --git a/src/SPC/builder/unix/library/libacl.php b/src/SPC/builder/unix/library/libacl.php index 6abfbb5b3..7e74c9473 100644 --- a/src/SPC/builder/unix/library/libacl.php +++ b/src/SPC/builder/unix/library/libacl.php @@ -37,7 +37,7 @@ protected function build(): void ]) ->execWithEnv('libtoolize --force --copy') ->execWithEnv('./autogen.sh || autoreconf -if') - ->execWithEnv('./configure --prefix= --enable-static --disable-shared --disable-tests --disable-nls') + ->execWithEnv('./configure --prefix= --enable-static --disable-shared --disable-tests --disable-nls --with-pic') ->execWithEnv("make -j {$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); diff --git a/src/SPC/builder/unix/library/libiconv.php b/src/SPC/builder/unix/library/libiconv.php index 722976468..a4f77d981 100644 --- a/src/SPC/builder/unix/library/libiconv.php +++ b/src/SPC/builder/unix/library/libiconv.php @@ -20,6 +20,7 @@ protected function build(): void './configure ' . '--enable-static ' . '--disable-shared ' . + '--enable-pic ' . '--enable-extra-encodings ' . '--prefix=' ) diff --git a/src/SPC/builder/unix/library/libjpeg.php b/src/SPC/builder/unix/library/libjpeg.php index c4f9833d2..5612e1301 100644 --- a/src/SPC/builder/unix/library/libjpeg.php +++ b/src/SPC/builder/unix/library/libjpeg.php @@ -26,6 +26,7 @@ protected function build(): void "cmake {$this->builder->makeCmakeArgs()} " . '-DENABLE_STATIC=ON ' . '-DENABLE_SHARED=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '..' ) ->exec("cmake --build . -j {$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/libtiff.php b/src/SPC/builder/unix/library/libtiff.php index b4ed21ad7..d2264ddae 100644 --- a/src/SPC/builder/unix/library/libtiff.php +++ b/src/SPC/builder/unix/library/libtiff.php @@ -30,7 +30,7 @@ protected function build(): void ]) ->execWithEnv( './configure ' . - '--enable-static --disable-shared ' . + '--enable-static --disable-shared --with-pic ' . "{$extra_libs} " . '--disable-cxx ' . '--prefix=' diff --git a/src/SPC/builder/unix/library/libxslt.php b/src/SPC/builder/unix/library/libxslt.php index 6de23e3ea..530612763 100644 --- a/src/SPC/builder/unix/library/libxslt.php +++ b/src/SPC/builder/unix/library/libxslt.php @@ -35,6 +35,7 @@ protected function build(): void "{$this->builder->getOption('ld_library_path')} " . './configure ' . '--enable-static --disable-shared ' . + '--with-pic ' . '--without-python ' . '--without-mem-debug ' . '--without-crypto ' . diff --git a/src/SPC/builder/unix/library/nghttp2.php b/src/SPC/builder/unix/library/nghttp2.php index cd0c488f2..b1c4433f3 100644 --- a/src/SPC/builder/unix/library/nghttp2.php +++ b/src/SPC/builder/unix/library/nghttp2.php @@ -45,6 +45,7 @@ protected function build(): void './configure ' . '--enable-static ' . '--disable-shared ' . + '--with-pic ' . '--enable-lib-only ' . '--with-boost=no ' . $args . ' ' . diff --git a/src/SPC/builder/unix/library/onig.php b/src/SPC/builder/unix/library/onig.php index 56f724130..458e9c478 100644 --- a/src/SPC/builder/unix/library/onig.php +++ b/src/SPC/builder/unix/library/onig.php @@ -23,7 +23,7 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->execWithEnv('./configure --enable-static --disable-shared --prefix=') + ->execWithEnv('./configure --enable-static --disable-shared --enable-pic --prefix=') ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") ->exec("make install DESTDIR={$destdir}"); diff --git a/src/SPC/builder/unix/library/sqlite.php b/src/SPC/builder/unix/library/sqlite.php index 7f9f31bda..131e0c3b0 100644 --- a/src/SPC/builder/unix/library/sqlite.php +++ b/src/SPC/builder/unix/library/sqlite.php @@ -14,7 +14,7 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->execWithEnv('./configure --enable-static --disable-shared --prefix=') + ->execWithEnv('./configure --enable-static --disable-shared --with-pic --prefix=') ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index 1869f589c..c1c84f1fa 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -20,6 +20,7 @@ public function build(): void './configure ' . '--enable-static ' . '--disable-shared ' . + '--enable-pic ' . '--disable-scripts ' . '--disable-doc ' . '--with-libiconv ' . From ad3860981a1019c52e1efb2159bdd74d92d58307 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 14:41:35 +0700 Subject: [PATCH 097/204] -DPOSITION_INDEPENDENT_CODE=ON --- src/SPC/builder/macos/library/glfw.php | 2 +- src/SPC/builder/macos/library/libxml2.php | 1 + src/SPC/builder/unix/library/brotli.php | 1 + src/SPC/builder/unix/library/curl.php | 2 +- src/SPC/builder/unix/library/freetype.php | 1 + src/SPC/builder/unix/library/gmssl.php | 2 +- src/SPC/builder/unix/library/libaom.php | 1 + src/SPC/builder/unix/library/libavif.php | 2 +- src/SPC/builder/unix/library/libde265.php | 1 + src/SPC/builder/unix/library/libevent.php | 1 + src/SPC/builder/unix/library/libheif.php | 1 + src/SPC/builder/unix/library/librabbitmq.php | 1 + src/SPC/builder/unix/library/libssh2.php | 1 + src/SPC/builder/unix/library/libuuid.php | 2 +- src/SPC/builder/unix/library/libuv.php | 2 +- src/SPC/builder/unix/library/libwebp.php | 1 + src/SPC/builder/unix/library/libyaml.php | 1 + src/SPC/builder/unix/library/libzip.php | 1 + src/SPC/builder/unix/library/mimalloc.php | 1 + src/SPC/builder/unix/library/snappy.php | 1 + src/SPC/builder/unix/library/tidy.php | 1 + 21 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/SPC/builder/macos/library/glfw.php b/src/SPC/builder/macos/library/glfw.php index 355785ed5..a3b88b6ad 100644 --- a/src/SPC/builder/macos/library/glfw.php +++ b/src/SPC/builder/macos/library/glfw.php @@ -19,7 +19,7 @@ protected function build(): void { // compile! shell()->cd(SOURCE_PATH . '/ext-glfw/vendor/glfw') - ->exec("cmake . {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF") + ->exec("cmake . {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DPOSITION_INDEPENDENT_CODE=ON -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF") ->exec("make -j{$this->builder->concurrency}") ->exec('make install'); // patch pkgconf diff --git a/src/SPC/builder/macos/library/libxml2.php b/src/SPC/builder/macos/library/libxml2.php index c0ed36c0e..f8d75f838 100644 --- a/src/SPC/builder/macos/library/libxml2.php +++ b/src/SPC/builder/macos/library/libxml2.php @@ -33,6 +33,7 @@ protected function build(): void "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . '-DBUILD_SHARED_LIBS=OFF ' . '-DLIBXML2_WITH_ICONV=ON ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . "-DLIBXML2_WITH_ZLIB={$enable_zlib} " . "-DLIBXML2_WITH_ICU={$enable_icu} " . "-DLIBXML2_WITH_LZMA={$enable_xz} " . diff --git a/src/SPC/builder/unix/library/brotli.php b/src/SPC/builder/unix/library/brotli.php index 30c862d2c..526f3341f 100644 --- a/src/SPC/builder/unix/library/brotli.php +++ b/src/SPC/builder/unix/library/brotli.php @@ -30,6 +30,7 @@ protected function build(): void '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . '-DCMAKE_INSTALL_LIBDIR=lib ' . '-DSHARE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DBUILD_SHARED_LIBS=OFF ' . '..' ) diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index ab8a8bd71..99444d763 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -60,7 +60,7 @@ protected function build(): void 'LIBS' => $this->getLibExtraLibs(), ]) ->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ../CMakeLists.txt') - ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DBUILD_LIBCURL_DOCS=OFF {$extra} ..") + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DPOSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DBUILD_LIBCURL_DOCS=OFF {$extra} ..") ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install'); // patch pkgconf diff --git a/src/SPC/builder/unix/library/freetype.php b/src/SPC/builder/unix/library/freetype.php index 6fb24212f..7dfa9b0e6 100644 --- a/src/SPC/builder/unix/library/freetype.php +++ b/src/SPC/builder/unix/library/freetype.php @@ -31,6 +31,7 @@ protected function build(): void ->execWithEnv( "cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON " . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . "{$extra_libs}.." ) ->execWithEnv('make clean') diff --git a/src/SPC/builder/unix/library/gmssl.php b/src/SPC/builder/unix/library/gmssl.php index 792a1c93e..bf0abe8ee 100644 --- a/src/SPC/builder/unix/library/gmssl.php +++ b/src/SPC/builder/unix/library/gmssl.php @@ -25,7 +25,7 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF ..") + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DPOSITION_INDEPENDENT_CODE=ON ..") ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); } diff --git a/src/SPC/builder/unix/library/libaom.php b/src/SPC/builder/unix/library/libaom.php index 5ecf67041..d0de97d74 100644 --- a/src/SPC/builder/unix/library/libaom.php +++ b/src/SPC/builder/unix/library/libaom.php @@ -26,6 +26,7 @@ protected function build(): void "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . '-DCMAKE_BUILD_TYPE=Release ' . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DAOM_TARGET_CPU=generic ' . '..' ) diff --git a/src/SPC/builder/unix/library/libavif.php b/src/SPC/builder/unix/library/libavif.php index ddcf1d577..e0b0430da 100644 --- a/src/SPC/builder/unix/library/libavif.php +++ b/src/SPC/builder/unix/library/libavif.php @@ -27,7 +27,7 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DAVIF_LIBYUV=OFF ..") + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DPOSITION_INDEPENDENT_CODE=ON -DAVIF_LIBYUV=OFF ..") ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); // patch pkgconfig diff --git a/src/SPC/builder/unix/library/libde265.php b/src/SPC/builder/unix/library/libde265.php index df02bbb34..bf1546f2b 100644 --- a/src/SPC/builder/unix/library/libde265.php +++ b/src/SPC/builder/unix/library/libde265.php @@ -26,6 +26,7 @@ protected function build(): void "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . '-DCMAKE_BUILD_TYPE=Release ' . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DENABLE_SDL=OFF ' . // Disable SDL, currently not supported '..' ) diff --git a/src/SPC/builder/unix/library/libevent.php b/src/SPC/builder/unix/library/libevent.php index bd070fd58..437bd68df 100644 --- a/src/SPC/builder/unix/library/libevent.php +++ b/src/SPC/builder/unix/library/libevent.php @@ -53,6 +53,7 @@ protected function build(): void 'cmake ' . '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DCMAKE_BUILD_TYPE=Release ' . '-DEVENT__LIBRARY_TYPE=STATIC ' . '-DEVENT__DISABLE_BENCHMARK=ON ' . diff --git a/src/SPC/builder/unix/library/libheif.php b/src/SPC/builder/unix/library/libheif.php index e2d2a486e..5725b7373 100644 --- a/src/SPC/builder/unix/library/libheif.php +++ b/src/SPC/builder/unix/library/libheif.php @@ -27,6 +27,7 @@ protected function build(): void "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . '-DCMAKE_BUILD_TYPE=Release ' . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DWITH_EXAMPLES=OFF ' . '-DWITH_GDK_PIXBUF=OFF ' . '-DBUILD_TESTING=OFF ' . diff --git a/src/SPC/builder/unix/library/librabbitmq.php b/src/SPC/builder/unix/library/librabbitmq.php index 42ef553b6..1f7fd0e3b 100644 --- a/src/SPC/builder/unix/library/librabbitmq.php +++ b/src/SPC/builder/unix/library/librabbitmq.php @@ -27,6 +27,7 @@ protected function build(): void '-DCMAKE_BUILD_TYPE=Release ' . '-DBUILD_SHARED_LIBS=OFF ' . '-DBUILD_STATIC_LIBS=ON ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '..' ) ->exec("cmake --build . -j {$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/libssh2.php b/src/SPC/builder/unix/library/libssh2.php index 9e999ca95..b99b9e7bf 100644 --- a/src/SPC/builder/unix/library/libssh2.php +++ b/src/SPC/builder/unix/library/libssh2.php @@ -27,6 +27,7 @@ protected function build(): void '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . '-DCMAKE_INSTALL_LIBDIR=lib ' . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DBUILD_EXAMPLES=OFF ' . '-DBUILD_TESTING=OFF ' . "-DENABLE_ZLIB_COMPRESSION={$enable_zlib} " . diff --git a/src/SPC/builder/unix/library/libuuid.php b/src/SPC/builder/unix/library/libuuid.php index 65ed02aca..405941ed6 100644 --- a/src/SPC/builder/unix/library/libuuid.php +++ b/src/SPC/builder/unix/library/libuuid.php @@ -20,7 +20,7 @@ protected function build(): void shell()->cd($this->source_dir . '/build') ->exec( 'cmake ' . - "{$this->builder->makeCmakeArgs()} " . + "{$this->builder->makeCmakeArgs()} -DPOSITION_INDEPENDENT_CODE=ON " . '..' ) ->exec("cmake --build . -j {$this->builder->concurrency}"); diff --git a/src/SPC/builder/unix/library/libuv.php b/src/SPC/builder/unix/library/libuv.php index fda11c0a5..2294a1e38 100644 --- a/src/SPC/builder/unix/library/libuv.php +++ b/src/SPC/builder/unix/library/libuv.php @@ -20,7 +20,7 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->exec("cmake {$this->builder->makeCmakeArgs()} -DLIBUV_BUILD_SHARED=OFF ..") + ->exec("cmake {$this->builder->makeCmakeArgs()} -DPOSITION_INDEPENDENT_CODE=ON -DLIBUV_BUILD_SHARED=OFF ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); // patch pkgconfig diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index efb78a68e..79fc1e3ec 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -26,6 +26,7 @@ protected function build(): void 'cmake ' . $this->builder->makeCmakeArgs() . ' ' . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DWEBP_BUILD_EXTRAS=ON ' . '..' ) diff --git a/src/SPC/builder/unix/library/libyaml.php b/src/SPC/builder/unix/library/libyaml.php index 53962e9be..b519f7094 100644 --- a/src/SPC/builder/unix/library/libyaml.php +++ b/src/SPC/builder/unix/library/libyaml.php @@ -41,6 +41,7 @@ protected function build(): void '-DCMAKE_BUILD_TYPE=Release ' . '-DBUILD_TESTING=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DCMAKE_INSTALL_PREFIX=/ ' . "-DCMAKE_INSTALL_LIBDIR={$lib} " . "-DCMAKE_INSTALL_INCLUDEDIR={$include} " . diff --git a/src/SPC/builder/unix/library/libzip.php b/src/SPC/builder/unix/library/libzip.php index 5e2bd0d6c..c206f3c9b 100644 --- a/src/SPC/builder/unix/library/libzip.php +++ b/src/SPC/builder/unix/library/libzip.php @@ -36,6 +36,7 @@ protected function build(): void '-DENABLE_GNUTLS=OFF ' . '-DENABLE_MBEDTLS=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DBUILD_DOC=OFF ' . '-DBUILD_EXAMPLES=OFF ' . '-DBUILD_REGRESS=OFF ' . diff --git a/src/SPC/builder/unix/library/mimalloc.php b/src/SPC/builder/unix/library/mimalloc.php index 40790a98a..34b4f7be7 100644 --- a/src/SPC/builder/unix/library/mimalloc.php +++ b/src/SPC/builder/unix/library/mimalloc.php @@ -28,6 +28,7 @@ protected function build(): void 'cmake ' . '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DCMAKE_BUILD_TYPE=Release ' . $args . '..' diff --git a/src/SPC/builder/unix/library/snappy.php b/src/SPC/builder/unix/library/snappy.php index f1b4c8252..8d1c3b8a7 100644 --- a/src/SPC/builder/unix/library/snappy.php +++ b/src/SPC/builder/unix/library/snappy.php @@ -24,6 +24,7 @@ protected function build(): void "{$this->builder->makeCmakeArgs()} " . '-DSNAPPY_BUILD_TESTS=OFF ' . '-DSNAPPY_BUILD_BENCHMARKS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '../..' ) ->exec("cmake --build . -j {$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/tidy.php b/src/SPC/builder/unix/library/tidy.php index 31c851d19..ce5cd462a 100644 --- a/src/SPC/builder/unix/library/tidy.php +++ b/src/SPC/builder/unix/library/tidy.php @@ -22,6 +22,7 @@ protected function build(): void 'cmake ' . "{$this->builder->makeCmakeArgs()} " . '-DBUILD_SHARED_LIB=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DSUPPORT_CONSOLE_APP=OFF ' . '..' ) From 3052b1cca5246af7de3b3c4c458b6502e00f621a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 31 May 2025 21:01:22 +0700 Subject: [PATCH 098/204] change extension_dir, the env variable only has an effect during compilation --- src/SPC/builder/Extension.php | 5 ++++- src/SPC/builder/extension/mbregex.php | 3 +-- src/SPC/builder/extension/swoole_hook_mysql.php | 1 - src/SPC/builder/extension/swoole_hook_pgsql.php | 1 - src/SPC/builder/extension/swoole_hook_sqlite.php | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 06c892a89..1ffc6dc3f 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -243,6 +243,10 @@ public function getSharedExtensionLoadString(): string } } + if ($ret !== '') { + $ret = ' -d "extension_dir=' . BUILD_MODULES_PATH . '"' . $ret; + } + return $ret; } @@ -255,7 +259,6 @@ public function runCliCheckUnix(): void // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php // If check failed, throw RuntimeException $sharedExtensions = $this->getSharedExtensionLoadString(); - putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index cdff2903e..0e1cad28f 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -26,8 +26,7 @@ public function getConfigureArg(bool $shared = false): string */ public function runCliCheckUnix(): void { - $sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? ' -d "extension=mbstring"' : ''; - putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); + $sharedext = $this->builder->getExt('mbstring')->isBuildShared() ? '-d "extension_dir=' . BUILD_MODULES_PATH . '" -d "extension=mbstring"' : ''; [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $sharedext . ' --ri "mbstring" | grep regex', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !'); diff --git a/src/SPC/builder/extension/swoole_hook_mysql.php b/src/SPC/builder/extension/swoole_hook_mysql.php index 55a58af3b..b45516ee8 100644 --- a/src/SPC/builder/extension/swoole_hook_mysql.php +++ b/src/SPC/builder/extension/swoole_hook_mysql.php @@ -29,7 +29,6 @@ public function runCliCheckUnix(): void if ($this->builder->getExt('swoole') === null) { return; } - putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); [$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $this->getSharedExtensionLoadString() . ' --ri "swoole"', false); $out = implode('', $out); if ($ret !== 0) { diff --git a/src/SPC/builder/extension/swoole_hook_pgsql.php b/src/SPC/builder/extension/swoole_hook_pgsql.php index 68661bd5a..dfbf7dc83 100644 --- a/src/SPC/builder/extension/swoole_hook_pgsql.php +++ b/src/SPC/builder/extension/swoole_hook_pgsql.php @@ -38,7 +38,6 @@ public function runCliCheckUnix(): void return; } $sharedExtensions = $this->getSharedExtensionLoadString(); - putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); $out = implode('', $out); if ($ret !== 0) { diff --git a/src/SPC/builder/extension/swoole_hook_sqlite.php b/src/SPC/builder/extension/swoole_hook_sqlite.php index cb217539b..29e9ef84a 100644 --- a/src/SPC/builder/extension/swoole_hook_sqlite.php +++ b/src/SPC/builder/extension/swoole_hook_sqlite.php @@ -38,7 +38,6 @@ public function runCliCheckUnix(): void return; } $sharedExtensions = $this->getSharedExtensionLoadString(); - putenv('EXTENSION_DIR=' . BUILD_MODULES_PATH); [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); $out = implode('', $out); if ($ret !== 0) { From 8312ce4d4c676773c690771295303242656e4e22 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 31 May 2025 22:17:06 +0700 Subject: [PATCH 099/204] add ext-xz and ext-brotli --- config/ext.json | 16 ++++++++++++++++ config/source.json | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/config/ext.json b/config/ext.json index 0dca824bf..fc8fb6672 100644 --- a/config/ext.json +++ b/config/ext.json @@ -24,6 +24,14 @@ "bcmath": { "type": "builtin" }, + "brotli": { + "type": "external", + "source": "ext-brotli", + "arg-type": "enable", + "lib-depends": [ + "brotli" + ] + }, "bz2": { "type": "builtin", "arg-type-unix": "with-prefix", @@ -1044,6 +1052,14 @@ "dom" ] }, + "xz": { + "type": "external", + "source": "ext-xz", + "arg-type": "with", + "lib-depends": [ + "xz" + ] + }, "yac": { "support": { "BSD": "wip" diff --git a/config/source.json b/config/source.json index a4b25cb8d..796e96f5f 100644 --- a/config/source.json +++ b/config/source.json @@ -102,6 +102,16 @@ "path": "LICENSE" } }, + "ext-brotli": { + "type": "git", + "path": "php-src/ext/brotli", + "rev": "master", + "url": "https://github.com/kjdev/php-ext-brotli", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "ext-ds": { "type": "url", "url": "https://pecl.php.net/get/ds", @@ -230,6 +240,16 @@ "path": "LICENSE" } }, + "ext-xz": { + "type": "git", + "path": "php-src/ext/xz", + "rev": "main", + "url": "https://github.com/codemasher/php-ext-xz", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "ext-zstd": { "type": "git", "path": "php-src/ext/zstd", From c44b8b1029e11b2b9a5d41ecd69af4758bc575d6 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 31 May 2025 22:20:03 +0700 Subject: [PATCH 100/204] test xz and brotli as well --- src/globals/test-extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index e2f0ca120..ed6c69701 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -45,13 +45,13 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'xsl,simplexml,xlswriter', + 'Linux', 'Darwin' => 'brotli,xsl,simplexml,xlswriter,xz', 'Windows' => 'xlswriter,openssl', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'xdebug,intl,pgsql', + 'Linux' => 'xdebug,intl,pgsql,imagick', 'Windows', 'Darwin' => '', }; From 61837f0d689c59f15b113625efa57f5725882610 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 May 2025 22:26:56 +0700 Subject: [PATCH 101/204] more os tests --- src/globals/test-extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index ed6c69701..35cfca388 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,7 +13,7 @@ // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - '8.1', + //'8.1', '8.2', '8.3', '8.4', @@ -26,7 +26,7 @@ 'macos-15', 'ubuntu-latest', 'ubuntu-22.04', - // 'ubuntu-24.04', + 'ubuntu-24.04', 'ubuntu-22.04-arm', 'ubuntu-24.04-arm', // 'windows-latest', From 3bc5ac28beaea082235204bd2c3274a73539c9e3 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 May 2025 22:33:30 +0700 Subject: [PATCH 102/204] space --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 1b8fc074e..84be5c5c5 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,7 +13,7 @@ // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - //'8.1', + // '8.1', '8.2', '8.3', '8.4', From 55b4ba5832bb9f51d3dfc94f1ed8e50c30f94092 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 1 Jun 2025 13:21:42 +0700 Subject: [PATCH 103/204] fix file_exists check in printing shared extension folder --- src/SPC/command/BuildPHPCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index cd8314385..61781d2c7 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -251,7 +251,7 @@ public function handle(): int if (!empty($shared_extensions)) { foreach ($shared_extensions as $ext) { $path = FileSystem::convertPath("{$build_root_path}/modules/{$ext}.so"); - if (file_exists("{$build_root_path}/modules/{$ext}.so")) { + if (file_exists(BUILD_MODULES_PATH . "/{$ext}.so")) { logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}"); } else { logger()->warning("Shared extension [{$ext}] not found, please check!"); From febf9b1815120ee5125191e6e75514930245bedf Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 1 Jun 2025 13:27:36 +0700 Subject: [PATCH 104/204] full test suite for shared extensions --- src/globals/test-extensions.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 84be5c5c5..90ef882ac 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -14,21 +14,21 @@ // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ // '8.1', - '8.2', - '8.3', + // '8.2', + // '8.3', '8.4', ]; // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - 'macos-13', + // 'macos-13', // 'macos-14', - 'macos-15', + // 'macos-15', // 'ubuntu-latest', 'ubuntu-22.04', - 'ubuntu-24.04', + //'ubuntu-24.04', 'ubuntu-22.04-arm', - 'ubuntu-24.04-arm', + //'ubuntu-24.04-arm', // 'windows-latest', ]; @@ -45,13 +45,14 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'brotli,xsl,simplexml,xlswriter,xz', + 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,gd,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', 'Windows' => 'xlswriter,openssl', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'xdebug,intl,pgsql,imagick', + 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_p +gsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,shmop,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd,spx', 'Windows', 'Darwin' => '', }; From da7a125fafdea778281c8a4149a7e2ab5340ce57 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 1 Jun 2025 13:51:05 +0700 Subject: [PATCH 105/204] librdkafka needs "which" to be installed --- bin/spc-gnu-docker | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/spc-gnu-docker b/bin/spc-gnu-docker index 1ff87303c..36e0420e9 100755 --- a/bin/spc-gnu-docker +++ b/bin/spc-gnu-docker @@ -72,6 +72,7 @@ RUN yum update -y && \ yum install -y devtoolset-10-gcc-* RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc RUN source /etc/bashrc +RUN yum install -y which RUN curl -o cmake.tgz -fsSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$BASE_ARCH.tar.gz && \ mkdir /cmake && \ From 396ddd3e6f549c32b95a52880d4e0d24e643daa1 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 1 Jun 2025 13:52:17 +0700 Subject: [PATCH 106/204] cs fix --- src/globals/test-extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 90ef882ac..d39fead36 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -26,9 +26,9 @@ // 'macos-15', // 'ubuntu-latest', 'ubuntu-22.04', - //'ubuntu-24.04', + // 'ubuntu-24.04', 'ubuntu-22.04-arm', - //'ubuntu-24.04-arm', + // 'ubuntu-24.04-arm', // 'windows-latest', ]; From 5ae5a3d75da16ee82823540db2ac8c872ee4e5a9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 1 Jun 2025 13:53:33 +0700 Subject: [PATCH 107/204] cs fix --- src/globals/test-extensions.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index d39fead36..3fe1586ba 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,8 +51,7 @@ // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_p -gsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,shmop,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd,spx', + 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,shmop,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd,spx', 'Windows', 'Darwin' => '', }; From 7c009b6dceebf737a7854564bdb7878bd1d637a2 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 1 Jun 2025 13:53:56 +0700 Subject: [PATCH 108/204] add rdkafka --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 3fe1586ba..1b11a20ff 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,7 +51,7 @@ // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,shmop,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd,spx', + 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd,spx', 'Windows', 'Darwin' => '', }; From 8b98792ccfefbda403e45a77da7be9d740ab9d01 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 1 Jun 2025 13:59:18 +0700 Subject: [PATCH 109/204] zts of course --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 1b11a20ff..44013ab37 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -33,7 +33,7 @@ ]; // whether enable thread safe -$zts = false; +$zts = true; $no_strip = false; From 108bf34cca8066be76198e6c1731efef35c49eea Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 2 Jun 2025 11:55:55 +0700 Subject: [PATCH 110/204] craft needs to download shared extensions too --- src/SPC/command/CraftCommand.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/SPC/command/CraftCommand.php b/src/SPC/command/CraftCommand.php index 9fa2f385f..3764c549b 100644 --- a/src/SPC/command/CraftCommand.php +++ b/src/SPC/command/CraftCommand.php @@ -48,7 +48,8 @@ public function handle(): int } } - $extensions = implode(',', $craft['extensions']); + $static_extensions = implode(',', $craft['extensions']); + $shared_extensions = implode(',', $craft['build-options']['build-shared']) ?? ''; $libs = implode(',', $craft['libs']); // init log @@ -67,7 +68,8 @@ public function handle(): int } // craft download if ($craft['craft-options']['download']) { - $args = ["--for-extensions={$extensions}"]; + $sharedAppend = $shared_extensions ? ',' . $shared_extensions : ''; + $args = ["--for-extensions={$static_extensions}{$sharedAppend}"]; if ($craft['libs'] !== []) { $args[] = "--for-libs={$libs}"; } @@ -90,7 +92,7 @@ public function handle(): int // craft build if ($craft['craft-options']['build']) { - $args = [$extensions, "--with-libs={$libs}", ...array_map(fn ($x) => "--build-{$x}", $craft['sapi'])]; + $args = [$static_extensions, "--with-libs={$libs}", ...array_map(fn ($x) => "--build-{$x}", $craft['sapi'])]; $this->optionsToArguments($craft['build-options'], $args); $retcode = $this->runCommand('build', ...$args); if ($retcode !== 0) { From ed87a7cd671312d0f1304605fad61789c0edd633 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 2 Jun 2025 12:00:20 +0700 Subject: [PATCH 111/204] don't force invalidate php-src if the download option is explicitly passed --- src/SPC/command/CraftCommand.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/SPC/command/CraftCommand.php b/src/SPC/command/CraftCommand.php index 3764c549b..7b75c7830 100644 --- a/src/SPC/command/CraftCommand.php +++ b/src/SPC/command/CraftCommand.php @@ -77,8 +77,6 @@ public function handle(): int $args[] = '--with-php=' . $craft['php-version']; if (!array_key_exists('ignore-cache-sources', $craft['download-options']) || $craft['download-options']['ignore-cache-sources'] === false) { $craft['download-options']['ignore-cache-sources'] = 'php-src'; - } elseif ($craft['download-options']['ignore-cache-sources'] !== null) { - $craft['download-options']['ignore-cache-sources'] .= ',php-src'; } } $this->optionsToArguments($craft['download-options'], $args); @@ -144,7 +142,6 @@ private function runCommand(string $cmd, ...$args): int }); } elseif (extension_loaded('pcntl')) { pcntl_signal(SIGINT, function () use ($process) { - /* @noinspection PhpComposerExtensionStubsInspection */ $process->signal(SIGINT); }); } else { From c53b06c3d27510b9e8504d07cd876ca5c7b0c0da Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 2 Jun 2025 12:27:58 +0700 Subject: [PATCH 112/204] shared-extensions instead of build-shared --- src/SPC/command/CraftCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/command/CraftCommand.php b/src/SPC/command/CraftCommand.php index 7b75c7830..25fae675f 100644 --- a/src/SPC/command/CraftCommand.php +++ b/src/SPC/command/CraftCommand.php @@ -49,7 +49,7 @@ public function handle(): int } $static_extensions = implode(',', $craft['extensions']); - $shared_extensions = implode(',', $craft['build-options']['build-shared']) ?? ''; + $shared_extensions = implode(',', $craft['shared-extensions']); $libs = implode(',', $craft['libs']); // init log @@ -90,7 +90,7 @@ public function handle(): int // craft build if ($craft['craft-options']['build']) { - $args = [$static_extensions, "--with-libs={$libs}", ...array_map(fn ($x) => "--build-{$x}", $craft['sapi'])]; + $args = [$static_extensions, "--with-libs={$libs}", "--build-shared={$shared_extensions}", ...array_map(fn ($x) => "--build-{$x}", $craft['sapi'])]; $this->optionsToArguments($craft['build-options'], $args); $retcode = $this->runCommand('build', ...$args); if ($retcode !== 0) { From 4b0fa94b3c97d97530a691f0f393422b3f0e80e5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 2 Jun 2025 12:32:53 +0700 Subject: [PATCH 113/204] stan --- src/SPC/util/ConfigValidator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/util/ConfigValidator.php b/src/SPC/util/ConfigValidator.php index d455dda50..eae2ef2bd 100644 --- a/src/SPC/util/ConfigValidator.php +++ b/src/SPC/util/ConfigValidator.php @@ -120,6 +120,7 @@ public static function validatePkgs(mixed $data): void * @return array{ * php-version?: string, * extensions: array, + * shared-extensions?: array, * libs?: array, * sapi: array, * debug?: bool, From 6b689f1584881546873334a8508e3ea9f8dd39c4 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 2 Jun 2025 15:12:44 +0700 Subject: [PATCH 114/204] explicitly pass env to process handler, fails in docker otherwise (??????) --- src/SPC/command/CraftCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/command/CraftCommand.php b/src/SPC/command/CraftCommand.php index 25fae675f..c5ddfb741 100644 --- a/src/SPC/command/CraftCommand.php +++ b/src/SPC/command/CraftCommand.php @@ -131,7 +131,8 @@ private function runCommand(string $cmd, ...$args): int } $prefix = PHP_SAPI === 'cli' ? [PHP_BINARY, $argv[0]] : [$argv[0]]; - $process = new Process([...$prefix, $cmd, '--no-motd', ...$args], timeout: null); + $env = getenv(); + $process = new Process([...$prefix, $cmd, '--no-motd', ...$args], env: $env, timeout: null); $this->log("Running: {$process->getCommandLine()}", true); if (PHP_OS_FAMILY === 'Windows') { From a9d37bb2a2e30c84043bb099fead9e810d94ac92 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 4 Jun 2025 08:58:46 +0700 Subject: [PATCH 115/204] add source patch for ffi on centos 7 --- src/SPC/store/SourcePatcher.php | 10 ++++++ .../patch/ffi_centos7_fix_O3_strncmp.patch | 31 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/globals/patch/ffi_centos7_fix_O3_strncmp.patch diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index f78928dec..6f6c7d450 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -22,6 +22,7 @@ public static function init(): void FileSystem::addSourceExtractHook('swoole', [SourcePatcher::class, 'patchSwoole']); FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchPhpLibxml212']); FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchGDWin32']); + FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchFfiCentos7FixO3strncmp']); FileSystem::addSourceExtractHook('sqlsrv', [SourcePatcher::class, 'patchSQLSRVWin32']); FileSystem::addSourceExtractHook('pdo_sqlsrv', [SourcePatcher::class, 'patchSQLSRVWin32']); FileSystem::addSourceExtractHook('yaml', [SourcePatcher::class, 'patchYamlWin32']); @@ -451,6 +452,15 @@ public static function patchImagickWith84(): bool return false; } + public static function patchFfiCentos7FixO3strncmp(): bool + { + if (PHP_OS_FAMILY === 'Linux' && SystemUtil::getLibcVersionIfExists() === '2.17') { + SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src'); + return true; + } + return false; + } + public static function patchLibaomForAlpine(): bool { if (PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist()) { diff --git a/src/globals/patch/ffi_centos7_fix_O3_strncmp.patch b/src/globals/patch/ffi_centos7_fix_O3_strncmp.patch new file mode 100644 index 000000000..815170bef --- /dev/null +++ b/src/globals/patch/ffi_centos7_fix_O3_strncmp.patch @@ -0,0 +1,31 @@ +--- a/ext/ffi/ffi.c 2025-01-17 10:37:37 ++++ a/ext/ffi/ffi.c 2025-01-17 10:39:17 +@@ -57,6 +57,8 @@ + /* XXX need something better, perhaps with regard to SIMD, etc. */ + # define __BIGGEST_ALIGNMENT__ sizeof(size_t) + #endif ++ ++#define ZEND_STRNCMP(s,str) strncmp((s),(str),(sizeof(str)-1)) + + ZEND_DECLARE_MODULE_GLOBALS(ffi) + +@@ -5046,16 +5048,16 @@ static char *zend_ffi_parse_directives(const char *fil + *scope_name = NULL; + *lib = NULL; + while (*code_pos == '#') { +- if (strncmp(code_pos, ZEND_STRL("#define")) == 0) { ++ if (ZEND_STRNCMP(code_pos, "#define") == 0) { + p = zend_ffi_skip_ws_and_comments(code_pos + sizeof("#define") - 1, false); + + char **target = NULL; + const char *target_name = NULL; +- if (strncmp(p, ZEND_STRL("FFI_SCOPE")) == 0) { ++ if (ZEND_STRNCMP(p, "FFI_SCOPE") == 0) { + p = zend_ffi_skip_ws_and_comments(p + sizeof("FFI_SCOPE") - 1, false); + target = scope_name; + target_name = "FFI_SCOPE"; +- } else if (strncmp(p, ZEND_STRL("FFI_LIB")) == 0) { ++ } else if (ZEND_STRNCMP(p, "FFI_LIB") == 0) { + p = zend_ffi_skip_ws_and_comments(p + sizeof("FFI_LIB") - 1, false); + target = lib; + target_name = "FFI_LIB"; From 161a5539480ae16ea129d6df2d8841e536e2198d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 5 Jun 2025 13:54:17 +0700 Subject: [PATCH 116/204] -release (soname) compilation support for linux shared embed --- config/env.ini | 2 ++ src/SPC/builder/linux/LinuxBuilder.php | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/config/env.ini b/config/env.ini index f70ad0a2e..85990e2e4 100644 --- a/config/env.ini +++ b/config/env.ini @@ -100,6 +100,8 @@ SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm" SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-ident -fPIE -fPIC" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm" +; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so +SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS="" ; EXTRA_LDFLAGS_PROGRAM for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie" diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index e38714f1a..7de9eaf2d 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -311,6 +311,18 @@ protected function buildEmbed(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') ->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install"); + + $ldflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'); + if (preg_match('/-release\s+(\S+)/', $ldflags, $matches)) { + $release = $matches[1]; + $realLibName = 'libphp-' . $release . '.so'; + $realLib = BUILD_LIB_PATH . '/' . $realLibName; + rename(BUILD_LIB_PATH . '/libphp.so', $realLib); + $cwd = getcwd(); + chdir(BUILD_LIB_PATH); + symlink($realLibName, 'libphp.so'); + chdir($cwd); + } $this->patchPhpScripts(); } @@ -319,6 +331,7 @@ private function getMakeExtraVars(): array return [ 'EXTRA_CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'), 'EXTRA_LIBS' => getenv('SPC_EXTRA_LIBS') . ' ' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS'), + 'EXTRA_LDFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'), 'EXTRA_LDFLAGS_PROGRAM' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM'), ]; } From e2191113b0b09073c80a3db7cc3c7c4b54f7d1db Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 5 Jun 2025 16:42:52 +0700 Subject: [PATCH 117/204] tests for brotli and xz --- src/globals/ext-tests/brotli.php | 8 ++++++++ src/globals/ext-tests/xz.php | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/globals/ext-tests/brotli.php create mode 100644 src/globals/ext-tests/xz.php diff --git a/src/globals/ext-tests/brotli.php b/src/globals/ext-tests/brotli.php new file mode 100644 index 000000000..7c8e94d22 --- /dev/null +++ b/src/globals/ext-tests/brotli.php @@ -0,0 +1,8 @@ + Date: Thu, 5 Jun 2025 17:32:54 +0700 Subject: [PATCH 118/204] doms --- src/globals/ext-tests/brotli.php | 2 +- src/globals/ext-tests/xz.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/ext-tests/brotli.php b/src/globals/ext-tests/brotli.php index 7c8e94d22..dbdb1f14d 100644 --- a/src/globals/ext-tests/brotli.php +++ b/src/globals/ext-tests/brotli.php @@ -1,4 +1,4 @@ - Date: Thu, 5 Jun 2025 19:57:59 +0700 Subject: [PATCH 119/204] only apply ffi patch at version >= 8.3.16 --- src/SPC/store/SourcePatcher.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 6f6c7d450..e16e84a47 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -454,6 +454,16 @@ public static function patchImagickWith84(): bool public static function patchFfiCentos7FixO3strncmp(): bool { + $version = null; + if (file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { + $file = SOURCE_PATH . '/php-src/main/php_version.h'; + $cnt = preg_match('/PHP_VERSION "(\d+\.\d+\.\d+)"/', file_get_contents($file), $match); + if (!$cnt) return false; + $version = $match[1]; + } + if (version_compare($version, '8.3.16', '<')) { + return false; + } if (PHP_OS_FAMILY === 'Linux' && SystemUtil::getLibcVersionIfExists() === '2.17') { SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src'); return true; From 86541b1aa870a3a4c24feb2d11823486f8bddcc7 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 5 Jun 2025 19:58:38 +0700 Subject: [PATCH 120/204] only apply ffi patch at version >= 8.3.16 --- src/SPC/store/SourcePatcher.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index e16e84a47..656e34cde 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -454,6 +454,9 @@ public static function patchImagickWith84(): bool public static function patchFfiCentos7FixO3strncmp(): bool { + if (PHP_OS_FAMILY !== 'Linux' || SystemUtil::getLibcVersionIfExists() >= '2.17') { + return false; + } $version = null; if (file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { $file = SOURCE_PATH . '/php-src/main/php_version.h'; @@ -464,11 +467,8 @@ public static function patchFfiCentos7FixO3strncmp(): bool if (version_compare($version, '8.3.16', '<')) { return false; } - if (PHP_OS_FAMILY === 'Linux' && SystemUtil::getLibcVersionIfExists() === '2.17') { - SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src'); - return true; - } - return false; + SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src'); + return true; } public static function patchLibaomForAlpine(): bool From 17b4c18830ae2d156c330c78c54d2d83f6007ae1 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 5 Jun 2025 19:59:45 +0700 Subject: [PATCH 121/204] accidental space --- src/globals/ext-tests/brotli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/ext-tests/brotli.php b/src/globals/ext-tests/brotli.php index dbdb1f14d..2b24941d1 100644 --- a/src/globals/ext-tests/brotli.php +++ b/src/globals/ext-tests/brotli.php @@ -4,5 +4,5 @@ $str = 'brotli_compress ( string $data, int $level = BROTLI_COMPRESS_LEVEL_DEFAULT, int $mode = BROTLI_GENERIC, string|null $dict = null ): string|false'; assert(function_exists('brotli_compress')); -assert(function_exists('brotli_uncompress ')); +assert(function_exists('brotli_uncompress')); assert(brotli_uncompress(brotli_compress($str)) === $str); From 01a79fcc6eae92393ea74d584015d15e95916c72 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 5 Jun 2025 20:07:55 +0700 Subject: [PATCH 122/204] unify tests for all compression extensions --- src/globals/ext-tests/brotli.php | 11 +++++++++-- src/globals/ext-tests/bz2.php | 13 ++++++++++--- src/globals/ext-tests/xz.php | 11 +++++++++-- src/globals/ext-tests/zlib.php | 11 ++++++++++- src/globals/ext-tests/zstd.php | 15 +++++++++++++++ 5 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/globals/ext-tests/zstd.php diff --git a/src/globals/ext-tests/brotli.php b/src/globals/ext-tests/brotli.php index 2b24941d1..bfe9f2592 100644 --- a/src/globals/ext-tests/brotli.php +++ b/src/globals/ext-tests/brotli.php @@ -2,7 +2,14 @@ declare(strict_types=1); -$str = 'brotli_compress ( string $data, int $level = BROTLI_COMPRESS_LEVEL_DEFAULT, int $mode = BROTLI_GENERIC, string|null $dict = null ): string|false'; assert(function_exists('brotli_compress')); assert(function_exists('brotli_uncompress')); -assert(brotli_uncompress(brotli_compress($str)) === $str); + +$input = str_repeat('The quick brown fox jumps over the lazy dog. ', 10); +$compressed = brotli_compress($input); +assert(is_string($compressed)); +assert(strlen($compressed) < strlen($input)); + +$uncompressed = brotli_uncompress($compressed); +assert(is_string($uncompressed)); +assert($uncompressed === $input); diff --git a/src/globals/ext-tests/bz2.php b/src/globals/ext-tests/bz2.php index 7550bee14..f5402dcfd 100644 --- a/src/globals/ext-tests/bz2.php +++ b/src/globals/ext-tests/bz2.php @@ -2,7 +2,14 @@ declare(strict_types=1); -$str = 'This is bz2 extension test'; -assert(function_exists('bzdecompress')); assert(function_exists('bzcompress')); -assert(bzdecompress(bzcompress($str, 9)) === $str); +assert(function_exists('bzdecompress')); + +$input = str_repeat('The quick brown fox jumps over the lazy dog. ', 10); +$compressed = bzcompress($input); +assert(is_string($compressed)); +assert(strlen($compressed) < strlen($input)); + +$uncompressed = bzdecompress($compressed); +assert(is_string($uncompressed)); +assert($uncompressed === $input); diff --git a/src/globals/ext-tests/xz.php b/src/globals/ext-tests/xz.php index bae345fa8..5f7503d73 100644 --- a/src/globals/ext-tests/xz.php +++ b/src/globals/ext-tests/xz.php @@ -2,7 +2,14 @@ declare(strict_types=1); -$str = 'Data you would like compressed.'; assert(function_exists('xzencode')); assert(function_exists('xzdecode')); -assert(xzdecode(xzencode($str)) === $str); + +$input = str_repeat('The quick brown fox jumps over the lazy dog. ', 10); +$compressed = xzencode($input); +assert(is_string($compressed)); +assert(strlen($compressed) < strlen($input)); + +$uncompressed = xzdecode($compressed); +assert(is_string($uncompressed)); +assert($uncompressed === $input); diff --git a/src/globals/ext-tests/zlib.php b/src/globals/ext-tests/zlib.php index 1fae531fe..699fc7597 100644 --- a/src/globals/ext-tests/zlib.php +++ b/src/globals/ext-tests/zlib.php @@ -3,4 +3,13 @@ declare(strict_types=1); assert(function_exists('gzcompress')); -assert(gzdecode(gzencode('aaa')) === 'aaa'); +assert(function_exists('gzdecode')); + +$input = str_repeat('The quick brown fox jumps over the lazy dog. ', 10); +$compressed = gzcompress($input); +assert(is_string($compressed)); +assert(strlen($compressed) < strlen($input)); + +$uncompressed = gzdecode($compressed); +assert(is_string($uncompressed)); +assert($uncompressed === $input); diff --git a/src/globals/ext-tests/zstd.php b/src/globals/ext-tests/zstd.php new file mode 100644 index 000000000..3ebaf2a27 --- /dev/null +++ b/src/globals/ext-tests/zstd.php @@ -0,0 +1,15 @@ + Date: Thu, 5 Jun 2025 20:14:02 +0700 Subject: [PATCH 123/204] cs fix --- src/SPC/store/SourcePatcher.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 656e34cde..6abcf52d2 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -461,7 +461,9 @@ public static function patchFfiCentos7FixO3strncmp(): bool if (file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { $file = SOURCE_PATH . '/php-src/main/php_version.h'; $cnt = preg_match('/PHP_VERSION "(\d+\.\d+\.\d+)"/', file_get_contents($file), $match); - if (!$cnt) return false; + if (!$cnt) { + return false; + } $version = $match[1]; } if (version_compare($version, '8.3.16', '<')) { From 31652e8b0460a27e4c8b8caaa6384ea25bf75c24 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 5 Jun 2025 20:26:41 +0700 Subject: [PATCH 124/204] I HATE WINDOWS --- src/globals/ext-tests/zstd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/ext-tests/zstd.php b/src/globals/ext-tests/zstd.php index 3ebaf2a27..72c7e2737 100644 --- a/src/globals/ext-tests/zstd.php +++ b/src/globals/ext-tests/zstd.php @@ -1,4 +1,4 @@ - Date: Thu, 5 Jun 2025 21:29:20 +0700 Subject: [PATCH 125/204] gzencode, of course --- src/globals/ext-tests/zlib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/ext-tests/zlib.php b/src/globals/ext-tests/zlib.php index 699fc7597..ed81775ce 100644 --- a/src/globals/ext-tests/zlib.php +++ b/src/globals/ext-tests/zlib.php @@ -2,11 +2,11 @@ declare(strict_types=1); -assert(function_exists('gzcompress')); +assert(function_exists('gzencode')); assert(function_exists('gzdecode')); $input = str_repeat('The quick brown fox jumps over the lazy dog. ', 10); -$compressed = gzcompress($input); +$compressed = gzencode($input); assert(is_string($compressed)); assert(strlen($compressed) < strlen($input)); From 861010af0ed3f0b3afb52ed26f2d143524de00ae Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 09:35:05 +0700 Subject: [PATCH 126/204] trim envs --- src/SPC/util/UnixShell.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/util/UnixShell.php b/src/SPC/util/UnixShell.php index 44e97bfec..f8a80affa 100644 --- a/src/SPC/util/UnixShell.php +++ b/src/SPC/util/UnixShell.php @@ -72,10 +72,10 @@ public function execWithResult(string $cmd, bool $with_log = true): array public function setEnv(array $env): UnixShell { foreach ($env as $k => $v) { - if ($v === '') { + if (trim($v) === '') { continue; } - $this->env[$k] = $v; + $this->env[$k] = trim($v); } return $this; } From 3b9670c202ceeba11f70da8841d155b51abd9c84 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 09:57:20 +0700 Subject: [PATCH 127/204] fpic for liblzma --- src/SPC/builder/unix/library/xz.php | 13 +++++++++---- src/SPC/command/CraftCommand.php | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index c1c84f1fa..e9ce30269 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -16,7 +16,12 @@ trait xz public function build(): void { shell()->cd($this->source_dir) - ->exec( + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) + ->execWithEnv( './configure ' . '--enable-static ' . '--disable-shared ' . @@ -26,9 +31,9 @@ public function build(): void '--with-libiconv ' . '--prefix=' ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->execWithEnv('make clean') + ->execWithEnv("make -j{$this->builder->concurrency}") + ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['liblzma.pc']); } } diff --git a/src/SPC/command/CraftCommand.php b/src/SPC/command/CraftCommand.php index c5ddfb741..8d3cc2bee 100644 --- a/src/SPC/command/CraftCommand.php +++ b/src/SPC/command/CraftCommand.php @@ -75,7 +75,7 @@ public function handle(): int } if (isset($craft['php-version'])) { $args[] = '--with-php=' . $craft['php-version']; - if (!array_key_exists('ignore-cache-sources', $craft['download-options']) || $craft['download-options']['ignore-cache-sources'] === false) { + if (!array_key_exists('ignore-cache-sources', $craft['download-options'])) { $craft['download-options']['ignore-cache-sources'] = 'php-src'; } } From 7c4c8c6275d79da2f90f5d79b8df455032dfdbf2 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 13:10:28 +0700 Subject: [PATCH 128/204] cache libc version --- src/SPC/builder/linux/SystemUtil.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/linux/SystemUtil.php b/src/SPC/builder/linux/SystemUtil.php index e49830d25..e873667ae 100644 --- a/src/SPC/builder/linux/SystemUtil.php +++ b/src/SPC/builder/linux/SystemUtil.php @@ -9,6 +9,7 @@ class SystemUtil { + static ?string $libc_version = null; use UnixSystemUtilTrait; /** @noinspection PhpMissingBreakStatementInspection */ @@ -188,6 +189,9 @@ public static function getSupportedDistros(): array */ public static function getLibcVersionIfExists(): ?string { + if (self::$libc_version !== null) { + return self::$libc_version; + } if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'glibc') { $result = shell()->execWithResult('ldd --version', false); if ($result[0] !== 0) { @@ -198,7 +202,8 @@ public static function getLibcVersionIfExists(): ?string // match ldd version: "ldd (some useless text) 2.17" match 2.17 $pattern = '/ldd\s+\(.*?\)\s+(\d+\.\d+)/'; if (preg_match($pattern, $first_line, $matches)) { - return $matches[1]; + self::$libc_version = $matches[1]; + return self::$libc_version; } return null; } @@ -212,7 +217,8 @@ public static function getLibcVersionIfExists(): ?string // match ldd version: "Version 1.2.3" match 1.2.3 $pattern = '/Version\s+(\d+\.\d+\.\d+)/'; if (preg_match($pattern, $result[1][1] ?? '', $matches)) { - return $matches[1]; + self::$libc_version = $matches[1]; + return self::$libc_version; } } return null; From 3761a9c8baa944535bd62593659e5e15a4a40cb2 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 13:18:49 +0700 Subject: [PATCH 129/204] brotli was matching /dev/null, which should not be used --- config/source.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/source.json b/config/source.json index 796e96f5f..803734e9c 100644 --- a/config/source.json +++ b/config/source.json @@ -50,8 +50,9 @@ } }, "brotli": { - "type": "ghtar", + "type": "ghtag", "repo": "google/brotli", + "match": "v1\\.\\d\\d", "provide-pre-built": true, "license": { "type": "file", From 1479bef00da211edb2677942498063628a8aab35 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 13:21:20 +0700 Subject: [PATCH 130/204] brotli was matching /dev/null, which should not be used --- config/source.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/source.json b/config/source.json index 803734e9c..f5987c3cf 100644 --- a/config/source.json +++ b/config/source.json @@ -50,9 +50,9 @@ } }, "brotli": { - "type": "ghtag", + "type": "ghtagtar", "repo": "google/brotli", - "match": "v1\\.\\d\\d", + "match": "v1\\.\\d.*", "provide-pre-built": true, "license": { "type": "file", From 4582e1f508c81cfdb60a1767d407ec2e8286a624 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 13:57:45 +0700 Subject: [PATCH 131/204] cs fix --- src/SPC/builder/extension/lz4.php | 2 +- src/SPC/builder/linux/SystemUtil.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/extension/lz4.php b/src/SPC/builder/extension/lz4.php index 541b1ecde..5727a97d5 100644 --- a/src/SPC/builder/extension/lz4.php +++ b/src/SPC/builder/extension/lz4.php @@ -15,7 +15,7 @@ public function getUnixConfigureArg(bool $shared = false): string return '--enable-lz4' . ($shared ? '=shared' : '') . ' --with-lz4-includedir=' . BUILD_ROOT_PATH; } - public function getWindowsConfigureArg(): string + public function getWindowsConfigureArg(bool $shared = false): string { return '--enable-lz4'; } diff --git a/src/SPC/builder/linux/SystemUtil.php b/src/SPC/builder/linux/SystemUtil.php index e873667ae..a85f3dec6 100644 --- a/src/SPC/builder/linux/SystemUtil.php +++ b/src/SPC/builder/linux/SystemUtil.php @@ -9,9 +9,10 @@ class SystemUtil { - static ?string $libc_version = null; use UnixSystemUtilTrait; + public static ?string $libc_version = null; + /** @noinspection PhpMissingBreakStatementInspection */ public static function getOSRelease(): array { From b6a118287622d817f2ec48716fc0b092621dfbf3 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 14:26:06 +0700 Subject: [PATCH 132/204] patch la files --- src/SPC/builder/unix/library/nghttp2.php | 1 + src/SPC/builder/unix/library/nghttp3.php | 1 + src/SPC/builder/unix/library/ngtcp2.php | 1 + src/SPC/builder/unix/library/xz.php | 1 + 4 files changed, 4 insertions(+) diff --git a/src/SPC/builder/unix/library/nghttp2.php b/src/SPC/builder/unix/library/nghttp2.php index 25cf17460..5fe5bc9ba 100644 --- a/src/SPC/builder/unix/library/nghttp2.php +++ b/src/SPC/builder/unix/library/nghttp2.php @@ -53,5 +53,6 @@ protected function build(): void ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv("make install DESTDIR={$destdir}"); $this->patchPkgconfPrefix(['libnghttp2.pc']); + $this->patchLaDependencyPrefix(['libnghttp2.la']); } } diff --git a/src/SPC/builder/unix/library/nghttp3.php b/src/SPC/builder/unix/library/nghttp3.php index 6f677869d..2b2e06157 100644 --- a/src/SPC/builder/unix/library/nghttp3.php +++ b/src/SPC/builder/unix/library/nghttp3.php @@ -41,5 +41,6 @@ protected function build(): void ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libnghttp3.pc']); + $this->patchLaDependencyPrefix(['libnghttp3.la']); } } diff --git a/src/SPC/builder/unix/library/ngtcp2.php b/src/SPC/builder/unix/library/ngtcp2.php index 206204992..7b075ed94 100644 --- a/src/SPC/builder/unix/library/ngtcp2.php +++ b/src/SPC/builder/unix/library/ngtcp2.php @@ -45,5 +45,6 @@ protected function build(): void ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libngtcp2.pc']); $this->patchPkgconfPrefix(['libngtcp2_crypto_ossl.pc']); + $this->patchLaDependencyPrefix(['libngtcp2.la', 'libngtcp2_crypto_ossl.la']); } } diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index e9ce30269..f3b4d9349 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -35,5 +35,6 @@ public function build(): void ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['liblzma.pc']); + $this->patchLaDependencyPrefix(['liblzma.la']); } } From a68212672bd24e6954433387c75ead9a384d6f1c Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 23:49:58 +0700 Subject: [PATCH 133/204] apply suggestions --- src/SPC/builder/Extension.php | 8 +++++- src/SPC/builder/extension/curl.php | 6 ++--- src/SPC/builder/extension/dom.php | 2 +- src/SPC/builder/extension/pdo_sqlsrv.php | 33 ------------------------ src/SPC/builder/extension/pgsql.php | 5 +--- src/SPC/builder/linux/LinuxBuilder.php | 12 --------- src/SPC/command/BuildPHPCommand.php | 2 +- src/SPC/store/SourcePatcher.php | 13 +++------- 8 files changed, 17 insertions(+), 64 deletions(-) delete mode 100644 src/SPC/builder/extension/pdo_sqlsrv.php diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 1ffc6dc3f..f4207dc6a 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -235,7 +235,7 @@ public function getSharedExtensionLoadString(): string $ret = ''; foreach ($order as $ext) { if ($ext instanceof Extension && $ext->isBuildShared()) { - if (Config::getExt($ext->getName(), 'zend_extension', false) === true) { + if (Config::getExt($ext->getName(), 'zend-extension', false) === true) { $ret .= " -d \"zend_extension={$ext->getName()}\""; } else { $ret .= " -d \"extension={$ext->getName()}\""; @@ -371,6 +371,7 @@ public function buildUnixShared(): void } $env = [ 'CFLAGS' => $config['cflags'], + 'CXXFLAGS' => $config['cflags'], 'LDFLAGS' => $config['ldflags'], 'LIBS' => '-Wl,-Bstatic ' . $staticLibs . ' -Wl,-Bdynamic ' . $sharedLibs, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, @@ -485,6 +486,11 @@ private function getLibraryDependencies(bool $recursive = false): array } } + if (array_key_exists(0, $deps)) { + $zero = [0 => $deps[0]]; + unset($deps[0]); + return $zero + $deps; + } return $deps; } } diff --git a/src/SPC/builder/extension/curl.php b/src/SPC/builder/extension/curl.php index 4779e67c7..0c5de6a5e 100644 --- a/src/SPC/builder/extension/curl.php +++ b/src/SPC/builder/extension/curl.php @@ -22,7 +22,7 @@ public function patchBeforeBuildconf(): bool { logger()->info('patching before-configure for curl checks'); $file1 = "AC_DEFUN([PHP_CHECK_LIBRARY], [\n $3\n])"; - $files = FileSystem::readFile(SOURCE_PATH . '/php-src/ext/curl/config.m4'); + $files = FileSystem::readFile($this->source_dir . '/config.m4'); $file2 = 'AC_DEFUN([PHP_CHECK_LIBRARY], [ save_old_LDFLAGS=$LDFLAGS ac_stuff="$5" @@ -41,7 +41,7 @@ public function patchBeforeBuildconf(): bool $4 ])dnl ])'; - file_put_contents(SOURCE_PATH . '/php-src/ext/curl/config.m4', $file1 . "\n" . $files . "\n" . $file2); + file_put_contents($this->source_dir . '/config.m4', $file1 . "\n" . $files . "\n" . $file2); return true; } @@ -59,7 +59,7 @@ public function patchBeforeConfigure(): bool public function patchBeforeSharedConfigure(): bool { - $file = SOURCE_PATH . '/php-src/ext/curl/config.m4'; + $file = $this->source_dir . '/config.m4'; $content = FileSystem::readFile($file); // Inject patch before it diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php index fb1a4e158..85437f623 100644 --- a/src/SPC/builder/extension/dom.php +++ b/src/SPC/builder/extension/dom.php @@ -30,6 +30,6 @@ public function patchBeforeBuildconf(): bool public function getWindowsConfigureArg($shared = false): string { - return '--with-dom --with-libxml'; + return '--with-dom'; } } diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php deleted file mode 100644 index ed501bb26..000000000 --- a/src/SPC/builder/extension/pdo_sqlsrv.php +++ /dev/null @@ -1,33 +0,0 @@ -builder))->config([$this->getName()]); - $env = [ - 'CFLAGS' => $config['cflags'], - 'CXXFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'], - 'LIBS' => $config['libs'], - 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, - ]; - // prepare configure args - shell()->cd($this->source_dir) - ->setEnv($env) - ->execWithEnv(BUILD_BIN_PATH . '/phpize') - ->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/pgsql.php b/src/SPC/builder/extension/pgsql.php index df852f4b7..a70c1fb72 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -39,12 +39,9 @@ public function getUnixConfigureArg(bool $shared = false): string $libfiles = $this->getLibFilesString(); $libfiles = str_replace(BUILD_LIB_PATH . '/lib', '-l', $libfiles); $libfiles = str_replace('.a', '', $libfiles); - $libfiles = str_replace(' -lpq', '', $libfiles); - $libfiles = str_replace(' -lpgport', '', $libfiles); - $libfiles = str_replace(' -lpgcommon', '', $libfiles); return '--with-pgsql' . ($shared ? '=shared' : '') . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . - ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon ' . $libfiles . '"'; + ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' ' . $libfiles . '"'; } return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index c40f88716..61a436ebf 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -109,18 +109,6 @@ public function makeAutoconfArgs(string $name, array $libSpecs): string */ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void { - if ($build_target === BUILD_TARGET_EMBED && - file_exists(BUILD_BIN_PATH . '/php-config') && - file_exists(BUILD_BIN_PATH . '/phpize') - ) { - $embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static'; - if ($embed_type === 'shared' && file_exists(BUILD_LIB_PATH . '/libphp.so')) { - return; - } - if (file_exists(BUILD_LIB_PATH . '/libphp.a')) { - return; - } - } // ---------- Update extra-libs ---------- $extra_libs = getenv('SPC_EXTRA_LIBS') ?: ''; // bloat means force-load all static libraries, even if they are not used diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 61781d2c7..24900d6d1 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -208,7 +208,7 @@ public function handle(): int SourcePatcher::patchSPCVersionToPHP($this->getApplication()->getVersion()); // start to build - $builder->buildPHP($rule); + // $builder->buildPHP($rule); SourcePatcher::patchBeforeSharedBuild($builder); diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 6abcf52d2..d61020b81 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -457,16 +457,11 @@ public static function patchFfiCentos7FixO3strncmp(): bool if (PHP_OS_FAMILY !== 'Linux' || SystemUtil::getLibcVersionIfExists() >= '2.17') { return false; } - $version = null; - if (file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { - $file = SOURCE_PATH . '/php-src/main/php_version.h'; - $cnt = preg_match('/PHP_VERSION "(\d+\.\d+\.\d+)"/', file_get_contents($file), $match); - if (!$cnt) { - return false; - } - $version = $match[1]; + if (!file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { + return false; } - if (version_compare($version, '8.3.16', '<')) { + $file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h'); + if (preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0 && intval($match[1]) < 80316) { return false; } SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src'); From 715650c4db11a6df437c035138fc91a1c7827c9d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 23:51:58 +0700 Subject: [PATCH 134/204] add "which" to spc doctor --- src/SPC/doctor/item/LinuxToolCheckList.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index 88a44a8e4..2522eb58e 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -21,7 +21,7 @@ class LinuxToolCheckList 'tar', 'unzip', 'gzip', 'bzip2', 'cmake', 'gcc', 'g++', 'patch', 'binutils-gold', - 'libtoolize', + 'libtoolize', 'which', ]; public const TOOLS_DEBIAN = [ @@ -29,14 +29,14 @@ class LinuxToolCheckList 'git', 'autoconf', 'automake', 'autopoint', 'tar', 'unzip', 'gzip', 'bzip2', 'cmake', 'patch', - 'xz', 'libtoolize', + 'xz', 'libtoolize', 'which', ]; public const TOOLS_RHEL = [ 'perl', 'make', 'bison', 'flex', 'git', 'autoconf', 'automake', 'tar', 'unzip', 'gzip', 'gcc', - 'bzip2', 'cmake', 'patch', + 'bzip2', 'cmake', 'patch', 'which', 'xz', 'libtool', 'gettext-devel', ]; From 0d91ad7d94fc62d34ae28df40e39718bdfc79e82 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 23:57:48 +0700 Subject: [PATCH 135/204] remove buildUnixShared method from sqlsrv --- src/SPC/builder/extension/sqlsrv.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/SPC/builder/extension/sqlsrv.php b/src/SPC/builder/extension/sqlsrv.php index 55a2b6a09..edf5d919b 100644 --- a/src/SPC/builder/extension/sqlsrv.php +++ b/src/SPC/builder/extension/sqlsrv.php @@ -7,7 +7,6 @@ use SPC\builder\Extension; use SPC\store\FileSystem; use SPC\util\CustomExt; -use SPC\util\SPCConfigUtil; #[CustomExt('sqlsrv')] class sqlsrv extends Extension @@ -34,31 +33,4 @@ public function patchBeforeConfigure(): bool } return false; } - - public function buildUnixShared(): void - { - $config = (new SPCConfigUtil($this->builder))->config([$this->getName()]); - $env = [ - 'CFLAGS' => $config['cflags'], - 'CXXFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'], - 'LIBS' => $config['libs'], - 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, - ]; - // prepare configure args - shell()->cd($this->source_dir) - ->setEnv($env) - ->execWithEnv(BUILD_BIN_PATH . '/phpize'); - - if ($this->patchBeforeSharedConfigure()) { - logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure'); - } - - shell()->cd($this->source_dir) - ->setEnv($env) - ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic') - ->execWithEnv('make clean') - ->execWithEnv('make -j' . $this->builder->concurrency) - ->execWithEnv('make install'); - } } From f29ee9517621cf09dbb27567a116104928db1373 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Fri, 6 Jun 2025 23:58:33 +0700 Subject: [PATCH 136/204] remove buildUnixShared method from xhprof --- src/SPC/builder/extension/xhprof.php | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/SPC/builder/extension/xhprof.php b/src/SPC/builder/extension/xhprof.php index 589ac5831..afb222577 100644 --- a/src/SPC/builder/extension/xhprof.php +++ b/src/SPC/builder/extension/xhprof.php @@ -31,30 +31,4 @@ public function patchBeforeBuildconf(): bool } return false; } - - public function buildUnixShared(): void - { - $config = (new SPCConfigUtil($this->builder))->config([$this->getName()]); - $env = [ - 'CFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'], - 'LIBS' => $config['libs'], - 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, - ]; - // prepare configure args - shell()->cd($this->source_dir . '/extension') - ->setEnv($env) - ->execWithEnv(BUILD_BIN_PATH . '/phpize'); - - if ($this->patchBeforeSharedConfigure()) { - logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure'); - } - - shell()->cd($this->source_dir . '/extension') - ->setEnv($env) - ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --with-pic') - ->execWithEnv('make clean') - ->execWithEnv('make -j' . $this->builder->concurrency) - ->execWithEnv('make install'); - } } From 111de20a5766550a19830ae1cb4f0e115618522b Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 00:00:17 +0700 Subject: [PATCH 137/204] fix cs --- src/SPC/builder/extension/xhprof.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SPC/builder/extension/xhprof.php b/src/SPC/builder/extension/xhprof.php index afb222577..c3d98aac3 100644 --- a/src/SPC/builder/extension/xhprof.php +++ b/src/SPC/builder/extension/xhprof.php @@ -7,7 +7,6 @@ use SPC\builder\Extension; use SPC\store\FileSystem; use SPC\util\CustomExt; -use SPC\util\SPCConfigUtil; #[CustomExt('xhprof')] class xhprof extends Extension From e31942bf1e64187c2c65a5625f1178a91a331353 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 08:21:56 +0700 Subject: [PATCH 138/204] uncommented buildphp, haha --- src/SPC/command/BuildPHPCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 24900d6d1..61781d2c7 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -208,7 +208,7 @@ public function handle(): int SourcePatcher::patchSPCVersionToPHP($this->getApplication()->getVersion()); // start to build - // $builder->buildPHP($rule); + $builder->buildPHP($rule); SourcePatcher::patchBeforeSharedBuild($builder); From 2dde53760a8a8d041b004485c9f034ed1b9a902d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 20:09:50 +0700 Subject: [PATCH 139/204] makeCmakeArgs --- src/SPC/builder/linux/library/icu.php | 2 +- src/SPC/builder/linux/library/libxml2.php | 8 +------ src/SPC/builder/macos/library/glfw.php | 2 +- src/SPC/builder/macos/library/libxml2.php | 8 +------ src/SPC/builder/unix/UnixBuilderBase.php | 3 +++ src/SPC/builder/unix/library/curl.php | 2 +- src/SPC/builder/unix/library/freetype.php | 4 +--- src/SPC/builder/unix/library/gmssl.php | 2 +- src/SPC/builder/unix/library/libaom.php | 11 +--------- src/SPC/builder/unix/library/libavif.php | 2 +- src/SPC/builder/unix/library/libde265.php | 11 +--------- src/SPC/builder/unix/library/libevent.php | 11 +++++----- src/SPC/builder/unix/library/libheif.php | 7 +------ src/SPC/builder/unix/library/libjpeg.php | 1 - src/SPC/builder/unix/library/librabbitmq.php | 11 +--------- src/SPC/builder/unix/library/libssh2.php | 8 +------ src/SPC/builder/unix/library/libuuid.php | 6 +----- src/SPC/builder/unix/library/libuv.php | 2 +- src/SPC/builder/unix/library/libwebp.php | 9 +------- src/SPC/builder/unix/library/libyaml.php | 22 ++++++-------------- src/SPC/builder/unix/library/libzip.php | 7 +------ src/SPC/builder/unix/library/mimalloc.php | 10 +-------- src/SPC/builder/unix/library/snappy.php | 4 +--- src/SPC/builder/unix/library/tidy.php | 13 +++++------- src/SPC/builder/unix/library/zstd.php | 13 +++--------- 25 files changed, 41 insertions(+), 138 deletions(-) diff --git a/src/SPC/builder/linux/library/icu.php b/src/SPC/builder/linux/library/icu.php index ddcfe1b29..87a922347 100644 --- a/src/SPC/builder/linux/library/icu.php +++ b/src/SPC/builder/linux/library/icu.php @@ -15,7 +15,7 @@ class icu extends LinuxLibraryBase protected function build(): void { $cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1 -DPIC -fPIC"'; - $cxxflags = 'CXXFLAGS="-std=c++17 -fPIC -fno-ident"'; + $cxxflags = 'CXXFLAGS="-std=c++17 -DPIC -fPIC -fno-ident"'; $ldflags = getenv('SPC_LIBC') !== 'glibc' ? 'LDFLAGS="-static"' : ''; shell()->cd($this->source_dir . '/source') ->setEnv([ diff --git a/src/SPC/builder/linux/library/libxml2.php b/src/SPC/builder/linux/library/libxml2.php index 6d9470aea..5f4f1dc94 100644 --- a/src/SPC/builder/linux/library/libxml2.php +++ b/src/SPC/builder/linux/library/libxml2.php @@ -30,13 +30,7 @@ public function build(): void 'LIBS' => $this->getLibExtraLibs(), ]) ->execWithEnv( - 'cmake ' . - '-DCMAKE_BUILD_TYPE=Release ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - '-DCMAKE_INSTALL_LIBDIR=' . BUILD_LIB_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . + "cmake {$this->builder->makeCmakeArgs()} " . '-DIconv_IS_BUILT_IN=OFF ' . '-DLIBXML2_WITH_ICONV=ON ' . "-DLIBXML2_WITH_ZLIB={$enable_zlib} " . diff --git a/src/SPC/builder/macos/library/glfw.php b/src/SPC/builder/macos/library/glfw.php index a3b88b6ad..8ab847704 100644 --- a/src/SPC/builder/macos/library/glfw.php +++ b/src/SPC/builder/macos/library/glfw.php @@ -19,7 +19,7 @@ protected function build(): void { // compile! shell()->cd(SOURCE_PATH . '/ext-glfw/vendor/glfw') - ->exec("cmake . {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DPOSITION_INDEPENDENT_CODE=ON -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF") + ->exec("cmake . {$this->builder->makeCmakeArgs()} -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF") ->exec("make -j{$this->builder->concurrency}") ->exec('make install'); // patch pkgconf diff --git a/src/SPC/builder/macos/library/libxml2.php b/src/SPC/builder/macos/library/libxml2.php index f8d75f838..d4646dbab 100644 --- a/src/SPC/builder/macos/library/libxml2.php +++ b/src/SPC/builder/macos/library/libxml2.php @@ -25,15 +25,9 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') ->exec( - 'cmake ' . + "cmake {$this->builder->makeCmakeArgs()} " . // '--debug-find ' . - '-DCMAKE_BUILD_TYPE=Release ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - '-DCMAKE_INSTALL_LIBDIR=' . BUILD_LIB_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DBUILD_SHARED_LIBS=OFF ' . '-DLIBXML2_WITH_ICONV=ON ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . "-DLIBXML2_WITH_ZLIB={$enable_zlib} " . "-DLIBXML2_WITH_ICU={$enable_icu} " . "-DLIBXML2_WITH_LZMA={$enable_xz} " . diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index d645a68f0..26b5747be 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -60,6 +60,9 @@ public function makeCmakeArgs(): string { $extra = $this instanceof LinuxBuilder ? '-DCMAKE_C_COMPILER=' . getenv('CC') . ' ' : ''; return $extra . + '-DBUILD_STATIC_LIBS=ON ' . + '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DCMAKE_BUILD_TYPE=Release ' . '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . '-DCMAKE_INSTALL_BINDIR=bin ' . diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index 5296d636a..7a166b20c 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -86,7 +86,7 @@ protected function build(): void 'LIBS' => $this->getLibExtraLibs(), ]) ->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ../CMakeLists.txt') - ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DPOSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DBUILD_LIBCURL_DOCS=OFF {$extra} ..") + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_CURL_EXE=OFF -DBUILD_LIBCURL_DOCS=OFF {$extra} ..") ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install'); // patch pkgconf diff --git a/src/SPC/builder/unix/library/freetype.php b/src/SPC/builder/unix/library/freetype.php index 903d3746f..187ebeff6 100644 --- a/src/SPC/builder/unix/library/freetype.php +++ b/src/SPC/builder/unix/library/freetype.php @@ -33,9 +33,7 @@ protected function build(): void 'LIBS' => $this->getLibExtraLibs(), ]) ->execWithEnv( - "cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON " . - '-DBUILD_SHARED_LIBS=OFF ' . - "{$extra}.." + "cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON {$extra}.." ) ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/gmssl.php b/src/SPC/builder/unix/library/gmssl.php index bf0abe8ee..5e2fe153a 100644 --- a/src/SPC/builder/unix/library/gmssl.php +++ b/src/SPC/builder/unix/library/gmssl.php @@ -25,7 +25,7 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DPOSITION_INDEPENDENT_CODE=ON ..") + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} ..") ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); } diff --git a/src/SPC/builder/unix/library/libaom.php b/src/SPC/builder/unix/library/libaom.php index d0de97d74..38e0b95a7 100644 --- a/src/SPC/builder/unix/library/libaom.php +++ b/src/SPC/builder/unix/library/libaom.php @@ -20,16 +20,7 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/builddir'); // Start build shell()->cd($this->source_dir . '/builddir') - ->exec( - 'cmake ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DCMAKE_BUILD_TYPE=Release ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '-DAOM_TARGET_CPU=generic ' . - '..' - ) + ->exec("cmake {$this->builder->makeCmakeArgs()} -DAOM_TARGET_CPU=generic ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); $this->patchPkgconfPrefix(['aom.pc']); diff --git a/src/SPC/builder/unix/library/libavif.php b/src/SPC/builder/unix/library/libavif.php index e0b0430da..3c01c1028 100644 --- a/src/SPC/builder/unix/library/libavif.php +++ b/src/SPC/builder/unix/library/libavif.php @@ -27,7 +27,7 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DPOSITION_INDEPENDENT_CODE=ON -DAVIF_LIBYUV=OFF ..") + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DAVIF_LIBYUV=OFF ..") ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); // patch pkgconfig diff --git a/src/SPC/builder/unix/library/libde265.php b/src/SPC/builder/unix/library/libde265.php index bf1546f2b..0f7d44a1b 100644 --- a/src/SPC/builder/unix/library/libde265.php +++ b/src/SPC/builder/unix/library/libde265.php @@ -20,16 +20,7 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->exec( - 'cmake ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DCMAKE_BUILD_TYPE=Release ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '-DENABLE_SDL=OFF ' . // Disable SDL, currently not supported - '..' - ) + ->exec("cmake {$this->builder->makeCmakeArgs()} ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); $this->patchPkgconfPrefix(['libde265.pc']); diff --git a/src/SPC/builder/unix/library/libevent.php b/src/SPC/builder/unix/library/libevent.php index 437bd68df..58b1b8798 100644 --- a/src/SPC/builder/unix/library/libevent.php +++ b/src/SPC/builder/unix/library/libevent.php @@ -39,8 +39,11 @@ public function beforePack(): void */ protected function build(): void { - [$lib, $include, $destdir] = SEPARATED_PATH; // CMake needs a clean build directory + $extra = ''; + if (version_compare(get_cmake_version(), '4.0.0', '>=')) { + $extra .= '-DCMAKE_POLICY_VERSION_MINIMUM=3.10 '; + } FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') @@ -50,11 +53,7 @@ protected function build(): void 'LIBS' => $this->getLibExtraLibs(), ]) ->execWithEnv( - 'cmake ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '-DCMAKE_BUILD_TYPE=Release ' . + "cmake {$this->builder->makeCmakeArgs()} {$extra}" . '-DEVENT__LIBRARY_TYPE=STATIC ' . '-DEVENT__DISABLE_BENCHMARK=ON ' . '-DEVENT__DISABLE_THREAD_SUPPORT=ON ' . diff --git a/src/SPC/builder/unix/library/libheif.php b/src/SPC/builder/unix/library/libheif.php index 5725b7373..9e92cf226 100644 --- a/src/SPC/builder/unix/library/libheif.php +++ b/src/SPC/builder/unix/library/libheif.php @@ -21,13 +21,8 @@ protected function build(): void // Start build shell()->cd($this->source_dir . '/build') ->exec( - 'cmake ' . + "cmake {$this->builder->makeCmakeArgs()} " . '--preset=release ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DCMAKE_BUILD_TYPE=Release ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DWITH_EXAMPLES=OFF ' . '-DWITH_GDK_PIXBUF=OFF ' . '-DBUILD_TESTING=OFF ' . diff --git a/src/SPC/builder/unix/library/libjpeg.php b/src/SPC/builder/unix/library/libjpeg.php index 5612e1301..c4f9833d2 100644 --- a/src/SPC/builder/unix/library/libjpeg.php +++ b/src/SPC/builder/unix/library/libjpeg.php @@ -26,7 +26,6 @@ protected function build(): void "cmake {$this->builder->makeCmakeArgs()} " . '-DENABLE_STATIC=ON ' . '-DENABLE_SHARED=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . '..' ) ->exec("cmake --build . -j {$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/librabbitmq.php b/src/SPC/builder/unix/library/librabbitmq.php index 1f7fd0e3b..d4044b46d 100644 --- a/src/SPC/builder/unix/library/librabbitmq.php +++ b/src/SPC/builder/unix/library/librabbitmq.php @@ -20,16 +20,7 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->exec( - 'cmake ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DCMAKE_BUILD_TYPE=Release ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DBUILD_STATIC_LIBS=ON ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '..' - ) + ->exec("cmake {$this->builder->makeCmakeArgs()} ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); } diff --git a/src/SPC/builder/unix/library/libssh2.php b/src/SPC/builder/unix/library/libssh2.php index b99b9e7bf..f2132fc86 100644 --- a/src/SPC/builder/unix/library/libssh2.php +++ b/src/SPC/builder/unix/library/libssh2.php @@ -21,13 +21,7 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') ->exec( - 'cmake ' . - '-DCMAKE_BUILD_TYPE=Release ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - '-DCMAKE_INSTALL_LIBDIR=lib ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . + "cmake {$this->builder->makeCmakeArgs()} " . '-DBUILD_EXAMPLES=OFF ' . '-DBUILD_TESTING=OFF ' . "-DENABLE_ZLIB_COMPRESSION={$enable_zlib} " . diff --git a/src/SPC/builder/unix/library/libuuid.php b/src/SPC/builder/unix/library/libuuid.php index 405941ed6..cb13c66b7 100644 --- a/src/SPC/builder/unix/library/libuuid.php +++ b/src/SPC/builder/unix/library/libuuid.php @@ -18,11 +18,7 @@ protected function build(): void { FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') - ->exec( - 'cmake ' . - "{$this->builder->makeCmakeArgs()} -DPOSITION_INDEPENDENT_CODE=ON " . - '..' - ) + ->exec("cmake {$this->builder->makeCmakeArgs()} ..") ->exec("cmake --build . -j {$this->builder->concurrency}"); copy($this->source_dir . '/build/libuuid.a', BUILD_LIB_PATH . '/libuuid.a'); FileSystem::createDir(BUILD_INCLUDE_PATH . '/uuid'); diff --git a/src/SPC/builder/unix/library/libuv.php b/src/SPC/builder/unix/library/libuv.php index 2294a1e38..fda11c0a5 100644 --- a/src/SPC/builder/unix/library/libuv.php +++ b/src/SPC/builder/unix/library/libuv.php @@ -20,7 +20,7 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->exec("cmake {$this->builder->makeCmakeArgs()} -DPOSITION_INDEPENDENT_CODE=ON -DLIBUV_BUILD_SHARED=OFF ..") + ->exec("cmake {$this->builder->makeCmakeArgs()} -DLIBUV_BUILD_SHARED=OFF ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); // patch pkgconfig diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index 79fc1e3ec..29076c6d4 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -22,14 +22,7 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); // Start build shell()->cd($this->source_dir . '/build') - ->exec( - 'cmake ' . - $this->builder->makeCmakeArgs() . ' ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '-DWEBP_BUILD_EXTRAS=ON ' . - '..' - ) + ->exec("cmake {$this->builder->makeCmakeArgs()} -DWEBP_BUILD_EXTRAS=ON ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); // patch pkgconfig diff --git a/src/SPC/builder/unix/library/libyaml.php b/src/SPC/builder/unix/library/libyaml.php index b519f7094..6907535d5 100644 --- a/src/SPC/builder/unix/library/libyaml.php +++ b/src/SPC/builder/unix/library/libyaml.php @@ -31,24 +31,14 @@ public function getLibVersion(): ?string */ protected function build(): void { - [$lib, $include, $destdir] = SEPARATED_PATH; - + $extra = ''; + if (version_compare(get_cmake_version(), '4.0.0', '>=')) { + $extra .= '-DCMAKE_POLICY_VERSION_MINIMUM=3.5'; + } FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') - ->exec( - 'cmake ' . - // '--debug-find ' . - '-DCMAKE_BUILD_TYPE=Release ' . - '-DBUILD_TESTING=OFF ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '-DCMAKE_INSTALL_PREFIX=/ ' . - "-DCMAKE_INSTALL_LIBDIR={$lib} " . - "-DCMAKE_INSTALL_INCLUDEDIR={$include} " . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '..' - ) + ->exec("cmake {$this->builder->makeCmakeArgs()} {$extra} -DBUILD_TESTING=OFF ..") ->exec("make -j{$this->builder->concurrency}") - ->exec("make install DESTDIR={$destdir}"); + ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); } } diff --git a/src/SPC/builder/unix/library/libzip.php b/src/SPC/builder/unix/library/libzip.php index c206f3c9b..9c00d6a28 100644 --- a/src/SPC/builder/unix/library/libzip.php +++ b/src/SPC/builder/unix/library/libzip.php @@ -29,14 +29,9 @@ protected function build(): void FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') ->exec( - 'cmake ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DCMAKE_BUILD_TYPE=Release ' . + "cmake {$this->builder->makeCmakeArgs()} " . '-DENABLE_GNUTLS=OFF ' . '-DENABLE_MBEDTLS=OFF ' . - '-DBUILD_SHARED_LIBS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DBUILD_DOC=OFF ' . '-DBUILD_EXAMPLES=OFF ' . '-DBUILD_REGRESS=OFF ' . diff --git a/src/SPC/builder/unix/library/mimalloc.php b/src/SPC/builder/unix/library/mimalloc.php index 34b4f7be7..bbf80bbdd 100644 --- a/src/SPC/builder/unix/library/mimalloc.php +++ b/src/SPC/builder/unix/library/mimalloc.php @@ -24,15 +24,7 @@ protected function build(): void $args .= '-DMI_INSTALL_TOPLEVEL=ON '; FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') - ->execWithEnv( - 'cmake ' . - '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . - "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '-DCMAKE_BUILD_TYPE=Release ' . - $args . - '..' - ) + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} {$args} ..") ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install'); } diff --git a/src/SPC/builder/unix/library/snappy.php b/src/SPC/builder/unix/library/snappy.php index 8d1c3b8a7..e1a1d4151 100644 --- a/src/SPC/builder/unix/library/snappy.php +++ b/src/SPC/builder/unix/library/snappy.php @@ -20,11 +20,9 @@ protected function build(): void shell()->cd($this->source_dir . '/cmake/build') ->exec( - 'cmake ' . - "{$this->builder->makeCmakeArgs()} " . + "cmake {$this->builder->makeCmakeArgs()} " . '-DSNAPPY_BUILD_TESTS=OFF ' . '-DSNAPPY_BUILD_BENCHMARKS=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . '../..' ) ->exec("cmake --build . -j {$this->builder->concurrency}") diff --git a/src/SPC/builder/unix/library/tidy.php b/src/SPC/builder/unix/library/tidy.php index ce5cd462a..b9bc6951b 100644 --- a/src/SPC/builder/unix/library/tidy.php +++ b/src/SPC/builder/unix/library/tidy.php @@ -16,16 +16,13 @@ trait tidy */ protected function build(): void { + $extra = ''; + if (version_compare(get_cmake_version(), '4.0.0', '>=')) { + $extra .= '-DCMAKE_POLICY_VERSION_MINIMUM=3.5'; + } FileSystem::resetDir($this->source_dir . '/build-dir'); shell()->cd($this->source_dir . '/build-dir') - ->exec( - 'cmake ' . - "{$this->builder->makeCmakeArgs()} " . - '-DBUILD_SHARED_LIB=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '-DSUPPORT_CONSOLE_APP=OFF ' . - '..' - ) + ->exec("cmake {$this->builder->makeCmakeArgs()} {$extra} -DSUPPORT_CONSOLE_APP=OFF ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); $this->patchPkgconfPrefix(['tidy.pc']); diff --git a/src/SPC/builder/unix/library/zstd.php b/src/SPC/builder/unix/library/zstd.php index 939567f21..a8fe34bc6 100644 --- a/src/SPC/builder/unix/library/zstd.php +++ b/src/SPC/builder/unix/library/zstd.php @@ -23,16 +23,9 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->exec( - 'cmake ' . - "{$this->builder->makeCmakeArgs()} " . - '-DZSTD_BUILD_STATIC=ON ' . - '-DZSTD_BUILD_SHARED=OFF ' . - '-DPOSITION_INDEPENDENT_CODE=ON ' . - '..' - ) - ->exec("cmake --build . -j {$this->builder->concurrency}") - ->exec('make install'); + ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} ..") + ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") + ->execWithEnv('make install'); $this->patchPkgconfPrefix(['libzstd.pc']); } } From a6ea49981d331233283c9879a7b9040332cfcc78 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 20:29:19 +0700 Subject: [PATCH 140/204] ngtcp2 patch la files --- src/SPC/builder/unix/library/ngtcp2.php | 1 + src/globals/test-extensions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/ngtcp2.php b/src/SPC/builder/unix/library/ngtcp2.php index 8ea280a85..bfe449006 100644 --- a/src/SPC/builder/unix/library/ngtcp2.php +++ b/src/SPC/builder/unix/library/ngtcp2.php @@ -49,6 +49,7 @@ protected function build(): void ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']); + $this->patchLaDependencyPrefix(['libngtcp2.la', 'libngtcp2_crypto_ossl.la']); // on macOS, the static library may contain other static libraries? // ld: archive member 'libssl.a' not a mach-o file in libngtcp2_crypto_ossl.a diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 62963ce6d..cdd032643 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -57,7 +57,7 @@ // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => '', + 'Linux', 'Darwin' => 'ngtcp2,nghttp2,nghttp3,libavif', 'Windows' => '', }; From a3025479e7cdab7d1803c17ab453c0fb638a5755 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 20:50:46 +0700 Subject: [PATCH 141/204] fix libyaml install dir --- src/SPC/builder/unix/library/libyaml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/libyaml.php b/src/SPC/builder/unix/library/libyaml.php index 6907535d5..145f5b57c 100644 --- a/src/SPC/builder/unix/library/libyaml.php +++ b/src/SPC/builder/unix/library/libyaml.php @@ -39,6 +39,6 @@ protected function build(): void shell()->cd($this->source_dir . '/build') ->exec("cmake {$this->builder->makeCmakeArgs()} {$extra} -DBUILD_TESTING=OFF ..") ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->exec('make install'); } } From 0b8543e6ddb7657cb8a953d5860c6c238afee2b5 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 20:50:54 +0700 Subject: [PATCH 142/204] thread safety for pgsql? --- src/SPC/builder/unix/library/postgresql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 5a0da5de3..acddc14ff 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -91,7 +91,7 @@ protected function build(): void ->execWithEnv( "{$envs} ../configure " . "--prefix={$builddir} " . - '--disable-thread-safety ' . + ($this->builder->getOption('enable-zts') ? '--enable-thread-safety ' : '--disable-thread-safety ') . '--enable-coverage=no ' . '--with-ssl=openssl ' . '--with-readline ' . From 23be5484e3a6263354ffff72d38371704028132a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 21:16:15 +0700 Subject: [PATCH 143/204] thread safety for pgsql (in version 17, remove this entirely) --- config/source.json | 5 +++-- src/SPC/builder/unix/library/ldap.php | 2 ++ src/SPC/builder/unix/library/postgresql.php | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config/source.json b/config/source.json index 10fd74726..98d37eb49 100644 --- a/config/source.json +++ b/config/source.json @@ -822,8 +822,9 @@ } }, "postgresql": { - "type": "url", - "url": "https://ftp.postgresql.org/pub/source/v16.2/postgresql-16.2.tar.bz2", + "type": "ghtagtar", + "repo": "postgres/postgres", + "match": "REL_16_\\d+", "license": { "type": "file", "path": "COPYRIGHT" diff --git a/src/SPC/builder/unix/library/ldap.php b/src/SPC/builder/unix/library/ldap.php index 6f8790f10..3a05e3dfc 100644 --- a/src/SPC/builder/unix/library/ldap.php +++ b/src/SPC/builder/unix/library/ldap.php @@ -50,6 +50,8 @@ protected function build(): void ->exec('sed -i -e "s/SUBDIRS= include libraries clients servers tests doc/SUBDIRS= include libraries clients servers/g" Makefile') ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + + FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/ldap.pc', 'Libs: -L${libdir} -lldap', 'Libs: -L${libdir} -lldap -llber'); $this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']); $this->patchLaDependencyPrefix(['libldap.la', 'liblber.la']); } diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index acddc14ff..cdeb22fca 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -22,7 +22,7 @@ protected function build(): void $packages = 'zlib openssl readline libxml-2.0'; $optional_packages = [ 'zstd' => 'libzstd', - // 'ldap' => 'ldap', + 'ldap' => 'ldap', 'libxslt' => 'libxslt', 'icu' => 'icu-i18n', ]; @@ -97,8 +97,8 @@ protected function build(): void '--with-readline ' . '--with-libxml ' . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . - // ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . - '--without-ldap ' . + ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . + // '--without-ldap ' . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . '--without-lz4 ' . From e5f483de1df0151d96d2588c31e75e0937703a7d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 21:16:53 +0700 Subject: [PATCH 144/204] libtidy uses strange cmake options --- src/SPC/builder/unix/library/tidy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/tidy.php b/src/SPC/builder/unix/library/tidy.php index b9bc6951b..18040c92b 100644 --- a/src/SPC/builder/unix/library/tidy.php +++ b/src/SPC/builder/unix/library/tidy.php @@ -22,7 +22,7 @@ protected function build(): void } FileSystem::resetDir($this->source_dir . '/build-dir'); shell()->cd($this->source_dir . '/build-dir') - ->exec("cmake {$this->builder->makeCmakeArgs()} {$extra} -DSUPPORT_CONSOLE_APP=OFF ..") + ->exec("cmake {$this->builder->makeCmakeArgs()} {$extra} -DBUILD_SHARED_LIB=OFF -DSUPPORT_CONSOLE_APP=OFF ..") ->exec("cmake --build . -j {$this->builder->concurrency}") ->exec('make install'); $this->patchPkgconfPrefix(['tidy.pc']); From 2093b4ec85a04e3e720900ded0f7bf6824b8df86 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 21:19:17 +0700 Subject: [PATCH 145/204] cs fix --- src/SPC/builder/unix/library/postgresql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index cdeb22fca..ff894ecf6 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -91,7 +91,7 @@ protected function build(): void ->execWithEnv( "{$envs} ../configure " . "--prefix={$builddir} " . - ($this->builder->getOption('enable-zts') ? '--enable-thread-safety ' : '--disable-thread-safety ') . + ($this->builder->getOption('enable-zts') ? '--enable-thread-safety ' : '--disable-thread-safety ') . '--enable-coverage=no ' . '--with-ssl=openssl ' . '--with-readline ' . From f4771b4f21c31bcc8c7d4af2bcb2a18015b5b9ed Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 21:33:02 +0700 Subject: [PATCH 146/204] test macos too --- src/globals/test-extensions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index cdd032643..33d4bd82f 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,9 +21,9 @@ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - // 'macos-13', + 'macos-13', // 'macos-14', - // 'macos-15', + 'macos-15', // 'ubuntu-latest', 'ubuntu-22.04', // 'ubuntu-24.04', @@ -52,7 +52,8 @@ // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd,spx', - 'Windows', 'Darwin' => '', + 'Darwin' => '', + 'Windows' => '', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). From bb1f0866746e90541bac62c314558125a9d2c684 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 21:57:04 +0700 Subject: [PATCH 147/204] pq forgets to link against -llber, only links against -lldap --- src/SPC/builder/unix/library/postgresql.php | 3 +++ src/globals/test-extensions.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index ff894ecf6..6f5cccafa 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -4,6 +4,7 @@ namespace SPC\builder\unix\library; +use Hoa\File\File; use SPC\builder\linux\library\LinuxLibraryBase; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; @@ -119,6 +120,8 @@ protected function build(): void ->exec("rm -rf {$builddir}/lib/*.so.*") ->exec("rm -rf {$builddir}/lib/*.so") ->exec("rm -rf {$builddir}/lib/*.dylib"); + + FileSystem::replaceFileStr(BUILD_LIB_PATH . '/libpq.pc', '-lldap', '-lldap -llber'); } private function getVersion(): string diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 33d4bd82f..79aff1dd6 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,7 +51,7 @@ // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd,spx', + 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', 'Darwin' => '', 'Windows' => '', }; From 08d3849c4385f4ddcb4baa2cd067bb5bff28a364 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 22:00:01 +0700 Subject: [PATCH 148/204] cs fix --- src/SPC/builder/unix/library/postgresql.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 6f5cccafa..6a42c29b0 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -4,7 +4,6 @@ namespace SPC\builder\unix\library; -use Hoa\File\File; use SPC\builder\linux\library\LinuxLibraryBase; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; From 2f53915064f6dfeaa3cd9e57eb3642dcc0bb7a61 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 23:00:26 +0700 Subject: [PATCH 149/204] fix ldap for postgresql --- config/lib.json | 4 ++-- src/SPC/builder/Extension.php | 10 ++++++---- src/SPC/builder/unix/library/libxslt.php | 3 +++ src/SPC/builder/unix/library/postgresql.php | 2 +- src/SPC/util/SPCConfigUtil.php | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/config/lib.json b/config/lib.json index 0d4941f07..36d93a6ed 100644 --- a/config/lib.json +++ b/config/lib.json @@ -234,8 +234,8 @@ "ldap": { "source": "ldap", "static-libs-unix": [ - "liblber.a", - "libldap.a" + "libldap.a", + "liblber.a" ], "lib-depends": [ "openssl", diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index f4207dc6a..c6342784f 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -356,16 +356,18 @@ public function buildUnixShared(): void { $config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true); $sharedLibs = ''; - $staticLibs = ''; + $staticLibs = $this->getLibFilesString(); + $staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs); + $staticLibs = str_replace('.a', '', $staticLibs); foreach (explode('-l', $config['libs']) as $lib) { $lib = trim($lib); if ($lib === '') { continue; } $static_lib = 'lib' . $lib . '.a'; - if (file_exists(BUILD_LIB_PATH . '/' . $static_lib)) { + if (file_exists(BUILD_LIB_PATH . '/' . $static_lib) && !str_contains($staticLibs, '-llib')) { $staticLibs .= ' -l' . $lib; - } else { + } elseif (!str_contains($sharedLibs, '-l' . $lib)) { $sharedLibs .= ' -l' . $lib; } } @@ -373,7 +375,7 @@ public function buildUnixShared(): void 'CFLAGS' => $config['cflags'], 'CXXFLAGS' => $config['cflags'], 'LDFLAGS' => $config['ldflags'], - 'LIBS' => '-Wl,-Bstatic ' . $staticLibs . ' -Wl,-Bdynamic ' . $sharedLibs, + 'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibs . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibs, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; // prepare configure args diff --git a/src/SPC/builder/unix/library/libxslt.php b/src/SPC/builder/unix/library/libxslt.php index 530612763..8a9bafaac 100644 --- a/src/SPC/builder/unix/library/libxslt.php +++ b/src/SPC/builder/unix/library/libxslt.php @@ -49,5 +49,8 @@ protected function build(): void ->execWithEnv('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH)); $this->patchPkgconfPrefix(['libexslt.pc']); $this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']); + shell()->cd(BUILD_LIB_PATH) + ->exec("ar -t libxslt.a | grep '\\.a$' | xargs -n1 ar d libxslt.a") + ->exec("ar -t libexslt.a | grep '\\.a$' | xargs -n1 ar d libexslt.a"); } } diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 6a42c29b0..699075567 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -120,7 +120,7 @@ protected function build(): void ->exec("rm -rf {$builddir}/lib/*.so") ->exec("rm -rf {$builddir}/lib/*.dylib"); - FileSystem::replaceFileStr(BUILD_LIB_PATH . '/libpq.pc', '-lldap', '-lldap -llber'); + FileSystem::replaceFileStr(BUILD_LIB_PATH . '/pkgconfig/libpq.pc', '-lldap', '-lldap -llber'); } private function getVersion(): string diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 9f75b41fc..60db9ba2a 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -31,7 +31,7 @@ public function __construct(?BuilderBase $builder = null) * @param array $libraries Additional library name list * @param bool $include_suggest_ext Include suggested extensions * @param bool $include_suggest_lib Include suggested libraries - * @param mixed $with_dependencies + * @param bool $with_dependencies * @return array{ * cflags: string, * ldflags: string, @@ -43,7 +43,7 @@ public function __construct(?BuilderBase $builder = null) * @throws WrongUsageException * @throws \Throwable */ - public function config(array $extensions = [], array $libraries = [], bool $include_suggest_ext = false, bool $include_suggest_lib = false, $with_dependencies = false): array + public function config(array $extensions = [], array $libraries = [], bool $include_suggest_ext = false, bool $include_suggest_lib = false, bool $with_dependencies = false): array { [$extensions, $libraries] = DependencyUtil::getExtsAndLibs($extensions, $libraries, $include_suggest_ext, $include_suggest_lib); From 0ebd44bc4f293043716adc4cc359680b9fe94cf3 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 7 Jun 2025 23:19:32 +0700 Subject: [PATCH 150/204] bring back zstd cmake flags --- src/SPC/builder/unix/library/zstd.php | 7 ++++++- src/SPC/util/SPCConfigUtil.php | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/zstd.php b/src/SPC/builder/unix/library/zstd.php index a8fe34bc6..6e2b67e4f 100644 --- a/src/SPC/builder/unix/library/zstd.php +++ b/src/SPC/builder/unix/library/zstd.php @@ -23,7 +23,12 @@ protected function build(): void 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ]) - ->execWithEnv("cmake {$this->builder->makeCmakeArgs()} ..") + ->execWithEnv( + "cmake {$this->builder->makeCmakeArgs()} " . + '-DZSTD_BUILD_STATIC=ON ' . + '-DZSTD_BUILD_SHARED=OFF ' . + '..' + ) ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") ->execWithEnv('make install'); $this->patchPkgconfPrefix(['libzstd.pc']); diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 60db9ba2a..375d40cd9 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -31,7 +31,6 @@ public function __construct(?BuilderBase $builder = null) * @param array $libraries Additional library name list * @param bool $include_suggest_ext Include suggested extensions * @param bool $include_suggest_lib Include suggested libraries - * @param bool $with_dependencies * @return array{ * cflags: string, * ldflags: string, From a99c4a3fee14b53c3c63904265d90343b1ffb9b1 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 8 Jun 2025 08:13:03 +0700 Subject: [PATCH 151/204] remove getLibFilesString from Extension buildUnixShared --- src/SPC/builder/Extension.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index c6342784f..6083e2d3e 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -356,9 +356,7 @@ public function buildUnixShared(): void { $config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true); $sharedLibs = ''; - $staticLibs = $this->getLibFilesString(); - $staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs); - $staticLibs = str_replace('.a', '', $staticLibs); + $staticLibs = ''; foreach (explode('-l', $config['libs']) as $lib) { $lib = trim($lib); if ($lib === '') { From 6ed440d8615d1c91eac1ef478f7b252ef42c14b4 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 8 Jun 2025 14:45:09 +0700 Subject: [PATCH 152/204] refactor out method to get static and shared libraries --- src/SPC/builder/Extension.php | 48 ++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 6083e2d3e..2dad0a80f 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -344,36 +344,54 @@ public function buildShared(): void } /** - * Build shared extension for Unix + * Get required static and shared libraries as a pair of strings in format -l{libname} -l{libname2} * - * @throws FileSystemException - * @throws RuntimeException - * @throws WrongUsageException - * @throws \ReflectionException - * @throws \Throwable + * @return array [staticLibString, sharedLibString] */ - public function buildUnixShared(): void + private function getStaticAndSharedLibs(): array { $config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true); - $sharedLibs = ''; - $staticLibs = ''; - foreach (explode('-l', $config['libs']) as $lib) { + $sharedLibString = ''; + $staticLibString = ''; + $staticLibs = $this->getLibFilesString(); + $staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs); + $staticLibs = str_replace('.a', '', $staticLibs); + $staticLibs = explode('-l', $staticLibs . ' ' . $config['libs']); + foreach ($staticLibs as $lib) { $lib = trim($lib); if ($lib === '') { continue; } $static_lib = 'lib' . $lib . '.a'; - if (file_exists(BUILD_LIB_PATH . '/' . $static_lib) && !str_contains($staticLibs, '-llib')) { - $staticLibs .= ' -l' . $lib; - } elseif (!str_contains($sharedLibs, '-l' . $lib)) { - $sharedLibs .= ' -l' . $lib; + if (file_exists(BUILD_LIB_PATH . '/' . $static_lib)) { + if (!str_contains($staticLibString, '-l' . $lib . ' ')) { + $staticLibString .= '-l' . $lib . ' '; + } + } elseif (!str_contains($sharedLibString, '-l' . $lib . ' ')) { + $sharedLibString .= '-l' . $lib . ' '; } } + return [$staticLibString, $sharedLibString]; + } + + /** + * Build shared extension for Unix + * + * @throws FileSystemException + * @throws RuntimeException + * @throws WrongUsageException + * @throws \ReflectionException + * @throws \Throwable + */ + public function buildUnixShared(): void + { + $config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true); + [$staticLibString, $sharedLibString] = $this->getStaticAndSharedLibs(); $env = [ 'CFLAGS' => $config['cflags'], 'CXXFLAGS' => $config['cflags'], 'LDFLAGS' => $config['ldflags'], - 'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibs . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibs, + 'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibString . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; // prepare configure args From 53eb6dcc80bca55032f5207de917f4c0cd6a4cdf Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sun, 8 Jun 2025 14:49:06 +0700 Subject: [PATCH 153/204] cs fix hook isn't working on windows --- src/SPC/builder/Extension.php | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 2dad0a80f..d0df37b57 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -343,37 +343,6 @@ public function buildShared(): void }; } - /** - * Get required static and shared libraries as a pair of strings in format -l{libname} -l{libname2} - * - * @return array [staticLibString, sharedLibString] - */ - private function getStaticAndSharedLibs(): array - { - $config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true); - $sharedLibString = ''; - $staticLibString = ''; - $staticLibs = $this->getLibFilesString(); - $staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs); - $staticLibs = str_replace('.a', '', $staticLibs); - $staticLibs = explode('-l', $staticLibs . ' ' . $config['libs']); - foreach ($staticLibs as $lib) { - $lib = trim($lib); - if ($lib === '') { - continue; - } - $static_lib = 'lib' . $lib . '.a'; - if (file_exists(BUILD_LIB_PATH . '/' . $static_lib)) { - if (!str_contains($staticLibString, '-l' . $lib . ' ')) { - $staticLibString .= '-l' . $lib . ' '; - } - } elseif (!str_contains($sharedLibString, '-l' . $lib . ' ')) { - $sharedLibString .= '-l' . $lib . ' '; - } - } - return [$staticLibString, $sharedLibString]; - } - /** * Build shared extension for Unix * @@ -479,6 +448,37 @@ protected function addExtensionDependency(string $name, bool $optional = false): } } + /** + * Get required static and shared libraries as a pair of strings in format -l{libname} -l{libname2} + * + * @return array [staticLibString, sharedLibString] + */ + private function getStaticAndSharedLibs(): array + { + $config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true); + $sharedLibString = ''; + $staticLibString = ''; + $staticLibs = $this->getLibFilesString(); + $staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs); + $staticLibs = str_replace('.a', '', $staticLibs); + $staticLibs = explode('-l', $staticLibs . ' ' . $config['libs']); + foreach ($staticLibs as $lib) { + $lib = trim($lib); + if ($lib === '') { + continue; + } + $static_lib = 'lib' . $lib . '.a'; + if (file_exists(BUILD_LIB_PATH . '/' . $static_lib)) { + if (!str_contains($staticLibString, '-l' . $lib . ' ')) { + $staticLibString .= '-l' . $lib . ' '; + } + } elseif (!str_contains($sharedLibString, '-l' . $lib . ' ')) { + $sharedLibString .= '-l' . $lib . ' '; + } + } + return [$staticLibString, $sharedLibString]; + } + private function getLibraryDependencies(bool $recursive = false): array { $ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase); From 187d51e5010cd9742d51371f1994e4c3a80f3d89 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 9 Jun 2025 14:41:14 +0700 Subject: [PATCH 154/204] -DPOSITION_INDEPENDENT_CODE=ON for cmake --- src/SPC/util/executor/UnixCMakeExecutor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index 4b8ec2e21..55a745785 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -137,6 +137,7 @@ private function getDefaultCMakeArgs(): string '-DCMAKE_INSTALL_BINDIR=bin', '-DCMAKE_INSTALL_LIBDIR=lib', '-DCMAKE_INSTALL_INCLUDEDIR=include', + '-DPOSITION_INDEPENDENT_CODE=ON', '-DBUILD_SHARED_LIBS=OFF', "-DCMAKE_TOOLCHAIN_FILE={$this->makeCmakeToolchainFile()}", ]); From 20f222d19e8eecc86e446cb5b38a101dc7808c50 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 9 Jun 2025 14:48:05 +0700 Subject: [PATCH 155/204] post merge fixes --- src/SPC/builder/freebsd/library/openssl.php | 9 ++------- src/SPC/builder/linux/library/icu.php | 15 +++++---------- src/SPC/builder/linux/library/libpng.php | 6 +++--- src/SPC/builder/unix/library/libsodium.php | 15 +++++---------- src/SPC/builder/unix/library/postgresql.php | 15 +++++++-------- src/SPC/builder/unix/library/unixodbc.php | 15 +++++---------- src/SPC/builder/unix/library/xz.php | 15 +++++---------- src/SPC/util/WindowsCmd.php | 20 -------------------- 8 files changed, 32 insertions(+), 78 deletions(-) diff --git a/src/SPC/builder/freebsd/library/openssl.php b/src/SPC/builder/freebsd/library/openssl.php index 3c62ba2eb..1bbabf525 100644 --- a/src/SPC/builder/freebsd/library/openssl.php +++ b/src/SPC/builder/freebsd/library/openssl.php @@ -48,13 +48,8 @@ protected function build(): void $ex_lib = trim($zlib->getStaticLibFiles() . ' ' . $ex_lib); } - shell()->cd($this->source_dir) - ->setEnv([ - 'CFLAGS' => $this->getLibExtraCFlags(), - 'LDFLAGS' => $this->getLibExtraLdFlags(), - 'LIBS' => $this->getLibExtraLibs() . " {$ex_lib}", - ]) - ->execWithEnv( + shell()->cd($this->source_dir)->initializeEnv($this) + ->exec( "./Configure no-shared {$extra} " . '--prefix=/ ' . // use prefix=/ "--libdir={$lib} " . diff --git a/src/SPC/builder/linux/library/icu.php b/src/SPC/builder/linux/library/icu.php index 87a922347..aa2825b7d 100644 --- a/src/SPC/builder/linux/library/icu.php +++ b/src/SPC/builder/linux/library/icu.php @@ -17,13 +17,8 @@ protected function build(): void $cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1 -DPIC -fPIC"'; $cxxflags = 'CXXFLAGS="-std=c++17 -DPIC -fPIC -fno-ident"'; $ldflags = getenv('SPC_LIBC') !== 'glibc' ? 'LDFLAGS="-static"' : ''; - shell()->cd($this->source_dir . '/source') - ->setEnv([ - 'CFLAGS' => $this->getLibExtraCFlags(), - 'LDFLAGS' => $this->getLibExtraLdFlags(), - 'LIBS' => $this->getLibExtraLibs(), - ]) - ->execWithEnv( + shell()->cd($this->source_dir . '/source')->initializeEnv($this) + ->exec( "{$cppflags} {$cxxflags} {$ldflags} " . './runConfigureICU Linux ' . '--enable-static ' . @@ -38,9 +33,9 @@ protected function build(): void '--enable-samples=no ' . '--prefix=' . BUILD_ROOT_PATH ) - ->execWithEnv('make clean') - ->execWithEnv("make -j{$this->builder->concurrency}") - ->execWithEnv('make install'); + ->exec('make clean') + ->exec("make -j{$this->builder->concurrency}") + ->exec('make install'); $this->patchPkgconfPrefix(['icu-i18n.pc', 'icu-io.pc', 'icu-uc.pc'], PKGCONF_PATCH_PREFIX); FileSystem::removeDir(BUILD_LIB_PATH . '/icu'); diff --git a/src/SPC/builder/linux/library/libpng.php b/src/SPC/builder/linux/library/libpng.php index 4e911c543..da660aff5 100644 --- a/src/SPC/builder/linux/library/libpng.php +++ b/src/SPC/builder/linux/library/libpng.php @@ -55,9 +55,9 @@ public function build(): void $optimizations . '--prefix=' ) - ->execWithEnv('make clean') - ->execWithEnv("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I{$this->source_dir} -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la") - ->execWithEnv('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH); + ->exec('make clean') + ->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I{$this->source_dir} -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la") + ->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX); $this->cleanLaFiles(); } diff --git a/src/SPC/builder/unix/library/libsodium.php b/src/SPC/builder/unix/library/libsodium.php index c6bc6168e..894310bdb 100644 --- a/src/SPC/builder/unix/library/libsodium.php +++ b/src/SPC/builder/unix/library/libsodium.php @@ -8,16 +8,11 @@ trait libsodium { protected function build(): void { - shell()->cd($this->source_dir) - ->setEnv([ - 'CFLAGS' => $this->getLibExtraCFlags(), - 'LDFLAGS' => $this->getLibExtraLdFlags(), - 'LIBS' => $this->getLibExtraLibs(), - ]) - ->execWithEnv('./configure --with-pic --enable-static --disable-shared --prefix=') - ->execWithEnv('make clean') - ->execWithEnv("make -j{$this->builder->concurrency}") - ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); + shell()->cd($this->source_dir)->initializeEnv($this) + ->exec('./configure --with-pic --enable-static --disable-shared --prefix=') + ->exec('make clean') + ->exec("make -j{$this->builder->concurrency}") + ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libsodium.pc'], PKGCONF_PATCH_PREFIX); } diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 699075567..21dce7917 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -86,9 +86,8 @@ protected function build(): void 'LIBS' => $this->getLibExtraLibs(), ]; // configure - shell()->cd($this->source_dir . '/build') - ->setEnv($env) - ->execWithEnv( + shell()->cd($this->source_dir . '/build')->initializeEnv($this) + ->exec( "{$envs} ../configure " . "--prefix={$builddir} " . ($this->builder->getOption('enable-zts') ? '--enable-thread-safety ' : '--disable-thread-safety ') . @@ -108,11 +107,11 @@ protected function build(): void '--without-bonjour ' . '--without-tcl ' ) - ->execWithEnv($envs . ' make -C src/bin/pg_config install') - ->execWithEnv($envs . ' make -C src/include install') - ->execWithEnv($envs . ' make -C src/common install') - ->execWithEnv($envs . ' make -C src/port install') - ->execWithEnv($envs . ' make -C src/interfaces/libpq install'); + ->exec($envs . ' make -C src/bin/pg_config install') + ->exec($envs . ' make -C src/include install') + ->exec($envs . ' make -C src/common install') + ->exec($envs . ' make -C src/port install') + ->exec($envs . ' make -C src/interfaces/libpq install'); // remove dynamic libs shell()->cd($this->source_dir . '/build') diff --git a/src/SPC/builder/unix/library/unixodbc.php b/src/SPC/builder/unix/library/unixodbc.php index be7e92972..0e40629dc 100644 --- a/src/SPC/builder/unix/library/unixodbc.php +++ b/src/SPC/builder/unix/library/unixodbc.php @@ -15,13 +15,8 @@ trait unixodbc */ protected function build(): void { - shell()->cd($this->source_dir) - ->setEnv([ - 'CFLAGS' => $this->getLibExtraCFlags(), - 'LDFLAGS' => $this->getLibExtraLdFlags(), - 'LIBS' => $this->getLibExtraLibs(), - ]) - ->execWithEnv( + shell()->cd($this->source_dir)->initializeEnv($this) + ->exec( './configure ' . '--enable-static --disable-shared ' . '--disable-debug ' . @@ -32,9 +27,9 @@ protected function build(): void '--enable-gui=no ' . '--prefix=' ) - ->execWithEnv('make clean') - ->execWithEnv("make -j{$this->builder->concurrency}") - ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); + ->exec('make clean') + ->exec("make -j{$this->builder->concurrency}") + ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']); $this->cleanLaFiles(); } diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index f3b4d9349..3aed6a153 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -15,13 +15,8 @@ trait xz */ public function build(): void { - shell()->cd($this->source_dir) - ->setEnv([ - 'CFLAGS' => $this->getLibExtraCFlags(), - 'LDFLAGS' => $this->getLibExtraLdFlags(), - 'LIBS' => $this->getLibExtraLibs(), - ]) - ->execWithEnv( + shell()->cd($this->source_dir)->initializeEnv($this) + ->exec( './configure ' . '--enable-static ' . '--disable-shared ' . @@ -31,9 +26,9 @@ public function build(): void '--with-libiconv ' . '--prefix=' ) - ->execWithEnv('make clean') - ->execWithEnv("make -j{$this->builder->concurrency}") - ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); + ->exec('make clean') + ->exec("make -j{$this->builder->concurrency}") + ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['liblzma.pc']); $this->patchLaDependencyPrefix(['liblzma.la']); } diff --git a/src/SPC/util/WindowsCmd.php b/src/SPC/util/WindowsCmd.php index ca06dc259..4398dc445 100644 --- a/src/SPC/util/WindowsCmd.php +++ b/src/SPC/util/WindowsCmd.php @@ -75,24 +75,4 @@ public function setEnv(array $env): WindowsCmd $this->env = array_merge($this->env, $env); return $this; } - - /** - * @throws RuntimeException - */ - public function execWithEnv(string $cmd): WindowsCmd - { - if ($this->getEnvString() !== '') { - return $this->exec($this->getEnvString() . "call {$cmd}"); - } - return $this->exec($cmd); - } - - private function getEnvString(): string - { - $str = ''; - foreach ($this->env as $k => $v) { - $str .= 'set ' . $k . '=' . $v . ' && '; - } - return $str; - } } From c9e9119bff0735a6d4f88d19af6f7a7c91f51e31 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 9 Jun 2025 14:48:42 +0700 Subject: [PATCH 156/204] remove gd from static extension test --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index b382ec38f..cba13c5e1 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -45,7 +45,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,gd,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', + 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', 'Windows' => 'xlswriter,openssl', }; From 978975d396d374abe752572234450eaf3ff61661 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 9 Jun 2025 14:54:58 +0700 Subject: [PATCH 157/204] import class --- src/SPC/builder/unix/library/curl.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index c903170de..bd15d27e9 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; trait curl From aedcc86fc5a99d6b0123a541535a7980c8aa4fc9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 9 Jun 2025 15:52:17 +0700 Subject: [PATCH 158/204] fix cmake minimum version for libtidy --- src/SPC/builder/unix/library/libxml2.php | 17 ++++++++++++++--- src/SPC/builder/unix/library/tidy.php | 9 ++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/SPC/builder/unix/library/libxml2.php b/src/SPC/builder/unix/library/libxml2.php index 72a418ef7..85a6e8b6f 100644 --- a/src/SPC/builder/unix/library/libxml2.php +++ b/src/SPC/builder/unix/library/libxml2.php @@ -17,7 +17,13 @@ trait libxml2 public function build(): void { $cmake = UnixCMakeExecutor::create($this) - ->optionalLib('zlib', "-DLIBXML2_WITH_ZLIB=ON -DZLIB_LIBRARY={$this->getLibDir()}/libz.a -DZLIB_INCLUDE_DIR={$this->getIncludeDir()}", '-DLIBXML2_WITH_ZLIB=OFF') + ->optionalLib( + 'zlib', + '-DLIBXML2_WITH_ZLIB=ON ' . + "-DZLIB_LIBRARY={$this->getLibDir()}/libz.a " . + "-DZLIB_INCLUDE_DIR={$this->getIncludeDir()}", + '-DLIBXML2_WITH_ZLIB=OFF', + ) ->optionalLib('icu', ...cmake_boolean_args('LIBXML2_WITH_ICU')) ->optionalLib('xz', ...cmake_boolean_args('LIBXML2_WITH_LZMA')) ->addConfigureArgs( @@ -35,8 +41,13 @@ public function build(): void FileSystem::replaceFileStr( BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc', - '-licudata -licui18n -licuuc', - '-licui18n -licuuc -licudata' + '-lxml2 -liconv', + '-lxml2' + ); + FileSystem::replaceFileStr( + BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc', + '-lxml2', + '-lxml2 -liconv' ); } } diff --git a/src/SPC/builder/unix/library/tidy.php b/src/SPC/builder/unix/library/tidy.php index d842dc6df..33405a477 100644 --- a/src/SPC/builder/unix/library/tidy.php +++ b/src/SPC/builder/unix/library/tidy.php @@ -16,13 +16,16 @@ trait tidy */ protected function build(): void { - UnixCMakeExecutor::create($this) + $cmake = UnixCMakeExecutor::create($this) ->setBuildDir("{$this->source_dir}/build-dir") ->addConfigureArgs( '-DSUPPORT_CONSOLE_APP=OFF', '-DBUILD_SHARED_LIB=OFF' - ) - ->build(); + ); + if (version_compare(get_cmake_version(), '4.0.0', '>=')) { + $cmake->addConfigureArgs('-DCMAKE_POLICY_VERSION_MINIMUM=3.5'); + } + $cmake->build(); $this->patchPkgconfPrefix(['tidy.pc']); } } From 684b5d45344a80c88a8d44974990e4292683e8b6 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 9 Jun 2025 16:16:54 +0700 Subject: [PATCH 159/204] remove alpine tests for now https://github.com/php/php-src/pull/18779 --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index cba13c5e1..982b134fb 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -24,7 +24,7 @@ 'macos-13', // 'macos-14', 'macos-15', - 'ubuntu-latest', + // 'ubuntu-latest', 'ubuntu-22.04', // 'ubuntu-24.04', 'ubuntu-22.04-arm', From 720251458f124820b00b057b4d18b5b531f0f991 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 9 Jun 2025 19:32:31 +0800 Subject: [PATCH 160/204] Add autoconf executor --- src/SPC/builder/LibraryBase.php | 5 + src/SPC/builder/linux/library/libffi.php | 23 +--- src/SPC/builder/linux/library/libpng.php | 32 ++--- src/SPC/builder/macos/library/libffi.php | 18 +-- .../builder/macos/library/libmemcached.php | 17 +-- src/SPC/builder/macos/library/libpng.php | 35 +++-- src/SPC/builder/unix/library/attr.php | 10 +- src/SPC/builder/unix/library/gettext.php | 46 ++++--- src/SPC/builder/unix/library/gmp.php | 7 +- src/SPC/builder/unix/library/imagemagick.php | 70 +++++----- src/SPC/builder/unix/library/ldap.php | 38 ++---- src/SPC/builder/unix/library/libacl.php | 10 +- src/SPC/builder/unix/library/libcares.php | 7 +- src/SPC/builder/unix/library/libiconv.php | 19 +-- src/SPC/builder/unix/library/librdkafka.php | 37 +++--- src/SPC/builder/unix/library/libsodium.php | 9 +- src/SPC/builder/unix/library/libtiff.php | 37 +++--- src/SPC/builder/unix/library/libxslt.php | 39 ++---- src/SPC/builder/unix/library/ncurses.php | 44 +++---- src/SPC/builder/unix/library/nghttp2.php | 61 ++++----- src/SPC/builder/unix/library/nghttp3.php | 14 +- src/SPC/builder/unix/library/ngtcp2.php | 43 +++--- src/SPC/builder/unix/library/onig.php | 9 +- src/SPC/builder/unix/library/pkgconfig.php | 35 +++-- src/SPC/builder/unix/library/postgresql.php | 6 +- src/SPC/builder/unix/library/qdbm.php | 13 +- src/SPC/builder/unix/library/readline.php | 17 +-- src/SPC/builder/unix/library/sqlite.php | 8 +- src/SPC/builder/unix/library/unixodbc.php | 23 ++-- src/SPC/builder/unix/library/xz.php | 21 ++- src/SPC/builder/unix/library/zlib.php | 7 +- src/SPC/util/UnixShell.php | 2 +- .../util/executor/UnixAutoconfExecutor.php | 124 ++++++++++++++++++ src/globals/functions.php | 5 + 34 files changed, 437 insertions(+), 454 deletions(-) create mode 100644 src/SPC/util/executor/UnixAutoconfExecutor.php diff --git a/src/SPC/builder/LibraryBase.php b/src/SPC/builder/LibraryBase.php index 0d8ab739d..a8b311f6a 100644 --- a/src/SPC/builder/LibraryBase.php +++ b/src/SPC/builder/LibraryBase.php @@ -328,6 +328,11 @@ public function patchBeforeMake(): bool return false; } + public function getBinDir(): string + { + return BUILD_BIN_PATH; + } + public function getIncludeDir(): string { return BUILD_INCLUDE_PATH; diff --git a/src/SPC/builder/linux/library/libffi.php b/src/SPC/builder/linux/library/libffi.php index fa221bd17..ecb3e1422 100644 --- a/src/SPC/builder/linux/library/libffi.php +++ b/src/SPC/builder/linux/library/libffi.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; class libffi extends LinuxLibraryBase { @@ -17,24 +18,14 @@ class libffi extends LinuxLibraryBase */ public function build(): void { - [$lib, , $destdir] = SEPARATED_PATH; $arch = getenv('SPC_ARCH'); - - shell()->cd($this->source_dir) - ->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--with-pic ' . - "--host={$arch}-unknown-linux " . - "--target={$arch}-unknown-linux " . - '--prefix= ' . - "--libdir={$lib}" + UnixAutoconfExecutor::create($this) + ->configure( + "--host={$arch}-unknown-linux", + "--target={$arch}-unknown-linux", + "--libdir={$this->getLibDir()}" ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec("make install DESTDIR={$destdir}"); + ->make(); if (is_file(BUILD_ROOT_PATH . '/lib64/libffi.a')) { copy(BUILD_ROOT_PATH . '/lib64/libffi.a', BUILD_ROOT_PATH . '/lib/libffi.a'); diff --git a/src/SPC/builder/linux/library/libpng.php b/src/SPC/builder/linux/library/libpng.php index da660aff5..ec63f9ada 100644 --- a/src/SPC/builder/linux/library/libpng.php +++ b/src/SPC/builder/linux/library/libpng.php @@ -24,6 +24,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; +use SPC\util\executor\UnixAutoconfExecutor; class libpng extends LinuxLibraryBase { @@ -36,28 +37,21 @@ class libpng extends LinuxLibraryBase */ public function build(): void { - $optimizations = match (getenv('SPC_ARCH')) { - 'x86_64' => '--enable-intel-sse ', - 'aarch64' => '--enable-arm-neon ', - default => '', - }; - shell()->cd($this->source_dir)->initializeEnv($this) + UnixAutoconfExecutor::create($this) ->exec('chmod +x ./configure') ->exec('chmod +x ./install-sh') - ->exec( - 'LDFLAGS="-L' . BUILD_LIB_PATH . '" ' . - './configure ' . - '--disable-shared ' . - '--enable-static ' . - '--with-pic ' . - '--enable-hardware-optimizations ' . - '--with-zlib-prefix="' . BUILD_ROOT_PATH . '" ' . - $optimizations . - '--prefix=' + ->appendEnv(['LDFLAGS' => "-L{$this->getLibDir()}"]) + ->configure( + '--enable-hardware-optimizations', + "--with-zlib-prefix={$this->getBuildRootPath()}", + match (getenv('SPC_ARCH')) { + 'x86_64' => '--enable-intel-sse', + 'aarch64' => '--enable-arm-neon', + default => '', + } ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I{$this->source_dir} -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la") - ->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH); + ->make('libpng16.la', 'install-libLTLIBRARIES install-data-am', after_env_vars: ['DEFAULT_INCLUDES' => "-I{$this->source_dir} -I{$this->getIncludeDir()}"]); + $this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX); $this->cleanLaFiles(); } diff --git a/src/SPC/builder/macos/library/libffi.php b/src/SPC/builder/macos/library/libffi.php index fb054b81c..992a1b75b 100644 --- a/src/SPC/builder/macos/library/libffi.php +++ b/src/SPC/builder/macos/library/libffi.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; class libffi extends MacOSLibraryBase { @@ -17,20 +18,13 @@ class libffi extends MacOSLibraryBase */ protected function build(): void { - [, , $destdir] = SEPARATED_PATH; $arch = getenv('SPC_ARCH'); - shell()->cd($this->source_dir) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - "--host={$arch}-apple-darwin " . - "--target={$arch}-apple-darwin " . - '--prefix= ' // use prefix=/ + UnixAutoconfExecutor::create($this) + ->configure( + "--host={$arch}-apple-darwin", + "--target={$arch}-apple-darwin", ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec("make install DESTDIR={$destdir}"); + ->make(); $this->patchPkgconfPrefix(['libffi.pc']); } } diff --git a/src/SPC/builder/macos/library/libmemcached.php b/src/SPC/builder/macos/library/libmemcached.php index 09a600a23..4b4c5485b 100644 --- a/src/SPC/builder/macos/library/libmemcached.php +++ b/src/SPC/builder/macos/library/libmemcached.php @@ -4,6 +4,8 @@ namespace SPC\builder\macos\library; +use SPC\util\executor\UnixAutoconfExecutor; + /** * gmp is a template library class for unix */ @@ -13,19 +15,6 @@ class libmemcached extends MacOSLibraryBase public function build(): void { - $rootdir = BUILD_ROOT_PATH; - - shell()->cd($this->source_dir) - ->exec('chmod +x configure') - ->exec( - './configure ' . - '--enable-static --disable-shared ' . - '--disable-sasl ' . - "--prefix={$rootdir}" - ) - ->exec('make clean') - ->exec('sed -ie "s/-Werror//g" ' . $this->source_dir . '/Makefile') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install'); + UnixAutoconfExecutor::create($this)->configure('--disable-sasl')->exec("sed -ie 's/-Werror//g' ./Makefile")->make(); } } diff --git a/src/SPC/builder/macos/library/libpng.php b/src/SPC/builder/macos/library/libpng.php index f273bff6b..5efc13184 100644 --- a/src/SPC/builder/macos/library/libpng.php +++ b/src/SPC/builder/macos/library/libpng.php @@ -24,6 +24,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; +use SPC\util\executor\UnixAutoconfExecutor; class libpng extends MacOSLibraryBase { @@ -36,28 +37,24 @@ class libpng extends MacOSLibraryBase */ protected function build(): void { - $optimizations = match (php_uname('m')) { - 'x86_64' => '--enable-intel-sse ', - 'arm64' => '--enable-arm-neon ', - default => '', - }; - shell()->cd($this->source_dir) + $arch = arch2gnu(php_uname('m')); + UnixAutoconfExecutor::create($this) ->exec('chmod +x ./configure') ->exec('chmod +x ./install-sh') - ->exec( - './configure ' . - '--host=' . arch2gnu(php_uname('m')) . '-apple-darwin ' . - '--disable-shared ' . - '--enable-static ' . - '--enable-hardware-optimizations ' . - $optimizations . - '--prefix=' + ->appendEnv(['LDFLAGS' => "-L{$this->getLibDir()}"]) + ->configure( + "--host={$arch}-apple-darwin", + '--enable-hardware-optimizations', + "--with-zlib-prefix={$this->getBuildRootPath()}", + match (getenv('SPC_ARCH')) { + 'x86_64' => '--enable-intel-sse', + 'aarch64' => '--enable-arm-neon', + default => '', + } ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la") - ->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH) - ->cd(BUILD_LIB_PATH) - ->exec('ln -sf libpng16.a libpng.a'); + ->make('libpng16.la', 'install-libLTLIBRARIES install-data-am', after_env_vars: ['DEFAULT_INCLUDES' => "-I{$this->source_dir} -I{$this->getIncludeDir()}"]); + + shell()->cd(BUILD_LIB_PATH)->exec('ln -sf libpng16.a libpng.a'); $this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX); $this->patchLaDependencyPrefix(['libpng16.la']); $this->cleanLaFiles(); diff --git a/src/SPC/builder/unix/library/attr.php b/src/SPC/builder/unix/library/attr.php index b62547201..439acf38e 100644 --- a/src/SPC/builder/unix/library/attr.php +++ b/src/SPC/builder/unix/library/attr.php @@ -5,6 +5,7 @@ namespace SPC\builder\unix\library; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait attr { @@ -13,14 +14,11 @@ trait attr */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->appendEnv(['CFLAGS' => "-I{$this->getIncludeDir()}", 'LDFLAGS' => "-L{$this->getLibDir()}"]) + UnixAutoconfExecutor::create($this) ->exec('libtoolize --force --copy') ->exec('./autogen.sh || autoreconf -if') - ->exec('./configure --prefix= --enable-static --disable-shared --with-pic --disable-nls') - ->exec("make -j {$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); - + ->configure('--disable-nls') + ->make(); $this->patchPkgconfPrefix(['libattr.pc'], PKGCONF_PATCH_PREFIX); } } diff --git a/src/SPC/builder/unix/library/gettext.php b/src/SPC/builder/unix/library/gettext.php index 15a6b6c71..cfe01798b 100644 --- a/src/SPC/builder/unix/library/gettext.php +++ b/src/SPC/builder/unix/library/gettext.php @@ -4,36 +4,34 @@ namespace SPC\builder\unix\library; +use SPC\util\executor\UnixAutoconfExecutor; + trait gettext { protected function build(): void { - $extra = $this->builder->getLib('ncurses') ? ('--with-libncurses-prefix=' . BUILD_ROOT_PATH . ' ') : ''; - $extra .= $this->builder->getLib('libxml2') ? ('--with-libxml2-prefix=' . BUILD_ROOT_PATH . ' ') : ''; - - $zts = $this->builder->getOption('enable-zts') ? '--enable-threads=isoc+posix ' : '--disable-threads '; + $autoconf = UnixAutoconfExecutor::create($this) + ->optionalLib('ncurses', "--with-libncurses-prefix={$this->getBuildRootPath()}") + ->optionalLib('libxml2', "--with-libxml2-prefix={$this->getBuildRootPath()}") + ->addConfigureArgs( + '--disable-java', + '--disable-c++', + '--with-included-gettext', + "--with-iconv-prefix={$this->getBuildRootPath()}", + ); - $cflags = $this->builder->getOption('enable-zts') ? '-lpthread -D_REENTRANT' : ''; - $ldflags = $this->builder->getOption('enable-zts') ? '-lpthread' : ''; + // zts + if ($this->builder->getOption('enable-zts')) { + $autoconf->addConfigureArgs('--enable-threads=isoc+posix') + ->appendEnv([ + 'CFLAGS' => '-lpthread -D_REENTRANT', + 'LDFLGAS' => '-lpthread', + ]); + } else { + $autoconf->addConfigureArgs('--disable-threads'); + } - shell()->cd($this->source_dir)->initializeEnv($this) - ->appendEnv(['CFLAGS' => $cflags, 'LDFLAGS' => $ldflags]) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--enable-pic ' . - '--disable-java ' . - '--disable-c++ ' . - $zts . - $extra . - '--with-included-gettext ' . - '--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' . - '--prefix=' . BUILD_ROOT_PATH - ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install'); + $autoconf->configure()->make(with_clean: true); $this->patchLaDependencyPrefix(['libintl.la']); } } diff --git a/src/SPC/builder/unix/library/gmp.php b/src/SPC/builder/unix/library/gmp.php index 57c580185..a8e4d15c6 100644 --- a/src/SPC/builder/unix/library/gmp.php +++ b/src/SPC/builder/unix/library/gmp.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait gmp { @@ -15,11 +16,7 @@ trait gmp */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec('./configure --enable-static --disable-shared --with-pic --prefix=') - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + UnixAutoconfExecutor::create($this)->configure()->make(); $this->patchPkgconfPrefix(['gmp.pc']); } } diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index 1284305c4..e3805ab5a 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -9,6 +9,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\store\FileSystem; +use SPC\util\executor\UnixAutoconfExecutor; trait imagemagick { @@ -18,48 +19,39 @@ trait imagemagick */ protected function build(): void { - $openmp = '--enable-openmp'; - // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so - if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) { - $openmp = '--disable-openmp'; - } - $extra = "--without-jxl --without-x {$openmp} "; - $required_libs = ''; - $optional_libs = [ - 'libzip' => 'zip', - 'libjpeg' => 'jpeg', - 'libpng' => 'png', - 'libwebp' => 'webp', - 'libxml2' => 'xml', - 'libheif' => 'heic', - 'zlib' => 'zlib', - 'xz' => 'lzma', - 'zstd' => 'zstd', - 'freetype' => 'freetype', - 'bzip2' => 'bzlib', - ]; - foreach ($optional_libs as $lib => $option) { - $extra .= $this->builder->getLib($lib) ? "--with-{$option} " : "--without-{$option} "; - if ($this->builder->getLib($lib) instanceof LinuxLibraryBase) { - $required_libs .= ' ' . $this->builder->getLib($lib)->getStaticLibFiles(); - } - } + $ac = UnixAutoconfExecutor::create($this) + ->optionalLib('libzip', ...ac_with_args('zip')) + ->optionalLib('libjpeg', ...ac_with_args('jpeg')) + ->optionalLib('libpng', ...ac_with_args('png')) + ->optionalLib('libwebp', ...ac_with_args('webp')) + ->optionalLib('libxml2', ...ac_with_args('xml')) + ->optionalLib('libheif', ...ac_with_args('heic')) + ->optionalLib('zlib', ...ac_with_args('zlib')) + ->optionalLib('xz', ...ac_with_args('lzma')) + ->optionalLib('zstd', ...ac_with_args('zstd')) + ->optionalLib('freetype', ...ac_with_args('freetype')) + ->optionalLib('bzip2', ...ac_with_args('bzlib')) + ->addConfigureArgs( + // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so + getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10') ? '--enable-openmp' : '--disable-openmp', + '--without-jxl', + '--without-x', + ); + // special: linux musl needs `-static` $ldflags = ($this instanceof LinuxLibraryBase) && getenv('SPC_LIBC') !== 'glibc' ? ('-static -ldl') : '-ldl'; - // libxml iconv patch - $required_libs .= $this instanceof MacOSLibraryBase ? ('-liconv') : ''; - shell()->cd($this->source_dir)->initializeEnv($this) - ->appendEnv(['LDFLAGS' => $ldflags, 'LIBS' => $required_libs, 'PKG_CONFIG' => '$PKG_CONFIG --static']) - ->exec( - './configure ' . - '--enable-static --disable-shared --with-pic ' . - $extra . - '--prefix=' - ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + // special: macOS needs -iconv + $libs = $this instanceof MacOSLibraryBase ? '-liconv' : ''; + + $ac->appendEnv([ + 'LDFLAGS' => $ldflags, + 'LIBS' => $libs, + 'PKG_CONFIG' => '$PKG_CONFIG --static', + ]); + + $ac->configure()->make(); + $filelist = [ 'ImageMagick.pc', 'ImageMagick-7.Q16HDRI.pc', diff --git a/src/SPC/builder/unix/library/ldap.php b/src/SPC/builder/unix/library/ldap.php index 501654de2..276f8e99c 100644 --- a/src/SPC/builder/unix/library/ldap.php +++ b/src/SPC/builder/unix/library/ldap.php @@ -5,6 +5,7 @@ namespace SPC\builder\unix\library; use SPC\store\FileSystem; +use SPC\util\executor\UnixAutoconfExecutor; trait ldap { @@ -17,34 +18,19 @@ public function patchBeforeBuild(): bool protected function build(): void { - $alt = ''; - // openssl support - $alt .= $this->builder->getLib('openssl') ? '--with-tls=openssl ' : ''; - // gmp support - $alt .= $this->builder->getLib('gmp') ? '--with-mp=gmp ' : ''; - // libsodium support - $alt .= $this->builder->getLib('libsodium') ? '--with-argon2=libsodium ' : '--enable-argon2=no '; - f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config'); - f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig'); - shell()->cd($this->source_dir)->initializeEnv($this) - ->appendEnv(['LDFLAGS' => "-L{$this->getLibDir()}"]) - ->exec( - $this->builder->makeAutoconfFlags(AUTOCONF_CPPFLAGS) . - ' ./configure ' . - '--enable-static ' . - '--disable-shared ' . - '--with-pic ' . - '--disable-slapd ' . - '--without-systemd ' . - '--without-cyrus-sasl ' . - $alt . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->optionalLib('openssl', '--with-tls=openssl') + ->optionalLib('gmp', '--with-mp=gmp') + ->optionalLib('libsodium', '--with-argon2=libsodium', '--enable-argon2=no') + ->addConfigureArgs( + '--disable-slapd', + '--without-systemd', + '--without-cyrus-sasl', ) - ->exec('make clean') - // remove tests and doc to prevent compile failed with error: soelim not found + ->appendEnv(['LDFLAGS' => "-L{$this->getLibDir()}"]) + ->configure() ->exec('sed -i -e "s/SUBDIRS= include libraries clients servers tests doc/SUBDIRS= include libraries clients servers/g" Makefile') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->make(); FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/ldap.pc', 'Libs: -L${libdir} -lldap', 'Libs: -L${libdir} -lldap -llber'); $this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']); diff --git a/src/SPC/builder/unix/library/libacl.php b/src/SPC/builder/unix/library/libacl.php index 7a371f9ef..c25e73363 100644 --- a/src/SPC/builder/unix/library/libacl.php +++ b/src/SPC/builder/unix/library/libacl.php @@ -7,6 +7,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\store\FileSystem; +use SPC\util\executor\UnixAutoconfExecutor; trait libacl { @@ -29,14 +30,11 @@ public function patchBeforeMake(): bool */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->appendEnv(['CFLAGS' => "-I{$this->getIncludeDir()}", 'LDFLAGS' => "-L{$this->getLibDir()}"]) + UnixAutoconfExecutor::create($this) ->exec('libtoolize --force --copy') ->exec('./autogen.sh || autoreconf -if') - ->exec('./configure --prefix= --enable-static --disable-shared --disable-tests --disable-nls --with-pic') - ->exec("make -j {$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); - + ->configure('--disable-nls', '--disable-tests') + ->make(); $this->patchPkgconfPrefix(['libacl.pc'], PKGCONF_PATCH_PREFIX); } } diff --git a/src/SPC/builder/unix/library/libcares.php b/src/SPC/builder/unix/library/libcares.php index 61683bbfd..59d9852e3 100644 --- a/src/SPC/builder/unix/library/libcares.php +++ b/src/SPC/builder/unix/library/libcares.php @@ -6,6 +6,7 @@ use SPC\exception\RuntimeException; use SPC\store\FileSystem; +use SPC\util\executor\UnixAutoconfExecutor; trait libcares { @@ -24,11 +25,7 @@ public function patchBeforeBuild(): bool */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec('./configure --prefix= --enable-static --disable-shared --disable-tests --with-pic') - ->exec("make -j {$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); - + UnixAutoconfExecutor::create($this)->configure('--disable-tests')->make(); $this->patchPkgconfPrefix(['libcares.pc'], PKGCONF_PATCH_PREFIX); } } diff --git a/src/SPC/builder/unix/library/libiconv.php b/src/SPC/builder/unix/library/libiconv.php index 36ef136ed..49ac47bc6 100644 --- a/src/SPC/builder/unix/library/libiconv.php +++ b/src/SPC/builder/unix/library/libiconv.php @@ -4,23 +4,18 @@ namespace SPC\builder\unix\library; +use SPC\util\executor\UnixAutoconfExecutor; + trait libiconv { protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--enable-pic ' . - '--enable-extra-encodings ' . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->configure( + '--enable-pic', + '--enable-extra-encodings', ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); - + ->make(); $this->patchLaDependencyPrefix(['libiconv.la']); } } diff --git a/src/SPC/builder/unix/library/librdkafka.php b/src/SPC/builder/unix/library/librdkafka.php index 5ee4c0c8e..69fe04d41 100644 --- a/src/SPC/builder/unix/library/librdkafka.php +++ b/src/SPC/builder/unix/library/librdkafka.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait librdkafka { @@ -15,25 +16,29 @@ trait librdkafka */ protected function build(): void { - $builddir = BUILD_ROOT_PATH; - - $zstd_option = $this->builder->getLib('zstd') ? ("STATIC_LIB_libzstd={$builddir}/lib/libzstd.a ") : ''; - shell()->cd($this->source_dir) - ->exec( - $zstd_option . - './configure ' . - '--enable-static --disable-shared --disable-curl --disable-sasl --disable-valgrind --disable-zlib --disable-ssl ' . - ($zstd_option == '' ? '--disable-zstd ' : '') . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->optionalLib( + 'zstd', + function ($lib) { + putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a"); + return ''; + }, + '--disable-zstd' + ) + ->configure( + '--disable-curl', + '--disable-sasl', + '--disable-valgrind', + '--disable-zlib', + '--disable-ssl', ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec("make install DESTDIR={$builddir}"); + ->make(); + $this->patchPkgconfPrefix(['rdkafka.pc', 'rdkafka-static.pc', 'rdkafka++.pc', 'rdkafka++-static.pc']); // remove dynamic libs shell() - ->exec("rm -rf {$builddir}/lib/*.so.*") - ->exec("rm -rf {$builddir}/lib/*.so") - ->exec("rm -rf {$builddir}/lib/*.dylib"); + ->exec("rm -rf {$this->getLibDir()}/*.so.*") + ->exec("rm -rf {$this->getLibDir()}/*.so") + ->exec("rm -rf {$this->getLibDir()}/*.dylib"); } } diff --git a/src/SPC/builder/unix/library/libsodium.php b/src/SPC/builder/unix/library/libsodium.php index 894310bdb..441166c9f 100644 --- a/src/SPC/builder/unix/library/libsodium.php +++ b/src/SPC/builder/unix/library/libsodium.php @@ -4,16 +4,13 @@ namespace SPC\builder\unix\library; +use SPC\util\executor\UnixAutoconfExecutor; + trait libsodium { protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec('./configure --with-pic --enable-static --disable-shared --prefix=') - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); - + UnixAutoconfExecutor::create($this)->configure()->make(); $this->patchPkgconfPrefix(['libsodium.pc'], PKGCONF_PATCH_PREFIX); } } diff --git a/src/SPC/builder/unix/library/libtiff.php b/src/SPC/builder/unix/library/libtiff.php index 8f59fcae7..f615019a2 100644 --- a/src/SPC/builder/unix/library/libtiff.php +++ b/src/SPC/builder/unix/library/libtiff.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait libtiff { @@ -15,24 +16,26 @@ trait libtiff */ protected function build(): void { - // zlib - $extra_libs = '--enable-zlib --with-zlib-include-dir=' . BUILD_ROOT_PATH . '/include --with-zlib-lib-dir=' . BUILD_ROOT_PATH . '/lib'; - // libjpeg - $extra_libs .= ' --enable-jpeg --disable-old-jpeg --disable-jpeg12 --with-jpeg-include-dir=' . BUILD_ROOT_PATH . '/include --with-jpeg-lib-dir=' . BUILD_ROOT_PATH . '/lib'; - // We disabled lzma, zstd, webp, libdeflate by default to reduce the size of the binary - $extra_libs .= ' --disable-lzma --disable-zstd --disable-webp --disable-libdeflate'; - - $shell = shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static --disable-shared --with-pic ' . - "{$extra_libs} " . - '--disable-cxx ' . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->configure( + // zlib deps + '--enable-zlib', + "--with-zlib-include-dir={$this->getIncludeDir()}", + "--with-zlib-lib-dir={$this->getLibDir()}", + // libjpeg deps + '--enable-jpeg', + '--disable-old-jpeg', + '--disable-jpeg12', + "--with-jpeg-include-dir={$this->getIncludeDir()}", + "--with-jpeg-lib-dir={$this->getLibDir()}", + // We disabled lzma, zstd, webp, libdeflate by default to reduce the size of the binary + '--disable-lzma', + '--disable-zstd', + '--disable-webp', + '--disable-libdeflate', + '--disable-cxx', ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->make(); $this->patchPkgconfPrefix(['libtiff-4.pc']); } } diff --git a/src/SPC/builder/unix/library/libxslt.php b/src/SPC/builder/unix/library/libxslt.php index 109751457..af85b052d 100644 --- a/src/SPC/builder/unix/library/libxslt.php +++ b/src/SPC/builder/unix/library/libxslt.php @@ -8,6 +8,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; +use SPC\util\executor\UnixAutoconfExecutor; trait libxslt { @@ -18,35 +19,23 @@ trait libxslt */ protected function build(): void { - $required_libs = ''; - foreach ($this->getDependencies() as $dep) { - if ($dep instanceof LinuxLibraryBase) { - $required_libs .= ' ' . $dep->getStaticLibFiles(); - } - } - shell()->cd($this->source_dir)->initializeEnv($this) + $static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles() : ''; + $ac = UnixAutoconfExecutor::create($this) ->appendEnv([ 'CFLAGS' => "-I{$this->getIncludeDir()}", 'LDFLAGS' => "-L{$this->getLibDir()}", - 'LIBS' => "{$required_libs} -lstdc++", + 'LIBS' => "{$static_libs} -lstdc++", ]) - ->exec( - "{$this->builder->getOption('library_path')} " . - "{$this->builder->getOption('ld_library_path')} " . - './configure ' . - '--enable-static --disable-shared ' . - '--with-pic ' . - '--without-python ' . - '--without-mem-debug ' . - '--without-crypto ' . - '--without-debug ' . - '--without-debugger ' . - '--with-libxml-prefix=' . escapeshellarg(BUILD_ROOT_PATH) . ' ' . - '--prefix=' - ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH)); + ->addConfigureArgs( + '--without-python', + '--without-mem-debug', + '--without-crypto', + '--without-debug', + '--without-debugger', + "--with-libxml-prefix={$this->getBuildRootPath()}", + ); + $ac->exec("{$this->builder->getOption('library_path')} {$this->builder->getOption('ld_library_path')} ./configure {$ac->getConfigureArgsString()}")->make(); + $this->patchPkgconfPrefix(['libexslt.pc']); $this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']); shell()->cd(BUILD_LIB_PATH) diff --git a/src/SPC/builder/unix/library/ncurses.php b/src/SPC/builder/unix/library/ncurses.php index 7d33c76a7..720e09001 100644 --- a/src/SPC/builder/unix/library/ncurses.php +++ b/src/SPC/builder/unix/library/ncurses.php @@ -5,37 +5,33 @@ namespace SPC\builder\unix\library; use SPC\store\FileSystem; +use SPC\util\executor\UnixAutoconfExecutor; trait ncurses { protected function build(): void { $filelist = FileSystem::scanDirFiles(BUILD_BIN_PATH, relative: true); - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--enable-overwrite ' . - '--with-curses-h ' . - '--enable-pc-files ' . - '--enable-echo ' . - '--disable-widec ' . - '--with-normal ' . - '--with-ticlib ' . - '--without-tests ' . - '--without-dlsym ' . - '--without-debug ' . - '-enable-symlinks ' . - '--bindir=' . BUILD_ROOT_PATH . '/bin ' . - '--includedir=' . BUILD_ROOT_PATH . '/include ' . - '--libdir=' . BUILD_ROOT_PATH . '/lib ' . - '--prefix=' . BUILD_ROOT_PATH - ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install'); + UnixAutoconfExecutor::create($this) + ->configure( + '--enable-overwrite', + '--with-curses-h', + '--enable-c-files', + '--enable-echo', + '--disable-widec', + '--with-normal', + '--with-ticlib', + '--without-tests', + '--without-dlsym', + '--without-debug', + '-enable-symlinks', + "--bindir={$this->getBinDir()}", + "--includedir={$this->getIncludeDir()}", + "--libdir={$this->getLibDir()}", + "--prefix={$this->getBuildRootPath()}", + ) + ->make(); $final = FileSystem::scanDirFiles(BUILD_BIN_PATH, relative: true); // Remove the new files $new_files = array_diff($final, $filelist); diff --git a/src/SPC/builder/unix/library/nghttp2.php b/src/SPC/builder/unix/library/nghttp2.php index e09832d90..6390f1d54 100644 --- a/src/SPC/builder/unix/library/nghttp2.php +++ b/src/SPC/builder/unix/library/nghttp2.php @@ -7,6 +7,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; +use SPC\util\executor\UnixAutoconfExecutor; trait nghttp2 { @@ -17,42 +18,32 @@ trait nghttp2 */ protected function build(): void { - $args = $this->builder->makeAutoconfArgs(static::NAME, [ - 'zlib' => null, - 'openssl' => null, - 'libxml2' => null, - 'libev' => null, - 'libcares' => null, - 'libngtcp2' => null, - 'libnghttp3' => null, - 'libbpf' => null, - 'libevent-openssl' => null, - 'jansson' => null, - 'jemalloc' => null, - 'systemd' => null, - ]); - if ($brotli = $this->builder->getLib('brotli')) { - /* @phpstan-ignore-next-line */ - $args .= ' --with-libbrotlidec=yes LIBBROTLIDEC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIDEC_LIBS="' . $brotli->getStaticLibFiles() . '"'; - /* @phpstan-ignore-next-line */ - $args .= ' --with-libbrotlienc=yes LIBBROTLIENC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIENC_LIBS="' . $brotli->getStaticLibFiles() . '"'; - } - - [,,$destdir] = SEPARATED_PATH; - - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--with-pic ' . - '--enable-lib-only ' . - $args . ' ' . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->optionalLib('zlib', ...ac_with_args('zlib', true)) + ->optionalLib('openssl', ...ac_with_args('openssl', true)) + ->optionalLib('libxml2', ...ac_with_args('libxml2', true)) + ->optionalLib('libev', ...ac_with_args('libev', true)) + ->optionalLib('libcares', ...ac_with_args('libcares', true)) + ->optionalLib('ngtcp2', ...ac_with_args('libngtcp2', true)) + ->optionalLib('nghttp3', ...ac_with_args('libnghttp3', true)) + // ->optionalLib('libbpf', ...ac_with_args('libbpf', true)) + // ->optionalLib('libevent-openssl', ...ac_with_args('libevent-openssl', true)) + // ->optionalLib('jansson', ...ac_with_args('jansson', true)) + // ->optionalLib('jemalloc', ...ac_with_args('jemalloc', true)) + // ->optionalLib('systemd', ...ac_with_args('systemd', true)) + ->optionalLib( + 'brotli', + fn ($lib) => implode(' ', [ + '--with-brotlidec=yes', + "LIBBROTLIDEC_CFLAGS=\"-I{$lib->getIncludeDir()}\"", + "LIBBROTLIDEC_LIBS=\"{$lib->getStaticLibFiles()}\"", + '--with-libbrotlienc=yes', + "LIBBROTLIENC_CFLAGS=\"-I{$lib->getIncludeDir()}\"", + "LIBBROTLIENC_LIBS=\"{$lib->getStaticLibFiles()}\"", + ]) ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec("make install DESTDIR={$destdir}"); + ->configure('--enable-lib-only') + ->make(); $this->patchPkgconfPrefix(['libnghttp2.pc']); $this->patchLaDependencyPrefix(['libnghttp2.la']); } diff --git a/src/SPC/builder/unix/library/nghttp3.php b/src/SPC/builder/unix/library/nghttp3.php index ca2862a22..c3dadcf04 100644 --- a/src/SPC/builder/unix/library/nghttp3.php +++ b/src/SPC/builder/unix/library/nghttp3.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait nghttp3 { @@ -15,18 +16,7 @@ trait nghttp3 */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--with-pic ' . - '--enable-lib-only ' . - '--prefix=' - ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + UnixAutoconfExecutor::create($this)->configure('--enable-lib-only')->make(); $this->patchPkgconfPrefix(['libnghttp3.pc']); $this->patchLaDependencyPrefix(['libnghttp3.la']); } diff --git a/src/SPC/builder/unix/library/ngtcp2.php b/src/SPC/builder/unix/library/ngtcp2.php index 94e9c5707..23c85e1e3 100644 --- a/src/SPC/builder/unix/library/ngtcp2.php +++ b/src/SPC/builder/unix/library/ngtcp2.php @@ -7,6 +7,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; +use SPC\util\executor\UnixAutoconfExecutor; trait ngtcp2 { @@ -17,32 +18,24 @@ trait ngtcp2 */ protected function build(): void { - $args = $this->builder->makeAutoconfArgs(static::NAME, [ - 'openssl' => null, - 'libev' => null, - 'jemalloc' => null, - 'libnghttp3' => null, - ]); - if ($brotli = $this->builder->getLib('brotli')) { - /* @phpstan-ignore-next-line */ - $args .= ' --with-libbrotlidec=yes LIBBROTLIDEC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIDEC_LIBS="' . $brotli->getStaticLibFiles() . '"'; - /* @phpstan-ignore-next-line */ - $args .= ' --with-libbrotlienc=yes LIBBROTLIENC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIENC_LIBS="' . $brotli->getStaticLibFiles() . '"'; - } - - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--with-pic ' . - '--enable-lib-only ' . - $args . ' ' . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->optionalLib('openssl', ...ac_with_args('openssl', true)) + ->optionalLib('libev', ...ac_with_args('libev', true)) + ->optionalLib('nghttp3', ...ac_with_args('libnghttp3', true)) + ->optionalLib('jemalloc', ...ac_with_args('jemalloc', true)) + ->optionalLib( + 'brotli', + fn ($lib) => implode(' ', [ + '--with-brotlidec=yes', + "LIBBROTLIDEC_CFLAGS=\"-I{$lib->getIncludeDir()}\"", + "LIBBROTLIDEC_LIBS=\"{$lib->getStaticLibFiles()}\"", + '--with-libbrotlienc=yes', + "LIBBROTLIENC_CFLAGS=\"-I{$lib->getIncludeDir()}\"", + "LIBBROTLIENC_LIBS=\"{$lib->getStaticLibFiles()}\"", + ]) ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->configure('--enable-lib-only') + ->make(); $this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']); $this->patchLaDependencyPrefix(['libngtcp2.la', 'libngtcp2_crypto_ossl.la']); diff --git a/src/SPC/builder/unix/library/onig.php b/src/SPC/builder/unix/library/onig.php index 62e8f606c..eb47c0b86 100644 --- a/src/SPC/builder/unix/library/onig.php +++ b/src/SPC/builder/unix/library/onig.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait onig { @@ -15,13 +16,7 @@ trait onig */ protected function build(): void { - [,,$destdir] = SEPARATED_PATH; - - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec('./configure --enable-static --disable-shared --enable-pic --prefix=') - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec("make install DESTDIR={$destdir}"); + UnixAutoconfExecutor::create($this)->configure('--enable-pic')->make(); $this->patchPkgconfPrefix(['oniguruma.pc']); } } diff --git a/src/SPC/builder/unix/library/pkgconfig.php b/src/SPC/builder/unix/library/pkgconfig.php index 51fa586be..05727f96a 100644 --- a/src/SPC/builder/unix/library/pkgconfig.php +++ b/src/SPC/builder/unix/library/pkgconfig.php @@ -5,32 +5,27 @@ namespace SPC\builder\unix\library; use SPC\builder\linux\library\LinuxLibraryBase; +use SPC\util\executor\UnixAutoconfExecutor; trait pkgconfig { protected function build(): void { - $cflags = PHP_OS_FAMILY !== 'Linux' ? "{$this->builder->arch_c_flags} -Wimplicit-function-declaration -Wno-int-conversion" : ''; - $ldflags = !($this instanceof LinuxLibraryBase) || getenv('SPC_LIBC') === 'glibc' ? '' : '--static'; - - shell()->cd($this->source_dir)->initializeEnv($this) - ->appendEnv(['CFLAGS' => $cflags, 'LDFLAGS' => $ldflags]) - ->exec( - './configure ' . - '--disable-shared ' . - '--enable-static ' . - '--with-internal-glib ' . - '--disable-host-tool ' . - '--with-pic ' . - '--prefix=' . BUILD_ROOT_PATH . ' ' . - '--without-sysroot ' . - '--without-system-include-path ' . - '--without-system-library-path ' . - '--without-pc-path' + UnixAutoconfExecutor::create($this) + ->appendEnv([ + 'CFLAGS' => PHP_OS_FAMILY !== 'Linux' ? '-Wimplicit-function-declaration -Wno-int-conversion' : '', + 'LDFLAGS' => !($this instanceof LinuxLibraryBase) || getenv('SPC_LIBC') === 'glibc' ? '' : '--static', + ]) + ->configure( + '--with-internal-glib', + '--disable-host-tool', + '--without-sysroot', + '--without-system-include-path', + '--without-system-library-path', + '--without-pc-path', ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install-exec'); + ->make(with_install: 'install-exec'); + shell()->exec('strip ' . BUILD_ROOT_PATH . '/bin/pkg-config'); } } diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 21dce7917..1de3e4c28 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -80,13 +80,9 @@ protected function build(): void throw new RuntimeException('Unsupported version for postgresql: ' . $version . ' !'); } - $env = [ - 'CFLAGS' => $this->getLibExtraCFlags() . ' ' . $cflags, - 'LDFLAGS' => $this->getLibExtraLdFlags(), - 'LIBS' => $this->getLibExtraLibs(), - ]; // configure shell()->cd($this->source_dir . '/build')->initializeEnv($this) + ->appendEnv(['CFLAGS' => $cflags]) ->exec( "{$envs} ../configure " . "--prefix={$builddir} " . diff --git a/src/SPC/builder/unix/library/qdbm.php b/src/SPC/builder/unix/library/qdbm.php index 21eff478a..b7a43cdf2 100644 --- a/src/SPC/builder/unix/library/qdbm.php +++ b/src/SPC/builder/unix/library/qdbm.php @@ -8,6 +8,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\store\FileSystem; +use SPC\util\executor\UnixAutoconfExecutor; trait qdbm { @@ -17,17 +18,9 @@ trait qdbm */ protected function build(): void { - shell()->cd($this->source_dir) - ->exec( - './configure ' . - '--enable-static --disable-shared ' . - '--prefix=' - ) - ->exec('make clean'); + $ac = UnixAutoconfExecutor::create($this)->configure(); FileSystem::replaceFileRegex($this->source_dir . '/Makefile', '/MYLIBS = libqdbm.a.*/m', 'MYLIBS = libqdbm.a'); - shell()->cd($this->source_dir) - ->exec("make -j{$this->builder->concurrency}" . ($this instanceof MacOSLibraryBase ? ' mac' : '')) - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + $ac->make($this instanceof MacOSLibraryBase ? 'mac' : ''); $this->patchPkgconfPrefix(['qdbm.pc']); } } diff --git a/src/SPC/builder/unix/library/readline.php b/src/SPC/builder/unix/library/readline.php index c0fe90780..8cfca0ab1 100644 --- a/src/SPC/builder/unix/library/readline.php +++ b/src/SPC/builder/unix/library/readline.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait readline { @@ -15,18 +16,12 @@ trait readline */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static=yes ' . - '--enable-shared=no ' . - '--prefix= ' . - '--with-curses ' . - '--enable-multibyte=yes' + UnixAutoconfExecutor::create($this) + ->configure( + '--with-curses', + '--enable-multibyte=yes', ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->make(); $this->patchPkgconfPrefix(['readline.pc']); } } diff --git a/src/SPC/builder/unix/library/sqlite.php b/src/SPC/builder/unix/library/sqlite.php index ca21cc9db..8f9add24b 100644 --- a/src/SPC/builder/unix/library/sqlite.php +++ b/src/SPC/builder/unix/library/sqlite.php @@ -4,15 +4,13 @@ namespace SPC\builder\unix\library; +use SPC\util\executor\UnixAutoconfExecutor; + trait sqlite { protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec('./configure --enable-static --disable-shared --with-pic --prefix=') - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + UnixAutoconfExecutor::create($this)->configure()->make(); $this->patchPkgconfPrefix(['sqlite3.pc']); } } diff --git a/src/SPC/builder/unix/library/unixodbc.php b/src/SPC/builder/unix/library/unixodbc.php index 0e40629dc..3e3423b5a 100644 --- a/src/SPC/builder/unix/library/unixodbc.php +++ b/src/SPC/builder/unix/library/unixodbc.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait unixodbc { @@ -15,21 +16,15 @@ trait unixodbc */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static --disable-shared ' . - '--disable-debug ' . - '--with-pic ' . - '--disable-dependency-tracking ' . - '--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' . - '--with-included-ltdl ' . - '--enable-gui=no ' . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->configure( + '--disable-debug', + '--disable-dependency-tracking', + "--with-libiconv-prefix={$this->getBuildRootPath()}", + '--with-included-ltdl', + '--enable-gui=no', ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->make(); $this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']); $this->cleanLaFiles(); } diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index 3aed6a153..abad7cee6 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait xz { @@ -15,20 +16,14 @@ trait xz */ public function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec( - './configure ' . - '--enable-static ' . - '--disable-shared ' . - '--enable-pic ' . - '--disable-scripts ' . - '--disable-doc ' . - '--with-libiconv ' . - '--prefix=' + UnixAutoconfExecutor::create($this) + ->configure( + '--enable-pic', + '--disable-scripts', + '--disable-doc', + '--with-libiconv', ) - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + ->make(); $this->patchPkgconfPrefix(['liblzma.pc']); $this->patchLaDependencyPrefix(['liblzma.la']); } diff --git a/src/SPC/builder/unix/library/zlib.php b/src/SPC/builder/unix/library/zlib.php index cd5dab483..b77299739 100644 --- a/src/SPC/builder/unix/library/zlib.php +++ b/src/SPC/builder/unix/library/zlib.php @@ -6,6 +6,7 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\util\executor\UnixAutoconfExecutor; trait zlib { @@ -15,11 +16,7 @@ trait zlib */ protected function build(): void { - shell()->cd($this->source_dir)->initializeEnv($this) - ->exec('./configure --static --prefix=') - ->exec('make clean') - ->exec("make -j{$this->builder->concurrency}") - ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + UnixAutoconfExecutor::create($this)->configure('--static')->make(); $this->patchPkgconfPrefix(['zlib.pc']); } } diff --git a/src/SPC/util/UnixShell.php b/src/SPC/util/UnixShell.php index e31d64107..0f320d50c 100644 --- a/src/SPC/util/UnixShell.php +++ b/src/SPC/util/UnixShell.php @@ -118,7 +118,7 @@ public function setEnv(array $env): UnixShell return $this; } - private function getEnvString(): string + public function getEnvString(): string { $str = ''; foreach ($this->env as $k => $v) { diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php new file mode 100644 index 000000000..d7b433685 --- /dev/null +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -0,0 +1,124 @@ +initShell(); + } + + /** + * Run ./configure + */ + public function configure(...$args): static + { + $configure_args = implode(' ', array_merge($args, $this->getDefaultConfigureArgs(), $this->configure_args)); + + $this->shell->exec("./configure {$configure_args}"); + return $this; + } + + public function getConfigureArgsString(): string + { + return implode(' ', array_merge($this->getDefaultConfigureArgs(), $this->configure_args)); + } + + /** + * Run make + * + * @param string $target Build target + * @throws RuntimeException + */ + public function make(string $target = '', false|string $with_install = 'install', bool $with_clean = true, array $after_env_vars = []): static + { + if ($with_clean) { + $this->shell->exec('make clean'); + } + $after_env_vars_str = $after_env_vars !== [] ? shell()->setEnv($after_env_vars)->getEnvString() : ''; + $this->shell->exec("make -j{$this->library->getBuilder()->concurrency} {$target} {$after_env_vars_str}"); + if ($with_install !== false) { + $this->shell->exec("make {$with_install}"); + } + return $this; + } + + public function exec(string $cmd): static + { + $this->shell->exec($cmd); + return $this; + } + + /** + * Add optional library configuration. + * This method checks if a library is available and adds the corresponding arguments to the CMake configuration. + * + * @param string $name library name to check + * @param \Closure|string $true_args arguments to use if the library is available (allow closure, returns string) + * @param string $false_args arguments to use if the library is not available + * @return $this + */ + public function optionalLib(string $name, \Closure|string $true_args, string $false_args = ''): static + { + if ($get = $this->library->getBuilder()->getLib($name)) { + $args = $true_args instanceof \Closure ? $true_args($get) : $true_args; + } else { + $args = $false_args; + } + $this->addConfigureArgs($args); + return $this; + } + + /** + * Add configure args. + */ + public function addConfigureArgs(...$args): static + { + $this->configure_args = [...$this->configure_args, ...$args]; + return $this; + } + + public function appendEnv(array $env): static + { + $this->shell->appendEnv($env); + return $this; + } + + /** + * Returns the default autoconf ./configure arguments + */ + private function getDefaultConfigureArgs(): array + { + return [ + '--disable-shared', + '--enable-static', + "--prefix={$this->library->getBuildRootPath()}", + '--with-pic', + ]; + } + + /** + * Initialize UnixShell class. + */ + private function initShell(): void + { + $this->shell = shell()->cd($this->library->getSourceDir())->initializeEnv($this->library)->appendEnv([ + 'CFLAGS' => "-I{$this->library->getIncludeDir()}", + 'LDFLAGS' => "-L{$this->library->getLibDir()}", + ]); + } +} diff --git a/src/globals/functions.php b/src/globals/functions.php index ea96df587..8718f4abf 100644 --- a/src/globals/functions.php +++ b/src/globals/functions.php @@ -216,3 +216,8 @@ function cmake_boolean_args(string $arg_name, bool $negative = false): array $res = ["-D{$arg_name}=ON", "-D{$arg_name}=OFF"]; return $negative ? array_reverse($res) : $res; } + +function ac_with_args(string $arg_name, bool $use_value = false): array +{ + return $use_value ? ["--with-{$arg_name}=yes", "--with-{$arg_name}=no"] : ["--with-{$arg_name}", "--without-{$arg_name}"]; +} From 8b09e1a446117d2841735121ed3b574408315c81 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 9 Jun 2025 19:51:55 +0800 Subject: [PATCH 161/204] Fix zlib autoconf builder --- src/SPC/builder/unix/library/zlib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/zlib.php b/src/SPC/builder/unix/library/zlib.php index b77299739..717ec3fb3 100644 --- a/src/SPC/builder/unix/library/zlib.php +++ b/src/SPC/builder/unix/library/zlib.php @@ -16,7 +16,7 @@ trait zlib */ protected function build(): void { - UnixAutoconfExecutor::create($this)->configure('--static')->make(); + UnixAutoconfExecutor::create($this)->exec("./configure --static --prefix={$this->getBuildRootPath()}")->make(); $this->patchPkgconfPrefix(['zlib.pc']); } } From 1b08a250f63c11428829832c52227d10ac3daf1b Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 9 Jun 2025 19:54:46 +0800 Subject: [PATCH 162/204] Add --enable-pic for default autoconf args --- src/SPC/builder/unix/library/libiconv.php | 7 +------ src/SPC/builder/unix/library/onig.php | 2 +- src/SPC/builder/unix/library/xz.php | 1 - src/SPC/util/executor/UnixAutoconfExecutor.php | 1 + 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/SPC/builder/unix/library/libiconv.php b/src/SPC/builder/unix/library/libiconv.php index 49ac47bc6..f4f30ed9d 100644 --- a/src/SPC/builder/unix/library/libiconv.php +++ b/src/SPC/builder/unix/library/libiconv.php @@ -10,12 +10,7 @@ trait libiconv { protected function build(): void { - UnixAutoconfExecutor::create($this) - ->configure( - '--enable-pic', - '--enable-extra-encodings', - ) - ->make(); + UnixAutoconfExecutor::create($this)->configure('--enable-extra-encodings')->make(); $this->patchLaDependencyPrefix(['libiconv.la']); } } diff --git a/src/SPC/builder/unix/library/onig.php b/src/SPC/builder/unix/library/onig.php index eb47c0b86..368c852bf 100644 --- a/src/SPC/builder/unix/library/onig.php +++ b/src/SPC/builder/unix/library/onig.php @@ -16,7 +16,7 @@ trait onig */ protected function build(): void { - UnixAutoconfExecutor::create($this)->configure('--enable-pic')->make(); + UnixAutoconfExecutor::create($this)->configure()->make(); $this->patchPkgconfPrefix(['oniguruma.pc']); } } diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index abad7cee6..62bcf304e 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -18,7 +18,6 @@ public function build(): void { UnixAutoconfExecutor::create($this) ->configure( - '--enable-pic', '--disable-scripts', '--disable-doc', '--with-libiconv', diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php index d7b433685..dc1741fd3 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -108,6 +108,7 @@ private function getDefaultConfigureArgs(): array '--enable-static', "--prefix={$this->library->getBuildRootPath()}", '--with-pic', + '--enable-pic', ]; } From 8896d477aa95a39c698f8e001d61e9567afd3c75 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 9 Jun 2025 19:57:12 +0800 Subject: [PATCH 163/204] Add tests for autoconf libs --- src/globals/test-extensions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 982b134fb..f9d60ce28 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,9 +13,9 @@ // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - '8.1', - '8.2', - '8.3', + // '8.1', + // '8.2', + // '8.3', '8.4', ]; @@ -45,20 +45,20 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', + 'Linux', 'Darwin' => 'zlib', 'Windows' => 'xlswriter,openssl', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', + 'Linux' => '', 'Darwin' => '', 'Windows' => '', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'ngtcp2,nghttp2,nghttp3,libavif', + 'Linux', 'Darwin' => 'libffi,libpng,gettext,gmp,imagemagick,ldap,attr,libacl,libcares,libiconv,librdkafka,libsodium,libtiff,libxslt,ncurses,nghttp2,nghttp3,ngtcp2,onig,qdbm,readline,sqlite,unixodbc,xz,zlib', 'Windows' => '', }; From 0ed6f2924e91e83fefad62bec65c5cce88e8211a Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 9 Jun 2025 19:58:40 +0800 Subject: [PATCH 164/204] Add tests for autoconf libs --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index f9d60ce28..589350859 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -58,7 +58,7 @@ // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'libffi,libpng,gettext,gmp,imagemagick,ldap,attr,libacl,libcares,libiconv,librdkafka,libsodium,libtiff,libxslt,ncurses,nghttp2,nghttp3,ngtcp2,onig,qdbm,readline,sqlite,unixodbc,xz,zlib', + 'Linux', 'Darwin' => 'libffi,libpng,gettext,gmp,imagemagick,ldap,attr,postgresql,libacl,libcares,libiconv,librdkafka,libsodium,libtiff,libxslt,ncurses,nghttp2,nghttp3,ngtcp2,onig,qdbm,readline,sqlite,unixodbc,xz,zlib', 'Windows' => '', }; From 4c8f9e154deaf8b2df1fa633b91934a6ff85c83e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 9 Jun 2025 20:09:05 +0800 Subject: [PATCH 165/204] Remove attr and libacl tests --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 589350859..be69531f9 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -58,7 +58,7 @@ // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'libffi,libpng,gettext,gmp,imagemagick,ldap,attr,postgresql,libacl,libcares,libiconv,librdkafka,libsodium,libtiff,libxslt,ncurses,nghttp2,nghttp3,ngtcp2,onig,qdbm,readline,sqlite,unixodbc,xz,zlib', + 'Linux', 'Darwin' => 'libffi,libpng,gettext,gmp,imagemagick,ldap,postgresql,libcares,libiconv,librdkafka,libsodium,libtiff,libxslt,ncurses,nghttp2,nghttp3,ngtcp2,onig,qdbm,readline,sqlite,unixodbc,xz,zlib', 'Windows' => '', }; From ae56bed032c5f47aa2115ddc57b4caf0e442e22f Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 9 Jun 2025 22:54:44 +0800 Subject: [PATCH 166/204] Fix ncurses build --- src/SPC/builder/unix/library/ncurses.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/ncurses.php b/src/SPC/builder/unix/library/ncurses.php index 720e09001..14d2a6dc7 100644 --- a/src/SPC/builder/unix/library/ncurses.php +++ b/src/SPC/builder/unix/library/ncurses.php @@ -17,7 +17,7 @@ protected function build(): void ->configure( '--enable-overwrite', '--with-curses-h', - '--enable-c-files', + '--enable-pc-files', '--enable-echo', '--disable-widec', '--with-normal', From 25c2bafa881a81879cf19a345c67cc6fd445376d Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 00:13:55 +0800 Subject: [PATCH 167/204] Fix brotlienc pkgconfig patching --- src/SPC/builder/unix/library/brotli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/brotli.php b/src/SPC/builder/unix/library/brotli.php index 588d27bbe..6de9c15c0 100644 --- a/src/SPC/builder/unix/library/brotli.php +++ b/src/SPC/builder/unix/library/brotli.php @@ -24,7 +24,7 @@ protected function build(): void $this->patchPkgconfPrefix(['libbrotlicommon.pc', 'libbrotlidec.pc', 'libbrotlienc.pc']); FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/libbrotlidec.pc', 'Libs: -L${libdir} -lbrotlidec', 'Libs: -L${libdir} -lbrotlidec -lbrotlicommon'); - FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/libbrotlienc.pc', 'Libs: -L${libdir} -lbrotlienc', 'Libs: -L${libdir} -lbrotlidec -lbrotlicommon'); + FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/libbrotlienc.pc', 'Libs: -L${libdir} -lbrotlienc', 'Libs: -L${libdir} -lbrotlienc -lbrotlicommon'); shell()->cd(BUILD_ROOT_PATH . '/lib')->exec('ln -sf libbrotlicommon.a libbrotli.a'); foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) { if (str_starts_with($filename, 'libbrotli') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) { From 9e8119e69cdcd22a2df2d24d6c9e50f0b5ba392c Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 12:28:28 +0800 Subject: [PATCH 168/204] Fix ldap build --- src/SPC/builder/unix/library/ldap.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/ldap.php b/src/SPC/builder/unix/library/ldap.php index 276f8e99c..36894a6fc 100644 --- a/src/SPC/builder/unix/library/ldap.php +++ b/src/SPC/builder/unix/library/ldap.php @@ -27,7 +27,10 @@ protected function build(): void '--without-systemd', '--without-cyrus-sasl', ) - ->appendEnv(['LDFLAGS' => "-L{$this->getLibDir()}"]) + ->appendEnv([ + 'LDFLAGS' => "-L{$this->getLibDir()}", + 'CPPFLAGS' => "-I{$this->getIncludeDir()}", + ]) ->configure() ->exec('sed -i -e "s/SUBDIRS= include libraries clients servers tests doc/SUBDIRS= include libraries clients servers/g" Makefile') ->make(); From 6cb2cdd5a2f9c0cdc6b32623ef5b761197d3fbba Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 12:42:37 +0800 Subject: [PATCH 169/204] Add ignoreConfigureArgs for UnixAutoconfExecutor --- src/SPC/builder/unix/library/librdkafka.php | 4 ++++ src/SPC/util/executor/UnixAutoconfExecutor.php | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/librdkafka.php b/src/SPC/builder/unix/library/librdkafka.php index 69fe04d41..28290ea06 100644 --- a/src/SPC/builder/unix/library/librdkafka.php +++ b/src/SPC/builder/unix/library/librdkafka.php @@ -25,6 +25,10 @@ function ($lib) { }, '--disable-zstd' ) + ->ignoreConfigureArgs( + '--with-pic', + '--enable-pic', + ) ->configure( '--disable-curl', '--disable-sasl', diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php index dc1741fd3..46eb678df 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -16,6 +16,8 @@ class UnixAutoconfExecutor extends Executor protected array $configure_args = []; + protected array $ignore_args = []; + public function __construct(protected BSDLibraryBase|LinuxLibraryBase|MacOSLibraryBase $library) { parent::__construct($library); @@ -27,7 +29,10 @@ public function __construct(protected BSDLibraryBase|LinuxLibraryBase|MacOSLibra */ public function configure(...$args): static { - $configure_args = implode(' ', array_merge($args, $this->getDefaultConfigureArgs(), $this->configure_args)); + // remove all the ignored args + $args = array_merge($args, $this->getDefaultConfigureArgs(), $this->configure_args); + $args = array_diff($args, $this->ignore_args); + $configure_args = implode(' ', $args); $this->shell->exec("./configure {$configure_args}"); return $this; @@ -92,6 +97,15 @@ public function addConfigureArgs(...$args): static return $this; } + /** + * Ignore some configure args, to bypass the configure option checking for some libs. + */ + public function ignoreConfigureArgs(...$args): static + { + $this->ignore_args = [...$this->ignore_args, ...$args]; + return $this; + } + public function appendEnv(array $env): static { $this->shell->appendEnv($env); From 11f21304f9b4dcf72e973b2f2a0ff3fc6546d0d9 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 15:33:41 +0800 Subject: [PATCH 170/204] Fix libxslt lib compile bug --- src/SPC/builder/freebsd/library/curl.php | 4 ++-- src/SPC/builder/linux/library/curl.php | 4 ++-- src/SPC/builder/linux/library/openssl.php | 4 ++-- src/SPC/builder/traits/UnixLibraryTrait.php | 4 ++-- src/SPC/builder/unix/library/libxslt.php | 3 +-- src/SPC/builder/windows/library/WindowsLibraryBase.php | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/SPC/builder/freebsd/library/curl.php b/src/SPC/builder/freebsd/library/curl.php index bb5c92656..4eeab20d8 100644 --- a/src/SPC/builder/freebsd/library/curl.php +++ b/src/SPC/builder/freebsd/library/curl.php @@ -10,9 +10,9 @@ class curl extends BSDLibraryBase public const NAME = 'curl'; - public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string + public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true, bool $include_self = true): string { - $libs = parent::getStaticLibFiles($style, $recursive); + $libs = parent::getStaticLibFiles($style, $recursive, $include_self); if ($this->builder->getLib('openssl')) { $this->builder->setOption('extra-libs', $this->builder->getOption('extra-libs') . ' /usr/lib/libpthread.a /usr/lib/libdl.a'); } diff --git a/src/SPC/builder/linux/library/curl.php b/src/SPC/builder/linux/library/curl.php index d45492c48..f382773ff 100644 --- a/src/SPC/builder/linux/library/curl.php +++ b/src/SPC/builder/linux/library/curl.php @@ -10,9 +10,9 @@ class curl extends LinuxLibraryBase public const NAME = 'curl'; - public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string + public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true, bool $include_self = true): string { - $libs = parent::getStaticLibFiles($style, $recursive); + $libs = parent::getStaticLibFiles($style, $recursive, $include_self); if ($this->builder->getLib('openssl')) { $libs .= ' -ldl -lpthread'; } diff --git a/src/SPC/builder/linux/library/openssl.php b/src/SPC/builder/linux/library/openssl.php index 11c60067e..252eb47fb 100644 --- a/src/SPC/builder/linux/library/openssl.php +++ b/src/SPC/builder/linux/library/openssl.php @@ -92,9 +92,9 @@ public function build(): void FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/cmake/OpenSSL/OpenSSLConfig.cmake', '/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m', 'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}/libz.a")'); } - public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string + public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true, bool $include_self = true): string { - $libFiles = parent::getStaticLibFiles($style, $recursive); + $libFiles = parent::getStaticLibFiles($style, $recursive, $include_self); if (!str_contains('-ldl -lpthread', $libFiles)) { $libFiles .= ' -ldl -lpthread'; } diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index fbca595fb..73037447a 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -17,9 +17,9 @@ trait UnixLibraryTrait * @throws FileSystemException * @throws WrongUsageException */ - public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string + public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true, bool $include_self = true): string { - $libs = [$this]; + $libs = $include_self ? [$this] : []; if ($recursive) { array_unshift($libs, ...array_values($this->getDependencies(recursive: true))); } diff --git a/src/SPC/builder/unix/library/libxslt.php b/src/SPC/builder/unix/library/libxslt.php index af85b052d..a1a39a088 100644 --- a/src/SPC/builder/unix/library/libxslt.php +++ b/src/SPC/builder/unix/library/libxslt.php @@ -19,7 +19,7 @@ trait libxslt */ protected function build(): void { - $static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles() : ''; + $static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles(include_self: false) : ''; $ac = UnixAutoconfExecutor::create($this) ->appendEnv([ 'CFLAGS' => "-I{$this->getIncludeDir()}", @@ -28,7 +28,6 @@ protected function build(): void ]) ->addConfigureArgs( '--without-python', - '--without-mem-debug', '--without-crypto', '--without-debug', '--without-debugger', diff --git a/src/SPC/builder/windows/library/WindowsLibraryBase.php b/src/SPC/builder/windows/library/WindowsLibraryBase.php index e8de629ea..076afa039 100644 --- a/src/SPC/builder/windows/library/WindowsLibraryBase.php +++ b/src/SPC/builder/windows/library/WindowsLibraryBase.php @@ -29,9 +29,9 @@ public function getBuilder(): BuilderBase * @throws FileSystemException * @throws WrongUsageException */ - public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string + public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true, bool $include_self = true): string { - $libs = [$this]; + $libs = $include_self ? [$this] : []; if ($recursive) { array_unshift($libs, ...array_values($this->getDependencies(recursive: true))); } From da45aa7f15445fc903ead83dcf525a0adfc20abf Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 15:37:39 +0800 Subject: [PATCH 171/204] Fix ngtcp2 and libheif build missing lib bug --- src/SPC/builder/macos/library/libheif.php | 15 --------------- src/SPC/builder/unix/library/libheif.php | 14 ++++++++++++++ src/SPC/builder/unix/library/ngtcp2.php | 10 +++++++--- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/SPC/builder/macos/library/libheif.php b/src/SPC/builder/macos/library/libheif.php index e785809d5..af99740b7 100644 --- a/src/SPC/builder/macos/library/libheif.php +++ b/src/SPC/builder/macos/library/libheif.php @@ -4,24 +4,9 @@ namespace SPC\builder\macos\library; -use SPC\store\FileSystem; - class libheif extends MacOSLibraryBase { use \SPC\builder\unix\library\libheif; public const NAME = 'libheif'; - - public function patchBeforeBuild(): bool - { - if (!str_contains(file_get_contents($this->source_dir . '/CMakeLists.txt'), 'libbrotlienc')) { - FileSystem::replaceFileStr( - $this->source_dir . '/CMakeLists.txt', - 'list(APPEND REQUIRES_PRIVATE "libbrotlidec")', - 'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")' - ); - return true; - } - return false; - } } diff --git a/src/SPC/builder/unix/library/libheif.php b/src/SPC/builder/unix/library/libheif.php index 131a330d7..680f33213 100644 --- a/src/SPC/builder/unix/library/libheif.php +++ b/src/SPC/builder/unix/library/libheif.php @@ -6,10 +6,24 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; +use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; trait libheif { + public function patchBeforeBuild(): bool + { + if (!str_contains(file_get_contents($this->source_dir . '/CMakeLists.txt'), 'libbrotlienc')) { + FileSystem::replaceFileStr( + $this->source_dir . '/CMakeLists.txt', + 'list(APPEND REQUIRES_PRIVATE "libbrotlidec")', + 'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")' + ); + return true; + } + return false; + } + /** * @throws RuntimeException * @throws FileSystemException diff --git a/src/SPC/builder/unix/library/ngtcp2.php b/src/SPC/builder/unix/library/ngtcp2.php index 23c85e1e3..2d0e8765e 100644 --- a/src/SPC/builder/unix/library/ngtcp2.php +++ b/src/SPC/builder/unix/library/ngtcp2.php @@ -19,7 +19,11 @@ trait ngtcp2 protected function build(): void { UnixAutoconfExecutor::create($this) - ->optionalLib('openssl', ...ac_with_args('openssl', true)) + ->optionalLib('openssl', fn ($lib) => implode(' ', [ + '--with-openssl=yes', + "OPENSSL_LIBS=\"{$lib->getStaticLibFiles()}\"", + "OPENSSL_CFLAGS=\"-I{$lib->getIncludeDir()}\"", + ]), '--with-openssl=no') ->optionalLib('libev', ...ac_with_args('libev', true)) ->optionalLib('nghttp3', ...ac_with_args('libnghttp3', true)) ->optionalLib('jemalloc', ...ac_with_args('jemalloc', true)) @@ -34,6 +38,7 @@ protected function build(): void "LIBBROTLIENC_LIBS=\"{$lib->getStaticLibFiles()}\"", ]) ) + ->appendEnv(['PKG_CONFIG' => '$PKG_CONFIG --static']) ->configure('--enable-lib-only') ->make(); $this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']); @@ -41,7 +46,6 @@ protected function build(): void // on macOS, the static library may contain other static libraries? // ld: archive member 'libssl.a' not a mach-o file in libngtcp2_crypto_ossl.a - shell()->cd(BUILD_LIB_PATH) - ->exec("ar -t libngtcp2_crypto_ossl.a | grep '\\.a$' | xargs -n1 ar d libngtcp2_crypto_ossl.a"); + shell()->cd(BUILD_LIB_PATH)->exec("ar -t libngtcp2_crypto_ossl.a | grep '\\.a$' | xargs -n1 ar d libngtcp2_crypto_ossl.a"); } } From 474fe63ad338b68cdd30376f7d0591793aa58caf Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 15:37:54 +0800 Subject: [PATCH 172/204] Add optional lib log --- src/SPC/util/executor/UnixAutoconfExecutor.php | 2 ++ src/SPC/util/executor/UnixCMakeExecutor.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php index 46eb678df..0e83a58d4 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -80,8 +80,10 @@ public function exec(string $cmd): static public function optionalLib(string $name, \Closure|string $true_args, string $false_args = ''): static { if ($get = $this->library->getBuilder()->getLib($name)) { + logger()->info("Building library [{$this->library->getName()}] with {$name} support"); $args = $true_args instanceof \Closure ? $true_args($get) : $true_args; } else { + logger()->info("Building library [{$this->library->getName()}] without {$name} support"); $args = $false_args; } $this->addConfigureArgs($args); diff --git a/src/SPC/util/executor/UnixCMakeExecutor.php b/src/SPC/util/executor/UnixCMakeExecutor.php index 55a745785..b9c7ef589 100644 --- a/src/SPC/util/executor/UnixCMakeExecutor.php +++ b/src/SPC/util/executor/UnixCMakeExecutor.php @@ -58,8 +58,10 @@ public function build(string $build_pos = '..'): void public function optionalLib(string $name, \Closure|string $true_args, string $false_args = ''): static { if ($get = $this->library->getBuilder()->getLib($name)) { + logger()->info("Building library [{$this->library->getName()}] with {$name} support"); $args = $true_args instanceof \Closure ? $true_args($get) : $true_args; } else { + logger()->info("Building library [{$this->library->getName()}] without {$name} support"); $args = $false_args; } $this->addConfigureArgs($args); @@ -193,6 +195,7 @@ private function makeCmakeToolchainFile(): string SET(CMAKE_INSTALL_LIBDIR "lib") set(PKG_CONFIG_EXECUTABLE "{$root}/bin/pkg-config") +list(APPEND PKG_CONFIG_EXECUTABLE "--static") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) From b320eb853a6d37454a430fad0b52178d1e960603 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 15:39:14 +0800 Subject: [PATCH 173/204] Rename ignoreConfigureArgs to removeConfigureArgs --- src/SPC/builder/unix/library/librdkafka.php | 2 +- src/SPC/util/executor/UnixAutoconfExecutor.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/unix/library/librdkafka.php b/src/SPC/builder/unix/library/librdkafka.php index 28290ea06..32f389e15 100644 --- a/src/SPC/builder/unix/library/librdkafka.php +++ b/src/SPC/builder/unix/library/librdkafka.php @@ -25,7 +25,7 @@ function ($lib) { }, '--disable-zstd' ) - ->ignoreConfigureArgs( + ->removeConfigureArgs( '--with-pic', '--enable-pic', ) diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php index 0e83a58d4..1c9f496e2 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -100,9 +100,9 @@ public function addConfigureArgs(...$args): static } /** - * Ignore some configure args, to bypass the configure option checking for some libs. + * Remove some configure args, to bypass the configure option checking for some libs. */ - public function ignoreConfigureArgs(...$args): static + public function removeConfigureArgs(...$args): static { $this->ignore_args = [...$this->ignore_args, ...$args]; return $this; From 145fe7ce1378b19949b0bf40b20e4fc5399b9327 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 10 Jun 2025 15:52:56 +0800 Subject: [PATCH 174/204] Remove curl libbrotli patches --- src/SPC/builder/unix/library/curl.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/SPC/builder/unix/library/curl.php b/src/SPC/builder/unix/library/curl.php index bd15d27e9..0d0b8d8d1 100644 --- a/src/SPC/builder/unix/library/curl.php +++ b/src/SPC/builder/unix/library/curl.php @@ -6,7 +6,6 @@ use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; -use SPC\store\FileSystem; use SPC\util\executor\UnixCMakeExecutor; trait curl @@ -38,26 +37,6 @@ protected function build(): void // patch pkgconf $this->patchPkgconfPrefix(['libcurl.pc']); - FileSystem::replaceFileStr( - BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', - '-lbrotlienc -lbrotlidec -lbrotlicommon', - '-lbrotlidec -lbrotlicommon' - ); - FileSystem::replaceFileStr( - BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', - '-lbrotlidec -lbrotlicommon', - '-lbrotlienc -lbrotlidec -lbrotlicommon' - ); - FileSystem::replaceFileStr( - BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', - 'libbrotlienc,libbrotlidec,libbrotlicommon', - 'libbrotlidec,libbrotlicommon' - ); - FileSystem::replaceFileStr( - BUILD_LIB_PATH . '/pkgconfig/libcurl.pc', - 'libbrotlidec,libbrotlicommon', - 'libbrotlienc,libbrotlidec,libbrotlicommon' - ); shell()->cd(BUILD_LIB_PATH . '/cmake/CURL/') ->exec("sed -ie 's|\"/lib/libcurl.a\"|\"" . BUILD_LIB_PATH . "/libcurl.a\"|g' CURLTargets-release.cmake"); } From 9ed62b02b6bd3419f8c63a5d2aa2df464a080ab4 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 10 Jun 2025 19:46:55 +0700 Subject: [PATCH 175/204] make patchLaDependencyPrefix argument optional, remove cleanLaFiles --- src/SPC/builder/linux/library/libpng.php | 2 +- src/SPC/builder/macos/library/libpng.php | 3 +- src/SPC/builder/traits/UnixLibraryTrait.php | 31 ++++++++------------ src/SPC/builder/unix/library/freetype.php | 2 -- src/SPC/builder/unix/library/gettext.php | 2 +- src/SPC/builder/unix/library/imagemagick.php | 6 +--- src/SPC/builder/unix/library/ldap.php | 2 +- src/SPC/builder/unix/library/libavif.php | 1 - src/SPC/builder/unix/library/libiconv.php | 2 +- src/SPC/builder/unix/library/libjpeg.php | 1 - src/SPC/builder/unix/library/libwebp.php | 2 -- src/SPC/builder/unix/library/libxslt.php | 4 +-- src/SPC/builder/unix/library/nghttp2.php | 2 +- src/SPC/builder/unix/library/nghttp3.php | 2 +- src/SPC/builder/unix/library/ngtcp2.php | 2 +- src/SPC/builder/unix/library/unixodbc.php | 2 +- src/SPC/builder/unix/library/xz.php | 2 +- 17 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/SPC/builder/linux/library/libpng.php b/src/SPC/builder/linux/library/libpng.php index da660aff5..5510a0238 100644 --- a/src/SPC/builder/linux/library/libpng.php +++ b/src/SPC/builder/linux/library/libpng.php @@ -59,6 +59,6 @@ public function build(): void ->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I{$this->source_dir} -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la") ->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX); - $this->cleanLaFiles(); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/macos/library/libpng.php b/src/SPC/builder/macos/library/libpng.php index f273bff6b..090e069e4 100644 --- a/src/SPC/builder/macos/library/libpng.php +++ b/src/SPC/builder/macos/library/libpng.php @@ -59,7 +59,6 @@ protected function build(): void ->cd(BUILD_LIB_PATH) ->exec('ln -sf libpng16.a libpng.a'); $this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX); - $this->patchLaDependencyPrefix(['libpng16.la']); - $this->cleanLaFiles(); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index fbca595fb..ffb6ade1f 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -84,13 +84,24 @@ public function patchPkgconfPrefix(array $files, int $patch_option = PKGCONF_PAT } } - public function patchLaDependencyPrefix(array $files): void + public function patchLaDependencyPrefix(?array $files = null): void { logger()->info('Patching library [' . static::NAME . '] la files'); + $throwOnMissing = true; + if ($files === null) { + $files = $this->getStaticLibs(); + $files = array_map(fn ($name) => str_replace('.a', '.la', $name), $files); + $throwOnMissing = false; + } foreach ($files as $name) { $realpath = realpath(BUILD_LIB_PATH . '/' . $name); if ($realpath === false) { - throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !'); + if ($throwOnMissing) { + throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !'); + } else { + logger()->warning('Cannot find library [' . static::NAME . '] la file [' . $name . '] !'); + continue; + } } logger()->debug('Patching ' . $realpath); // replace prefix @@ -105,22 +116,6 @@ public function patchLaDependencyPrefix(array $files): void } } - /** - * remove libtool archive files - * - * @throws FileSystemException - * @throws WrongUsageException - */ - public function cleanLaFiles(): void - { - foreach ($this->getStaticLibs() as $lib) { - $filename = pathinfo($lib, PATHINFO_FILENAME) . '.la'; - if (file_exists(BUILD_LIB_PATH . '/' . $filename)) { - unlink(BUILD_LIB_PATH . '/' . $filename); - } - } - } - public function getLibExtraCFlags(): string { $env = getenv($this->getSnakeCaseName() . '_CFLAGS') ?: ''; diff --git a/src/SPC/builder/unix/library/freetype.php b/src/SPC/builder/unix/library/freetype.php index 35e626020..581a5e754 100644 --- a/src/SPC/builder/unix/library/freetype.php +++ b/src/SPC/builder/unix/library/freetype.php @@ -38,7 +38,5 @@ protected function build(): void ' -L/lib ', ' -L' . BUILD_ROOT_PATH . '/lib ' ); - - $this->cleanLaFiles(); } } diff --git a/src/SPC/builder/unix/library/gettext.php b/src/SPC/builder/unix/library/gettext.php index 15a6b6c71..576df3855 100644 --- a/src/SPC/builder/unix/library/gettext.php +++ b/src/SPC/builder/unix/library/gettext.php @@ -34,6 +34,6 @@ protected function build(): void ->exec('make clean') ->exec("make -j{$this->builder->concurrency}") ->exec('make install'); - $this->patchLaDependencyPrefix(['libintl.la']); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index 1284305c4..714fdff5e 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -78,10 +78,6 @@ protected function build(): void 'includearchdir=${prefix}/include/ImageMagick-7' ); } - $this->patchLaDependencyPrefix([ - 'libMagick++-7.Q16HDRI.la', - 'libMagickCore-7.Q16HDRI.la', - 'libMagickWand-7.Q16HDRI.la', - ]); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/ldap.php b/src/SPC/builder/unix/library/ldap.php index 501654de2..b2c5e65b2 100644 --- a/src/SPC/builder/unix/library/ldap.php +++ b/src/SPC/builder/unix/library/ldap.php @@ -48,6 +48,6 @@ protected function build(): void FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/ldap.pc', 'Libs: -L${libdir} -lldap', 'Libs: -L${libdir} -lldap -llber'); $this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']); - $this->patchLaDependencyPrefix(['libldap.la', 'liblber.la']); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/libavif.php b/src/SPC/builder/unix/library/libavif.php index cbec640bb..dea45c6ea 100644 --- a/src/SPC/builder/unix/library/libavif.php +++ b/src/SPC/builder/unix/library/libavif.php @@ -23,6 +23,5 @@ protected function build(): void ->build(); // patch pkgconfig $this->patchPkgconfPrefix(['libavif.pc']); - $this->cleanLaFiles(); } } diff --git a/src/SPC/builder/unix/library/libiconv.php b/src/SPC/builder/unix/library/libiconv.php index 36ef136ed..98b40c103 100644 --- a/src/SPC/builder/unix/library/libiconv.php +++ b/src/SPC/builder/unix/library/libiconv.php @@ -21,6 +21,6 @@ protected function build(): void ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); - $this->patchLaDependencyPrefix(['libiconv.la']); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/libjpeg.php b/src/SPC/builder/unix/library/libjpeg.php index 3f8aff9e1..6196f8afa 100644 --- a/src/SPC/builder/unix/library/libjpeg.php +++ b/src/SPC/builder/unix/library/libjpeg.php @@ -26,6 +26,5 @@ protected function build(): void ->build(); // patch pkgconfig $this->patchPkgconfPrefix(['libjpeg.pc', 'libturbojpeg.pc']); - $this->cleanLaFiles(); } } diff --git a/src/SPC/builder/unix/library/libwebp.php b/src/SPC/builder/unix/library/libwebp.php index e4f45eb43..32331ea27 100644 --- a/src/SPC/builder/unix/library/libwebp.php +++ b/src/SPC/builder/unix/library/libwebp.php @@ -24,8 +24,6 @@ protected function build(): void // patch pkgconfig $this->patchPkgconfPrefix(['libsharpyuv.pc', 'libwebp.pc', 'libwebpdecoder.pc', 'libwebpdemux.pc', 'libwebpmux.pc'], PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR); $this->patchPkgconfPrefix(['libsharpyuv.pc'], PKGCONF_PATCH_CUSTOM, ['/^includedir=.*$/m', 'includedir=${prefix}/include/webp']); - $this->cleanLaFiles(); - // fix imagemagick binary linking issue $this->patchPkgconfPrefix(['libwebp.pc'], PKGCONF_PATCH_CUSTOM, ['/-lwebp$/m', '-lwebp -lsharpyuv']); } } diff --git a/src/SPC/builder/unix/library/libxslt.php b/src/SPC/builder/unix/library/libxslt.php index 109751457..0fd641b37 100644 --- a/src/SPC/builder/unix/library/libxslt.php +++ b/src/SPC/builder/unix/library/libxslt.php @@ -47,8 +47,8 @@ protected function build(): void ->exec('make clean') ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH)); - $this->patchPkgconfPrefix(['libexslt.pc']); - $this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']); + $this->patchPkgconfPrefix(['libxslt.pc', 'libexslt.pc']); + $this->patchLaDependencyPrefix(); shell()->cd(BUILD_LIB_PATH) ->exec("ar -t libxslt.a | grep '\\.a$' | xargs -n1 ar d libxslt.a") ->exec("ar -t libexslt.a | grep '\\.a$' | xargs -n1 ar d libexslt.a"); diff --git a/src/SPC/builder/unix/library/nghttp2.php b/src/SPC/builder/unix/library/nghttp2.php index e09832d90..23f5b3c79 100644 --- a/src/SPC/builder/unix/library/nghttp2.php +++ b/src/SPC/builder/unix/library/nghttp2.php @@ -54,6 +54,6 @@ protected function build(): void ->exec("make -j{$this->builder->concurrency}") ->exec("make install DESTDIR={$destdir}"); $this->patchPkgconfPrefix(['libnghttp2.pc']); - $this->patchLaDependencyPrefix(['libnghttp2.la']); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/nghttp3.php b/src/SPC/builder/unix/library/nghttp3.php index ca2862a22..bf8f1bd29 100644 --- a/src/SPC/builder/unix/library/nghttp3.php +++ b/src/SPC/builder/unix/library/nghttp3.php @@ -28,6 +28,6 @@ protected function build(): void ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libnghttp3.pc']); - $this->patchLaDependencyPrefix(['libnghttp3.la']); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/ngtcp2.php b/src/SPC/builder/unix/library/ngtcp2.php index 94e9c5707..f36d44cb6 100644 --- a/src/SPC/builder/unix/library/ngtcp2.php +++ b/src/SPC/builder/unix/library/ngtcp2.php @@ -44,7 +44,7 @@ protected function build(): void ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']); - $this->patchLaDependencyPrefix(['libngtcp2.la', 'libngtcp2_crypto_ossl.la']); + $this->patchLaDependencyPrefix(); // on macOS, the static library may contain other static libraries? // ld: archive member 'libssl.a' not a mach-o file in libngtcp2_crypto_ossl.a diff --git a/src/SPC/builder/unix/library/unixodbc.php b/src/SPC/builder/unix/library/unixodbc.php index 0e40629dc..c694cb86f 100644 --- a/src/SPC/builder/unix/library/unixodbc.php +++ b/src/SPC/builder/unix/library/unixodbc.php @@ -31,6 +31,6 @@ protected function build(): void ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']); - $this->cleanLaFiles(); + $this->patchLaDependencyPrefix(); } } diff --git a/src/SPC/builder/unix/library/xz.php b/src/SPC/builder/unix/library/xz.php index 3aed6a153..5f90cc4d7 100644 --- a/src/SPC/builder/unix/library/xz.php +++ b/src/SPC/builder/unix/library/xz.php @@ -30,6 +30,6 @@ public function build(): void ->exec("make -j{$this->builder->concurrency}") ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); $this->patchPkgconfPrefix(['liblzma.pc']); - $this->patchLaDependencyPrefix(['liblzma.la']); + $this->patchLaDependencyPrefix(); } } From 6d3e2d9316e74188490eace2b1cd08d4f7974695 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 10 Jun 2025 19:57:31 +0700 Subject: [PATCH 176/204] revert extension tests --- src/globals/test-extensions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index be69531f9..9706740ae 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -45,20 +45,20 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'zlib', + 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', 'Windows' => 'xlswriter,openssl', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => '', + 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', 'Darwin' => '', 'Windows' => '', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'libffi,libpng,gettext,gmp,imagemagick,ldap,postgresql,libcares,libiconv,librdkafka,libsodium,libtiff,libxslt,ncurses,nghttp2,nghttp3,ngtcp2,onig,qdbm,readline,sqlite,unixodbc,xz,zlib', + 'Linux', 'Darwin' => 'libavif,nghttp2,nghttp3,ngtcp2', 'Windows' => '', }; From 63656cf3833a033b73b810faa5732cd83dedb47e Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 10 Jun 2025 19:58:25 +0700 Subject: [PATCH 177/204] cs fixer, of course --- src/SPC/builder/traits/UnixLibraryTrait.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/traits/UnixLibraryTrait.php b/src/SPC/builder/traits/UnixLibraryTrait.php index 3b378c4e6..e98a6f3a8 100644 --- a/src/SPC/builder/traits/UnixLibraryTrait.php +++ b/src/SPC/builder/traits/UnixLibraryTrait.php @@ -98,10 +98,9 @@ public function patchLaDependencyPrefix(?array $files = null): void if ($realpath === false) { if ($throwOnMissing) { throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !'); - } else { - logger()->warning('Cannot find library [' . static::NAME . '] la file [' . $name . '] !'); - continue; } + logger()->warning('Cannot find library [' . static::NAME . '] la file [' . $name . '] !'); + continue; } logger()->debug('Patching ' . $realpath); // replace prefix From c3aa7356ecdd800582f4672333d2b71fdfba2331 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 11:43:00 +0700 Subject: [PATCH 178/204] update tests to all static --- src/globals/test-extensions.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 9706740ae..575a40d35 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -45,20 +45,23 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib', + 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib,amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', 'Windows' => 'xlswriter,openssl', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xdebug,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', + 'Linux' => 'xdebug', 'Darwin' => '', 'Windows' => '', }; -// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). +// If you want to test lib-suggests for all extensions and libraries, set it to true. +$with_suggested_libs = true; + +// If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true. $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'libavif,nghttp2,nghttp3,ngtcp2', + 'Linux', 'Darwin' => '', 'Windows' => '', }; @@ -169,6 +172,7 @@ function quote2(string $param): string $build_cmd = 'build '; $build_cmd .= quote2($final_extensions) . ' '; $build_cmd .= $shared_cmd; + $build_cmd .= $with_suggested_libs ? '--with-suggested-libs ' : ''; $build_cmd .= $zts ? '--enable-zts ' : ''; $build_cmd .= $no_strip ? '--no-strip ' : ''; $build_cmd .= $upx ? '--with-upx-pack ' : ''; From 311de9381c74d30b239e61f5928f1babc2dd9c07 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 13:47:32 +0700 Subject: [PATCH 179/204] fix gomp error --- src/SPC/builder/unix/library/imagemagick.php | 2 +- src/globals/test-extensions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index 2011363c4..ead786a22 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -33,7 +33,7 @@ protected function build(): void ->optionalLib('bzip2', ...ac_with_args('bzlib')) ->addConfigureArgs( // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so - getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10') ? '--enable-openmp' : '--disable-openmp', + getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10') ? '--disable-openmp' : '--enable-openmp', '--without-jxl', '--without-x', ); diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 575a40d35..7f4e05caf 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -45,7 +45,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib,amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,inotify,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', + 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib,amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', 'Windows' => 'xlswriter,openssl', }; From a7771e95f28566a80c0c55fa356750f50aa36c7a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 13:49:38 +0700 Subject: [PATCH 180/204] enable musl too --- src/globals/test-extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 7f4e05caf..fe245f49e 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -26,9 +26,9 @@ 'macos-15', // 'ubuntu-latest', 'ubuntu-22.04', - // 'ubuntu-24.04', + 'ubuntu-24.04', 'ubuntu-22.04-arm', - // 'ubuntu-24.04-arm', + 'ubuntu-24.04-arm', // 'windows-latest', ]; From a503aaa8a00648e058f61557f5b2509e5e1cdc7d Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 15:01:16 +0700 Subject: [PATCH 181/204] -lomp on macos --- src/SPC/builder/extension/imagick.php | 8 ++++++-- src/SPC/builder/unix/library/imagemagick.php | 2 +- src/SPC/util/SPCConfigUtil.php | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index 7b0e20f9d..4bd4ddcc2 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -15,8 +15,12 @@ public function patchBeforeMake(): bool if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) { return false; } - // imagick with calls omp_pause_all which requires -lgomp, on non-musl we build imagick without openmp - $extra_libs = trim(getenv('SPC_EXTRA_LIBS') . ' -lgomp'); + // imagick with calls omp_pause_all which requires openmp, on non-musl we build imagick without openmp + $extra_libs = match (PHP_OS_FAMILY) { + 'Linux' => trim(getenv('SPC_EXTRA_LIBS') . ' -lgomp'), + 'Darwin' => trim(getenv('SPC_EXTRA_LIBS') . ' -lomp'), + default => '' + }; f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); return true; } diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index ead786a22..bf0b29315 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -33,7 +33,7 @@ protected function build(): void ->optionalLib('bzip2', ...ac_with_args('bzlib')) ->addConfigureArgs( // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so - getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10') ? '--disable-openmp' : '--enable-openmp', + getenv('SPC_LIBC') === 'musl' ? '--enable-openmp' : '--disable-openmp', '--without-jxl', '--without-x', ); diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 375d40cd9..da52d3b8c 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -146,6 +146,9 @@ private function getLibsString(array $libraries, bool $withDependencies = false) if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Linux' && !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10'))) { $short_name[] = '-lgomp'; } + if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Darwin') { + $short_name[] = '-lomp'; + } return implode(' ', $short_name); } From d322be16664f44661430c996acaca87e81f270bf Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 15:02:07 +0700 Subject: [PATCH 182/204] err, add it back in --- src/SPC/builder/unix/library/imagemagick.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/imagemagick.php b/src/SPC/builder/unix/library/imagemagick.php index bf0b29315..ead786a22 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -33,7 +33,7 @@ protected function build(): void ->optionalLib('bzip2', ...ac_with_args('bzlib')) ->addConfigureArgs( // TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so - getenv('SPC_LIBC') === 'musl' ? '--enable-openmp' : '--disable-openmp', + getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10') ? '--disable-openmp' : '--enable-openmp', '--without-jxl', '--without-x', ); From 518ed3a7fd19d23ad489ad4723f23736b7a11195 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 15:38:43 +0700 Subject: [PATCH 183/204] don't add -lomp on macos (not required) --- src/SPC/builder/extension/imagick.php | 11 +++++------ src/SPC/util/SPCConfigUtil.php | 3 --- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index 4bd4ddcc2..d78627ef7 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -12,15 +12,14 @@ class imagick extends Extension { public function patchBeforeMake(): bool { + if (PHP_OS_FAMILY !== 'Linux') { + return false; + } if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) { return false; } - // imagick with calls omp_pause_all which requires openmp, on non-musl we build imagick without openmp - $extra_libs = match (PHP_OS_FAMILY) { - 'Linux' => trim(getenv('SPC_EXTRA_LIBS') . ' -lgomp'), - 'Darwin' => trim(getenv('SPC_EXTRA_LIBS') . ' -lomp'), - default => '' - }; + // imagick with calls omp_pause_all, which requires openmp, on non-musl we build imagick without openmp + $extra_libs = trim(getenv('SPC_EXTRA_LIBS') . ' -lgomp'); f_putenv('SPC_EXTRA_LIBS=' . $extra_libs); return true; } diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index da52d3b8c..375d40cd9 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -146,9 +146,6 @@ private function getLibsString(array $libraries, bool $withDependencies = false) if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Linux' && !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10'))) { $short_name[] = '-lgomp'; } - if (in_array('imagemagick', $libraries) && PHP_OS_FAMILY === 'Darwin') { - $short_name[] = '-lomp'; - } return implode(' ', $short_name); } From a1ccddb53ceb2ff56447dc68b335e448cf9623a2 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 11 Jun 2025 20:57:43 +0800 Subject: [PATCH 184/204] Test macOS 15 for all php version --- src/globals/test-extensions.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index fe245f49e..efcfb1f11 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,22 +13,22 @@ // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - // '8.1', - // '8.2', - // '8.3', + '8.1', + '8.2', + '8.3', '8.4', ]; // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - 'macos-13', + // 'macos-13', // 'macos-14', 'macos-15', // 'ubuntu-latest', - 'ubuntu-22.04', - 'ubuntu-24.04', - 'ubuntu-22.04-arm', - 'ubuntu-24.04-arm', + // 'ubuntu-22.04', + // 'ubuntu-24.04', + // 'ubuntu-22.04-arm', + // 'ubuntu-24.04-arm', // 'windows-latest', ]; From 70b91867cbbac931ff8773802b65f93a5ed463a5 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 11 Jun 2025 21:37:00 +0800 Subject: [PATCH 185/204] Lets' fuzz it --- .github/workflows/ext-matrix-tests.yml | 109 +++++++++---------------- 1 file changed, 38 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ext-matrix-tests.yml b/.github/workflows/ext-matrix-tests.yml index da30d0086..a43bfff2a 100644 --- a/.github/workflows/ext-matrix-tests.yml +++ b/.github/workflows/ext-matrix-tests.yml @@ -15,81 +15,48 @@ jobs: fail-fast: false matrix: extension: - - amqp - - apcu - - bcmath - - bz2 - - calendar - - ctype - - curl - - dba - - dom - - ds - - event - - exif - - filter - - fileinfo - - ftp - - gd - - gettext - - gmp - - iconv - - igbinary - - imagick - - imap - - intl - - ldap - - mbstring,mbregex - - memcache - - mysqli,mysqlnd,pdo_mysql - - opcache - - openssl - - pcntl - - password-argon2 - - pcntl - - pdo - - pgsql,pdo_pgsql - - phar - - posix - - rar - - protobuf - - readline - - redis - - session - - shmop - - simdjson - - simplexml,xml - - snappy - - soap - - sockets - - sodium - - sqlite3,pdo_sqlite - - sqlsrv - - ssh2 - - swoole - - swoole,swoole-hook-pgsql,swoole-hook-mysql,swoole-hook-sqlite - - swow - - sysvmsg,sysvsem,sysvshm - - tidy - - tokenizer - - uuid - - uv - - xhprof - - xlswriter - - xmlwriter,xmlreader - - xsl - - yac - - yaml - - zip - - zlib - - zstd + - dom,amqp + - dom,ast + - dom,brotli + - dom,dio + - dom,ds + - dom,ev + - dom,ffi + - dom,gettext + - dom,gmssl + - dom,igbinary + - dom,ldap + - dom,libxml + - dom,lz4 + - dom,memcache + - dom,mongodb + - dom,msgpack + - dom,odbc + - dom,opentelemetry + - dom,parallel + - dom,pdo_odbc + - dom,pdo_sqlsrv + - dom,rar + - dom,rdkafka + - dom,spx + - dom,sqlsrv + - dom,ssh2 + - dom,tidy + - dom,uuid + - dom,uv + - dom,xhprof + - dom,xlswriter + - dom,xz + - dom,yac + - dom,yaml + - dom,zstd php-version: - "8.4" operating-system: - - "ubuntu-latest" + #- "ubuntu-latest" #- "macos-13" #- "debian-arm64-self-hosted" - - "macos-14" + - "macos-15" steps: - name: "Checkout" @@ -145,4 +112,4 @@ jobs: ./bin/spc install-pkg upx UPX=--with-upx-pack fi - ./bin/spc build --build-cli --build-micro --build-fpm ${{ matrix.extension }} --debug $UPX --with-suggested-libs --with-suggested-exts + ./bin/spc build --build-embed ${{ matrix.extension }} --debug $UPX --with-suggested-libs --with-suggested-exts --enable-zts From 80f2912026fa5681857aa67cf81ee4f2a8fe7936 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 11 Jun 2025 22:40:43 +0800 Subject: [PATCH 186/204] Fix rdkafka with zstd build failed bug, reset test-extensions --- src/SPC/builder/extension/rdkafka.php | 19 +++++++++---------- src/globals/test-extensions.php | 10 +++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/SPC/builder/extension/rdkafka.php b/src/SPC/builder/extension/rdkafka.php index 9f28c6270..cb1792c5f 100644 --- a/src/SPC/builder/extension/rdkafka.php +++ b/src/SPC/builder/extension/rdkafka.php @@ -11,6 +11,13 @@ #[CustomExt('rdkafka')] class rdkafka extends Extension { + public function patchBeforeBuildconf(): bool + { + FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\n", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm \$RDKAFKA_LIBS\n"); + FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\"\n", '-L$RDKAFKA_DIR/$PHP_LIBDIR -lm $RDKAFKA_LIBS"'); + return true; + } + public function patchBeforeMake(): bool { // when compiling rdkafka with inline builds, it shows some errors, I don't know why. @@ -27,18 +34,10 @@ public function patchBeforeMake(): bool return true; } - public function getConfigureArg(bool $shared = false): string + public function getUnixConfigureArg(bool $shared = false): string { $pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1]; $pkgconf_libs = trim(implode('', $pkgconf_libs)); - return '--with-rdkafka=' . BUILD_ROOT_PATH . ' LIBS="' . $pkgconf_libs . '"'; - } - - public function getUnixConfigureArg(bool $shared = false): string - { - if ($shared) { - return '--with-rdkafka=' . BUILD_ROOT_PATH; - } - return parent::getUnixConfigureArg($shared); + return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' RDKAFKA_LIBS="' . $pkgconf_libs . '"'; } } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index efcfb1f11..744028d39 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,9 +13,9 @@ // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ - '8.1', - '8.2', - '8.3', + // '8.1', + // '8.2', + // '8.3', '8.4', ]; @@ -45,13 +45,13 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'apcu,ast,bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib,amqp,brotli,bz2,dio,ds,ev,event,ffi,ftp,gd,gettext,gmp,gmssl,igbinary,imagick,intl,ldap,lz4,memcache,mongodb,msgpack,odbc,opentelemetry,parallel,pdo_odbc,pdo_pgsql,pdo_sqlsrv,pgsql,protobuf,rar,redis,rdkafka,shmop,spx,sqlsrv,ssh2,swoole,sysvmsg,sysvsem,sysvshm,tidy,uuid,uv,xhprof,xlswriter,xsl,xz,yac,yaml,zstd', + 'Linux', 'Darwin' => 'dom', 'Windows' => 'xlswriter,openssl', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => 'xdebug', + 'Linux' => '', 'Darwin' => '', 'Windows' => '', }; From cec5274ea3ecdcdb13add007b31d97808d565fd2 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 11 Jun 2025 22:42:26 +0800 Subject: [PATCH 187/204] Re-test --- .github/workflows/ext-matrix-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ext-matrix-tests.yml b/.github/workflows/ext-matrix-tests.yml index a43bfff2a..a8006e0ba 100644 --- a/.github/workflows/ext-matrix-tests.yml +++ b/.github/workflows/ext-matrix-tests.yml @@ -100,7 +100,9 @@ jobs: - name: "Download sources" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug --ignore-cache-sources=php-src + run: | + ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug --ignore-cache-sources=php-src + ./bin/spc download pkg-config --prefer-pre-built --debug - name: "Build library: ${{ matrix.library }}" run: | @@ -112,4 +114,4 @@ jobs: ./bin/spc install-pkg upx UPX=--with-upx-pack fi - ./bin/spc build --build-embed ${{ matrix.extension }} --debug $UPX --with-suggested-libs --with-suggested-exts --enable-zts + ./bin/spc build --build-embed ${{ matrix.extension }} --debug $UPX --enable-zts From 62a581393d3cfcad1230392befc643374b53bda8 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 21:54:59 +0700 Subject: [PATCH 188/204] compatibility with RHEL 10? --- src/SPC/builder/Extension.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index c11644ddb..1dbbdd302 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -363,6 +363,13 @@ public function buildUnixShared(): void 'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibString . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; + + FileSystem::replaceFileRegex( + $this->source_dir . '/config.m4', + '/(\$PKG_CONFIG\s+[^\s]+)\s+--libs/', + '$1 --static --libs' + ); + // prepare configure args shell()->cd($this->source_dir) ->setEnv($env) From 4be1e75128557783893eb8c8c0449def82b3e77a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 22:41:55 +0700 Subject: [PATCH 189/204] dirty as fuck, I don't understand why AMQP_SHARED_LIBADD is not available in ./configure --- src/SPC/builder/Extension.php | 48 ++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 1dbbdd302..c502b395c 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -359,15 +359,36 @@ public function buildUnixShared(): void $env = [ 'CFLAGS' => $config['cflags'], 'CXXFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'], - 'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibString . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString, + 'LDFLAGS' => $config['ldflags'] + . ' -Wl,--require-defined=SSL_CTX_use_RSAPrivateKey' + . ' -Wl,--undefined=SSL_connect' + . ' -Wl,--undefined=SSL_ctrl' + . ' -Wl,--undefined=SSL_CTX_ctrl' + . ' -Wl,--undefined=SSL_CTX_free' + . ' -Wl,--undefined=SSL_CTX_load_verify_locations' + . ' -Wl,--undefined=SSL_CTX_new' + . ' -Wl,--undefined=SSL_CTX_set_default_passwd_cb_userdata' + . ' -Wl,--undefined=SSL_CTX_set_default_verify_paths' + . ' -Wl,--undefined=SSL_CTX_use_certificate_chain_file' + . ' -Wl,--undefined=SSL_CTX_use_PrivateKey_file' + . ' -Wl,--undefined=SSL_CTX_use_RSAPrivateKey' + . ' -Wl,--undefined=SSL_free' + . ' -Wl,--undefined=SSL_get1_peer_certificate' + . ' -Wl,--undefined=SSL_get_error' + . ' -Wl,--undefined=SSL_get_verify_result' + . ' -Wl,--undefined=SSL_new' + . ' -Wl,--undefined=SSL_read' + . ' -Wl,--undefined=SSL_set_bio' + . ' -Wl,--undefined=SSL_shutdown' + . ' -Wl,--undefined=SSL_write', + 'LIBS' => '-Wl,-Bstatic -Wl,--start-group -Wl,--whole-archive ' . $staticLibString . ' -Wl,--no-whole-archive -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; FileSystem::replaceFileRegex( $this->source_dir . '/config.m4', - '/(\$PKG_CONFIG\s+[^\s]+)\s+--libs/', - '$1 --static --libs' + '/=(.\$PKG_CONFIG\s+(?:[^\s]+\s+)*?)--libs.*/', + '"' . $staticLibString . '"' ); // prepare configure args @@ -381,8 +402,21 @@ public function buildUnixShared(): void shell()->cd($this->source_dir) ->setEnv($env) - ->exec('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static') - ->exec('make clean') + ->exec( + './configure ' . $this->getUnixConfigureArg(true) . + ' --with-php-config=' . BUILD_BIN_PATH . '/php-config ' . + '--enable-shared --disable-static' + ); + + FileSystem::replaceFileRegex( + $this->source_dir . '/Makefile', + '/^(.*_SHARED_LIBADD\s*=.*)$/m', + '$1 ' . $staticLibString + ); + + shell()->cd($this->source_dir) + ->setEnv($env) + ->exec('make clean') ->exec('make -j' . $this->builder->concurrency) ->exec('make install'); } @@ -483,7 +517,7 @@ private function getStaticAndSharedLibs(): array $sharedLibString .= '-l' . $lib . ' '; } } - return [$staticLibString, $sharedLibString]; + return [trim($staticLibString), trim($sharedLibString)]; } private function getLibraryDependencies(bool $recursive = false): array From 0e092284eb4e1bc1ee6b999702d5d730256b6616 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 22:43:41 +0700 Subject: [PATCH 190/204] err --- src/SPC/builder/Extension.php | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index c502b395c..f280ca957 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -359,28 +359,7 @@ public function buildUnixShared(): void $env = [ 'CFLAGS' => $config['cflags'], 'CXXFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'] - . ' -Wl,--require-defined=SSL_CTX_use_RSAPrivateKey' - . ' -Wl,--undefined=SSL_connect' - . ' -Wl,--undefined=SSL_ctrl' - . ' -Wl,--undefined=SSL_CTX_ctrl' - . ' -Wl,--undefined=SSL_CTX_free' - . ' -Wl,--undefined=SSL_CTX_load_verify_locations' - . ' -Wl,--undefined=SSL_CTX_new' - . ' -Wl,--undefined=SSL_CTX_set_default_passwd_cb_userdata' - . ' -Wl,--undefined=SSL_CTX_set_default_verify_paths' - . ' -Wl,--undefined=SSL_CTX_use_certificate_chain_file' - . ' -Wl,--undefined=SSL_CTX_use_PrivateKey_file' - . ' -Wl,--undefined=SSL_CTX_use_RSAPrivateKey' - . ' -Wl,--undefined=SSL_free' - . ' -Wl,--undefined=SSL_get1_peer_certificate' - . ' -Wl,--undefined=SSL_get_error' - . ' -Wl,--undefined=SSL_get_verify_result' - . ' -Wl,--undefined=SSL_new' - . ' -Wl,--undefined=SSL_read' - . ' -Wl,--undefined=SSL_set_bio' - . ' -Wl,--undefined=SSL_shutdown' - . ' -Wl,--undefined=SSL_write', + 'LDFLAGS' => $config['ldflags'], 'LIBS' => '-Wl,-Bstatic -Wl,--start-group -Wl,--whole-archive ' . $staticLibString . ' -Wl,--no-whole-archive -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; From 78b3778442c6e67c561da22797b695d29fff9486 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 22:43:51 +0700 Subject: [PATCH 191/204] err --- src/SPC/builder/Extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index f280ca957..ad7f6b6c3 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -360,7 +360,7 @@ public function buildUnixShared(): void 'CFLAGS' => $config['cflags'], 'CXXFLAGS' => $config['cflags'], 'LDFLAGS' => $config['ldflags'], - 'LIBS' => '-Wl,-Bstatic -Wl,--start-group -Wl,--whole-archive ' . $staticLibString . ' -Wl,--no-whole-archive -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString, + 'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibString . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibString, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; From 9f35c954acd28c3917ef1126144935a8b62dde5c Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 22:45:08 +0700 Subject: [PATCH 192/204] cs fix --- src/SPC/builder/Extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index ad7f6b6c3..78a5a0394 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -395,7 +395,7 @@ public function buildUnixShared(): void shell()->cd($this->source_dir) ->setEnv($env) - ->exec('make clean') + ->exec('make clean') ->exec('make -j' . $this->builder->concurrency) ->exec('make install'); } From 84fb354bc0ef1f441ca67c21c181e96afd537e09 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 11 Jun 2025 22:46:22 +0700 Subject: [PATCH 193/204] this is not needed anymore --- src/SPC/builder/Extension.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 78a5a0394..6581414b2 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -364,12 +364,6 @@ public function buildUnixShared(): void 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, ]; - FileSystem::replaceFileRegex( - $this->source_dir . '/config.m4', - '/=(.\$PKG_CONFIG\s+(?:[^\s]+\s+)*?)--libs.*/', - '"' . $staticLibString . '"' - ); - // prepare configure args shell()->cd($this->source_dir) ->setEnv($env) From c0ea47ce759b05c0ac71833d4de4d7cdf7eb30f2 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 12 Jun 2025 00:41:33 +0800 Subject: [PATCH 194/204] I really got redundant test error --- src/SPC/builder/unix/UnixBuilderBase.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index d5d5ca29e..2aa7860ef 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -186,11 +186,7 @@ protected function sanityCheck(int $build_target): void } // sanity check for embed - if (($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED || - file_exists(BUILD_BIN_PATH . '/php-config') && - file_exists(BUILD_BIN_PATH . '/phpize') && - (file_exists(BUILD_LIB_PATH . '/libphp.a') || file_exists(BUILD_LIB_PATH . '/libphp.so')) - ) { + if (($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED) { logger()->info('running embed sanity check'); $sample_file_path = SOURCE_PATH . '/embed-test'; if (!is_dir($sample_file_path)) { From 2ea8a7e662e539124520797081157a7d26984251 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 12 Jun 2025 01:16:30 +0800 Subject: [PATCH 195/204] Fix macOS embed re-archive bug --- src/SPC/builder/macos/MacOSBuilder.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 1d4a29497..f83b07ad2 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -271,14 +271,7 @@ protected function buildEmbed(): void shell()->cd(SOURCE_PATH . '/php-src') ->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install") - // Workaround for https://github.com/php/php-src/issues/12082 - ->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o') - ->exec('mkdir ' . BUILD_ROOT_PATH . '/lib/php-o') - ->cd(BUILD_ROOT_PATH . '/lib/php-o') - ->exec('ar x ' . BUILD_ROOT_PATH . '/lib/libphp.a') - ->exec('rm ' . BUILD_ROOT_PATH . '/lib/libphp.a') - ->exec('ar rcs ' . BUILD_ROOT_PATH . '/lib/libphp.a *.o') - ->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o'); + ->exec('ar -t ' . BUILD_LIB_PATH . "/libphp.a | grep '\\.a$' | xargs -n1 ar d " . BUILD_LIB_PATH . '/libphp.a'); $this->patchPhpScripts(); } From e0734fe848ed756eb3c705bb268124cc19f21b01 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 12 Jun 2025 01:16:57 +0800 Subject: [PATCH 196/204] Add frameworks for extension --- config/ext.json | 4 ++++ src/SPC/builder/Extension.php | 5 +++++ src/SPC/builder/macos/MacOSBuilder.php | 4 ++++ src/SPC/util/SPCConfigUtil.php | 19 ++++++++++++++++++- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index ad42071d9..9f9d5c5fd 100644 --- a/config/ext.json +++ b/config/ext.json @@ -424,6 +424,10 @@ "openssl", "zstd", "zlib" + ], + "frameworks": [ + "CoreFoundation", + "Security" ] }, "msgpack": { diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 6581414b2..6ec68b6fd 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -53,6 +53,11 @@ public function __construct(protected string $name, protected BuilderBase $build } } + public function getFrameworks(): array + { + return Config::getExt($this->getName(), 'frameworks', []); + } + /** * 获取开启该扩展的 PHP 编译添加的参数 * diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index f83b07ad2..2205f4a02 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -67,6 +67,10 @@ public function getFrameworks(bool $asString = false): array|string array_push($frameworks, ...$lib->getFrameworks()); } + foreach ($this->exts as $ext) { + array_push($frameworks, ...$ext->getFrameworks()); + } + if ($asString) { return implode(' ', array_map(fn ($x) => "-framework {$x}", $frameworks)); } diff --git a/src/SPC/util/SPCConfigUtil.php b/src/SPC/util/SPCConfigUtil.php index 375d40cd9..8e69e89ce 100644 --- a/src/SPC/util/SPCConfigUtil.php +++ b/src/SPC/util/SPCConfigUtil.php @@ -55,10 +55,13 @@ public function config(array $extensions = [], array $libraries = [], bool $incl ob_get_clean(); $ldflags = $this->getLdflagsString(); $libs = $this->getLibsString($libraries, $with_dependencies); + if (PHP_OS_FAMILY === 'Darwin') { + $libs .= " {$this->getFrameworksString($extensions)}"; + } $cflags = $this->getIncludesString(); // embed - $libs = '-lphp -lc ' . $libs; + $libs = trim("-lphp -lc {$libs}"); $extra_env = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS'); if (is_string($extra_env)) { $libs .= ' ' . trim($extra_env, '"'); @@ -157,4 +160,18 @@ private function getShortLibName(string $lib): string // get short name return '-l' . substr($lib, 3, -2); } + + private function getFrameworksString(array $extensions): string + { + $list = []; + foreach ($extensions as $extension) { + foreach (Config::getExt($extension, 'frameworks', []) as $fw) { + $ks = '-framework ' . $fw; + if (!in_array($ks, $list)) { + $list[] = $ks; + } + } + } + return implode(' ', $list); + } } From 28e5e584b49d06573c63b003ec93bcd71630e197 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 12 Jun 2025 01:20:02 +0800 Subject: [PATCH 197/204] Revert ext-matrix-tests and test-extensions --- .github/workflows/ext-matrix-tests.yml | 113 ++++++++++++++++--------- src/globals/test-extensions.php | 12 +-- 2 files changed, 78 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ext-matrix-tests.yml b/.github/workflows/ext-matrix-tests.yml index a8006e0ba..da30d0086 100644 --- a/.github/workflows/ext-matrix-tests.yml +++ b/.github/workflows/ext-matrix-tests.yml @@ -15,48 +15,81 @@ jobs: fail-fast: false matrix: extension: - - dom,amqp - - dom,ast - - dom,brotli - - dom,dio - - dom,ds - - dom,ev - - dom,ffi - - dom,gettext - - dom,gmssl - - dom,igbinary - - dom,ldap - - dom,libxml - - dom,lz4 - - dom,memcache - - dom,mongodb - - dom,msgpack - - dom,odbc - - dom,opentelemetry - - dom,parallel - - dom,pdo_odbc - - dom,pdo_sqlsrv - - dom,rar - - dom,rdkafka - - dom,spx - - dom,sqlsrv - - dom,ssh2 - - dom,tidy - - dom,uuid - - dom,uv - - dom,xhprof - - dom,xlswriter - - dom,xz - - dom,yac - - dom,yaml - - dom,zstd + - amqp + - apcu + - bcmath + - bz2 + - calendar + - ctype + - curl + - dba + - dom + - ds + - event + - exif + - filter + - fileinfo + - ftp + - gd + - gettext + - gmp + - iconv + - igbinary + - imagick + - imap + - intl + - ldap + - mbstring,mbregex + - memcache + - mysqli,mysqlnd,pdo_mysql + - opcache + - openssl + - pcntl + - password-argon2 + - pcntl + - pdo + - pgsql,pdo_pgsql + - phar + - posix + - rar + - protobuf + - readline + - redis + - session + - shmop + - simdjson + - simplexml,xml + - snappy + - soap + - sockets + - sodium + - sqlite3,pdo_sqlite + - sqlsrv + - ssh2 + - swoole + - swoole,swoole-hook-pgsql,swoole-hook-mysql,swoole-hook-sqlite + - swow + - sysvmsg,sysvsem,sysvshm + - tidy + - tokenizer + - uuid + - uv + - xhprof + - xlswriter + - xmlwriter,xmlreader + - xsl + - yac + - yaml + - zip + - zlib + - zstd php-version: - "8.4" operating-system: - #- "ubuntu-latest" + - "ubuntu-latest" #- "macos-13" #- "debian-arm64-self-hosted" - - "macos-15" + - "macos-14" steps: - name: "Checkout" @@ -100,9 +133,7 @@ jobs: - name: "Download sources" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug --ignore-cache-sources=php-src - ./bin/spc download pkg-config --prefer-pre-built --debug + run: ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug --ignore-cache-sources=php-src - name: "Build library: ${{ matrix.library }}" run: | @@ -114,4 +145,4 @@ jobs: ./bin/spc install-pkg upx UPX=--with-upx-pack fi - ./bin/spc build --build-embed ${{ matrix.extension }} --debug $UPX --enable-zts + ./bin/spc build --build-cli --build-micro --build-fpm ${{ matrix.extension }} --debug $UPX --with-suggested-libs --with-suggested-exts diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 744028d39..cfde83f6c 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,14 +21,14 @@ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - // 'macos-13', + 'macos-13', // 'macos-14', 'macos-15', // 'ubuntu-latest', - // 'ubuntu-22.04', - // 'ubuntu-24.04', - // 'ubuntu-22.04-arm', - // 'ubuntu-24.04-arm', + 'ubuntu-22.04', + 'ubuntu-24.04', + 'ubuntu-22.04-arm', + 'ubuntu-24.04-arm', // 'windows-latest', ]; @@ -45,7 +45,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'dom', + 'Linux', 'Darwin' => 'dom,mongodb', 'Windows' => 'xlswriter,openssl', }; From e2efaab2b278c1556655225d6e5df2c0c263db36 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 12 Jun 2025 08:18:32 +0700 Subject: [PATCH 198/204] fix attempted ar deletions when building shared libphp --- src/SPC/builder/macos/MacOSBuilder.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 2205f4a02..c71dabceb 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -274,8 +274,12 @@ protected function buildEmbed(): void $vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars()); shell()->cd(SOURCE_PATH . '/php-src') - ->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install") - ->exec('ar -t ' . BUILD_LIB_PATH . "/libphp.a | grep '\\.a$' | xargs -n1 ar d " . BUILD_LIB_PATH . '/libphp.a'); + ->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install"); + + if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'static') { + shell()->cd(SOURCE_PATH . '/php-src') + ->exec('ar -t ' . BUILD_LIB_PATH . "/libphp.a | grep '\\.a$' | xargs -n1 ar d " . BUILD_LIB_PATH . '/libphp.a'); + } $this->patchPhpScripts(); } From bfba598ef4ec1b799a1cae8c34cc3626deb5d411 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 12 Jun 2025 10:58:58 +0800 Subject: [PATCH 199/204] Fix glfw source path --- src/SPC/builder/LibraryBase.php | 25 ++++--------------------- src/SPC/util/GlobalValueTrait.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 src/SPC/util/GlobalValueTrait.php diff --git a/src/SPC/builder/LibraryBase.php b/src/SPC/builder/LibraryBase.php index a8b311f6a..6780a6950 100644 --- a/src/SPC/builder/LibraryBase.php +++ b/src/SPC/builder/LibraryBase.php @@ -11,9 +11,12 @@ use SPC\store\Downloader; use SPC\store\FileSystem; use SPC\store\SourceManager; +use SPC\util\GlobalValueTrait; abstract class LibraryBase { + use GlobalValueTrait; + /** @var string */ public const NAME = 'unknown'; @@ -31,7 +34,7 @@ public function __construct(?string $source_dir = null) if (static::NAME === 'unknown') { throw new RuntimeException('no unknown!!!!!'); } - $this->source_dir = $source_dir ?? (SOURCE_PATH . '/' . static::NAME); + $this->source_dir = $source_dir ?? (SOURCE_PATH . '/' . Config::getLib(static::NAME, 'source')); } /** @@ -328,26 +331,6 @@ public function patchBeforeMake(): bool return false; } - public function getBinDir(): string - { - return BUILD_BIN_PATH; - } - - public function getIncludeDir(): string - { - return BUILD_INCLUDE_PATH; - } - - public function getBuildRootPath(): string - { - return BUILD_ROOT_PATH; - } - - public function getLibDir(): string - { - return BUILD_LIB_PATH; - } - /** * Build this library. * diff --git a/src/SPC/util/GlobalValueTrait.php b/src/SPC/util/GlobalValueTrait.php new file mode 100644 index 000000000..d815b1f09 --- /dev/null +++ b/src/SPC/util/GlobalValueTrait.php @@ -0,0 +1,28 @@ + Date: Thu, 12 Jun 2025 10:46:26 +0700 Subject: [PATCH 200/204] add fastlz, libmemcached for linux --- config/ext.json | 30 +++++++++++-------- config/lib.json | 13 +++++++- config/source.json | 17 ++++++++--- src/SPC/builder/extension/memcached.php | 9 ++++-- src/SPC/builder/extension/yac.php | 2 +- src/SPC/builder/linux/library/fastlz.php | 12 ++++++++ .../builder/linux/library/libmemcached.php | 9 ++---- src/SPC/builder/macos/library/fastlz.php | 12 ++++++++ .../builder/macos/library/libmemcached.php | 7 ++--- src/SPC/builder/unix/library/fastlz.php | 22 ++++++++++++++ 10 files changed, 101 insertions(+), 32 deletions(-) create mode 100644 src/SPC/builder/linux/library/fastlz.php create mode 100644 src/SPC/builder/macos/library/fastlz.php create mode 100644 src/SPC/builder/unix/library/fastlz.php diff --git a/config/ext.json b/config/ext.json index 9f9d5c5fd..f86306970 100644 --- a/config/ext.json +++ b/config/ext.json @@ -330,6 +330,16 @@ "openssl" ] }, + "libxml": { + "support": { + "BSD": "wip" + }, + "type": "builtin", + "arg-type": "none", + "target": [ + "static" + ] + }, "lz4": { "support": { "Windows": "wip", @@ -342,16 +352,6 @@ "liblz4" ] }, - "libxml": { - "support": { - "BSD": "wip" - }, - "type": "builtin", - "arg-type": "none", - "target": [ - "static" - ] - }, "mbregex": { "type": "builtin", "arg-type": "custom", @@ -396,8 +396,7 @@ "memcached": { "support": { "Windows": "wip", - "BSD": "wip", - "Linux": "no" + "BSD": "wip" }, "type": "external", "source": "memcached", @@ -406,6 +405,10 @@ "lib-depends": [ "libmemcached" ], + "lib-depends-unix": [ + "libmemcached", + "fastlz" + ], "ext-depends": [ "session", "zlib" @@ -1083,6 +1086,9 @@ "type": "external", "source": "yac", "arg-type-unix": "custom", + "lib-depends-unix": [ + "fastlz" + ], "ext-depends-unix": [ "igbinary" ] diff --git a/config/lib.json b/config/lib.json index 36d93a6ed..160d43f2f 100644 --- a/config/lib.json +++ b/config/lib.json @@ -101,6 +101,15 @@ "SystemConfiguration" ] }, + "fastlz": { + "source": "fastlz", + "static-libs-unix": [ + "libfastlz.a" + ], + "headers": [ + "fastlz/fastlz.h" + ] + }, "freetype": { "source": "freetype", "static-libs-unix": [ @@ -389,7 +398,9 @@ "source": "libmemcached", "static-libs-unix": [ "libmemcached.a", - "libmemcachedutil.a" + "libmemcachedprotocol.a", + "libmemcachedutil.a", + "libhashkit.a" ] }, "libpng": { diff --git a/config/source.json b/config/source.json index 98d37eb49..2ad8ec873 100644 --- a/config/source.json +++ b/config/source.json @@ -272,6 +272,15 @@ "path": "LICENSE" } }, + "fastlz": { + "type": "git", + "url": "https://github.com/ariya/FastLZ.git", + "rev": "master", + "license": { + "type": "file", + "path": "LICENSE.MIT" + } + }, "freetype": { "type": "git", "rev": "VER-2-13-2", @@ -528,12 +537,12 @@ } }, "libmemcached": { - "type": "git", - "url": "https://github.com/static-php/libmemcached-macos.git", - "rev": "master", + "type": "ghtagtar", + "repo": "awesomized/libmemcached", + "match": "1.\\d.\\d", "license": { "type": "file", - "path": "COPYING" + "path": "LICENSE" } }, "libpng": { diff --git a/src/SPC/builder/extension/memcached.php b/src/SPC/builder/extension/memcached.php index 8ea8b81e5..a1b88ac68 100644 --- a/src/SPC/builder/extension/memcached.php +++ b/src/SPC/builder/extension/memcached.php @@ -12,8 +12,11 @@ class memcached extends Extension { public function getUnixConfigureArg(bool $shared = false): string { - $rootdir = BUILD_ROOT_PATH; - $zlib_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : "--with-zlib-dir={$rootdir}"; - return '--enable-memcached' . ($shared ? '=shared' : '') . " {$zlib_dir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json"; + return '--enable-memcached' . ($shared ? '=shared' : '') . ' ' . + '--with-zlib-dir=' . BUILD_ROOT_PATH . ' ' . + '--with-libmemcached-dir=' . BUILD_ROOT_PATH . ' ' . + '--disable-memcached-sasl ' . + '--enable-memcached-json ' . + '--with-system-fastlz'; } } diff --git a/src/SPC/builder/extension/yac.php b/src/SPC/builder/extension/yac.php index bb085133e..07589b2eb 100644 --- a/src/SPC/builder/extension/yac.php +++ b/src/SPC/builder/extension/yac.php @@ -21,6 +21,6 @@ public function patchBeforeBuildconf(): bool public function getUnixConfigureArg(bool $shared = false): string { - return '--enable-yac --enable-igbinary --enable-json'; + return '--enable-yac ' . ($shared ? '=shared' : '') . ' --enable-igbinary --enable-json --with-system-fastlz'; } } diff --git a/src/SPC/builder/linux/library/fastlz.php b/src/SPC/builder/linux/library/fastlz.php new file mode 100644 index 000000000..07bee9bb2 --- /dev/null +++ b/src/SPC/builder/linux/library/fastlz.php @@ -0,0 +1,12 @@ +build(); } } diff --git a/src/SPC/builder/macos/library/fastlz.php b/src/SPC/builder/macos/library/fastlz.php new file mode 100644 index 000000000..db0f517a4 --- /dev/null +++ b/src/SPC/builder/macos/library/fastlz.php @@ -0,0 +1,12 @@ +configure('--disable-sasl')->exec("sed -ie 's/-Werror//g' ./Makefile")->make(); + UnixCMakeExecutor::create($this)->build(); } } diff --git a/src/SPC/builder/unix/library/fastlz.php b/src/SPC/builder/unix/library/fastlz.php new file mode 100644 index 000000000..5989893ce --- /dev/null +++ b/src/SPC/builder/unix/library/fastlz.php @@ -0,0 +1,22 @@ +cd($this->source_dir)->initializeEnv($this) + ->exec((getenv('CC') ?? 'cc') . ' -c -O3 -fPIC fastlz.c -o fastlz.o') + ->exec((getenv('AR') ?? 'ar') . ' rcs libfastlz.a fastlz.o'); + + if (!copy($this->source_dir . '/fastlz.h', BUILD_INCLUDE_PATH . '/fastlz.h')) { + throw new \RuntimeException('Failed to copy fastlz.h'); + } + if (!copy($this->source_dir . '/libfastlz.a', BUILD_LIB_PATH . '/libfastlz.a')) { + throw new \RuntimeException('Failed to copy libfastlz.a'); + } + } +} From fcfbb59637913e813cbfd5a61caa133fdbe3d689 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 12 Jun 2025 10:48:15 +0700 Subject: [PATCH 201/204] fix phpstan --- src/SPC/builder/unix/library/fastlz.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/fastlz.php b/src/SPC/builder/unix/library/fastlz.php index 5989893ce..db0b7f793 100644 --- a/src/SPC/builder/unix/library/fastlz.php +++ b/src/SPC/builder/unix/library/fastlz.php @@ -9,8 +9,8 @@ trait fastlz protected function build(): void { shell()->cd($this->source_dir)->initializeEnv($this) - ->exec((getenv('CC') ?? 'cc') . ' -c -O3 -fPIC fastlz.c -o fastlz.o') - ->exec((getenv('AR') ?? 'ar') . ' rcs libfastlz.a fastlz.o'); + ->exec((getenv('CC') ?: 'cc') . ' -c -O3 -fPIC fastlz.c -o fastlz.o') + ->exec((getenv('AR') ?: 'ar') . ' rcs libfastlz.a fastlz.o'); if (!copy($this->source_dir . '/fastlz.h', BUILD_INCLUDE_PATH . '/fastlz.h')) { throw new \RuntimeException('Failed to copy fastlz.h'); From 01ab0d35305d2c15142dc2e4470e08e6b4463b9f Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 12 Jun 2025 11:01:05 +0700 Subject: [PATCH 202/204] update default flags --- config/env.ini | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/env.ini b/config/env.ini index 5e2288aba..8b5d516d4 100644 --- a/config/env.ini +++ b/config/env.ini @@ -68,8 +68,8 @@ CXX=${SPC_LINUX_DEFAULT_CXX} AR=${SPC_LINUX_DEFAULT_AR} LD=ld.gold ; default compiler flags, used in CMake toolchain file, openssl and pkg-config build -SPC_DEFAULT_C_FLAGS="-fPIC" -SPC_DEFAULT_CXX_FLAGS= +SPC_DEFAULT_C_FLAGS="-fpic -Os" +SPC_DEFAULT_CXX_FLAGS="fpic -Os" ; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated) SPC_EXTRA_LIBS= ; upx executable path @@ -89,7 +89,7 @@ SPC_CMD_VAR_PHP_EMBED_TYPE="static" ; *** default build vars for building php *** ; CFLAGS for configuring php -SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS} -fPIE" +SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS} -fpie" ; CPPFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}" ; LDFLAGS for configuring php @@ -97,7 +97,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; LIBS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-ident -fPIE -fPIC" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -Os -fno-ident -fpic -fpie" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm" ; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so @@ -110,8 +110,8 @@ SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie" CC=clang CXX=clang++ ; default compiler flags, used in CMake toolchain file, openssl and pkg-config build -SPC_DEFAULT_C_FLAGS="--target=${MAC_ARCH}-apple-darwin" -SPC_DEFAULT_CXX_FLAGS="--target=${MAC_ARCH}-apple-darwin" +SPC_DEFAULT_C_FLAGS="--target=${MAC_ARCH}-apple-darwin -Os" +SPC_DEFAULT_CXX_FLAGS="--target=${MAC_ARCH}-apple-darwin -Os" ; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated) SPC_EXTRA_LIBS= ; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches @@ -133,7 +133,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}" ; LDFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-lresolv" ; embed type for php, static (libphp.a) or shared (libphp.dylib) From d9f7aa760e2fa67acca9198c20bb32baac244327 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 12 Jun 2025 11:40:32 +0700 Subject: [PATCH 203/204] update default env (shouldn't we pass -fpic to default c flags on macos?) --- config/env.ini | 8 ++++---- src/SPC/builder/unix/UnixBuilderBase.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/env.ini b/config/env.ini index 8b5d516d4..fddb5deb0 100644 --- a/config/env.ini +++ b/config/env.ini @@ -69,7 +69,7 @@ AR=${SPC_LINUX_DEFAULT_AR} LD=ld.gold ; default compiler flags, used in CMake toolchain file, openssl and pkg-config build SPC_DEFAULT_C_FLAGS="-fpic -Os" -SPC_DEFAULT_CXX_FLAGS="fpic -Os" +SPC_DEFAULT_CXX_FLAGS="-fpic -Os" ; extra libs for building php executable, used in `make` command for building php (this value may changed by extension build process, space separated) SPC_EXTRA_LIBS= ; upx executable path @@ -91,13 +91,13 @@ SPC_CMD_VAR_PHP_EMBED_TYPE="static" ; CFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS} -fpie" ; CPPFLAGS for configuring php -SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}" +SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="${SPC_DEFAULT_CXX_FLAGS} -I${BUILD_INCLUDE_PATH} -fpie" ; LDFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; LIBS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -Os -fno-ident -fpic -fpie" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fno-ident -fpie ${SPC_DEFAULT_C_FLAGS}" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm" ; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so @@ -133,7 +133,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}" ; LDFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie ${SPC_DEFAULT_C_FLAGS}" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-lresolv" ; embed type for php, static (libphp.a) or shared (libphp.dylib) diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index 2aa7860ef..0d367de19 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -151,7 +151,7 @@ public function proveLibs(array $sorted_libraries): void protected function sanityCheck(int $build_target): void { // sanity check for php-cli - if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI || file_exists(BUILD_BIN_PATH . '/php')) { + if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI) { logger()->info('running cli sanity check'); [$ret, $output] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -r "echo \"hello\";"'); $raw_output = implode('', $output); From 0ee9a0cfa457b525525f71644d87a81314d986fc Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Thu, 12 Jun 2025 11:45:47 +0700 Subject: [PATCH 204/204] oops, don't pass -fpic to CPPflags, I misread it as CXXflags --- config/env.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/env.ini b/config/env.ini index fddb5deb0..ba8652d5f 100644 --- a/config/env.ini +++ b/config/env.ini @@ -91,7 +91,7 @@ SPC_CMD_VAR_PHP_EMBED_TYPE="static" ; CFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS="${SPC_DEFAULT_C_FLAGS} -fpie" ; CPPFLAGS for configuring php -SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="${SPC_DEFAULT_CXX_FLAGS} -I${BUILD_INCLUDE_PATH} -fpie" +SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}" ; LDFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; LIBS for configuring php