From 1c307d0d594a0b3139446d0bcd5e1a28c805ddaa Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 13:30:12 +0800 Subject: [PATCH 01/24] upgrade libpq to v16.1 --- config/source.json | 2 +- src/SPC/builder/unix/library/postgresql.php | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/config/source.json b/config/source.json index 143e1874..fb29e410 100644 --- a/config/source.json +++ b/config/source.json @@ -386,7 +386,7 @@ }, "postgresql": { "type": "url", - "url": "https://ftp.postgresql.org/pub/source/v15.1/postgresql-15.1.tar.gz", + "url": "https://ftp.postgresql.org/pub/source/v16.1/postgresql-16.1.tar.gz", "license": { "type": "file", "path": "COPYRIGHT" diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 5769c106..b3630f57 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -57,9 +57,7 @@ trait postgresql # 有静态链接配置 参考文件: src/interfaces/libpq/Makefile shell()->cd($this->source_dir . '/build') - ->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile') - ->exec('sed -i.backup "293 s/^/#$/" ../src/Makefile.shlib') - ->exec('sed -i.backup "441 s/^/#$/" ../src/Makefile.shlib'); + ->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile'); // configure shell()->cd($this->source_dir . '/build') @@ -88,9 +86,7 @@ trait postgresql ->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/backend/port install') ->exec($envs . ' make -C src/port install') - ->exec($envs . ' make -C src/backend/libpq install') ->exec($envs . ' make -C src/interfaces/libpq install'); // remove dynamic libs From 41cd319d4e7147d0c07573d02fbcf529ee7b4837 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Wed, 29 Nov 2023 14:28:39 +0800 Subject: [PATCH 02/24] 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 fbdbf3bd..b1c96f55 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -3,6 +3,6 @@ declare(strict_types=1); # If you want to test new extensions here, just modify it. -$extensions = 'tidy,bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip'; +$extensions = 'apcu,bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,openssl,opcache,pcntl,pdo,pdo_mysql,pdo_sqlite,pdo_pgsql,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib,bz2,event,gmp,imagick,imap,ldap,protobuf,shmop,snappy,soap,swoole,sysvmsg,sysvsem,sysvshm,tidy,zstd'; echo $extensions; From c7b3275a72ec37302e22d9cc63c23d440814e899 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 15:06:17 +0800 Subject: [PATCH 03/24] update libpq build config --- src/SPC/builder/unix/library/postgresql.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index b3630f57..339664ae 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -57,7 +57,9 @@ trait postgresql # 有静态链接配置 参考文件: src/interfaces/libpq/Makefile shell()->cd($this->source_dir . '/build') - ->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile'); + ->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile') + ->exec('sed -i.backup "278 s/^/# /" ../src/Makefile.shlib') + ->exec('sed -i.backup "402 s/^/# /" ../src/Makefile.shlib'); // configure shell()->cd($this->source_dir . '/build') From 5db084ba0e3f63b0a005c0ced6005ee56dea5678 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Wed, 29 Nov 2023 15:17:21 +0800 Subject: [PATCH 04/24] reduce test extensions --- 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 b1c96f55..a06374df 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -3,6 +3,6 @@ declare(strict_types=1); # If you want to test new extensions here, just modify it. -$extensions = 'apcu,bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,openssl,opcache,pcntl,pdo,pdo_mysql,pdo_sqlite,pdo_pgsql,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib,bz2,event,gmp,imagick,imap,ldap,protobuf,shmop,snappy,soap,swoole,sysvmsg,sysvsem,sysvshm,tidy,zstd'; +$extensions = 'pgsql,openssl,posix,pcntl,phar,zip,pdo_pgsql'; echo $extensions; From ed22945ae2c786aa1758fc78bfa9bd4c085d0805 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 15:44:04 +0800 Subject: [PATCH 05/24] test --- src/SPC/builder/unix/library/postgresql.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 339664ae..b1187a5b 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -27,9 +27,13 @@ trait postgresql 'libxslt' => 'libxslt', 'icu' => 'icu-i18n', ]; + logger()->info(shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}")[1][0]); foreach ($optional_packages as $lib => $pkg) { if ($this->getBuilder()->getLib($lib)) { $packages .= ' ' . $pkg; + logger()->info(shell()->execWithResult("pkg-config --cflags-only-I --static {$pkg}")[1][0]); + logger()->info(shell()->execWithResult("pkg-config --libs-only-L --static {$pkg}")[1][0]); + logger()->info(shell()->execWithResult("pkg-config --libs-only-l --static {$pkg}")[1][0]); } } @@ -96,5 +100,7 @@ trait postgresql ->exec("rm -rf {$builddir}/lib/*.so.*") ->exec("rm -rf {$builddir}/lib/*.so") ->exec("rm -rf {$builddir}/lib/*.dylib"); + + logger()->info(shell()->execWithResult('pkg-config --cflags-only-I --static libpq')[1][0]); } } From 400007c206a5e085410b9dee9a0a0f141c7483fd Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 15:56:52 +0800 Subject: [PATCH 06/24] test change test-extensions --- 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 a06374df..075c1f8d 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -3,6 +3,6 @@ declare(strict_types=1); # If you want to test new extensions here, just modify it. -$extensions = 'pgsql,openssl,posix,pcntl,phar,zip,pdo_pgsql'; - +$extensions = +'apcu,bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,openssl,opcache,pcntl,pdo,pdo_mysql,pdo_sqlite,pdo_pgsql,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib,bz2,event,gmp,imagick,imap,ldap,protobuf,shmop,snappy,soap,swoole,sysvmsg,sysvsem,sysvshm,tidy,zstd'; echo $extensions; From 6b23c90bba480d8643f8a2a8bdb101be8bfd68af Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 16:52:53 +0800 Subject: [PATCH 07/24] test build libpq --- src/SPC/builder/unix/library/postgresql.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index b1187a5b..580cbe4e 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -27,13 +27,13 @@ trait postgresql 'libxslt' => 'libxslt', 'icu' => 'icu-i18n', ]; - logger()->info(shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}")[1][0]); + foreach ($optional_packages as $lib => $pkg) { if ($this->getBuilder()->getLib($lib)) { $packages .= ' ' . $pkg; - logger()->info(shell()->execWithResult("pkg-config --cflags-only-I --static {$pkg}")[1][0]); - logger()->info(shell()->execWithResult("pkg-config --libs-only-L --static {$pkg}")[1][0]); - logger()->info(shell()->execWithResult("pkg-config --libs-only-l --static {$pkg}")[1][0]); + logger()->debug(shell()->execWithResult("pkg-config --cflags-only-I --static {$pkg}")[1][0]); + logger()->debug(shell()->execWithResult("pkg-config --libs-only-L --static {$pkg}")[1][0]); + logger()->debug(shell()->execWithResult("pkg-config --libs-only-l --static {$pkg}")[1][0]); } } @@ -101,6 +101,8 @@ trait postgresql ->exec("rm -rf {$builddir}/lib/*.so") ->exec("rm -rf {$builddir}/lib/*.dylib"); - logger()->info(shell()->execWithResult('pkg-config --cflags-only-I --static libpq')[1][0]); + logger()->debug(shell()->execWithResult('pkg-config --cflags-only-I --static libpq')[1][0]); + logger()->debug(shell()->execWithResult('pkg-config --libs-only-L --static libpq')[1][0]); + logger()->debug(shell()->execWithResult('pkg-config --libs-only-l --static libpq')[1][0]); } } From 82e3a86f17ef1fc50c741a48cacc5daf7bb898c7 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 29 Nov 2023 20:31:53 +0800 Subject: [PATCH 08/24] bypass error: swoole curl hook is buggy for php 8.0 --- src/SPC/builder/extension/swoole.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/swoole.php b/src/SPC/builder/extension/swoole.php index a9c1199f..3dd570a1 100644 --- a/src/SPC/builder/extension/swoole.php +++ b/src/SPC/builder/extension/swoole.php @@ -17,7 +17,8 @@ class swoole extends Extension $arg .= ' --disable-swoole-pgsql'; $arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl'; $arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli'; - $arg .= $this->builder->getExt('curl') ? ' --enable-swoole-curl' : ' --disable-swoole-curl'; + // swoole curl hook is buggy for php 8.0 + $arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl'; return $arg; } } From 266108b25f1f4e26c9ca29485610f23389ea3a80 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 22:06:30 +0800 Subject: [PATCH 09/24] test libpq build config --- src/SPC/builder/unix/library/postgresql.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 580cbe4e..4c50f783 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -31,9 +31,11 @@ trait postgresql foreach ($optional_packages as $lib => $pkg) { if ($this->getBuilder()->getLib($lib)) { $packages .= ' ' . $pkg; - logger()->debug(shell()->execWithResult("pkg-config --cflags-only-I --static {$pkg}")[1][0]); - logger()->debug(shell()->execWithResult("pkg-config --libs-only-L --static {$pkg}")[1][0]); - logger()->debug(shell()->execWithResult("pkg-config --libs-only-l --static {$pkg}")[1][0]); + + $output = shell()->execWithResult("pkg-config --cflags --libs --static {$pkg}")[1][0]; + if (!empty($output[1][0])) { + logger()->info($output[1][0]); + } } } @@ -100,9 +102,5 @@ trait postgresql ->exec("rm -rf {$builddir}/lib/*.so.*") ->exec("rm -rf {$builddir}/lib/*.so") ->exec("rm -rf {$builddir}/lib/*.dylib"); - - logger()->debug(shell()->execWithResult('pkg-config --cflags-only-I --static libpq')[1][0]); - logger()->debug(shell()->execWithResult('pkg-config --libs-only-L --static libpq')[1][0]); - logger()->debug(shell()->execWithResult('pkg-config --libs-only-l --static libpq')[1][0]); } } From 7c866cb0e3f47ff7cc02d8afbffd6e9e242e13aa Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 22:19:20 +0800 Subject: [PATCH 10/24] swoole enable pgsql --- src/SPC/builder/extension/swoole.php | 19 +++++-- src/SPC/builder/linux/LinuxBuilder.php | 59 ++++++++++++++++----- src/SPC/builder/unix/library/postgresql.php | 1 - 3 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/SPC/builder/extension/swoole.php b/src/SPC/builder/extension/swoole.php index 3dd570a1..b98e74f8 100644 --- a/src/SPC/builder/extension/swoole.php +++ b/src/SPC/builder/extension/swoole.php @@ -13,12 +13,23 @@ class swoole extends Extension public function getUnixConfigureArg(): string { $arg = '--enable-swoole'; - // pgsql hook is buggy for static php - $arg .= ' --disable-swoole-pgsql'; + + $options = ''; + if ($this->builder->getLib('postgresql')) { + if (!$this->builder->getExt('pdo_pgsql')) { + $options .= '--enable-swoole-pgsql'; + } + } else { + $options .= '--disable-swoole-pgsql'; + } + $arg .= $options; $arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl'; - $arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli'; + $arg .= $this->builder->getLib( + 'brotli' + ) ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli'; // swoole curl hook is buggy for php 8.0 - $arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl'; + $arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID( + ) >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl'; return $arg; } } diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index da7f793d..758a561d 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -46,15 +46,23 @@ class LinuxBuilder extends BuilderBase f_putenv("CXX={$this->getOption('cxx', "{$arch}-linux-musl-g++")}"); f_putenv("AR={$this->getOption('ar', "{$arch}-linux-musl-ar")}"); f_putenv("LD={$this->getOption('ld', 'ld.gold')}"); - f_putenv("PATH=/usr/local/musl/bin:/usr/local/musl/{$arch}-linux-musl/bin:" . BUILD_ROOT_PATH . '/bin:' . getenv('PATH')); + f_putenv( + "PATH=/usr/local/musl/bin:/usr/local/musl/{$arch}-linux-musl/bin:" . BUILD_ROOT_PATH . '/bin:' . getenv( + 'PATH' + ) + ); // set library path, some libraries need it. (We cannot use `putenv` here, because cmake will be confused) $this->setOptionIfNotExist('library_path', "LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib"); $this->setOptionIfNotExist('ld_library_path', "LD_LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib"); // check musl-cross make installed if we use musl-cross-make - if (str_ends_with(getenv('CC'), 'linux-musl-gcc') && !file_exists("/usr/local/musl/bin/{$arch}-linux-musl-gcc")) { - throw new WrongUsageException('musl-cross-make not installed, please install it first. (You can use `doctor` command to install it)'); + if (str_ends_with(getenv('CC'), 'linux-musl-gcc') && !file_exists( + "/usr/local/musl/bin/{$arch}-linux-musl-gcc" + )) { + throw new WrongUsageException( + 'musl-cross-make not installed, please install it first. (You can use `doctor` command to install it)' + ); } } @@ -72,7 +80,10 @@ class LinuxBuilder extends BuilderBase // cflags $this->arch_c_flags = SystemUtil::getArchCFlags(getenv('CC'), $this->getOption('arch')); $this->arch_cxx_flags = SystemUtil::getArchCFlags(getenv('CXX'), $this->getOption('arch')); - $this->tune_c_flags = SystemUtil::checkCCFlags(SystemUtil::getTuneCFlags($this->getOption('arch')), getenv('CC')); + $this->tune_c_flags = SystemUtil::checkCCFlags( + SystemUtil::getTuneCFlags($this->getOption('arch')), + getenv('CC') + ); // cmake toolchain $this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile( 'Linux', @@ -133,7 +144,10 @@ class LinuxBuilder extends BuilderBase if (!$this->getOption('bloat', false)) { $extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', $this->getAllStaticLibFiles()); } else { - $extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", array_filter($this->getAllStaticLibFiles()))); + $extra_libs .= (empty($extra_libs) ? '' : ' ') . implode( + ' ', + array_map(fn ($x) => "-Xcompiler {$x}", array_filter($this->getAllStaticLibFiles())) + ); } // add libstdc++, some extensions or libraries need it $extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lstdc++ ' : ''); @@ -212,7 +226,11 @@ class LinuxBuilder extends BuilderBase if ($enableEmbed) { logger()->info('building embed'); if ($enableMicro) { - FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/Makefile', 'OVERALL_TARGET =', 'OVERALL_TARGET = libphp.la'); + FileSystem::replaceFileStr( + SOURCE_PATH . '/php-src/Makefile', + 'OVERALL_TARGET =', + 'OVERALL_TARGET = libphp.la' + ); } $this->buildEmbed(); } @@ -259,9 +277,11 @@ class LinuxBuilder extends BuilderBase SourcePatcher::patchMicro(['phar']); } - $vars = SystemUtil::makeEnvVarString($this->getBuildVars([ - 'EXTRA_CFLAGS' => $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '', - ])); + $vars = SystemUtil::makeEnvVarString( + $this->getBuildVars([ + 'EXTRA_CFLAGS' => $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '', + ]) + ); shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') ->exec("make -j{$this->concurrency} {$vars} micro"); @@ -322,10 +342,25 @@ class LinuxBuilder extends BuilderBase $cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : ''; $libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : ''; $ldflags = isset($input['EXTRA_LDFLAGS_PROGRAM']) && $input['EXTRA_LDFLAGS_PROGRAM'] ? " {$input['EXTRA_LDFLAGS_PROGRAM']}" : ''; - return [ - 'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE " . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags)) . $cflags, + + $export_variables = []; + if ($this->getLib('postgresql') && $this->getExt('swoole')) { + $output = shell()->execWithResult('pkg-config --cflags --static libpq'); + if (!empty($output[1][0])) { + $export_variables['LIBPQ_CFLAGS'] = $output[1][0]; + } + $output = shell()->execWithResult('pkg-config --libs --static libpq'); + if (!empty($output[1][0])) { + $export_variables['LIBPQ_LIBS'] = $output[1][0]; + } + } + return array_merge($export_variables, [ + 'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE " . implode( + ' ', + array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags) + ) . $cflags, 'EXTRA_LIBS' => $this->getOption('extra-libs', '') . $libs, 'EXTRA_LDFLAGS_PROGRAM' => "{$use_lld} -all-static" . $ldflags, - ]; + ]); } } diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 4c50f783..0e52224b 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -31,7 +31,6 @@ trait postgresql foreach ($optional_packages as $lib => $pkg) { if ($this->getBuilder()->getLib($lib)) { $packages .= ' ' . $pkg; - $output = shell()->execWithResult("pkg-config --cflags --libs --static {$pkg}")[1][0]; if (!empty($output[1][0])) { logger()->info($output[1][0]); From 7ee431725cc652d716ffa8e1d65cf70351dbdede Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 22:22:36 +0800 Subject: [PATCH 11/24] test swoole enable pgsql --- src/SPC/builder/extension/swoole.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SPC/builder/extension/swoole.php b/src/SPC/builder/extension/swoole.php index b98e74f8..eaa7e783 100644 --- a/src/SPC/builder/extension/swoole.php +++ b/src/SPC/builder/extension/swoole.php @@ -12,24 +12,24 @@ class swoole extends Extension { public function getUnixConfigureArg(): string { - $arg = '--enable-swoole'; + $arg = ' --enable-swoole '; $options = ''; if ($this->builder->getLib('postgresql')) { if (!$this->builder->getExt('pdo_pgsql')) { - $options .= '--enable-swoole-pgsql'; + $options .= ' --enable-swoole-pgsql '; } } else { - $options .= '--disable-swoole-pgsql'; + $options .= ' --disable-swoole-pgsql '; } $arg .= $options; - $arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl'; + $arg .= $this->builder->getLib('openssl') ? ' --enable-openssl ' : ' --disable-openssl --without-openssl '; $arg .= $this->builder->getLib( 'brotli' - ) ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli'; + ) ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli '; // swoole curl hook is buggy for php 8.0 $arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID( - ) >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl'; + ) >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl '; return $arg; } } From 930849758c74fb7e57c851bbf2eb133275cb91f4 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 22:28:20 +0800 Subject: [PATCH 12/24] swoole.php and LinuxBuilder.php revert --- src/SPC/builder/extension/swoole.php | 23 +++------- src/SPC/builder/linux/LinuxBuilder.php | 59 ++++++-------------------- 2 files changed, 18 insertions(+), 64 deletions(-) diff --git a/src/SPC/builder/extension/swoole.php b/src/SPC/builder/extension/swoole.php index eaa7e783..3dd570a1 100644 --- a/src/SPC/builder/extension/swoole.php +++ b/src/SPC/builder/extension/swoole.php @@ -12,24 +12,13 @@ class swoole extends Extension { public function getUnixConfigureArg(): string { - $arg = ' --enable-swoole '; - - $options = ''; - if ($this->builder->getLib('postgresql')) { - if (!$this->builder->getExt('pdo_pgsql')) { - $options .= ' --enable-swoole-pgsql '; - } - } else { - $options .= ' --disable-swoole-pgsql '; - } - $arg .= $options; - $arg .= $this->builder->getLib('openssl') ? ' --enable-openssl ' : ' --disable-openssl --without-openssl '; - $arg .= $this->builder->getLib( - 'brotli' - ) ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli '; + $arg = '--enable-swoole'; + // pgsql hook is buggy for static php + $arg .= ' --disable-swoole-pgsql'; + $arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl'; + $arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli'; // swoole curl hook is buggy for php 8.0 - $arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID( - ) >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl '; + $arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl'; return $arg; } } diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 758a561d..da7f793d 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -46,23 +46,15 @@ class LinuxBuilder extends BuilderBase f_putenv("CXX={$this->getOption('cxx', "{$arch}-linux-musl-g++")}"); f_putenv("AR={$this->getOption('ar', "{$arch}-linux-musl-ar")}"); f_putenv("LD={$this->getOption('ld', 'ld.gold')}"); - f_putenv( - "PATH=/usr/local/musl/bin:/usr/local/musl/{$arch}-linux-musl/bin:" . BUILD_ROOT_PATH . '/bin:' . getenv( - 'PATH' - ) - ); + f_putenv("PATH=/usr/local/musl/bin:/usr/local/musl/{$arch}-linux-musl/bin:" . BUILD_ROOT_PATH . '/bin:' . getenv('PATH')); // set library path, some libraries need it. (We cannot use `putenv` here, because cmake will be confused) $this->setOptionIfNotExist('library_path', "LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib"); $this->setOptionIfNotExist('ld_library_path', "LD_LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib"); // check musl-cross make installed if we use musl-cross-make - if (str_ends_with(getenv('CC'), 'linux-musl-gcc') && !file_exists( - "/usr/local/musl/bin/{$arch}-linux-musl-gcc" - )) { - throw new WrongUsageException( - 'musl-cross-make not installed, please install it first. (You can use `doctor` command to install it)' - ); + if (str_ends_with(getenv('CC'), 'linux-musl-gcc') && !file_exists("/usr/local/musl/bin/{$arch}-linux-musl-gcc")) { + throw new WrongUsageException('musl-cross-make not installed, please install it first. (You can use `doctor` command to install it)'); } } @@ -80,10 +72,7 @@ class LinuxBuilder extends BuilderBase // cflags $this->arch_c_flags = SystemUtil::getArchCFlags(getenv('CC'), $this->getOption('arch')); $this->arch_cxx_flags = SystemUtil::getArchCFlags(getenv('CXX'), $this->getOption('arch')); - $this->tune_c_flags = SystemUtil::checkCCFlags( - SystemUtil::getTuneCFlags($this->getOption('arch')), - getenv('CC') - ); + $this->tune_c_flags = SystemUtil::checkCCFlags(SystemUtil::getTuneCFlags($this->getOption('arch')), getenv('CC')); // cmake toolchain $this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile( 'Linux', @@ -144,10 +133,7 @@ class LinuxBuilder extends BuilderBase if (!$this->getOption('bloat', false)) { $extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', $this->getAllStaticLibFiles()); } else { - $extra_libs .= (empty($extra_libs) ? '' : ' ') . implode( - ' ', - array_map(fn ($x) => "-Xcompiler {$x}", array_filter($this->getAllStaticLibFiles())) - ); + $extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", array_filter($this->getAllStaticLibFiles()))); } // add libstdc++, some extensions or libraries need it $extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lstdc++ ' : ''); @@ -226,11 +212,7 @@ class LinuxBuilder extends BuilderBase if ($enableEmbed) { logger()->info('building embed'); if ($enableMicro) { - FileSystem::replaceFileStr( - SOURCE_PATH . '/php-src/Makefile', - 'OVERALL_TARGET =', - 'OVERALL_TARGET = libphp.la' - ); + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/Makefile', 'OVERALL_TARGET =', 'OVERALL_TARGET = libphp.la'); } $this->buildEmbed(); } @@ -277,11 +259,9 @@ class LinuxBuilder extends BuilderBase SourcePatcher::patchMicro(['phar']); } - $vars = SystemUtil::makeEnvVarString( - $this->getBuildVars([ - 'EXTRA_CFLAGS' => $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '', - ]) - ); + $vars = SystemUtil::makeEnvVarString($this->getBuildVars([ + 'EXTRA_CFLAGS' => $this->getOption('with-micro-fake-cli', false) ? ' -DPHP_MICRO_FAKE_CLI' : '', + ])); shell()->cd(SOURCE_PATH . '/php-src') ->exec('sed -i "s|//lib|/lib|g" Makefile') ->exec("make -j{$this->concurrency} {$vars} micro"); @@ -342,25 +322,10 @@ class LinuxBuilder extends BuilderBase $cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : ''; $libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : ''; $ldflags = isset($input['EXTRA_LDFLAGS_PROGRAM']) && $input['EXTRA_LDFLAGS_PROGRAM'] ? " {$input['EXTRA_LDFLAGS_PROGRAM']}" : ''; - - $export_variables = []; - if ($this->getLib('postgresql') && $this->getExt('swoole')) { - $output = shell()->execWithResult('pkg-config --cflags --static libpq'); - if (!empty($output[1][0])) { - $export_variables['LIBPQ_CFLAGS'] = $output[1][0]; - } - $output = shell()->execWithResult('pkg-config --libs --static libpq'); - if (!empty($output[1][0])) { - $export_variables['LIBPQ_LIBS'] = $output[1][0]; - } - } - return array_merge($export_variables, [ - 'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE " . implode( - ' ', - array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags) - ) . $cflags, + return [ + 'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE " . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags)) . $cflags, 'EXTRA_LIBS' => $this->getOption('extra-libs', '') . $libs, 'EXTRA_LDFLAGS_PROGRAM' => "{$use_lld} -all-static" . $ldflags, - ]); + ]; } } From b1958ea0c4a9e8ec1f9ca50b3f2e2216280b58f7 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 12:37:20 +0800 Subject: [PATCH 13/24] test libpq build --- src/SPC/builder/unix/library/postgresql.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 0e52224b..6b7478ef 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -28,13 +28,14 @@ trait postgresql 'icu' => 'icu-i18n', ]; + f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config'); + f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig'); + foreach ($optional_packages as $lib => $pkg) { if ($this->getBuilder()->getLib($lib)) { $packages .= ' ' . $pkg; - $output = shell()->execWithResult("pkg-config --cflags --libs --static {$pkg}")[1][0]; - if (!empty($output[1][0])) { - logger()->info($output[1][0]); - } + $output = shell()->execWithResult("pkg-config --static {$pkg}"); + logger()->info($output[1][0]); } } From b1bf8bb848c3bb2be1fd8418d9fe1a6bfd1148ff Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 12:53:19 +0800 Subject: [PATCH 14/24] test libpq build --- 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 6b7478ef..0eb46643 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -35,7 +35,7 @@ trait postgresql if ($this->getBuilder()->getLib($lib)) { $packages .= ' ' . $pkg; $output = shell()->execWithResult("pkg-config --static {$pkg}"); - logger()->info($output[1][0]); + logger()->info(var_export($output[1], true)); } } From e603e441e7248ddec80e157b16ce3e627e858a96 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 12:56:47 +0800 Subject: [PATCH 15/24] test libpq build --- src/SPC/builder/unix/library/postgresql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 0eb46643..03d8eb5f 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -23,7 +23,7 @@ trait postgresql $packages = 'openssl zlib readline libxml-2.0 zlib'; $optional_packages = [ 'zstd' => 'libzstd', - 'ldap' => 'ldap', + // 'ldap' => 'ldap', 'libxslt' => 'libxslt', 'icu' => 'icu-i18n', ]; @@ -78,7 +78,7 @@ trait postgresql '--with-readline ' . '--with-libxml ' . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . - ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . + ($this->builder->getLib('ldap') && 0 ? '--with-ldap ' : '--without-ldap ') . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . '--without-lz4 ' . From 3185d98b1a9ba383cf97b7e8b0e6f6656dd683ae Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 13:00:04 +0800 Subject: [PATCH 16/24] test libpq build --- 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 03d8eb5f..bd3530de 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -78,7 +78,7 @@ trait postgresql '--with-readline ' . '--with-libxml ' . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . - ($this->builder->getLib('ldap') && 0 ? '--with-ldap ' : '--without-ldap ') . + (($this->builder->getLib('ldap') && 0) ? '--with-ldap ' : '--without-ldap ') . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . '--without-lz4 ' . From 433c91b68d429afea805b73af71c337b9d3922f7 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 13:01:15 +0800 Subject: [PATCH 17/24] test libpq build --- src/SPC/builder/unix/library/postgresql.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index bd3530de..393c85a9 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -78,7 +78,7 @@ trait postgresql '--with-readline ' . '--with-libxml ' . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . - (($this->builder->getLib('ldap') && 0) ? '--with-ldap ' : '--without-ldap ') . + '--without-ldap ' . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . '--without-lz4 ' . @@ -88,6 +88,7 @@ trait postgresql '--without-bonjour ' . '--without-tcl ' ); + // ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . // build shell()->cd($this->source_dir . '/build') From d3e4470e1fc01b1b1b422e46df57bb49c3135a2d Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 13:06:36 +0800 Subject: [PATCH 18/24] test libpq build --- src/SPC/builder/unix/library/ldap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SPC/builder/unix/library/ldap.php b/src/SPC/builder/unix/library/ldap.php index 9b4080df..a557eb8e 100644 --- a/src/SPC/builder/unix/library/ldap.php +++ b/src/SPC/builder/unix/library/ldap.php @@ -15,6 +15,8 @@ trait ldap $alt .= $this->builder->getLib('gmp') ? '--with-mp=gmp ' : ''; // libsodium support $alt .= $this->builder->getLib('libsodium') ? '--with-argon2=libsodium ' : ''; + f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config'); + f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig'); shell()->cd($this->source_dir) ->exec( $this->builder->makeAutoconfFlags(AUTOCONF_LDFLAGS | AUTOCONF_CPPFLAGS) . From 98b7164de3ac393a0f4b553895e87bdc659be298 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 13:09:02 +0800 Subject: [PATCH 19/24] test libpq build --- config/lib.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/lib.json b/config/lib.json index 7abff12c..63ca1967 100644 --- a/config/lib.json +++ b/config/lib.json @@ -156,8 +156,10 @@ "liblber.a", "libldap.a" ], + "lib-depends": [ + "openssl" + ], "lib-suggests": [ - "openssl", "gmp", "libsodium" ] From 00689b951b03e64f9785802e09e660e95d46c20a Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 14:19:20 +0800 Subject: [PATCH 20/24] update ldap depends --- config/lib.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/lib.json b/config/lib.json index 63ca1967..318afe16 100644 --- a/config/lib.json +++ b/config/lib.json @@ -157,9 +157,8 @@ "libldap.a" ], "lib-depends": [ - "openssl" - ], - "lib-suggests": [ + "openssl", + "zlib", "gmp", "libsodium" ] From bba2d0dbf736b7a7462f05ca7ce73e085de93b55 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 30 Nov 2023 21:29:57 +0800 Subject: [PATCH 21/24] test remove imap ldap extension --- 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 b1c96f55..07fedb5f 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -3,6 +3,6 @@ declare(strict_types=1); # If you want to test new extensions here, just modify it. -$extensions = 'apcu,bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,openssl,opcache,pcntl,pdo,pdo_mysql,pdo_sqlite,pdo_pgsql,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib,bz2,event,gmp,imagick,imap,ldap,protobuf,shmop,snappy,soap,swoole,sysvmsg,sysvsem,sysvshm,tidy,zstd'; +$extensions = 'apcu,bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,openssl,opcache,pcntl,pdo,pdo_mysql,pdo_sqlite,pdo_pgsql,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib,bz2,event,gmp,imagick,protobuf,shmop,snappy,soap,swoole,sysvmsg,sysvsem,sysvshm,tidy,zstd'; echo $extensions; From 0cfac49560734c4f6e92fa3ee89b9c808c011cef Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 15 Dec 2023 00:34:22 +0800 Subject: [PATCH 22/24] adjust package order --- 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 393c85a9..2448f656 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -20,7 +20,7 @@ trait postgresql { $builddir = BUILD_ROOT_PATH; $envs = ''; - $packages = 'openssl zlib readline libxml-2.0 zlib'; + $packages = 'zlib openssl readline libxml-2.0'; $optional_packages = [ 'zstd' => 'libzstd', // 'ldap' => 'ldap', From d8ce5f69f41b2357c92a6a5a7e36548372ca4ad1 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 15 Dec 2023 01:31:01 +0800 Subject: [PATCH 23/24] fix mongodb support for Linux (mac still broken) --- src/SPC/builder/BuilderBase.php | 13 +++++++++++++ src/SPC/builder/extension/mongodb.php | 9 +++++++++ src/globals/test-extensions.php | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/BuilderBase.php b/src/SPC/builder/BuilderBase.php index d214b859..72db5961 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -259,6 +259,19 @@ abstract class BuilderBase throw new RuntimeException('PHP version file format is malformed, please remove it and download again'); } + public function getPHPVersion(): string + { + if (!file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { + throw new WrongUsageException('PHP source files are not available, you need to download them first'); + } + $file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h'); + if (preg_match('/PHP_VERSION "(.*)"/', $file, $match) !== 0) { + return $match[1]; + } + + throw new RuntimeException('PHP version file format is malformed, please remove it and download again'); + } + /** * Get build type name string to display. * diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 2096de05..e6f12d54 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -5,11 +5,20 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\store\FileSystem; use SPC\util\CustomExt; #[CustomExt('mongodb')] class mongodb extends Extension { + public function patchBeforeBuildconf(): bool + { + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'if test -z "$PHP_CONFIG"; then', 'if false; then'); + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`', 'PHP_MONGODB_PHP_VERSION=' . $this->builder->getPHPVersion()); + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/mongodb/config.m4', 'PHP_MONGODB_PHP_VERSION_ID=`${PHP_CONFIG} --vernum`', 'PHP_MONGODB_PHP_VERSION_ID=' . $this->builder->getPHPVersionID()); + return true; + } + public function getUnixConfigureArg(): string { $arg = ' --enable-mongodb '; diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 07fedb5f..a80c9a78 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -3,6 +3,6 @@ declare(strict_types=1); # If you want to test new extensions here, just modify it. -$extensions = 'apcu,bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,openssl,opcache,pcntl,pdo,pdo_mysql,pdo_sqlite,pdo_pgsql,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib,bz2,event,gmp,imagick,protobuf,shmop,snappy,soap,swoole,sysvmsg,sysvsem,sysvshm,tidy,zstd'; +$extensions = 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,intl,ldap,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib'; echo $extensions; From 9266a4c504701de4a13e70fefe2e4753f8f65d0f Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 15 Dec 2023 23:36:12 +0800 Subject: [PATCH 24/24] remove ldap 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 a80c9a78..73b57056 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -3,6 +3,6 @@ declare(strict_types=1); # If you want to test new extensions here, just modify it. -$extensions = 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,intl,ldap,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib'; +$extensions = 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib'; echo $extensions;