mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
commit
0902f80b46
@ -211,12 +211,19 @@
|
|||||||
},
|
},
|
||||||
"pdo_pgsql": {
|
"pdo_pgsql": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "with",
|
"arg-type": "with-prefix",
|
||||||
"ext-depends": [
|
"ext-depends": [
|
||||||
"pdo"
|
"pdo"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"pq"
|
"postgresql"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pgsql": {
|
||||||
|
"type": "builtin",
|
||||||
|
"arg-type": "with-prefix",
|
||||||
|
"lib-depends": [
|
||||||
|
"postgresql"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"pdo_sqlite": {
|
"pdo_sqlite": {
|
||||||
|
|||||||
@ -381,7 +381,16 @@
|
|||||||
"postgresql": {
|
"postgresql": {
|
||||||
"source": "postgresql",
|
"source": "postgresql",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libpg.a"
|
"libpq.a",
|
||||||
|
"libpgport.a",
|
||||||
|
"libpgcommon.a"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"libiconv",
|
||||||
|
"libxml2",
|
||||||
|
"openssl",
|
||||||
|
"zlib",
|
||||||
|
"readline"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"pthreads4w": {
|
"pthreads4w": {
|
||||||
|
|||||||
@ -318,7 +318,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
"type": "custom",
|
"type": "url",
|
||||||
|
"url": "https://ftp.postgresql.org/pub/source/v15.1/postgresql-15.1.tar.gz",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYRIGHT"
|
"path": "COPYRIGHT"
|
||||||
|
|||||||
12
src/SPC/builder/linux/library/postgresql.php
Normal file
12
src/SPC/builder/linux/library/postgresql.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class postgresql extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\postgresql;
|
||||||
|
|
||||||
|
public const NAME = 'postgresql';
|
||||||
|
}
|
||||||
12
src/SPC/builder/macos/library/postgresql.php
Normal file
12
src/SPC/builder/macos/library/postgresql.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class postgresql extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\postgresql;
|
||||||
|
|
||||||
|
public const NAME = 'postgresql';
|
||||||
|
}
|
||||||
89
src/SPC/builder/unix/library/postgresql.php
Normal file
89
src/SPC/builder/unix/library/postgresql.php
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\builder\macos\library\MacOSLibraryBase;
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
trait postgresql
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
protected function build()
|
||||||
|
{
|
||||||
|
$builddir = BUILD_ROOT_PATH;
|
||||||
|
$env = $this->builder->configure_env;
|
||||||
|
$envs = $env;
|
||||||
|
$packages = 'openssl zlib readline libxml-2.0'; // icu-uc icu-io icu-i18n libzstd
|
||||||
|
|
||||||
|
$pkgconfig_executable = $builddir . '/bin/pkg-config';
|
||||||
|
$output = shell()->execWithResult($env . " {$pkgconfig_executable} --cflags-only-I --static " . $packages);
|
||||||
|
if (!empty($output[1][0])) {
|
||||||
|
$cppflags = $output[1][0];
|
||||||
|
$envs .= " CPPFLAGS=\"{$cppflags}\"";
|
||||||
|
}
|
||||||
|
$output = shell()->execWithResult($env . " {$pkgconfig_executable} --libs-only-L --static " . $packages);
|
||||||
|
if (!empty($output[1][0])) {
|
||||||
|
$ldflags = $output[1][0];
|
||||||
|
$envs .= $this instanceof MacOSLibraryBase ? " LDFLAGS=\"{$ldflags}\" " : " LDFLAGS=\"{$ldflags} -static\" ";
|
||||||
|
}
|
||||||
|
$output = shell()->execWithResult($env . " {$pkgconfig_executable} --libs-only-l --static " . $packages);
|
||||||
|
if (!empty($output[1][0])) {
|
||||||
|
$libs = $output[1][0];
|
||||||
|
$envs .= " LIBS=\"{$libs}\" ";
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
|
|
||||||
|
# 有静态链接配置 参考文件: 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');
|
||||||
|
|
||||||
|
// configure
|
||||||
|
shell()->cd($this->source_dir . '/build')
|
||||||
|
->exec(
|
||||||
|
"{$env} ../configure " .
|
||||||
|
"--prefix={$builddir} " .
|
||||||
|
'--disable-thread-safety ' .
|
||||||
|
'--enable-coverage=no ' .
|
||||||
|
'--with-ssl=openssl ' .
|
||||||
|
'--with-readline ' .
|
||||||
|
'--with-libxml ' .
|
||||||
|
'--without-icu ' .
|
||||||
|
'--without-ldap ' .
|
||||||
|
'--without-libxslt ' .
|
||||||
|
'--without-lz4 ' .
|
||||||
|
'--without-zstd ' .
|
||||||
|
'--without-perl ' .
|
||||||
|
'--without-python ' .
|
||||||
|
'--without-pam ' .
|
||||||
|
'--without-ldap ' .
|
||||||
|
'--without-bonjour ' .
|
||||||
|
'--without-tcl '
|
||||||
|
);
|
||||||
|
|
||||||
|
// build
|
||||||
|
shell()->cd($this->source_dir . '/build')
|
||||||
|
->exec($envs . ' make -C src/bin/pg_config install')
|
||||||
|
->exec($envs . ' make -C src/include install')
|
||||||
|
->exec($envs . ' make -C src/common install')
|
||||||
|
->exec($envs . ' make -C src/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
|
||||||
|
shell()->cd($this->source_dir . '/build')
|
||||||
|
->exec("rm -rf {$builddir}/lib/*.so.*")
|
||||||
|
->exec("rm -rf {$builddir}/lib/*.so")
|
||||||
|
->exec("rm -rf {$builddir}/lib/*.dylib");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -88,6 +88,9 @@ class SourcePatcher
|
|||||||
if ($ssh2 = $builder->getExt('ssh2')) {
|
if ($ssh2 = $builder->getExt('ssh2')) {
|
||||||
$patch[] = ['ssh2 patch', '/-lssh2/', $ssh2->getLibFilesString()];
|
$patch[] = ['ssh2 patch', '/-lssh2/', $ssh2->getLibFilesString()];
|
||||||
}
|
}
|
||||||
|
if ($pgsql = $builder->getExt('pgsql')) {
|
||||||
|
$patch[] = ['pgsql patch', '/-lpq/', $pgsql->getLibFilesString()];
|
||||||
|
}
|
||||||
$patch[] = ['disable capstone', '/have_capstone="yes"/', 'have_capstone="no"'];
|
$patch[] = ['disable capstone', '/have_capstone="yes"/', 'have_capstone="no"'];
|
||||||
foreach ($patch as $item) {
|
foreach ($patch as $item) {
|
||||||
logger()->info('Patching configure: ' . $item[0]);
|
logger()->info('Patching configure: ' . $item[0]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user