From 07f943af7ebc9e2102b920df4f454d1383b085a9 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 5 Nov 2023 18:31:14 +0800 Subject: [PATCH 01/80] add dev:extensions command custom column display --- src/SPC/command/dev/AllExtCommand.php | 45 ++++++++++++++++++++------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/SPC/command/dev/AllExtCommand.php b/src/SPC/command/dev/AllExtCommand.php index 196de39f..399156c2 100644 --- a/src/SPC/command/dev/AllExtCommand.php +++ b/src/SPC/command/dev/AllExtCommand.php @@ -12,6 +12,7 @@ use SPC\store\Config; use SPC\util\DependencyUtil; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Style\SymfonyStyle; use function Laravel\Prompts\table; @@ -22,6 +23,13 @@ class AllExtCommand extends BaseCommand public function configure(): void { $this->addArgument('extensions', InputArgument::OPTIONAL, 'List of extensions that will be displayed, comma separated'); + $this->addOption( + 'columns', + null, + InputOption::VALUE_REQUIRED, + 'List of columns that will be displayed, comma separated (lib-depends, lib-suggests, ext-depends, ext-suggests, unix-only)', + 'lib-depends,lib-suggests,ext-depends,ext-suggests,unix-only' + ); } /** @@ -32,6 +40,16 @@ class AllExtCommand extends BaseCommand public function handle(): int { $extensions = array_map('trim', array_filter(explode(',', $this->getArgument('extensions') ?? ''))); + $columns = array_map('trim', array_filter(explode(',', $this->getOption('columns')))); + + foreach ($columns as $column) { + if (!in_array($column, ['lib-depends', 'lib-suggests', 'ext-depends', 'ext-suggests', 'unix-only', 'type'])) { + $this->output->writeln('Column name [' . $column . '] is not valid.'); + $this->output->writeln('Available column name: lib-depends, lib-suggests, ext-depends, ext-suggests, unix-only, type'); + return static::FAILURE; + } + } + array_unshift($columns, 'name'); $style = new SymfonyStyle($this->input, $this->output); $style->writeln($extensions ? 'Available extensions:' : 'Extensions:'); @@ -51,23 +69,26 @@ class AllExtCommand extends BaseCommand $lib_suggests = Config::getExt($extension, 'lib-suggests', []); $ext_suggests = Config::getExt($extension, 'ext-suggests', []); - $data[] = [ - $extension, - implode(', ', $libraries), - implode(', ', $lib_suggests), - implode(',', $not_included), - implode(', ', $ext_suggests), - Config::getExt($extension, 'unix-only', false) ? 'true' : 'false', - ]; + $row = []; + foreach ($columns as $column) { + $row[] = match ($column) { + 'name' => $extension, + 'type' => Config::getExt($extension, 'type'), + 'lib-depends' => implode(', ', $libraries), + 'lib-suggests' => implode(', ', $lib_suggests), + 'ext-depends' => implode(',', $not_included), + 'ext-suggests' => implode(', ', $ext_suggests), + 'unix-only' => Config::getExt($extension, 'unix-only', false) ? 'true' : 'false', + default => '', + }; + } + $data[] = $row; } if ($data === []) { $style->warning('Unknown extension selected: ' . implode(',', $extensions)); } else { - table( - ['Extension', 'lib-depends', 'lib-suggests', 'ext-depends', 'ext-suggests', 'unix-only'], - $data - ); + table($columns, $data); } return static::SUCCESS; From 7c4a991c0e59cb1fdc5283bf6d94dd30e7850828 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 31 Oct 2023 13:09:01 +0100 Subject: [PATCH 02/80] add imap support --- config/ext.json | 8 ++- config/lib.json | 9 +++ config/source.json | 9 +++ src/SPC/builder/extension/imap.php | 28 ++++++++ src/SPC/builder/linux/library/imap.php | 68 +++++++++++++++++++ src/SPC/builder/unix/library/postgresql.php | 3 +- .../patch/1006_openssl1.1_autoverify.patch | 58 ++++++++++++++++ src/globals/patch/2014_openssl1.1.1_sni.patch | 42 ++++++++++++ 8 files changed, 220 insertions(+), 5 deletions(-) create mode 100644 src/SPC/builder/extension/imap.php create mode 100644 src/SPC/builder/linux/library/imap.php create mode 100644 src/globals/patch/1006_openssl1.1_autoverify.patch create mode 100644 src/globals/patch/2014_openssl1.1.1_sni.patch diff --git a/config/ext.json b/config/ext.json index 778afe0e..e3081154 100644 --- a/config/ext.json +++ b/config/ext.json @@ -132,12 +132,13 @@ }, "imap": { "type": "builtin", - "arg-type": "with", + "arg-type": "custom", "lib-depends": [ "imap" ], "lib-suggests": [ - "kerberos" + "kerberos", + "openssl" ] }, "inotify": { @@ -234,7 +235,8 @@ "type": "builtin", "arg-type": "custom", "lib-depends": [ - "openssl" + "openssl", + "zlib" ], "ext-depends": [ "zlib" diff --git a/config/lib.json b/config/lib.json index 6a602d16..5e6189e6 100644 --- a/config/lib.json +++ b/config/lib.json @@ -141,6 +141,15 @@ "libxml2" ] }, + "imap": { + "source": "imap", + "static-libs-unix": [ + "libc-client.a" + ], + "lib-suggests": [ + "openssl" + ] + }, "ldap": { "source": "ldap", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index cd849f86..7e1de028 100644 --- a/config/source.json +++ b/config/source.json @@ -144,6 +144,15 @@ "path": "LICENSE" } }, + "imap": { + "type": "git", + "url": "https://github.com/uw-imap/imap.git", + "rev": "master", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "inotify": { "type": "url", "url": "https://pecl.php.net/get/inotify", diff --git a/src/SPC/builder/extension/imap.php b/src/SPC/builder/extension/imap.php new file mode 100644 index 00000000..389223ec --- /dev/null +++ b/src/SPC/builder/extension/imap.php @@ -0,0 +1,28 @@ +builder->getOption('enable-zts')) { + throw new WrongUsageException('ext-imap is not thread safe, do not build it with ZTS builds'); + } + $arg = '--with-imap=' . BUILD_ROOT_PATH; + if ($this->builder->getLib('openssl') !== null) { + $arg .= ' --with-imap-ssl=' . BUILD_ROOT_PATH; + } + return $arg; + } +} diff --git a/src/SPC/builder/linux/library/imap.php b/src/SPC/builder/linux/library/imap.php new file mode 100644 index 00000000..594a75bd --- /dev/null +++ b/src/SPC/builder/linux/library/imap.php @@ -0,0 +1,68 @@ +source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', ''); + FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}"); + FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto'); + FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz'); + FileSystem::replaceFileStr( + $this->source_dir . '/src/osdep/unix/ssl_unix.c', + "#include \n#include ", + "#include \n#include " + ); + SourcePatcher::patchFile('1007_openssl1.1_autoverify.patch', $this->source_dir); + SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); + FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH); + FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH); + return true; + } + + /** + * @throws FileSystemException + * @throws RuntimeException + * @throws WrongUsageException + */ + protected function build(): void + { + if ($this->builder->getLib('openssl')) { + $ssl_options = 'SPECIALAUTHENTICATORS=ssl SSLTYPE=unix.nopwd SSLINCLUDE=' . BUILD_INCLUDE_PATH . ' SSLLIB=' . BUILD_LIB_PATH; + } else { + $ssl_options = 'SSLTYPE=none'; + } + shell()->cd($this->source_dir) + ->exec('make clean') + ->exec('touch ip6') + ->exec( + "yes | make slx {$ssl_options}" + ); + try { + shell() + ->exec("cp -rf {$this->source_dir}/c-client/c-client.a " . BUILD_LIB_PATH . '/libc-client.a') + ->exec("cp -rf {$this->source_dir}/c-client/*.c " . BUILD_LIB_PATH . '/') + ->exec("cp -rf {$this->source_dir}/c-client/*.h " . BUILD_INCLUDE_PATH . '/') + ->exec("cp -rf {$this->source_dir}/src/osdep/unix/*.h " . BUILD_INCLUDE_PATH . '/'); + } catch (\Throwable) { + // last command throws an exception, no idea why since it works + } + } +} diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 38be1bf2..5769c106 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -24,7 +24,6 @@ trait postgresql $optional_packages = [ 'zstd' => 'libzstd', 'ldap' => 'ldap', - 'libpam' => 'libpam', 'libxslt' => 'libxslt', 'icu' => 'icu-i18n', ]; @@ -74,12 +73,12 @@ trait postgresql '--with-libxml ' . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . - ($this->builder->getLib('libpam') ? '--with-pam ' : '--without-pam ') . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . '--without-lz4 ' . '--without-perl ' . '--without-python ' . + '--without-pam ' . '--without-bonjour ' . '--without-tcl ' ); diff --git a/src/globals/patch/1006_openssl1.1_autoverify.patch b/src/globals/patch/1006_openssl1.1_autoverify.patch new file mode 100644 index 00000000..f8629f2f --- /dev/null +++ b/src/globals/patch/1006_openssl1.1_autoverify.patch @@ -0,0 +1,58 @@ +Description: Support OpenSSL 1.1 + When building with OpenSSL 1.1 and newer, use the new built-in + hostname verification instead of code that doesn't compile due to + structs having been made opaque. +Bug-Debian: https://bugs.debian.org/828589 + +--- a/src/osdep/unix/ssl_unix.c ++++ b/src/osdep/unix/ssl_unix.c +@@ -227,8 +227,16 @@ static char *ssl_start_work (SSLSTREAM * + /* disable certificate validation? */ + if (flags & NET_NOVALIDATECERT) + SSL_CTX_set_verify (stream->context,SSL_VERIFY_NONE,NIL); +- else SSL_CTX_set_verify (stream->context,SSL_VERIFY_PEER,ssl_open_verify); ++ else { ++#if OPENSSL_VERSION_NUMBER >= 0x10100000 ++ X509_VERIFY_PARAM *param = SSL_CTX_get0_param(stream->context); ++ X509_VERIFY_PARAM_set_hostflags(param, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS); ++ X509_VERIFY_PARAM_set1_host(param, host, 0); ++#endif ++ ++ SSL_CTX_set_verify (stream->context,SSL_VERIFY_PEER,ssl_open_verify); + /* set default paths to CAs... */ ++ } + SSL_CTX_set_default_verify_paths (stream->context); + /* ...unless a non-standard path desired */ + if (s = (char *) mail_parameters (NIL,GET_SSLCAPATH,NIL)) +@@ -266,6 +274,7 @@ static char *ssl_start_work (SSLSTREAM * + if (SSL_write (stream->con,"",0) < 0) + return ssl_last_error ? ssl_last_error : "SSL negotiation failed"; + /* need to validate host names? */ ++#if OPENSSL_VERSION_NUMBER < 0x10100000 + if (!(flags & NET_NOVALIDATECERT) && + (err = ssl_validate_cert (cert = SSL_get_peer_certificate (stream->con), + host))) { +@@ -275,6 +284,7 @@ static char *ssl_start_work (SSLSTREAM * + sprintf (tmp,"*%.128s: %.255s",err,cert ? cert->name : "???"); + return ssl_last_error = cpystr (tmp); + } ++#endif + return NIL; + } + +@@ -313,6 +323,7 @@ static int ssl_open_verify (int ok,X509_ + * Returns: NIL if validated, else string of error message + */ + ++#if OPENSSL_VERSION_NUMBER < 0x10100000 + static char *ssl_validate_cert (X509 *cert,char *host) + { + int i,n; +@@ -342,6 +353,7 @@ static char *ssl_validate_cert (X509 *ce + else ret = "Unable to locate common name in certificate"; + return ret; + } ++#endif + + /* Case-independent wildcard pattern match + * Accepts: base string diff --git a/src/globals/patch/2014_openssl1.1.1_sni.patch b/src/globals/patch/2014_openssl1.1.1_sni.patch new file mode 100644 index 00000000..256d7d6d --- /dev/null +++ b/src/globals/patch/2014_openssl1.1.1_sni.patch @@ -0,0 +1,42 @@ +Bug-Debian: https://bugs.debian.org/916041 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1834340 +Description: + Google IMAP servers require SNI if TLSv1.3 is used, + otherwise it sends a self-signed certificate which + fails validation. + + OpenSSL support/versions: + - TLSv1.3 on 1.1.1, + - a2i_IPADDRESS() on 0.9.8'ish, + - SSL_set_tlsext_host_name() on 0.9.8'ish/1.0.0; + per 'git blame/describe' and the CHANGES file. + + So check for TLSv1.3 support / OpenSSL 1.1.1 + not to incur behavior changes on pre-TLSv1.3, + and set host_name to 'host' (ssl_open_verify() + validates this, via 'ssl_last_host' variable) + + This patch just combines these two patches: + - BTS#916041 (message #5) by Ed Spiridonov, + - LP#1834340 (comment #6) by David Zuelke. +Author: Mauricio Faria de Oliveira + +Index: uw-imap-2007f~dfsg/src/osdep/unix/ssl_unix.c +=================================================================== +--- uw-imap-2007f~dfsg.orig/src/osdep/unix/ssl_unix.c ++++ uw-imap-2007f~dfsg/src/osdep/unix/ssl_unix.c +@@ -266,6 +266,14 @@ static char *ssl_start_work (SSLSTREAM * + /* create connection */ + if (!(stream->con = (SSL *) SSL_new (stream->context))) + return "SSL connection failed"; ++#if OPENSSL_VERSION_NUMBER >= 0x10101000 ++ /* Use SNI in case server requires it with TLSv1.3. ++ * Literal IP addresses not permitted per RFC 6066. */ ++ if (!a2i_IPADDRESS(host)) { ++ ERR_clear_error(); ++ SSL_set_tlsext_host_name(stream->con,host); ++ } ++#endif + bio = BIO_new_socket (stream->tcpstream->tcpsi,BIO_NOCLOSE); + SSL_set_bio (stream->con,bio,bio); + SSL_set_connect_state (stream->con); From 31cf9bb5b7d3f5c2d988eff5cdb7147517a14544 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 31 Oct 2023 14:56:43 +0100 Subject: [PATCH 03/80] fix redhat os detection --- src/SPC/doctor/item/LinuxToolCheckList.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index ee9394f3..40d17956 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -36,7 +36,7 @@ class LinuxToolCheckList 'git', 'autoconf', 'automake', 'tar', 'unzip', 'gzip', 'gcc', 'bzip2', 'cmake', 'patch', - 'xz', 'wget', // to get musl + 'xz', ]; /** @noinspection PhpUnused */ @@ -47,8 +47,7 @@ class LinuxToolCheckList $required = match ($distro['dist']) { 'alpine' => self::TOOLS_ALPINE, - 'almalinux' => self::TOOLS_RHEL, - 'rhel' => self::TOOLS_RHEL, + 'redhat' => self::TOOLS_RHEL, default => self::TOOLS_DEBIAN, }; $missing = []; @@ -61,8 +60,7 @@ class LinuxToolCheckList return match ($distro['dist']) { 'ubuntu', 'alpine', - 'rhel', - 'almalinux', + 'redhat', 'debian' => CheckResult::fail(implode(', ', $missing) . ' not installed on your system', 'install-linux-tools', [$distro, $missing]), default => CheckResult::fail(implode(', ', $missing) . ' not installed on your system'), }; @@ -74,11 +72,10 @@ class LinuxToolCheckList #[AsCheckItem('if necessary packages are installed', limit_os: 'Linux')] public function checkSystemOSPackages(): ?CheckResult { - $distro = SystemUtil::getOSRelease(); - if ($distro['dist'] === 'alpine') { + if (SystemUtil::isMuslDist()) { // check linux-headers installation if (!file_exists('/usr/include/linux/mman.h')) { - return CheckResult::fail('linux-headers not installed on your system', 'install-linux-tools', [$distro, ['linux-headers']]); + return CheckResult::fail('linux-headers not installed on your system', 'install-linux-tools', [SystemUtil::getOSRelease(), ['linux-headers']]); } } return CheckResult::ok(); @@ -94,8 +91,7 @@ class LinuxToolCheckList $install_cmd = match ($distro['dist']) { 'ubuntu', 'debian' => 'apt-get install -y', 'alpine' => 'apk add', - 'rhel' => 'dnf install -y', - 'almalinux' => 'dnf install -y', + 'redhat' => 'dnf install -y', default => throw new RuntimeException('Current linux distro does not have an auto-install script for musl packages yet.'), }; $prefix = ''; @@ -104,8 +100,8 @@ class LinuxToolCheckList logger()->warning('Current user is not root, using sudo for running command'); } try { - $is_rhel = in_array($distro['dist'], ['rhel', 'almalinux']); - $to_install = $is_rhel ? $missing : str_replace('xz', 'xz-utils', $missing); + $is_debian = in_array($distro['dist'], ['debian', 'ubuntu']); + $to_install = $is_debian ? str_replace('xz', 'xz-utils', $missing) : $missing; shell(true)->exec($prefix . $install_cmd . ' ' . implode(' ', $to_install)); } catch (RuntimeException) { return false; From 3d64c6349e087055ab1fb843dde353b36b7b030f Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 12 Nov 2023 16:59:16 +0800 Subject: [PATCH 04/80] remove kerberos temporarily --for-extensions is not working with it --- config/ext.json | 1 - 1 file changed, 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index e3081154..cb313ff5 100644 --- a/config/ext.json +++ b/config/ext.json @@ -137,7 +137,6 @@ "imap" ], "lib-suggests": [ - "kerberos", "openssl" ] }, From 65ef9ab20c70e5a09f50e0aa3347b4b843a1810a Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 12 Nov 2023 17:00:27 +0800 Subject: [PATCH 05/80] use WrongUsageException for not supported libs --- 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 6e46886f..d214b859 100644 --- a/src/SPC/builder/BuilderBase.php +++ b/src/SPC/builder/BuilderBase.php @@ -69,7 +69,7 @@ abstract class BuilderBase foreach ($libraries as $library) { // if some libs are not supported (but in config "lib.json", throw exception) if (!isset($support_lib_list[$library])) { - throw new RuntimeException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!'); + throw new WrongUsageException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!'); } $lib = new ($support_lib_list[$library])($this); $this->addLib($lib); From 347da67b714728f4f128d3c52a796373b867b0ab Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 13 Nov 2023 00:09:52 +0800 Subject: [PATCH 06/80] use static-php/imap --- config/source.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/source.json b/config/source.json index 7e1de028..a94236c3 100644 --- a/config/source.json +++ b/config/source.json @@ -146,7 +146,7 @@ }, "imap": { "type": "git", - "url": "https://github.com/uw-imap/imap.git", + "url": "https://github.com/static-php/imap.git", "rev": "master", "license": { "type": "file", From 5fdeb330313713bfe97eebd09c99f2b1f7b3f672 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 13 Nov 2023 00:10:23 +0800 Subject: [PATCH 07/80] separate linux and macos patches --- src/SPC/builder/linux/library/imap.php | 12 ++--- src/SPC/builder/macos/library/imap.php | 66 ++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 src/SPC/builder/macos/library/imap.php diff --git a/src/SPC/builder/linux/library/imap.php b/src/SPC/builder/linux/library/imap.php index 594a75bd..6a36c4ad 100644 --- a/src/SPC/builder/linux/library/imap.php +++ b/src/SPC/builder/linux/library/imap.php @@ -6,7 +6,6 @@ namespace SPC\builder\linux\library; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; -use SPC\exception\WrongUsageException; use SPC\store\FileSystem; use SPC\store\SourcePatcher; @@ -16,31 +15,28 @@ class imap extends LinuxLibraryBase /** * @throws FileSystemException - * @throws RuntimeException */ public function patchBeforeBuild(): bool { $cc = getenv('CC') ?: 'gcc'; - FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', ''); + // FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', ''); FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}"); - FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto'); + /* FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto'); FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz'); FileSystem::replaceFileStr( $this->source_dir . '/src/osdep/unix/ssl_unix.c', "#include \n#include ", "#include \n#include " ); - SourcePatcher::patchFile('1007_openssl1.1_autoverify.patch', $this->source_dir); - SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); + // SourcePatcher::patchFile('1006_openssl1.1_autoverify.patch', $this->source_dir); + SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); */ FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH); FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH); return true; } /** - * @throws FileSystemException * @throws RuntimeException - * @throws WrongUsageException */ protected function build(): void { diff --git a/src/SPC/builder/macos/library/imap.php b/src/SPC/builder/macos/library/imap.php new file mode 100644 index 00000000..ab489ee6 --- /dev/null +++ b/src/SPC/builder/macos/library/imap.php @@ -0,0 +1,66 @@ +source_dir); + // FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', ''); + FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}"); + /* FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto'); + FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz'); + FileSystem::replaceFileStr( + $this->source_dir . '/src/osdep/unix/ssl_unix.c', + "#include \n#include ", + "#include \n#include " + ); + // SourcePatcher::patchFile('1006_openssl1.1_autoverify.patch', $this->source_dir); + SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); */ + FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH); + FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH); + return true; + } + + /** + * @throws RuntimeException + */ + protected function build(): void + { + if ($this->builder->getLib('openssl')) { + $ssl_options = 'SPECIALAUTHENTICATORS=ssl SSLTYPE=unix.nopwd SSLINCLUDE=' . BUILD_INCLUDE_PATH . ' SSLLIB=' . BUILD_LIB_PATH; + } else { + $ssl_options = 'SSLTYPE=none'; + } + shell()->cd($this->source_dir) + ->exec('make clean') + ->exec('touch ip6') + ->exec( + "yes | EXTRACFLAGS='-Wimplicit-function-declaration -include $(xcrun --show-sdk-path)/usr/include/poll.h -include $(xcrun --show-sdk-path)/usr/include/time.h -include $(xcrun --show-sdk-path)/usr/include/utime.h' make osx {$ssl_options}" + ); + try { + shell() + ->exec("cp -rf {$this->source_dir}/c-client/c-client.a " . BUILD_LIB_PATH . '/libc-client.a') + ->exec("cp -rf {$this->source_dir}/c-client/*.c " . BUILD_LIB_PATH . '/') + ->exec("cp -rf {$this->source_dir}/c-client/*.h " . BUILD_INCLUDE_PATH . '/') + ->exec("cp -rf {$this->source_dir}/src/osdep/unix/*.h " . BUILD_INCLUDE_PATH . '/'); + } catch (\Throwable) { + // last command throws an exception, no idea why since it works + } + } +} From 031da802f3d24e3a095aa121f3c9dc40b5652690 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 13 Nov 2023 00:10:32 +0800 Subject: [PATCH 08/80] apply new patches --- src/globals/patch/0001_imap_macos.patch | 220 ++++++++++++++++++ .../patch/1006_openssl1.1_autoverify.patch | 58 ----- src/globals/patch/2014_openssl1.1.1_sni.patch | 42 ---- 3 files changed, 220 insertions(+), 100 deletions(-) create mode 100644 src/globals/patch/0001_imap_macos.patch delete mode 100644 src/globals/patch/1006_openssl1.1_autoverify.patch delete mode 100644 src/globals/patch/2014_openssl1.1.1_sni.patch diff --git a/src/globals/patch/0001_imap_macos.patch b/src/globals/patch/0001_imap_macos.patch new file mode 100644 index 00000000..c977de6a --- /dev/null +++ b/src/globals/patch/0001_imap_macos.patch @@ -0,0 +1,220 @@ +From 5ab3bd7fa858eec0626a9dd0117ca3b050ef4660 Mon Sep 17 00:00:00 2001 +From: crazywhalecc +Date: Mon, 13 Nov 2023 00:00:52 +0800 +Subject: [PATCH] make macOS static compile happy + +--- + src/c-client/netmsg.c | 1 + + src/c-client/nntp.c | 1 + + src/osdep/amiga/dummy.c | 1 + + src/osdep/amiga/mbx.c | 1 + + src/osdep/amiga/mh.c | 1 + + src/osdep/amiga/mtx.c | 1 + + src/osdep/amiga/unix.c | 1 + + src/osdep/unix/dummy.c | 1 + + src/osdep/unix/mbx.c | 1 + + src/osdep/unix/mh.c | 1 + + src/osdep/unix/mmdf.c | 1 + + src/osdep/unix/mtx.c | 1 + + src/osdep/unix/mx.c | 1 + + src/osdep/unix/tcp_unix.c | 1 + + src/osdep/unix/tenex.c | 2 ++ + src/osdep/unix/unix.c | 1 + + 16 files changed, 17 insertions(+) + +diff --git a/src/c-client/netmsg.c b/src/c-client/netmsg.c +index 187e4eb..f316d0b 100644 +--- a/src/c-client/netmsg.c ++++ b/src/c-client/netmsg.c +@@ -29,6 +29,7 @@ + + #include + #include ++#include + extern int errno; /* just in case */ + #include "c-client.h" + #include "netmsg.h" +diff --git a/src/c-client/nntp.c b/src/c-client/nntp.c +index fe90edb..b2f7536 100644 +--- a/src/c-client/nntp.c ++++ b/src/c-client/nntp.c +@@ -29,6 +29,7 @@ + + #include + #include ++#include + #include "c-client.h" + #include "newsrc.h" + #include "netmsg.h" +diff --git a/src/osdep/amiga/dummy.c b/src/osdep/amiga/dummy.c +index b003a0b..2c65824 100644 +--- a/src/osdep/amiga/dummy.c ++++ b/src/osdep/amiga/dummy.c +@@ -35,6 +35,7 @@ extern int errno; /* just in case */ + #include "osdep.h" + #include + #include ++#include + #include "dummy.h" + #include "misc.h" + +diff --git a/src/osdep/amiga/mbx.c b/src/osdep/amiga/mbx.c +index 1ece5d8..2495965 100644 +--- a/src/osdep/amiga/mbx.c ++++ b/src/osdep/amiga/mbx.c +@@ -43,6 +43,7 @@ extern int errno; /* just in case */ + #include + #include + #include ++#include + #include "misc.h" + #include "dummy.h" + #include "fdstring.h" +diff --git a/src/osdep/amiga/mh.c b/src/osdep/amiga/mh.c +index 0226b7a..e7c907a 100644 +--- a/src/osdep/amiga/mh.c ++++ b/src/osdep/amiga/mh.c +@@ -36,6 +36,7 @@ extern int errno; /* just in case */ + #include + #include + #include ++#include + #include "misc.h" + #include "dummy.h" + #include "fdstring.h" +diff --git a/src/osdep/amiga/mtx.c b/src/osdep/amiga/mtx.c +index 8e6f76e..ca7b368 100644 +--- a/src/osdep/amiga/mtx.c ++++ b/src/osdep/amiga/mtx.c +@@ -43,6 +43,7 @@ extern int errno; /* just in case */ + #include + #include + #include ++#include + #include "misc.h" + #include "dummy.h" + #include "fdstring.h" +diff --git a/src/osdep/amiga/unix.c b/src/osdep/amiga/unix.c +index be3c437..c755fe7 100644 +--- a/src/osdep/amiga/unix.c ++++ b/src/osdep/amiga/unix.c +@@ -46,6 +46,7 @@ extern int errno; /* just in case */ + #include "osdep.h" + #include + #include ++#include + #include "unix.h" + #include "pseudo.h" + #include "fdstring.h" +diff --git a/src/osdep/unix/dummy.c b/src/osdep/unix/dummy.c +index b003a0b..2c65824 100644 +--- a/src/osdep/unix/dummy.c ++++ b/src/osdep/unix/dummy.c +@@ -35,6 +35,7 @@ extern int errno; /* just in case */ + #include "osdep.h" + #include + #include ++#include + #include "dummy.h" + #include "misc.h" + +diff --git a/src/osdep/unix/mbx.c b/src/osdep/unix/mbx.c +index 1ece5d8..2495965 100644 +--- a/src/osdep/unix/mbx.c ++++ b/src/osdep/unix/mbx.c +@@ -43,6 +43,7 @@ extern int errno; /* just in case */ + #include + #include + #include ++#include + #include "misc.h" + #include "dummy.h" + #include "fdstring.h" +diff --git a/src/osdep/unix/mh.c b/src/osdep/unix/mh.c +index 0226b7a..e7c907a 100644 +--- a/src/osdep/unix/mh.c ++++ b/src/osdep/unix/mh.c +@@ -36,6 +36,7 @@ extern int errno; /* just in case */ + #include + #include + #include ++#include + #include "misc.h" + #include "dummy.h" + #include "fdstring.h" +diff --git a/src/osdep/unix/mmdf.c b/src/osdep/unix/mmdf.c +index e962434..8cc9fae 100644 +--- a/src/osdep/unix/mmdf.c ++++ b/src/osdep/unix/mmdf.c +@@ -34,6 +34,7 @@ extern int errno; /* just in case */ + #include "osdep.h" + #include + #include ++#include + #include "pseudo.h" + #include "fdstring.h" + #include "misc.h" +diff --git a/src/osdep/unix/mtx.c b/src/osdep/unix/mtx.c +index 8e6f76e..ca7b368 100644 +--- a/src/osdep/unix/mtx.c ++++ b/src/osdep/unix/mtx.c +@@ -43,6 +43,7 @@ extern int errno; /* just in case */ + #include + #include + #include ++#include + #include "misc.h" + #include "dummy.h" + #include "fdstring.h" +diff --git a/src/osdep/unix/mx.c b/src/osdep/unix/mx.c +index 4549527..9d444c9 100644 +--- a/src/osdep/unix/mx.c ++++ b/src/osdep/unix/mx.c +@@ -36,6 +36,7 @@ extern int errno; /* just in case */ + #include + #include + #include ++#include + #include "misc.h" + #include "dummy.h" + #include "fdstring.h" +diff --git a/src/osdep/unix/tcp_unix.c b/src/osdep/unix/tcp_unix.c +index 5bad706..5d6cd03 100644 +--- a/src/osdep/unix/tcp_unix.c ++++ b/src/osdep/unix/tcp_unix.c +@@ -27,6 +27,7 @@ + */ + + #include "ip_unix.c" ++#include + + #undef write /* don't use redefined write() */ + +diff --git a/src/osdep/unix/tenex.c b/src/osdep/unix/tenex.c +index eee61fb..61760f0 100644 +--- a/src/osdep/unix/tenex.c ++++ b/src/osdep/unix/tenex.c +@@ -46,6 +46,8 @@ extern int errno; /* just in case */ + #include "mail.h" + #include "osdep.h" + #include ++#include ++#include + #include "misc.h" + #include "dummy.h" + +diff --git a/src/osdep/unix/unix.c b/src/osdep/unix/unix.c +index be3c437..c755fe7 100644 +--- a/src/osdep/unix/unix.c ++++ b/src/osdep/unix/unix.c +@@ -46,6 +46,7 @@ extern int errno; /* just in case */ + #include "osdep.h" + #include + #include ++#include + #include "unix.h" + #include "pseudo.h" + #include "fdstring.h" +-- +2.39.3 (Apple Git-145) + diff --git a/src/globals/patch/1006_openssl1.1_autoverify.patch b/src/globals/patch/1006_openssl1.1_autoverify.patch deleted file mode 100644 index f8629f2f..00000000 --- a/src/globals/patch/1006_openssl1.1_autoverify.patch +++ /dev/null @@ -1,58 +0,0 @@ -Description: Support OpenSSL 1.1 - When building with OpenSSL 1.1 and newer, use the new built-in - hostname verification instead of code that doesn't compile due to - structs having been made opaque. -Bug-Debian: https://bugs.debian.org/828589 - ---- a/src/osdep/unix/ssl_unix.c -+++ b/src/osdep/unix/ssl_unix.c -@@ -227,8 +227,16 @@ static char *ssl_start_work (SSLSTREAM * - /* disable certificate validation? */ - if (flags & NET_NOVALIDATECERT) - SSL_CTX_set_verify (stream->context,SSL_VERIFY_NONE,NIL); -- else SSL_CTX_set_verify (stream->context,SSL_VERIFY_PEER,ssl_open_verify); -+ else { -+#if OPENSSL_VERSION_NUMBER >= 0x10100000 -+ X509_VERIFY_PARAM *param = SSL_CTX_get0_param(stream->context); -+ X509_VERIFY_PARAM_set_hostflags(param, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS); -+ X509_VERIFY_PARAM_set1_host(param, host, 0); -+#endif -+ -+ SSL_CTX_set_verify (stream->context,SSL_VERIFY_PEER,ssl_open_verify); - /* set default paths to CAs... */ -+ } - SSL_CTX_set_default_verify_paths (stream->context); - /* ...unless a non-standard path desired */ - if (s = (char *) mail_parameters (NIL,GET_SSLCAPATH,NIL)) -@@ -266,6 +274,7 @@ static char *ssl_start_work (SSLSTREAM * - if (SSL_write (stream->con,"",0) < 0) - return ssl_last_error ? ssl_last_error : "SSL negotiation failed"; - /* need to validate host names? */ -+#if OPENSSL_VERSION_NUMBER < 0x10100000 - if (!(flags & NET_NOVALIDATECERT) && - (err = ssl_validate_cert (cert = SSL_get_peer_certificate (stream->con), - host))) { -@@ -275,6 +284,7 @@ static char *ssl_start_work (SSLSTREAM * - sprintf (tmp,"*%.128s: %.255s",err,cert ? cert->name : "???"); - return ssl_last_error = cpystr (tmp); - } -+#endif - return NIL; - } - -@@ -313,6 +323,7 @@ static int ssl_open_verify (int ok,X509_ - * Returns: NIL if validated, else string of error message - */ - -+#if OPENSSL_VERSION_NUMBER < 0x10100000 - static char *ssl_validate_cert (X509 *cert,char *host) - { - int i,n; -@@ -342,6 +353,7 @@ static char *ssl_validate_cert (X509 *ce - else ret = "Unable to locate common name in certificate"; - return ret; - } -+#endif - - /* Case-independent wildcard pattern match - * Accepts: base string diff --git a/src/globals/patch/2014_openssl1.1.1_sni.patch b/src/globals/patch/2014_openssl1.1.1_sni.patch deleted file mode 100644 index 256d7d6d..00000000 --- a/src/globals/patch/2014_openssl1.1.1_sni.patch +++ /dev/null @@ -1,42 +0,0 @@ -Bug-Debian: https://bugs.debian.org/916041 -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1834340 -Description: - Google IMAP servers require SNI if TLSv1.3 is used, - otherwise it sends a self-signed certificate which - fails validation. - - OpenSSL support/versions: - - TLSv1.3 on 1.1.1, - - a2i_IPADDRESS() on 0.9.8'ish, - - SSL_set_tlsext_host_name() on 0.9.8'ish/1.0.0; - per 'git blame/describe' and the CHANGES file. - - So check for TLSv1.3 support / OpenSSL 1.1.1 - not to incur behavior changes on pre-TLSv1.3, - and set host_name to 'host' (ssl_open_verify() - validates this, via 'ssl_last_host' variable) - - This patch just combines these two patches: - - BTS#916041 (message #5) by Ed Spiridonov, - - LP#1834340 (comment #6) by David Zuelke. -Author: Mauricio Faria de Oliveira - -Index: uw-imap-2007f~dfsg/src/osdep/unix/ssl_unix.c -=================================================================== ---- uw-imap-2007f~dfsg.orig/src/osdep/unix/ssl_unix.c -+++ uw-imap-2007f~dfsg/src/osdep/unix/ssl_unix.c -@@ -266,6 +266,14 @@ static char *ssl_start_work (SSLSTREAM * - /* create connection */ - if (!(stream->con = (SSL *) SSL_new (stream->context))) - return "SSL connection failed"; -+#if OPENSSL_VERSION_NUMBER >= 0x10101000 -+ /* Use SNI in case server requires it with TLSv1.3. -+ * Literal IP addresses not permitted per RFC 6066. */ -+ if (!a2i_IPADDRESS(host)) { -+ ERR_clear_error(); -+ SSL_set_tlsext_host_name(stream->con,host); -+ } -+#endif - bio = BIO_new_socket (stream->tcpstream->tcpsi,BIO_NOCLOSE); - SSL_set_bio (stream->con,bio,bio); - SSL_set_connect_state (stream->con); From 2d192fc3908088e2faea14bc50ceb2822a5e171e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 13 Nov 2023 00:17:46 +0800 Subject: [PATCH 09/80] replace libpng to github --- config/source.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/source.json b/config/source.json index a94236c3..d0e8e3b3 100644 --- a/config/source.json +++ b/config/source.json @@ -234,7 +234,7 @@ }, "libpng": { "type": "git", - "url": "https://git.code.sf.net/p/libpng/code", + "url": "https://github.com/glennrp/libpng.git", "rev": "libpng16", "license": { "type": "file", From a8f2b0096b6362e90a9bbf21b126d70495073a14 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 13 Nov 2023 00:32:59 +0800 Subject: [PATCH 10/80] cs fix --- src/SPC/builder/linux/library/imap.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SPC/builder/linux/library/imap.php b/src/SPC/builder/linux/library/imap.php index 6a36c4ad..60b02203 100644 --- a/src/SPC/builder/linux/library/imap.php +++ b/src/SPC/builder/linux/library/imap.php @@ -7,7 +7,6 @@ namespace SPC\builder\linux\library; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\store\FileSystem; -use SPC\store\SourcePatcher; class imap extends LinuxLibraryBase { From 74536bd2e1be3dc530e9cd2de16b23c694f3e674 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Mon, 13 Nov 2023 17:59:03 +0800 Subject: [PATCH 11/80] Change CI download all to --for-extensions (#262) * Change download all to --for-extensions * Update build-linux-x86_64.yml * Update build-linux-arm.yml * Update build-linux-x86_64.yml * Update build-macos-x86_64.yml --- .github/workflows/build-linux-arm.yml | 4 ++-- .github/workflows/build-linux-x86_64.yml | 4 ++-- .github/workflows/build-macos-x86_64.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-linux-arm.yml b/.github/workflows/build-linux-arm.yml index d36321e4..3fc6d5e5 100644 --- a/.github/workflows/build-linux-arm.yml +++ b/.github/workflows/build-linux-arm.yml @@ -51,7 +51,7 @@ jobs: uses: actions/cache@v3 with: path: downloads - key: php-${{ inputs.version }}-dependencies + key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }} # With or without debug - if: inputs.debug == true @@ -67,7 +67,7 @@ jobs: # If there's no dependencies cache, fetch sources, with or without debug - if: steps.cache-download.outputs.cache-hit != 'true' - run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }} + run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} # Run build command - run: SPC_USE_ARCH=${{ inputs.operating-system }} ./bin/spc-alpine-docker build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} diff --git a/.github/workflows/build-linux-x86_64.yml b/.github/workflows/build-linux-x86_64.yml index 90705f33..4251f9e2 100644 --- a/.github/workflows/build-linux-x86_64.yml +++ b/.github/workflows/build-linux-x86_64.yml @@ -56,7 +56,7 @@ jobs: uses: actions/cache@v3 with: path: downloads - key: php-${{ inputs.version }}-dependencies + key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }} # With or without debug - if: inputs.debug == true @@ -72,7 +72,7 @@ jobs: # If there's no dependencies cache, fetch sources, with or without debug - if: steps.cache-download.outputs.cache-hit != 'true' - run: CACHE_API_EXEC=yes ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }} + run: CACHE_API_EXEC=yes ./bin/spc-alpine-docker download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} # Run build command - run: ./bin/spc-alpine-docker build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} diff --git a/.github/workflows/build-macos-x86_64.yml b/.github/workflows/build-macos-x86_64.yml index 6727fcbd..7ef31bb7 100644 --- a/.github/workflows/build-macos-x86_64.yml +++ b/.github/workflows/build-macos-x86_64.yml @@ -61,7 +61,7 @@ jobs: uses: actions/cache@v3 with: path: downloads - key: php-${{ inputs.version }}-dependencies + key: php-${{ inputs.version }}-dependencies-${{ inputs.extensions }} # With or without debug - if: inputs.debug == true @@ -77,7 +77,7 @@ jobs: # If there's no dependencies cache, fetch sources, with or without debug - if: steps.cache-download.outputs.cache-hit != 'true' - run: ./bin/spc download --with-php=${{ inputs.version }} --all ${{ env.SPC_BUILD_DEBUG }} + run: ./bin/spc download --with-php=${{ inputs.version }} --for-extensions=${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} # Run build command - run: ./bin/spc build ${{ inputs.extensions }} ${{ env.SPC_BUILD_DEBUG }} ${{ env.SPC_BUILD_CLI }} ${{ env.SPC_BUILD_MICRO }} ${{ env.SPC_BUILD_FPM }} From f7c73c00afcb6e166c0d86eecb7f7eaa79196179 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Tue, 14 Nov 2023 20:24:32 +0800 Subject: [PATCH 12/80] Fix iconv not depends on libiconv in linux --- config/ext.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index cb313ff5..21aedf67 100644 --- a/config/ext.json +++ b/config/ext.json @@ -118,7 +118,7 @@ "iconv": { "type": "builtin", "arg-type": "with-prefix", - "lib-depends-windows": [ + "lib-depends": [ "libiconv" ] }, From e3671387fc3b2f09c11ba800e7b11236a3e46a53 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 15 Nov 2023 18:00:06 +0800 Subject: [PATCH 13/80] temporarily use fixed url for freetype --- config/source.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/source.json b/config/source.json index d0e8e3b3..32ca61f3 100644 --- a/config/source.json +++ b/config/source.json @@ -111,9 +111,8 @@ } }, "freetype": { - "type": "filelist", - "url": "https://download-mirror.savannah.gnu.org/releases/freetype/", - "regex": "/href=\"(?freetype-(?[^\"]+)\\.tar\\.xz)\"/", + "type": "url", + "url": "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-2.tar.gz", "license": { "type": "file", "path": "LICENSE.TXT" From 66cebb5fe4191d05e9cd6173ccaf628a9962d5d8 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 15 Nov 2023 18:29:59 +0800 Subject: [PATCH 14/80] disable brotli if not enabled --- src/SPC/builder/extension/swoole.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/swoole.php b/src/SPC/builder/extension/swoole.php index 987a0cab..a9c1199f 100644 --- a/src/SPC/builder/extension/swoole.php +++ b/src/SPC/builder/extension/swoole.php @@ -16,7 +16,7 @@ class swoole extends Extension // 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) : ''; + $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'; return $arg; } From a6fbcc954e7d611bfddc71b972bab1288cda830d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 15 Nov 2023 15:28:38 +0100 Subject: [PATCH 15/80] fix pthreads4w URL --- config/source.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/source.json b/config/source.json index 32ca61f3..3595223d 100644 --- a/config/source.json +++ b/config/source.json @@ -404,7 +404,7 @@ "pthreads4w": { "type": "git", "rev": "master", - "url": "https://git.code.sf.net/p/pthreads4w/code", + "url": "https://github.com/jwinarske/pthreads4w", "license": { "type": "file", "path": "LICENSE" From 3bd5a0572504846678fcab0e2c69ec0ab9bc5034 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 16 Nov 2023 00:11:52 +0800 Subject: [PATCH 16/80] remove pthreads4w --- config/lib.json | 15 +-------------- config/source.json | 9 --------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/config/lib.json b/config/lib.json index 5e6189e6..a36afebd 100644 --- a/config/lib.json +++ b/config/lib.json @@ -311,8 +311,7 @@ ], "lib-suggests-windows": [ "icu", - "xz", - "pthreads4w" + "xz" ] }, "libxslt": { @@ -450,18 +449,6 @@ "zstd" ] }, - "pthreads4w": { - "source": "pthreads4w", - "static-libs-windows": [ - "libpthreadVC3.lib" - ], - "headers-windows": [ - "_ptw32.h", - "pthread.h", - "sched.h", - "semaphore.h" - ] - }, "readline": { "source": "readline", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index 3595223d..99264f06 100644 --- a/config/source.json +++ b/config/source.json @@ -401,15 +401,6 @@ "path": "LICENSE" } }, - "pthreads4w": { - "type": "git", - "rev": "master", - "url": "https://github.com/jwinarske/pthreads4w", - "license": { - "type": "file", - "path": "LICENSE" - } - }, "readline": { "type": "filelist", "url": "https://ftp.gnu.org/pub/gnu/readline/", From 2a6441a500dc406a2662d563c409bcc56c639c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 16 Nov 2023 11:09:06 +0100 Subject: [PATCH 17/80] switch to git --- config/source.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/source.json b/config/source.json index 99264f06..9f9124cb 100644 --- a/config/source.json +++ b/config/source.json @@ -111,8 +111,9 @@ } }, "freetype": { - "type": "url", - "url": "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-2.tar.gz", + "type": "git", + "rev": "VER-2-13-2", + "url": "https://github.com/freetype/freetype", "license": { "type": "file", "path": "LICENSE.TXT" @@ -216,7 +217,7 @@ }, "libmcrypt": { "type": "url", - "url": "https://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz", + "url": "https://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz", "license": { "type": "file", "path": "COPYING" @@ -302,7 +303,7 @@ }, "mcrypt": { "type": "url", - "url": "https://jaist.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz", + "url": "https://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz", "license": { "type": "file", "path": "COPYING" From edaa82b8c522d48ed14779c00df95a2cbf2ea5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 16 Nov 2023 11:17:36 +0100 Subject: [PATCH 18/80] autogen --- src/SPC/builder/unix/library/freetype.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/freetype.php b/src/SPC/builder/unix/library/freetype.php index 8ef3368f..3158d828 100644 --- a/src/SPC/builder/unix/library/freetype.php +++ b/src/SPC/builder/unix/library/freetype.php @@ -26,6 +26,7 @@ trait freetype $suggested .= ' '; shell()->cd($this->source_dir) + ->exec('sh autogen.sh') ->exec( './configure ' . '--enable-static --disable-shared --without-harfbuzz --prefix= ' . From 5736964b2e6c26b1fa96d39c10ff8cbd028d8fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 16 Nov 2023 11:37:58 +0100 Subject: [PATCH 19/80] fix --- config/source.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/source.json b/config/source.json index 9f9124cb..61db9e3c 100644 --- a/config/source.json +++ b/config/source.json @@ -111,9 +111,8 @@ } }, "freetype": { - "type": "git", - "rev": "VER-2-13-2", - "url": "https://github.com/freetype/freetype", + "type": "url", + "url": "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-2.tar.gz", "license": { "type": "file", "path": "LICENSE.TXT" From d09a3074ad4913e41fb4d5a86dfbf2d321e03426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 16 Nov 2023 11:54:31 +0100 Subject: [PATCH 20/80] include git metadata --- config/source.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/source.json b/config/source.json index 61db9e3c..9f9124cb 100644 --- a/config/source.json +++ b/config/source.json @@ -111,8 +111,9 @@ } }, "freetype": { - "type": "url", - "url": "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-2.tar.gz", + "type": "git", + "rev": "VER-2-13-2", + "url": "https://github.com/freetype/freetype", "license": { "type": "file", "path": "LICENSE.TXT" From a2c687599f6d44876fc9291d3a50c1a08bbdbdd0 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sun, 19 Nov 2023 13:38:09 +0800 Subject: [PATCH 21/80] Create pull_request_template.md --- .github/pull_request_template.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..6a441788 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +## What does this PR do? + + + +## Checklist before merging + +> If your PR involves the changes mentioned below and completed the action, please tick the corresponding option. +> If a modification is not involved, please skip it directly. + +- [ ] If it's a extension or dependency update, make sure adding related extensions in `src/global/test-extensions.php`. +- [ ] If you changed the behavior of static-php-cli, add docs in [static-php/static-php-cli-docs](https://github.com/static-php/static-php-cli-docs) . +- [ ] If you updated `config/xxxx.json` content, run `bin/spc dev:sort-config xxx`. From 2e637524fce5dca2bee1893671d94a9c49a765e8 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 19 Nov 2023 13:38:55 +0800 Subject: [PATCH 22/80] Add test build things --- .github/workflows/tests.yml | 203 ++++++++++++++++++++------------ src/globals/test-extensions.php | 8 ++ 2 files changed, 133 insertions(+), 78 deletions(-) create mode 100644 src/globals/test-extensions.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d7223f64..8370a0c3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,98 +1,145 @@ name: Tests on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] permissions: - contents: read + contents: read jobs: - php-cs-fixer: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 + php-cs-fixer: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: "Checkout" + uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: curl, openssl, mbstring - ini-values: memory_limit=-1 - tools: pecl, composer, php-cs-fixer + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: curl, openssl, mbstring + ini-values: memory_limit=-1 + tools: pecl, composer, php-cs-fixer - - name: Run PHP-CS-Fixer fix - run: php-cs-fixer fix --dry-run --diff --ansi + - name: Run PHP-CS-Fixer fix + run: php-cs-fixer fix --dry-run --diff --ansi - phpstan: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 + phpstan: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: "Checkout" + uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: curl, openssl, mbstring - ini-values: memory_limit=-1 - tools: composer + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: curl, openssl, mbstring + ini-values: memory_limit=-1 + tools: composer - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v3 - with: - path: vendor - key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-phpstan- + - name: "Cache Composer packages" + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-phpstan- - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: "Install Dependencies" + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - name: Run phpstan - run: vendor/bin/phpstan analyse + - name: "Run phpstan" + run: vendor/bin/phpstan analyse - phpunit: - name: PHPUnit (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - timeout-minutes: 10 - strategy: - matrix: - include: - - php: '8.1' - - php: '8.2' - fail-fast: false + phpunit: + name: "PHPUnit (PHP ${{ matrix.php }})" + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + matrix: + include: + - php: '8.1' + - php: '8.2' + fail-fast: false - steps: - - name: Checkout - uses: actions/checkout@v4 + steps: + - name: "Checkout" + uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - tools: pecl, composer - extensions: curl, openssl, mbstring - ini-values: memory_limit=-1 + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + tools: pecl, composer + extensions: curl, openssl, mbstring + ini-values: memory_limit=-1 - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v3 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- + - name: "Cache Composer packages" + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: "Install Dependencies" + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - name: Run PHPUnit tests - run: | - vendor/bin/phpunit tests/ --no-coverage + - name: "Run PHPUnit Tests" + run: | + vendor/bin/phpunit tests/ --no-coverage + + build: + name: "Build PHP Test (PHP ${{ matrix.php }})" + runs-on: ${{ matrix.os }} + timeout-minutes: 120 + strategy: + matrix: + php: + - 8.0 + - 8.1 + - 8.2 + os: + - ubuntu-latest + - macos-latest + fail-fast: false + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + tools: pecl, composer + extensions: curl, openssl, mbstring + ini-values: memory_limit=-1 + + - name: "Cache Composer packages" + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: "Install Dependencies" + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: "Run Build Tests (doctor)" + run: bin/spc doctor --auto-fix + + - name: "Run Build Tests (download)" + run: bin/spc download --for-extensions="$(php src/globals/test-extensions.php)" --with-php=${{ matrix.php }} --debug + + - name: "Run Build Tests (build)" + run: bin/spc build "$(php src/globals/test-extensions.php)" --build-cli --build-micro --build-fpm --debug diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php new file mode 100644 index 00000000..3a2548d3 --- /dev/null +++ b/src/globals/test-extensions.php @@ -0,0 +1,8 @@ + Date: Sun, 19 Nov 2023 13:41:09 +0800 Subject: [PATCH 23/80] Add test build things --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8370a0c3..3e23e8f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -133,7 +133,7 @@ jobs: ${{ runner.os }}-php- - name: "Install Dependencies" - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: "Run Build Tests (doctor)" run: bin/spc doctor --auto-fix From c0e88bf4bd21150311d7311ababb8b3396b2c509 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 19 Nov 2023 13:42:40 +0800 Subject: [PATCH 24/80] prevent setup php from using 8.0 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3e23e8f2..517dc25f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -118,7 +118,7 @@ jobs: - name: "Setup PHP" uses: shivammathur/setup-php@v2 with: - php-version: "${{ matrix.php }}" + php-version: 8.2 tools: pecl, composer extensions: curl, openssl, mbstring ini-values: memory_limit=-1 From 859182abff39fc3c4d228861fdfbaf1daa107102 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 19 Nov 2023 13:44:12 +0800 Subject: [PATCH 25/80] remove fail fast --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 517dc25f..0fc951b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,7 +67,6 @@ jobs: include: - php: '8.1' - php: '8.2' - fail-fast: false steps: - name: "Checkout" @@ -98,7 +97,7 @@ jobs: vendor/bin/phpunit tests/ --no-coverage build: - name: "Build PHP Test (PHP ${{ matrix.php }})" + name: "Build PHP Test (PHP ${{ matrix.php }} ${{ matrix.os }})" runs-on: ${{ matrix.os }} timeout-minutes: 120 strategy: From 9c904409cdc1c58b837698ef3f1c292423c3d260 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 19 Nov 2023 13:47:48 +0800 Subject: [PATCH 26/80] use string --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0fc951b7..f90631dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -103,9 +103,9 @@ jobs: strategy: matrix: php: - - 8.0 - - 8.1 - - 8.2 + - "8.0" + - "8.1" + - "8.2" os: - ubuntu-latest - macos-latest From b3d41ef969efa83543a9f2ae4beae16c631d1803 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 9 Nov 2023 00:35:01 +0800 Subject: [PATCH 27/80] add extension rar --- config/ext.json | 5 +++++ config/source.json | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/config/ext.json b/config/ext.json index 21aedf67..19125296 100644 --- a/config/ext.json +++ b/config/ext.json @@ -278,6 +278,11 @@ "sqlite" ] }, + "rar": { + "type": "external", + "source": "rar", + "cpp-extension": true + }, "pgsql": { "type": "builtin", "arg-type": "with-prefix", diff --git a/config/source.json b/config/source.json index 9f9124cb..cca1284f 100644 --- a/config/source.json +++ b/config/source.json @@ -51,6 +51,16 @@ "path": "LICENSE" } }, + "rar": { + "type": "git", + "url": "https://github.com/static-php/php-rar.git", + "path": "php-src/ext/rar", + "rev": "issue-php82", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "ext-glfw": { "type": "git", "url": "https://github.com/mario-deluna/php-glfw", From 2bb08af89bac1ac4d277d3d4d454f05e7f66aad1 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 19 Nov 2023 14:04:51 +0800 Subject: [PATCH 28/80] add rar 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 3a2548d3..b3bd4572 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 = '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 = 'rar,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'; echo $extensions; From 869130572f8c206864792ff0f5e8d68237280b50 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 19 Nov 2023 14:46:30 +0800 Subject: [PATCH 29/80] change 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 b3bd4572..83783a27 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 = 'rar,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 = 'rar,zlib,zip'; echo $extensions; From 36a30cc23b83e3511f158437c2efc235a7b81da9 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Tue, 21 Nov 2023 23:35:34 +0800 Subject: [PATCH 30/80] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c89abc91..0fe5acef 100755 --- a/README.md +++ b/README.md @@ -272,11 +272,13 @@ You can sponsor my project on [this page](https://github.com/crazywhalecc/crazyw ## Open-Source License This project itself is based on MIT License, -some newly added extensions and dependencies may originate from the following projects (including but not limited to), -and the headers of these code files will also be given additional instructions LICENSE and AUTHOR: +some newly added extensions and dependencies may originate from the the other projects, +and the headers of these code files will also be given additional instructions LICENSE and AUTHOR. -- [dixyes/lwmbs](https://github.com/dixyes/lwmbs) (Mulun Permissive License) -- [swoole/swoole-cli](https://github.com/swoole/swoole-cli) (Apache 2.0 LICENSE+SWOOLE-CLI LICENSE) +These are similar projects: + +- [dixyes/lwmbs](https://github.com/dixyes/lwmbs) +- [swoole/swoole-cli](https://github.com/swoole/swoole-cli) Due to the special nature of this project, many other open source projects such as curl and protobuf will be used during the project compilation process, From 2e24976b71bcb678f713b86efbe505165f8c7b96 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Wed, 22 Nov 2023 11:05:57 +0800 Subject: [PATCH 31/80] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0fe5acef..356f812b 100755 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Please first select the extension you want to compile based on the extension lis > If an extension you need is missing, you can submit an issue. +Here is the current planned roadmap for extension support: [#152](https://github.com/crazywhalecc/static-php-cli/issues/152) . + ### GitHub Actions Build Use GitHub Action to easily build a statically compiled PHP, From 04f100da8bf308a3a006cede42455aa2f2576851 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 21 Nov 2023 23:12:00 +0800 Subject: [PATCH 32/80] add tidy support --- config/ext.json | 12 +++++----- config/lib.json | 6 +++++ config/source.json | 29 +++++++++++++++-------- src/SPC/builder/macos/library/tidy.php | 12 ++++++++++ src/SPC/builder/unix/library/tidy.php | 32 ++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 src/SPC/builder/macos/library/tidy.php create mode 100644 src/SPC/builder/unix/library/tidy.php diff --git a/config/ext.json b/config/ext.json index 19125296..e38bacb6 100644 --- a/config/ext.json +++ b/config/ext.json @@ -278,11 +278,6 @@ "sqlite" ] }, - "rar": { - "type": "external", - "source": "rar", - "cpp-extension": true - }, "pgsql": { "type": "builtin", "arg-type": "with-prefix", @@ -311,6 +306,11 @@ "aspell" ] }, + "rar": { + "type": "external", + "source": "rar", + "cpp-extension": true + }, "readline": { "type": "builtin", "arg-type": "with-prefix", @@ -435,7 +435,7 @@ }, "tidy": { "type": "builtin", - "arg-type": "with", + "arg-type": "with-prefix", "lib-depends": [ "tidy" ] diff --git a/config/lib.json b/config/lib.json index a36afebd..7abff12c 100644 --- a/config/lib.json +++ b/config/lib.json @@ -483,6 +483,12 @@ "sqlite3ext.h" ] }, + "tidy": { + "source": "tidy", + "static-libs-unix": [ + "libtidy.a" + ] + }, "xz": { "source": "xz", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index cca1284f..143e1874 100644 --- a/config/source.json +++ b/config/source.json @@ -51,16 +51,6 @@ "path": "LICENSE" } }, - "rar": { - "type": "git", - "url": "https://github.com/static-php/php-rar.git", - "path": "php-src/ext/rar", - "rev": "issue-php82", - "license": { - "type": "file", - "path": "LICENSE" - } - }, "ext-glfw": { "type": "git", "url": "https://github.com/mario-deluna/php-glfw", @@ -412,6 +402,16 @@ "path": "LICENSE" } }, + "rar": { + "type": "git", + "url": "https://github.com/static-php/php-rar.git", + "path": "php-src/ext/rar", + "rev": "issue-php82", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "readline": { "type": "filelist", "url": "https://ftp.gnu.org/pub/gnu/readline/", @@ -469,6 +469,15 @@ "path": "LICENSE" } }, + "tidy": { + "type": "url", + "url": "https://github.com/htacg/tidy-html5/archive/refs/tags/5.8.0.tar.gz", + "filename": "tidy-html5.tgz", + "license": { + "type": "file", + "path": "README/LICENSE.md" + } + }, "xlswriter": { "type": "url", "url": "https://pecl.php.net/get/xlswriter", diff --git a/src/SPC/builder/macos/library/tidy.php b/src/SPC/builder/macos/library/tidy.php new file mode 100644 index 00000000..733e7644 --- /dev/null +++ b/src/SPC/builder/macos/library/tidy.php @@ -0,0 +1,12 @@ +source_dir . '/build-dir'); + shell()->cd($this->source_dir . '/build-dir') + ->exec( + 'cmake ' . + "{$this->builder->makeCmakeArgs()} " . + '-DBUILD_SHARED_LIB=OFF ' . + '-DSUPPORT_CONSOLE_APP=OFF ' . + '..' + ) + ->exec("cmake --build . -j {$this->builder->concurrency}") + ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + $this->patchPkgconfPrefix(['tidy.pc']); + } +} From 89afd44344933d752424c61abf0bf74fa4d94e57 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 21 Nov 2023 23:12:40 +0800 Subject: [PATCH 33/80] add tidy support for linux --- src/SPC/builder/linux/library/tidy.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/SPC/builder/linux/library/tidy.php diff --git a/src/SPC/builder/linux/library/tidy.php b/src/SPC/builder/linux/library/tidy.php new file mode 100644 index 00000000..0cfcd27e --- /dev/null +++ b/src/SPC/builder/linux/library/tidy.php @@ -0,0 +1,12 @@ + Date: Tue, 21 Nov 2023 23:13:09 +0800 Subject: [PATCH 34/80] add 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 83783a27..fbdbf3bd 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 = 'rar,zlib,zip'; +$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'; echo $extensions; From 7a2e237069b15aad1f22eb4b33e731bb89116e95 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 22 Nov 2023 00:29:44 +0800 Subject: [PATCH 35/80] add php 8.3 support --- .github/workflows/build-linux-arm.yml | 1 + .github/workflows/build-linux-x86_64.yml | 1 + .github/workflows/build-macos-x86_64.yml | 1 + .github/workflows/download-cache.yml | 2 +- .github/workflows/tests.yml | 4 +++- README-zh.md | 2 +- README.md | 2 +- bin/setup-runtime | 4 ++-- 8 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-linux-arm.yml b/.github/workflows/build-linux-arm.yml index 3fc6d5e5..1a062727 100644 --- a/.github/workflows/build-linux-arm.yml +++ b/.github/workflows/build-linux-arm.yml @@ -15,6 +15,7 @@ on: default: '8.2' type: choice options: + - '8.3' - '8.2' - '8.1' - '8.0' diff --git a/.github/workflows/build-linux-x86_64.yml b/.github/workflows/build-linux-x86_64.yml index 4251f9e2..91803677 100644 --- a/.github/workflows/build-linux-x86_64.yml +++ b/.github/workflows/build-linux-x86_64.yml @@ -9,6 +9,7 @@ on: default: '8.2' type: choice options: + - '8.3' - '8.2' - '8.1' - '8.0' diff --git a/.github/workflows/build-macos-x86_64.yml b/.github/workflows/build-macos-x86_64.yml index 7ef31bb7..a942a39f 100644 --- a/.github/workflows/build-macos-x86_64.yml +++ b/.github/workflows/build-macos-x86_64.yml @@ -9,6 +9,7 @@ on: default: '8.2' type: choice options: + - '8.3' - '8.2' - '8.1' - '8.0' diff --git a/.github/workflows/download-cache.yml b/.github/workflows/download-cache.yml index 86b4322e..1d0a5f52 100644 --- a/.github/workflows/download-cache.yml +++ b/.github/workflows/download-cache.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: [ "8.0", "8.1", "8.2" ] + php-version: [ "8.0", "8.1", "8.2", "8.3" ] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f90631dd..d5b9d041 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,6 +67,7 @@ jobs: include: - php: '8.1' - php: '8.2' + - php: '8.3' steps: - name: "Checkout" @@ -106,6 +107,7 @@ jobs: - "8.0" - "8.1" - "8.2" + - "8.3" os: - ubuntu-latest - macos-latest @@ -117,7 +119,7 @@ jobs: - name: "Setup PHP" uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 tools: pecl, composer extensions: curl, openssl, mbstring ini-values: memory_limit=-1 diff --git a/README-zh.md b/README-zh.md index 33cb1d64..e8aac2c3 100755 --- a/README-zh.md +++ b/README-zh.md @@ -130,7 +130,7 @@ chmod +x bin/spc ./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro ``` -你也可以使用参数 `--with-php=x.y` 来指定下载的 PHP 版本,目前支持 7.3 ~ 8.2: +你也可以使用参数 `--with-php=x.y` 来指定下载的 PHP 版本,目前支持 7.3 ~ 8.3: ```bash # 优先考虑使用 >= 8.0 的 PHP 版本,因为 phpmicro 不支持在 PHP7 中构建 diff --git a/README.md b/README.md index 356f812b..2f5f5ccf 100755 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ Basic usage for building php and micro with some extensions: ./bin/spc build bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl --build-cli --build-micro ``` -You can also use the parameter `--with-php=x.y` to specify the downloaded PHP version, currently supports 7.4 ~ 8.2: +You can also use the parameter `--with-php=x.y` to specify the downloaded PHP version, currently supports 7.4 ~ 8.3: ```bash # Using PHP >= 8.0 is recommended, because PHP7 cannot use phpmicro diff --git a/bin/setup-runtime b/bin/setup-runtime index bd7144b7..b344bab5 100755 --- a/bin/setup-runtime +++ b/bin/setup-runtime @@ -25,7 +25,7 @@ __DIR__=$(cd "$(dirname "$0")" && pwd) __PROJECT__=$(cd "${__DIR__}"/../ && pwd) # set download dir -__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/common/php-8.2.10-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" +__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/common/php-8.2.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" __COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar" # use china mirror @@ -46,7 +46,7 @@ done case "$mirror" in china) - __PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/common/php-8.2.10-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" + __PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/common/php-8.2.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" __COMPOSER_URL__="https://mirrors.aliyun.com/composer/composer.phar" ;; From 93e64e1d5a8ebd05d29a516541f0bf541c1dd978 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 24 Nov 2023 01:20:13 +0800 Subject: [PATCH 36/80] use php 8.2 to setup php runtime --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5b9d041..9b9e64a8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -119,7 +119,7 @@ jobs: - name: "Setup PHP" uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.2 tools: pecl, composer extensions: curl, openssl, mbstring ini-values: memory_limit=-1 From 5449e0589802ec6c66d6a1bbb6bd434665baec1b Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Fri, 24 Nov 2023 10:28:35 +0800 Subject: [PATCH 37/80] Update README.md --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2f5f5ccf..cd714f70 100755 --- a/README.md +++ b/README.md @@ -90,13 +90,12 @@ Currently, the platforms supported by `spc` binary are Linux and macOS. Here's how to download from GitHub Actions: -1. Enter [GitHub Actions](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml). -2. Select the latest build task, select `Artifacts`, and download the binary file of the corresponding platform. -3. Unzip the `.zip` file. After decompressing, add execution permissions to it: `chmod +x ./spc`. +1. Enter [GitHub Actions](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml) or [self-hosted nightly builds](https://dl.static-php.dev/static-php-cli/spc-bin/nightly/). +2. If you download from GHA, select the latest build task, select `Artifacts`, and download the binary file of the corresponding platform. +3. If you download from GHA, unzip the `.zip` file. After decompressing, add execution permissions to it: `chmod +x ./spc`. +4. If you download from self-hosted server, download `spc-$os-$arch` file and just use it (don't forget `chmod +x`). -You can also download binaries from a self-hosted server: [enter](https://dl.static-php.dev/static-php-cli/spc-bin/nightly/). - -> SPC single-file binary is built by phpmicro and box. +> SPC single-file binary is built by phpmicro and box, and it doesn't need to install PHP. Just treat `spc` as a standalone executable. ### Manual build (using source code) From 0589690eaa6aea204abb15975ad1f739d0a7168e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 27 Nov 2023 21:21:31 +0800 Subject: [PATCH 38/80] add libtool installation for debian --- 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 40d17956..7755f838 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -28,7 +28,7 @@ class LinuxToolCheckList 'git', 'autoconf', 'automake', 'tar', 'unzip', 'gzip', 'bzip2', 'cmake', 'patch', - 'xz', + 'xz', 'libtool', ]; public const TOOLS_RHEL = [ From 4400c6271e267a16da108f63020b9d7d512848d6 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 27 Nov 2023 21:21:45 +0800 Subject: [PATCH 39/80] update composer lock --- composer.lock | 236 +++++++++++++++++++++++++------------------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/composer.lock b/composer.lock index 109c39b3..1be1f401 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "illuminate/collections", - "version": "v10.29.0", + "version": "v10.33.0", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "bb8784ce913bd46f944b4bd67cd857f40d9cfe68" + "reference": "766a3b6c3e5c8011b037a147266dcf7f93b21223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/bb8784ce913bd46f944b4bd67cd857f40d9cfe68", - "reference": "bb8784ce913bd46f944b4bd67cd857f40d9cfe68", + "url": "https://api.github.com/repos/illuminate/collections/zipball/766a3b6c3e5c8011b037a147266dcf7f93b21223", + "reference": "766a3b6c3e5c8011b037a147266dcf7f93b21223", "shasum": "" }, "require": { @@ -59,11 +59,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-10-10T12:55:25+00:00" + "time": "2023-11-20T15:45:45+00:00" }, { "name": "illuminate/conditionable", - "version": "v10.29.0", + "version": "v10.33.0", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -109,16 +109,16 @@ }, { "name": "illuminate/contracts", - "version": "v10.29.0", + "version": "v10.33.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "6c39fba7b2311e28f5c6ac7d729e3d49a2a98406" + "reference": "f6bf37a272fda164f6c451407c99f820eb1eb95b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/6c39fba7b2311e28f5c6ac7d729e3d49a2a98406", - "reference": "6c39fba7b2311e28f5c6ac7d729e3d49a2a98406", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/f6bf37a272fda164f6c451407c99f820eb1eb95b", + "reference": "f6bf37a272fda164f6c451407c99f820eb1eb95b", "shasum": "" }, "require": { @@ -153,11 +153,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-09-05T19:07:46+00:00" + "time": "2023-10-30T00:59:22+00:00" }, { "name": "illuminate/macroable", - "version": "v10.29.0", + "version": "v10.33.0", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -203,16 +203,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.12", + "version": "v0.1.13", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "b35f249028c22016e45e48626e19e5d42fd827ff" + "reference": "e1379d8ead15edd6cc4369c22274345982edc95a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/b35f249028c22016e45e48626e19e5d42fd827ff", - "reference": "b35f249028c22016e45e48626e19e5d42fd827ff", + "url": "https://api.github.com/repos/laravel/prompts/zipball/e1379d8ead15edd6cc4369c22274345982edc95a", + "reference": "e1379d8ead15edd6cc4369c22274345982edc95a", "shasum": "" }, "require": { @@ -254,9 +254,9 @@ ], "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.12" + "source": "https://github.com/laravel/prompts/tree/v0.1.13" }, - "time": "2023-10-18T14:18:57+00:00" + "time": "2023-10-27T13:53:59+00:00" }, { "name": "psr/container", @@ -414,16 +414,16 @@ }, { "name": "symfony/console", - "version": "v6.3.4", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6" + "reference": "0d14a9f6d04d4ac38a8cea1171f4554e325dae92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6", - "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6", + "url": "https://api.github.com/repos/symfony/console/zipball/0d14a9f6d04d4ac38a8cea1171f4554e325dae92", + "reference": "0d14a9f6d04d4ac38a8cea1171f4554e325dae92", "shasum": "" }, "require": { @@ -484,7 +484,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.3.4" + "source": "https://github.com/symfony/console/tree/v6.3.8" }, "funding": [ { @@ -500,11 +500,11 @@ "type": "tidelift" } ], - "time": "2023-08-16T10:10:12+00:00" + "time": "2023-10-31T08:09:35+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -551,7 +551,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -901,16 +901,16 @@ }, { "name": "symfony/service-contracts", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" + "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b3313c2dbffaf71c8de2934e2ea56ed2291a3838", + "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838", "shasum": "" }, "require": { @@ -963,7 +963,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.4.0" }, "funding": [ { @@ -979,20 +979,20 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2023-07-30T20:28:31+00:00" }, { "name": "symfony/string", - "version": "v6.3.5", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339" + "reference": "13880a87790c76ef994c91e87efb96134522577a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339", - "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339", + "url": "https://api.github.com/repos/symfony/string/zipball/13880a87790c76ef994c91e87efb96134522577a", + "reference": "13880a87790c76ef994c91e87efb96134522577a", "shasum": "" }, "require": { @@ -1049,7 +1049,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.3.5" + "source": "https://github.com/symfony/string/tree/v6.3.8" }, "funding": [ { @@ -1065,7 +1065,7 @@ "type": "tidelift" } ], - "time": "2023-09-18T10:38:32+00:00" + "time": "2023-11-09T08:28:21+00:00" }, { "name": "zhamao/logger", @@ -1691,16 +1691,16 @@ }, { "name": "captainhook/captainhook", - "version": "5.18.2", + "version": "5.18.3", "source": { "type": "git", "url": "https://github.com/captainhookphp/captainhook.git", - "reference": "61c24442f71ea216e9e172861d48d7676439dd18" + "reference": "b7bc503a40ccfe80ea9638e4921b4697669d725f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/captainhookphp/captainhook/zipball/61c24442f71ea216e9e172861d48d7676439dd18", - "reference": "61c24442f71ea216e9e172861d48d7676439dd18", + "url": "https://api.github.com/repos/captainhookphp/captainhook/zipball/b7bc503a40ccfe80ea9638e4921b4697669d725f", + "reference": "b7bc503a40ccfe80ea9638e4921b4697669d725f", "shasum": "" }, "require": { @@ -1762,7 +1762,7 @@ ], "support": { "issues": "https://github.com/captainhookphp/captainhook/issues", - "source": "https://github.com/captainhookphp/captainhook/tree/5.18.2" + "source": "https://github.com/captainhookphp/captainhook/tree/5.18.3" }, "funding": [ { @@ -1770,7 +1770,7 @@ "type": "github" } ], - "time": "2023-10-16T15:13:42+00:00" + "time": "2023-11-05T13:56:19+00:00" }, { "name": "captainhook/plugin-composer", @@ -2247,16 +2247,16 @@ }, { "name": "filp/whoops", - "version": "2.15.3", + "version": "2.15.4", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "c83e88a30524f9360b11f585f71e6b17313b7187" + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/c83e88a30524f9360b11f585f71e6b17313b7187", - "reference": "c83e88a30524f9360b11f585f71e6b17313b7187", + "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546", + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546", "shasum": "" }, "require": { @@ -2306,7 +2306,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.15.3" + "source": "https://github.com/filp/whoops/tree/2.15.4" }, "funding": [ { @@ -2314,54 +2314,54 @@ "type": "github" } ], - "time": "2023-07-13T12:00:00+00:00" + "time": "2023-11-03T12:00:00+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.37.1", + "version": "v3.40.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "c3fe76976081ab871aa654e872da588077e19679" + "reference": "27d2b3265b5d550ec411b4319967ae7cfddfb2e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/c3fe76976081ab871aa654e872da588077e19679", - "reference": "c3fe76976081ab871aa654e872da588077e19679", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/27d2b3265b5d550ec411b4319967ae7cfddfb2e0", + "reference": "27d2b3265b5d550ec411b4319967ae7cfddfb2e0", "shasum": "" }, "require": { - "composer/semver": "^3.3", + "composer/semver": "^3.4", "composer/xdebug-handler": "^3.0.3", "ext-json": "*", "ext-tokenizer": "*", "php": "^7.4 || ^8.0", "sebastian/diff": "^4.0 || ^5.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/filesystem": "^5.4 || ^6.0", - "symfony/finder": "^5.4 || ^6.0", - "symfony/options-resolver": "^5.4 || ^6.0", - "symfony/polyfill-mbstring": "^1.27", - "symfony/polyfill-php80": "^1.27", - "symfony/polyfill-php81": "^1.27", - "symfony/process": "^5.4 || ^6.0", - "symfony/stopwatch": "^5.4 || ^6.0" + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", - "keradus/cli-executor": "^2.0", + "keradus/cli-executor": "^2.1", "mikey179/vfsstream": "^1.6.11", - "php-coveralls/php-coveralls": "^2.5.3", + "php-coveralls/php-coveralls": "^2.7", "php-cs-fixer/accessible-object": "^1.1", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", - "phpspec/prophecy": "^1.16", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", + "phpspec/prophecy": "^1.17", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5", - "symfony/phpunit-bridge": "^6.2.3", - "symfony/yaml": "^5.4 || ^6.0" + "phpunit/phpunit": "^9.6", + "symfony/phpunit-bridge": "^6.3.8 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -2399,7 +2399,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.37.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.40.0" }, "funding": [ { @@ -2407,7 +2407,7 @@ "type": "github" } ], - "time": "2023-10-29T20:51:23+00:00" + "time": "2023-11-26T09:25:53+00:00" }, { "name": "humbug/box", @@ -2521,16 +2521,16 @@ }, { "name": "humbug/php-scoper", - "version": "0.18.4", + "version": "0.18.7", "source": { "type": "git", "url": "https://github.com/humbug/php-scoper.git", - "reference": "d79c1486537280c21c907e9a8a610eceb391407f" + "reference": "9386a0af946f175d7a1ebfb68851bc2bb8ad7858" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/humbug/php-scoper/zipball/d79c1486537280c21c907e9a8a610eceb391407f", - "reference": "d79c1486537280c21c907e9a8a610eceb391407f", + "url": "https://api.github.com/repos/humbug/php-scoper/zipball/9386a0af946f175d7a1ebfb68851bc2bb8ad7858", + "reference": "9386a0af946f175d7a1ebfb68851bc2bb8ad7858", "shasum": "" }, "require": { @@ -2548,7 +2548,7 @@ "bamarni/composer-bin-plugin": "^1.1", "ergebnis/composer-normalize": "^2.28", "fidry/makefile": "^1.0", - "humbug/box": "^4.0", + "humbug/box": "^4.5.1", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.0", "symfony/yaml": "^6.1" @@ -2598,9 +2598,9 @@ "description": "Prefixes all PHP namespaces in a file or directory.", "support": { "issues": "https://github.com/humbug/php-scoper/issues", - "source": "https://github.com/humbug/php-scoper/tree/0.18.4" + "source": "https://github.com/humbug/php-scoper/tree/0.18.7" }, - "time": "2023-10-20T17:14:04+00:00" + "time": "2023-11-04T18:01:12+00:00" }, { "name": "jetbrains/phpstorm-stubs", @@ -2722,16 +2722,16 @@ }, { "name": "laravel/serializable-closure", - "version": "v1.3.2", + "version": "v1.3.3", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "076fe2cf128bd54b4341cdc6d49b95b34e101e4c" + "reference": "3dbf8a8e914634c48d389c1234552666b3d43754" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/076fe2cf128bd54b4341cdc6d49b95b34e101e4c", - "reference": "076fe2cf128bd54b4341cdc6d49b95b34e101e4c", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3dbf8a8e914634c48d389c1234552666b3d43754", + "reference": "3dbf8a8e914634c48d389c1234552666b3d43754", "shasum": "" }, "require": { @@ -2778,7 +2778,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2023-10-17T13:38:16+00:00" + "time": "2023-11-08T14:08:06+00:00" }, { "name": "myclabs/deep-copy", @@ -3477,16 +3477,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.2", + "version": "1.24.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bcad8d995980440892759db0c32acae7c8e79442" + "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", - "reference": "bcad8d995980440892759db0c32acae7c8e79442", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6bd0c26f3786cd9b7c359675cb789e35a8e07496", + "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496", "shasum": "" }, "require": { @@ -3518,22 +3518,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.4" }, - "time": "2023-09-26T12:28:12+00:00" + "time": "2023-11-26T18:29:22+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.40", + "version": "1.10.44", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "93c84b5bf7669920d823631e39904d69b9c7dc5d" + "reference": "bf84367c53a23f759513985c54ffe0d0c249825b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/93c84b5bf7669920d823631e39904d69b9c7dc5d", - "reference": "93c84b5bf7669920d823631e39904d69b9c7dc5d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/bf84367c53a23f759513985c54ffe0d0c249825b", + "reference": "bf84367c53a23f759513985c54ffe0d0c249825b", "shasum": "" }, "require": { @@ -3582,20 +3582,20 @@ "type": "tidelift" } ], - "time": "2023-10-30T14:48:31+00:00" + "time": "2023-11-21T16:30:46+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.7", + "version": "10.1.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" + "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", - "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/a56a9ab2f680246adcf3db43f38ddf1765774735", + "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735", "shasum": "" }, "require": { @@ -3652,7 +3652,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.9" }, "funding": [ { @@ -3660,7 +3660,7 @@ "type": "github" } ], - "time": "2023-10-04T15:34:17+00:00" + "time": "2023-11-23T12:23:20+00:00" }, { "name": "phpunit/php-file-iterator", @@ -5292,7 +5292,7 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", @@ -5348,7 +5348,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.4.0" }, "funding": [ { @@ -5685,16 +5685,16 @@ }, { "name": "symfony/var-dumper", - "version": "v6.3.6", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "999ede244507c32b8e43aebaa10e9fce20de7c97" + "reference": "81acabba9046550e89634876ca64bfcd3c06aa0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/999ede244507c32b8e43aebaa10e9fce20de7c97", - "reference": "999ede244507c32b8e43aebaa10e9fce20de7c97", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/81acabba9046550e89634876ca64bfcd3c06aa0a", + "reference": "81acabba9046550e89634876ca64bfcd3c06aa0a", "shasum": "" }, "require": { @@ -5749,7 +5749,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.3.6" + "source": "https://github.com/symfony/var-dumper/tree/v6.3.8" }, "funding": [ { @@ -5765,7 +5765,7 @@ "type": "tidelift" } ], - "time": "2023-10-12T18:45:56+00:00" + "time": "2023-11-08T10:42:36+00:00" }, { "name": "thecodingmachine/safe", @@ -5908,16 +5908,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -5946,7 +5946,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -5954,7 +5954,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" }, { "name": "webmozart/assert", From 9dcda873f3ed7dd6a40fa52157c23236d778925e Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Mon, 27 Nov 2023 22:35:40 +0800 Subject: [PATCH 40/80] Fix debian libtool bug (#276) * add libtool installation for debian * update composer lock * re-fix libtool check * re-fix libtool check --- src/SPC/doctor/item/LinuxToolCheckList.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index 7755f838..33aa0639 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -28,7 +28,7 @@ class LinuxToolCheckList 'git', 'autoconf', 'automake', 'tar', 'unzip', 'gzip', 'bzip2', 'cmake', 'patch', - 'xz', 'libtool', + 'xz', 'libtoolize', ]; public const TOOLS_RHEL = [ @@ -102,6 +102,7 @@ class LinuxToolCheckList try { $is_debian = in_array($distro['dist'], ['debian', 'ubuntu']); $to_install = $is_debian ? str_replace('xz', 'xz-utils', $missing) : $missing; + $to_install = $is_debian ? str_replace('libtoolize', 'libtool', $to_install) : $to_install; shell(true)->exec($prefix . $install_cmd . ' ' . implode(' ', $to_install)); } catch (RuntimeException) { return false; From 1c307d0d594a0b3139446d0bcd5e1a28c805ddaa Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 13:30:12 +0800 Subject: [PATCH 41/80] 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 42/80] 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 43/80] 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 44/80] 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 45/80] 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 46/80] 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 cee1346bec042fcd7a8f096eee2130b8bf7924a3 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 29 Nov 2023 00:51:05 +0800 Subject: [PATCH 47/80] fix imagemagick linking issue --- src/SPC/builder/extension/imagick.php | 5 ++++- src/SPC/builder/unix/library/imagemagick.php | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/extension/imagick.php b/src/SPC/builder/extension/imagick.php index ef965d58..d7721a24 100644 --- a/src/SPC/builder/extension/imagick.php +++ b/src/SPC/builder/extension/imagick.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\builder\linux\LinuxBuilder; use SPC\util\CustomExt; #[CustomExt('imagick')] @@ -14,7 +15,9 @@ class imagick extends Extension { // imagick may call omp_pause_all which requires -lgomp $extra_libs = $this->builder->getOption('extra-libs', ''); - $extra_libs .= ' -lgomp '; + if ($this->builder instanceof LinuxBuilder) { + $extra_libs .= ' -lgomp '; + } $this->builder->setOption('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 bd4d0424..a75969ac 100644 --- a/src/SPC/builder/unix/library/imagemagick.php +++ b/src/SPC/builder/unix/library/imagemagick.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace SPC\builder\unix\library; use SPC\builder\linux\library\LinuxLibraryBase; +use SPC\builder\macos\library\MacOSLibraryBase; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\store\FileSystem; @@ -39,8 +40,12 @@ trait imagemagick } $ldflags = $this instanceof LinuxLibraryBase ? ('LDFLAGS="-static" ') : ''; + + // libxml iconv patch + $required_libs .= $this instanceof MacOSLibraryBase ? (' -liconv') : ''; shell()->cd($this->source_dir) ->exec( + 'PKG_CONFIG="$PKG_CONFIG --static" ' . $ldflags . "LIBS='{$required_libs}' " . './configure ' . From 8ed95602e2c69c22075c4cb78ebb7f851de1b571 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 29 Nov 2023 00:55:04 +0800 Subject: [PATCH 48/80] add 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 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 edfd371973be54bf28fdf7b84c1d00c2d75058cd Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 29 Nov 2023 01:01:19 +0800 Subject: [PATCH 49/80] bypass error: unknown warning option '-Wno-logical-op' for macOS --- src/SPC/builder/extension/sodium.php | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/SPC/builder/extension/sodium.php diff --git a/src/SPC/builder/extension/sodium.php b/src/SPC/builder/extension/sodium.php new file mode 100644 index 00000000..18059774 --- /dev/null +++ b/src/SPC/builder/extension/sodium.php @@ -0,0 +1,35 @@ +removeLineContainingString(); + } + + private function removeLineContainingString(): bool + { + $path = SOURCE_PATH . '/php-src/ext/sodium/config.m4'; + $search = '-Wno-logical-op'; + if (!file_exists($path)) { + return false; + } + $content = file_get_contents($path); + $lines = preg_split('/\r\n|\n/', $content); + $filteredLines = array_filter($lines, function ($line) use ($search) { + return strpos($line, $search) === false; + }); + $newContent = implode("\n", $filteredLines); + file_put_contents($path, $newContent); + return true; + } +} From 6b23c90bba480d8643f8a2a8bdb101be8bfd68af Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 29 Nov 2023 16:52:53 +0800 Subject: [PATCH 50/80] 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 51/80] 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 52/80] 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 53/80] 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 54/80] 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 55/80] 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 56/80] 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 57/80] 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 58/80] 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 59/80] 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 60/80] 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 61/80] 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 62/80] 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 63/80] 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 64/80] 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 c1758bd75466a36a0c86d8efc72f4002003e5787 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Thu, 7 Dec 2023 16:01:12 +0800 Subject: [PATCH 65/80] Update README.md --- README.md | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index cd714f70..1edbc56a 100755 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You can also use the micro binary file to combine php binary and php source code [![](https://img.shields.io/badge/Extension%20Counter-65+-yellow.svg?style=flat-square)]() [![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]() -## Docs +## Documentation The current README contains basic usage. For all the features of static-php-cli, see . @@ -135,7 +135,7 @@ Basic usage for building php and micro with some extensions: > If you are using the packaged `spc` binary, you need to replace `bin/spc` with `./spc` in the following commands. ```bash -# Check system tool dependencies, fix them automatically +# Check system tool dependencies, fix them if possible ./bin/spc doctor # fetch all libraries ./bin/spc download --all @@ -167,7 +167,7 @@ If anything goes wrong, use `--debug` option to display full terminal output: ./bin/spc fetch --all --debug ``` -In addition, we build NTS by default. If you are going to build ZTS version, just add `--enable-zts` option. +In addition, we build NTS (non-thread-safe) by default. If you are going to build ZTS version, just add `--enable-zts` option. ```bash ./bin/spc build openssl,pcntl --build-all --enable-zts @@ -236,7 +236,7 @@ When using the parameter `--build-all` or `--build-fpm`, the final compilation result will output a file named `./php-fpm`, This file will be located in the path `buildroot/bin/`, simply copy it out for use. -In normal Linux distributions and macOS systems, the package manager will automatically generate a default fpm configuration file after installing php-fpm. +In common Linux distributions and macOS systems, the package manager will automatically generate a default fpm configuration file after installing php-fpm. Because php-fpm must specify a configuration file before running, the php-fpm compiled by this project will not have any configuration files, so you need to write `php-fpm.conf` and `pool.conf` configuration files yourself. Specifying `php-fpm.conf` can use the command parameter `-y`, for example: `./php-fpm -y php-fpm.conf`. @@ -262,10 +262,6 @@ If you want to contribute documentation, please go to [static-php/static-php-cli Now there is a [static-php](https://github.com/static-php) organization, which is used to store the repo related to the project. -Part of the English document is written by me, and part is translated by Google, -and there may be inaccurate descriptions, strange or offensive expressions. -If you are a native English speaker, some corrections to the documentation are welcome. - ## Sponsor this project You can sponsor my project on [this page](https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md). @@ -288,8 +284,3 @@ and they all have their own open source licenses. Please use the `bin/spc dump-license` command to export the open source licenses used in the project after compilation, and comply with the corresponding project's LICENSE. -## Advanced - -The refactoring branch of this project is written modularly. -If you are interested in this project and want to join the development, -you can refer to the [Contribution Guide](https://static-php.dev) of the documentation to contribute code or documentation. From c7e929490828b204584af3271423600397e09e67 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 10 Dec 2023 18:27:19 +0800 Subject: [PATCH 66/80] fix libtool missing bug for freetype --- bin/spc-alpine-docker | 1 + src/SPC/doctor/item/LinuxToolCheckList.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/spc-alpine-docker b/bin/spc-alpine-docker index e807a2df..87e52968 100755 --- a/bin/spc-alpine-docker +++ b/bin/spc-alpine-docker @@ -73,6 +73,7 @@ RUN apk update; \ git \ jq \ libgcc \ + libtool \ libstdc++ \ linux-headers \ m4 \ diff --git a/src/SPC/doctor/item/LinuxToolCheckList.php b/src/SPC/doctor/item/LinuxToolCheckList.php index 33aa0639..01df03d6 100644 --- a/src/SPC/doctor/item/LinuxToolCheckList.php +++ b/src/SPC/doctor/item/LinuxToolCheckList.php @@ -21,6 +21,7 @@ class LinuxToolCheckList 'tar', 'unzip', 'gzip', 'bzip2', 'cmake', 'gcc', 'g++', 'patch', 'binutils-gold', + 'libtoolize', ]; public const TOOLS_DEBIAN = [ @@ -102,7 +103,8 @@ class LinuxToolCheckList try { $is_debian = in_array($distro['dist'], ['debian', 'ubuntu']); $to_install = $is_debian ? str_replace('xz', 'xz-utils', $missing) : $missing; - $to_install = $is_debian ? str_replace('libtoolize', 'libtool', $to_install) : $to_install; + // debian, alpine libtool -> libtoolize + $to_install = str_replace('libtoolize', 'libtool', $to_install); shell(true)->exec($prefix . $install_cmd . ' ' . implode(' ', $to_install)); } catch (RuntimeException) { return false; From f0319de93e7c7720c1dae3f5e03d64ab5a44e328 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 10 Dec 2023 18:27:52 +0800 Subject: [PATCH 67/80] opcache limit php version --- config/ext.json | 3 ++- src/SPC/builder/extension/opcache.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/config/ext.json b/config/ext.json index e38bacb6..2df51239 100644 --- a/config/ext.json +++ b/config/ext.json @@ -228,7 +228,8 @@ ] }, "opcache": { - "type": "builtin" + "type": "builtin", + "arg-type": "custom" }, "openssl": { "type": "builtin", diff --git a/src/SPC/builder/extension/opcache.php b/src/SPC/builder/extension/opcache.php index f592303a..82efc853 100644 --- a/src/SPC/builder/extension/opcache.php +++ b/src/SPC/builder/extension/opcache.php @@ -5,11 +5,25 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\exception\RuntimeException; +use SPC\exception\WrongUsageException; use SPC\util\CustomExt; #[CustomExt('opcache')] class opcache extends Extension { + /** + * @throws WrongUsageException + * @throws RuntimeException + */ + public function getUnixConfigureArg(): string + { + if ($this->builder->getPHPVersionID() < 80000) { + throw new WrongUsageException('Statically compiled PHP with Zend Opcache only available for PHP >= 8.0 !'); + } + return '--enable-opcache'; + } + public function getDistName(): string { return 'Zend Opcache'; From 42f448cf1799d064894b36d1dbcb6f28d94a3daf Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 10 Dec 2023 18:28:15 +0800 Subject: [PATCH 68/80] reformat build log --- src/SPC/command/BuildCliCommand.php | 77 +++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/src/SPC/command/BuildCliCommand.php b/src/SPC/command/BuildCliCommand.php index 72235847..5bd0bba3 100644 --- a/src/SPC/command/BuildCliCommand.php +++ b/src/SPC/command/BuildCliCommand.php @@ -16,7 +16,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use ZM\Logger\ConsoleColor; -#[AsCommand('build', 'build CLI binary')] +#[AsCommand('build', 'build PHP')] class BuildCliCommand extends BuildCommand { public function configure(): void @@ -33,6 +33,8 @@ class BuildCliCommand extends BuildCommand $this->addOption('disable-opcache-jit', null, null, 'disable opcache jit'); $this->addOption('with-hardcoded-ini', 'I', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Patch PHP source code, inject hardcoded INI'); $this->addOption('with-micro-fake-cli', null, null, 'Enable phpmicro fake cli'); + $this->addOption('with-suggested-libs', 'L', null, 'Build with suggested libs for selected exts and libs'); + $this->addOption('with-suggested-exts', 'E', null, 'Build with suggested extensions for selected exts'); } public function handle(): int @@ -42,12 +44,9 @@ class BuildCliCommand extends BuildCommand // transform string to array $extensions = array_map('trim', array_filter(explode(',', $this->getArgument('extensions')))); - $rule = BUILD_TARGET_NONE; - $rule |= ($this->getOption('build-cli') ? BUILD_TARGET_CLI : BUILD_TARGET_NONE); - $rule |= ($this->getOption('build-micro') ? BUILD_TARGET_MICRO : BUILD_TARGET_NONE); - $rule |= ($this->getOption('build-fpm') ? BUILD_TARGET_FPM : BUILD_TARGET_NONE); - $rule |= ($this->getOption('build-embed') ? BUILD_TARGET_EMBED : BUILD_TARGET_NONE); - $rule |= ($this->getOption('build-all') ? BUILD_TARGET_ALL : BUILD_TARGET_NONE); + // parse rule with options + $rule = $this->parseRules(); + if ($rule === BUILD_TARGET_NONE) { $this->output->writeln('Please add at least one build target!'); $this->output->writeln("\t--build-cli\tBuild php-cli SAPI"); @@ -62,16 +61,27 @@ class BuildCliCommand extends BuildCommand $builder = BuilderProvider::makeBuilderByInput($this->input); // calculate dependencies [$extensions, $libraries, $not_included] = DependencyUtil::getExtLibsByDeps($extensions, $libraries); - /* @phpstan-ignore-next-line */ - logger()->info('Build target: ' . ConsoleColor::yellow($builder->getBuildTypeName($rule))); - /* @phpstan-ignore-next-line */ - logger()->info('Enabled extensions: ' . ConsoleColor::yellow(implode(', ', $extensions))); - /* @phpstan-ignore-next-line */ - logger()->info('Required libraries: ' . ConsoleColor::yellow(implode(', ', $libraries))); - if (!empty($not_included)) { - logger()->warning('some extensions will be enabled due to dependencies: ' . implode(',', $not_included)); + + // print info + $indent_texts = [ + 'Build OS' => PHP_OS_FAMILY . ' (' . php_uname('m') . ')', + 'Build SAPI' => $builder->getBuildTypeName($rule), + 'Extensions (' . count($extensions) . ')' => implode(', ', $extensions), + 'Libraries (' . count($libraries) . ')' => implode(', ', $libraries), + 'Strip Binaries' => $builder->getOption('no-strip') ? 'no' : 'yes', + 'Enable ZTS' => $builder->getOption('enable-zts') ? 'yes' : 'no', + ]; + if (!empty($this->input->getOption('with-hardcoded-ini'))) { + $indent_texts['Hardcoded INI'] = $this->input->getOption('with-hardcoded-ini'); } + $this->printFormatInfo($indent_texts); + + if (!empty($not_included)) { + logger()->warning('Some extensions will be enabled due to dependencies: ' . implode(',', $not_included)); + } + logger()->info('Build will start after 2s ...'); sleep(2); + if ($this->input->getOption('with-clean')) { logger()->info('Cleaning source dir...'); FileSystem::removeDir(SOURCE_PATH); @@ -140,4 +150,41 @@ class BuildCliCommand extends BuildCommand return static::FAILURE; } } + + /** + * Parse build options to rule int. + */ + private function parseRules(): int + { + $rule = BUILD_TARGET_NONE; + $rule |= ($this->getOption('build-cli') ? BUILD_TARGET_CLI : BUILD_TARGET_NONE); + $rule |= ($this->getOption('build-micro') ? BUILD_TARGET_MICRO : BUILD_TARGET_NONE); + $rule |= ($this->getOption('build-fpm') ? BUILD_TARGET_FPM : BUILD_TARGET_NONE); + $rule |= ($this->getOption('build-embed') ? BUILD_TARGET_EMBED : BUILD_TARGET_NONE); + $rule |= ($this->getOption('build-all') ? BUILD_TARGET_ALL : BUILD_TARGET_NONE); + return $rule; + } + + private function printFormatInfo(array $indent_texts): void + { + // calculate space count for every line + $maxlen = 0; + foreach ($indent_texts as $k => $v) { + $maxlen = max(strlen($k), $maxlen); + } + foreach ($indent_texts as $k => $v) { + if (is_string($v)) { + /* @phpstan-ignore-next-line */ + logger()->info($k . ': ' . str_pad('', $maxlen - strlen($k)) . ConsoleColor::yellow($v)); + } elseif (is_array($v) && !is_assoc_array($v)) { + $first = array_shift($v); + /* @phpstan-ignore-next-line */ + logger()->info($k . ': ' . str_pad('', $maxlen - strlen($k)) . ConsoleColor::yellow($first)); + foreach ($v as $vs) { + /* @phpstan-ignore-next-line */ + logger()->info(str_pad('', $maxlen + 2) . ConsoleColor::yellow($vs)); + } + } + } + } } From 3e9ddc8e0122822c5d7ed137ed2e46c994fcfb61 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 10 Dec 2023 20:43:52 +0800 Subject: [PATCH 69/80] update to rc9 --- src/SPC/ConsoleApplication.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 2de132e0..73b354be 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -23,7 +23,7 @@ use Symfony\Component\Console\Command\ListCommand; */ final class ConsoleApplication extends Application { - public const VERSION = '2.0.0-rc8'; + public const VERSION = '2.0.0-rc9'; public function __construct() { From 0cfac49560734c4f6e92fa3ee89b9c808c011cef Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 15 Dec 2023 00:34:22 +0800 Subject: [PATCH 70/80] 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 71/80] 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 72/80] 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; From ed8b60676152658d0ed7af833b7080e0db3ddc72 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 16 Dec 2023 15:07:04 +0800 Subject: [PATCH 73/80] add libtool for macos doctor --- src/SPC/doctor/item/MacOSToolCheckList.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/doctor/item/MacOSToolCheckList.php b/src/SPC/doctor/item/MacOSToolCheckList.php index df1e6ed4..9f43e8fb 100644 --- a/src/SPC/doctor/item/MacOSToolCheckList.php +++ b/src/SPC/doctor/item/MacOSToolCheckList.php @@ -25,6 +25,7 @@ class MacOSToolCheckList 'autoconf', 'automake', 'tar', + 'libtool', 'unzip', 'xz', 'gzip', From ea64e50ce5762077dc990be1d08504c3c59d5add Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 16 Dec 2023 18:49:38 +0800 Subject: [PATCH 74/80] fix SourcePatcher::patchFile not working with spc binary --- src/SPC/store/SourcePatcher.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index b0edc303..426f978a 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -134,6 +134,12 @@ class SourcePatcher $patch_file = ROOT_DIR . "/src/globals/patch/{$patch_name}"; $patch_str = str_replace('/', DIRECTORY_SEPARATOR, $patch_file); + // copy patch from phar + if (\Phar::running() !== '') { + file_put_contents(SOURCE_PATH . '/' . $patch_name, file_get_contents($patch_file)); + $patch_str = str_replace('/', DIRECTORY_SEPARATOR, SOURCE_PATH . '/' . $patch_name); + } + f_passthru( 'cd ' . $cwd . ' && ' . (PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patch_str . ' | patch -p1 ' . ($reverse ? '-R' : '') From 1f7bdb94fb9f0cff322936a69d4047ffd62a4270 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 17 Dec 2023 01:02:02 +0800 Subject: [PATCH 75/80] update README --- README-zh.md | 5 +++-- README.md | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README-zh.md b/README-zh.md index e8aac2c3..3e31ae79 100755 --- a/README-zh.md +++ b/README-zh.md @@ -28,9 +28,10 @@ Build single static PHP binary, with PHP project together, with popular extensio ## 自托管直接下载 -如果你不想自行编译 PHP,可以从本项目现有的示例 Action 下载 Artifact,也可以从自托管的服务器下载:[进入](https://dl.static-php.dev/static-php-cli/common/) +如果你不想自行编译 PHP,可以从本项目现有的示例 Action 下载 Artifact,也可以从自托管的服务器下载。 -> 自托管的服务器默认包含的扩展有:`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` +- [扩展组合 - common](https://dl.static-php.dev/static-php-cli/common/):common 组合包含了约 [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) 个常用扩展,体积为 22MB 左右。 +- [扩展组合 - bulk](https://dl.static-php.dev/static-php-cli/bulk/):bulk 组合包含了 [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) 个扩展,体积为 70MB 左右。 ## 使用 static-php-cli 构建 PHP diff --git a/README.md b/README.md index 1edbc56a..61dd9f2f 100755 --- a/README.md +++ b/README.md @@ -31,9 +31,13 @@ see . ## Direct Download -If you don't want to compile yourself, you can download example pre-compiled artifact from [Actions](https://github.com/static-php/static-php-cli-hosted/actions/workflows/build-php-common.yml), or from [self-hosted server](https://dl.static-php.dev/static-php-cli/common/). +If you don't want to compile yourself, you can download example pre-compiled artifact from [Actions](https://github.com/static-php/static-php-cli-hosted/actions/workflows/build-php-common.yml), or from self-hosted server. -> self-hosted server contains extensions: `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` +Below are several precompiled static-php binaries with different extension combinations, +which can be downloaded directly according to your needs. + +- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): The common combination contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB. +- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): The bulk package contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size. ## Use static-php-cli to build PHP From bc15de0dfb925249b95f725769cfea7e99b1838d Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sun, 17 Dec 2023 01:03:32 +0800 Subject: [PATCH 76/80] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61dd9f2f..40c28991 100755 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ If you don't want to compile yourself, you can download example pre-compiled art Below are several precompiled static-php binaries with different extension combinations, which can be downloaded directly according to your needs. -- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): The common combination contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB. -- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): The bulk package contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size. +- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` combination contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB. +- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` combination contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size. ## Use static-php-cli to build PHP From a5fa46b82dfc92d48a2b21405ca4b4eb34ba9f67 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 17 Dec 2023 01:35:28 +0800 Subject: [PATCH 77/80] update README --- README-zh.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README-zh.md b/README-zh.md index 3e31ae79..da571330 100755 --- a/README-zh.md +++ b/README-zh.md @@ -32,6 +32,7 @@ Build single static PHP binary, with PHP project together, with popular extensio - [扩展组合 - common](https://dl.static-php.dev/static-php-cli/common/):common 组合包含了约 [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) 个常用扩展,体积为 22MB 左右。 - [扩展组合 - bulk](https://dl.static-php.dev/static-php-cli/bulk/):bulk 组合包含了 [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) 个扩展,体积为 70MB 左右。 +- [扩展组合 - minimal](https://dl.static-php.dev/static-php-cli/minimal/):minimal 组合包含了 [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) 个扩展,体积为 6MB 左右。 ## 使用 static-php-cli 构建 PHP diff --git a/README.md b/README.md index 40c28991..cc626e40 100755 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ which can be downloaded directly according to your needs. - [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` combination contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB. - [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` combination contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size. +- [Extension-Combination - minimal](https://dl.static-php.dev/static-php-cli/minimal/): `minimal` combination contains [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) extensions and is about 6MB in size. ## Use static-php-cli to build PHP From d72ee53cb42d720a6a96695eebfa13da48d02168 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sun, 17 Dec 2023 02:02:00 +0800 Subject: [PATCH 78/80] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc626e40..0926ea29 100755 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ cat buildroot/bin/micro.sfx my-app.phar > my-app && chmod +x my-app bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=system" --output my-app-2 ``` -> In some cases, PHAR files may not run in a micro environment. +> In some cases, PHAR files may not run in a micro environment. Overall, micro is not production ready. ### Use fpm From 33e1759caa0b8192eeaf8f7baa0b150e76cdb5de Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sun, 17 Dec 2023 12:16:54 +0800 Subject: [PATCH 79/80] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0926ea29..faedaf13 100755 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ If you don't want to compile yourself, you can download example pre-compiled art Below are several precompiled static-php binaries with different extension combinations, which can be downloaded directly according to your needs. -- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` combination contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB. -- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` combination contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size. -- [Extension-Combination - minimal](https://dl.static-php.dev/static-php-cli/minimal/): `minimal` combination contains [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) extensions and is about 6MB in size. +- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB. +- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size. +- [Extension-Combination - minimal](https://dl.static-php.dev/static-php-cli/minimal/): `minimal` contains [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) extensions and is about 6MB in size. ## Use static-php-cli to build PHP From b961c34d9a8b85e296fff5f8b3ac7c2cfb316940 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 18 Dec 2023 00:14:14 +0800 Subject: [PATCH 80/80] add 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 73b57056..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,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'; +$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;