From 7b6fae6d920e877a083d6c461b8ac226d6acaa36 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sun, 23 Mar 2025 22:33:26 +0800 Subject: [PATCH 1/4] Fix windows ssl bug for curl (#674) --- config/lib.json | 1 - src/SPC/ConsoleApplication.php | 2 +- src/SPC/builder/windows/library/curl.php | 2 ++ src/globals/ext-tests/curl.php | 13 +++++++++++++ src/globals/test-extensions.php | 14 +++++++------- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/config/lib.json b/config/lib.json index eb009f21..9656fcc1 100644 --- a/config/lib.json +++ b/config/lib.json @@ -78,7 +78,6 @@ "zlib" ], "lib-depends-windows": [ - "openssl", "zlib", "libssh2", "nghttp2" diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 752cb999..5240ca55 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -32,7 +32,7 @@ use Symfony\Component\Console\Application; */ final class ConsoleApplication extends Application { - public const VERSION = '2.5.0'; + public const VERSION = '2.5.1'; public function __construct() { diff --git a/src/SPC/builder/windows/library/curl.php b/src/SPC/builder/windows/library/curl.php index df195735..a758bf05 100644 --- a/src/SPC/builder/windows/library/curl.php +++ b/src/SPC/builder/windows/library/curl.php @@ -37,6 +37,8 @@ class curl extends WindowsLibraryBase '-DBUILD_EXAMPLES=OFF ' . // disable examples '-DUSE_LIBIDN2=OFF ' . // disable libidn2 '-DCURL_USE_LIBPSL=OFF ' . // disable libpsl + '-DCURL_USE_SCHANNEL=ON ' . // use Schannel instead of OpenSSL + '-DCURL_USE_OPENSSL=OFF ' . // disable openssl due to certificate issue '-DCURL_ENABLE_SSL=ON ' . '-DUSE_NGHTTP2=ON ' . // enable nghttp2 '-DCURL_USE_LIBSSH2=ON ' . // enable libssh2 diff --git a/src/globals/ext-tests/curl.php b/src/globals/ext-tests/curl.php index e088cbf4..a890a8cf 100644 --- a/src/globals/ext-tests/curl.php +++ b/src/globals/ext-tests/curl.php @@ -3,3 +3,16 @@ declare(strict_types=1); assert(function_exists('curl_init')); +assert(function_exists('curl_setopt')); +assert(function_exists('curl_exec')); +assert(function_exists('curl_close')); +$curl_version = curl_version(); +if (stripos($curl_version['ssl_version'], 'schannel') !== false) { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, 'https://example.com/'); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_HEADER, 0); + $data = curl_exec($curl); + curl_close($curl); + assert($data !== false); +} diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 85f47e1e..9322cee1 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,10 +21,10 @@ $test_php_version = [ // test os (macos-13, macos-14, ubuntu-latest, windows-latest are available) $test_os = [ - 'macos-13', - 'macos-14', + // 'macos-13', + // 'macos-14', 'ubuntu-latest', - // 'windows-latest', + 'windows-latest', ]; // whether enable thread safe @@ -41,20 +41,20 @@ $prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => '', - 'Windows' => 'bz2,ctype,curl,dom,filter,gd,iconv,mbstring,opcache,openssl,pdo,pdo_sqlite,phar,session,simplexml,sqlite3,tokenizer,xml,xmlwriter,yaml,zip,zlib', + 'Windows' => 'mbstring,tokenizer,phar,curl,openssl', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'mimalloc', - 'Windows' => 'libjpeg,libavif,freetype,libwebp', + 'Linux', 'Darwin' => '', + 'Windows' => '', }; // Please change your test base combination. We recommend testing with `common`. // You can use `common`, `bulk`, `minimal` or `none`. // note: combination is only available for *nix platform. Windows must use `none` combination $base_combination = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'bulk', + 'Linux', 'Darwin' => 'minimal', 'Windows' => 'none', }; From 161a3924d2aceb61cf78b28a29a6e754bd3d534d Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sun, 23 Mar 2025 22:55:25 +0800 Subject: [PATCH 2/4] Fix windows micro logo changer bug (illegal realpath) (#675) --- src/SPC/builder/windows/WindowsBuilder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/builder/windows/WindowsBuilder.php b/src/SPC/builder/windows/WindowsBuilder.php index 1c43c375..fb7eaa0f 100644 --- a/src/SPC/builder/windows/WindowsBuilder.php +++ b/src/SPC/builder/windows/WindowsBuilder.php @@ -95,8 +95,9 @@ class WindowsBuilder extends BuilderBase if (($logo = $this->getOption('with-micro-logo')) !== null) { // realpath - $logo = realpath($logo); + // $logo = realpath($logo); $micro_logo = '--enable-micro-logo=' . $logo . ' '; + copy($logo, SOURCE_PATH . '\php-src\\' . $logo); } else { $micro_logo = ''; } From 3ba215c35c6ae27689fd1cdb47c93049a13ddd81 Mon Sep 17 00:00:00 2001 From: tricker Date: Sun, 23 Mar 2025 16:26:36 +0100 Subject: [PATCH 3/4] enable PDO_ODBC and ODBC extension statically (#661) * enable PDO_ODBC and ODBC extension statically * fix sorting of ext.json * add odbc and pdo_odbc extension to tests * Add full tests, remove pdo_odbc from bulk * Remove windows support for docs * Add ODBC and PDO_ODBC extension * Revert curl static lib * Add full tests * Add iconv for macOS * Add tests * Fix linux pdo_odbc patch * Sort config --------- Co-authored-by: crazywhalecc --- config/ext.json | 25 ++++++++++++++++++++++ src/SPC/builder/extension/odbc.php | 17 +++++++++++++++ src/SPC/builder/extension/pdo_odbc.php | 29 ++++++++++++++++++++++++++ src/globals/test-extensions.php | 8 +++---- 4 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 src/SPC/builder/extension/odbc.php create mode 100644 src/SPC/builder/extension/pdo_odbc.php diff --git a/config/ext.json b/config/ext.json index 4d6044b3..5650b9d8 100644 --- a/config/ext.json +++ b/config/ext.json @@ -426,6 +426,17 @@ }, "notes": true }, + "odbc": { + "support": { + "BSD": "wip", + "Windows": "wip" + }, + "type": "builtin", + "arg-type-unix": "custom", + "lib-depends-unix": [ + "unixodbc" + ] + }, "opcache": { "type": "builtin", "arg-type-unix": "custom" @@ -492,6 +503,20 @@ "mysqlnd" ] }, + "pdo_odbc": { + "support": { + "BSD": "wip" + }, + "type": "builtin", + "arg-type": "custom", + "lib-depends-unix": [ + "unixodbc" + ], + "ext-depends": [ + "pdo", + "odbc" + ] + }, "pdo_pgsql": { "support": { "Windows": "wip", diff --git a/src/SPC/builder/extension/odbc.php b/src/SPC/builder/extension/odbc.php new file mode 100644 index 00000000..6234f4e8 --- /dev/null +++ b/src/SPC/builder/extension/odbc.php @@ -0,0 +1,17 @@ + '', - 'Windows' => 'mbstring,tokenizer,phar,curl,openssl', + 'Linux', 'Darwin' => 'odbc,pdo_odbc', + 'Windows' => 'odbc,pdo_odbc', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). From ee54b6d347d07bf00262ab4411c3643937991d99 Mon Sep 17 00:00:00 2001 From: tricker Date: Mon, 24 Mar 2025 05:47:00 +0100 Subject: [PATCH 4/4] Add pgsql extension for Windows <#664> (#665) * Add pgsql extension for Windows <#664> * Add pgsql to windows test * Added pdo_pgsql for windows, added missing header files * Adjust some configure args and deps --------- Co-authored-by: crazywhalecc --- config/ext.json | 13 ++++++--- config/lib.json | 8 ++++++ config/source.json | 8 ++++++ src/SPC/builder/extension/pdo_pgsql.php | 17 ++++++++++++ src/SPC/builder/extension/pgsql.php | 12 +++++++++ .../windows/library/postgresql_win.php | 27 +++++++++++++++++++ src/globals/test-extensions.php | 8 +++--- 7 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 src/SPC/builder/extension/pdo_pgsql.php create mode 100644 src/SPC/builder/windows/library/postgresql_win.php diff --git a/config/ext.json b/config/ext.json index 5650b9d8..5dc86c62 100644 --- a/config/ext.json +++ b/config/ext.json @@ -519,17 +519,20 @@ }, "pdo_pgsql": { "support": { - "Windows": "wip", "BSD": "wip" }, "type": "builtin", "arg-type": "with-prefix", + "arg-type-windows": "custom", "ext-depends": [ "pdo", "pgsql" ], - "lib-depends": [ + "lib-depends-unix": [ "postgresql" + ], + "lib-depends-windows": [ + "postgresql-win" ] }, "pdo_sqlite": { @@ -560,14 +563,16 @@ }, "pgsql": { "support": { - "Windows": "wip", "BSD": "wip" }, "notes": true, "type": "builtin", "arg-type": "custom", - "lib-depends": [ + "lib-depends-unix": [ "postgresql" + ], + "lib-depends-windows": [ + "postgresql-win" ] }, "phar": { diff --git a/config/lib.json b/config/lib.json index 9656fcc1..0dae815f 100644 --- a/config/lib.json +++ b/config/lib.json @@ -671,6 +671,14 @@ "zstd" ] }, + "postgresql-win": { + "source": "postgresql-win", + "static-libs": [ + "libpq.lib", + "libpgport.lib", + "libpgcommon.lib" + ] + }, "pthreads4w": { "source": "pthreads4w", "static-libs-windows": [ diff --git a/config/source.json b/config/source.json index 006c9d6b..10daf546 100644 --- a/config/source.json +++ b/config/source.json @@ -761,6 +761,14 @@ "path": "COPYRIGHT" } }, + "postgresql-win": { + "type": "url", + "url": "https://get.enterprisedb.com/postgresql/postgresql-16.8-1-windows-x64-binaries.zip", + "license": { + "type": "text", + "text": "PostgreSQL Database Management System\n(also known as Postgres, formerly as Postgres95)\n\nPortions Copyright (c) 1996-2025, The PostgreSQL Global Development Group\n\nPortions Copyright (c) 1994, The Regents of the University of California\n\nPermission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose, without fee, and without a written\nagreement is hereby granted, provided that the above copyright notice\nand this paragraph and the following two paragraphs appear in all\ncopies.\n\nIN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY\nFOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,\nINCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS\nDOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF\nTHE POSSIBILITY OF SUCH DAMAGE.\n\nTHE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\nON AN \"AS IS\" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS\nTO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." + } + }, "protobuf": { "type": "url", "url": "https://pecl.php.net/get/protobuf", diff --git a/src/SPC/builder/extension/pdo_pgsql.php b/src/SPC/builder/extension/pdo_pgsql.php new file mode 100644 index 00000000..e29014cb --- /dev/null +++ b/src/SPC/builder/extension/pdo_pgsql.php @@ -0,0 +1,17 @@ +builder->getPHPVersionID() >= 80400) { + return '--with-pgsql'; + } + return '--with-pgsql=' . BUILD_ROOT_PATH; + } } diff --git a/src/SPC/builder/windows/library/postgresql_win.php b/src/SPC/builder/windows/library/postgresql_win.php new file mode 100644 index 00000000..7f708be6 --- /dev/null +++ b/src/SPC/builder/windows/library/postgresql_win.php @@ -0,0 +1,27 @@ +source_dir . '\pgsql\lib\libpq.lib', BUILD_LIB_PATH . '\libpq.lib'); + copy($this->source_dir . '\pgsql\lib\libpgport.lib', BUILD_LIB_PATH . '\libpgport.lib'); + copy($this->source_dir . '\pgsql\lib\libpgcommon.lib', BUILD_LIB_PATH . '\libpgcommon.lib'); + + // create libpq folder in buildroot/includes/libpq + if (!file_exists(BUILD_INCLUDE_PATH . '\libpq')) { + mkdir(BUILD_INCLUDE_PATH . '\libpq'); + } + + $headerFiles = ['libpq-fe.h', 'postgres_ext.h', 'pg_config_ext.h', 'libpq\libpq-fs.h']; + foreach ($headerFiles as $header) { + copy($this->source_dir . '\pgsql\include\\' . $header, BUILD_INCLUDE_PATH . '\\' . $header); + } + } +} diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 5b376e94..cecb8ace 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,8 +21,8 @@ $test_php_version = [ // test os (macos-13, macos-14, ubuntu-latest, windows-latest are available) $test_os = [ - 'macos-13', - 'macos-14', + // 'macos-13', + // 'macos-14', 'ubuntu-latest', 'windows-latest', ]; @@ -40,8 +40,8 @@ $prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'odbc,pdo_odbc', - 'Windows' => 'odbc,pdo_odbc', + 'Linux', 'Darwin' => 'pgsql,pdo_pgsql', + 'Windows' => 'pgsql,pdo_pgsql', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).