mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 00:05:42 +08:00
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 <jesse2061@outlook.com>
This commit is contained in:
17
src/SPC/builder/extension/pdo_pgsql.php
Normal file
17
src/SPC/builder/extension/pdo_pgsql.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('pdo_pgsql')]
|
||||
class pdo_pgsql extends Extension
|
||||
{
|
||||
public function getWindowsConfigureArg(): string
|
||||
{
|
||||
return '--with-pdo-pgsql=yes';
|
||||
}
|
||||
}
|
||||
@@ -40,4 +40,16 @@ class pgsql extends Extension
|
||||
}
|
||||
return '--with-pgsql=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WrongUsageException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function getWindowsConfigureArg(): string
|
||||
{
|
||||
if ($this->builder->getPHPVersionID() >= 80400) {
|
||||
return '--with-pgsql';
|
||||
}
|
||||
return '--with-pgsql=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
27
src/SPC/builder/windows/library/postgresql_win.php
Normal file
27
src/SPC/builder/windows/library/postgresql_win.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\windows\library;
|
||||
|
||||
class postgresql_win extends WindowsLibraryBase
|
||||
{
|
||||
public const NAME = 'postgresql-win';
|
||||
|
||||
protected function build(): void
|
||||
{
|
||||
copy($this->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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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`).
|
||||
|
||||
Reference in New Issue
Block a user