mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
Merge pull request #279 from jingjingxyk/feature_upgrade_libpq
upgrade libpq to v16.1
This commit is contained in:
commit
b722b3edd4
@ -156,8 +156,9 @@
|
|||||||
"liblber.a",
|
"liblber.a",
|
||||||
"libldap.a"
|
"libldap.a"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-depends": [
|
||||||
"openssl",
|
"openssl",
|
||||||
|
"zlib",
|
||||||
"gmp",
|
"gmp",
|
||||||
"libsodium"
|
"libsodium"
|
||||||
]
|
]
|
||||||
|
|||||||
@ -386,7 +386,7 @@
|
|||||||
},
|
},
|
||||||
"postgresql": {
|
"postgresql": {
|
||||||
"type": "url",
|
"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": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYRIGHT"
|
"path": "COPYRIGHT"
|
||||||
|
|||||||
@ -259,6 +259,19 @@ abstract class BuilderBase
|
|||||||
throw new RuntimeException('PHP version file format is malformed, please remove it and download again');
|
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.
|
* Get build type name string to display.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -5,11 +5,20 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('mongodb')]
|
#[CustomExt('mongodb')]
|
||||||
class mongodb extends Extension
|
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
|
public function getUnixConfigureArg(): string
|
||||||
{
|
{
|
||||||
$arg = ' --enable-mongodb ';
|
$arg = ' --enable-mongodb ';
|
||||||
|
|||||||
@ -17,7 +17,8 @@ class swoole extends Extension
|
|||||||
$arg .= ' --disable-swoole-pgsql';
|
$arg .= ' --disable-swoole-pgsql';
|
||||||
$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';
|
$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;
|
return $arg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,8 @@ trait ldap
|
|||||||
$alt .= $this->builder->getLib('gmp') ? '--with-mp=gmp ' : '';
|
$alt .= $this->builder->getLib('gmp') ? '--with-mp=gmp ' : '';
|
||||||
// libsodium support
|
// libsodium support
|
||||||
$alt .= $this->builder->getLib('libsodium') ? '--with-argon2=libsodium ' : '';
|
$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)
|
shell()->cd($this->source_dir)
|
||||||
->exec(
|
->exec(
|
||||||
$this->builder->makeAutoconfFlags(AUTOCONF_LDFLAGS | AUTOCONF_CPPFLAGS) .
|
$this->builder->makeAutoconfFlags(AUTOCONF_LDFLAGS | AUTOCONF_CPPFLAGS) .
|
||||||
|
|||||||
@ -20,16 +20,22 @@ trait postgresql
|
|||||||
{
|
{
|
||||||
$builddir = BUILD_ROOT_PATH;
|
$builddir = BUILD_ROOT_PATH;
|
||||||
$envs = '';
|
$envs = '';
|
||||||
$packages = 'openssl zlib readline libxml-2.0 zlib';
|
$packages = 'zlib openssl readline libxml-2.0';
|
||||||
$optional_packages = [
|
$optional_packages = [
|
||||||
'zstd' => 'libzstd',
|
'zstd' => 'libzstd',
|
||||||
'ldap' => 'ldap',
|
// 'ldap' => 'ldap',
|
||||||
'libxslt' => 'libxslt',
|
'libxslt' => 'libxslt',
|
||||||
'icu' => 'icu-i18n',
|
'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) {
|
foreach ($optional_packages as $lib => $pkg) {
|
||||||
if ($this->getBuilder()->getLib($lib)) {
|
if ($this->getBuilder()->getLib($lib)) {
|
||||||
$packages .= ' ' . $pkg;
|
$packages .= ' ' . $pkg;
|
||||||
|
$output = shell()->execWithResult("pkg-config --static {$pkg}");
|
||||||
|
logger()->info(var_export($output[1], true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +64,8 @@ trait postgresql
|
|||||||
# 有静态链接配置 参考文件: src/interfaces/libpq/Makefile
|
# 有静态链接配置 参考文件: src/interfaces/libpq/Makefile
|
||||||
shell()->cd($this->source_dir . '/build')
|
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 "293 s/^/#$/" ../src/Makefile.shlib')
|
->exec('sed -i.backup "278 s/^/# /" ../src/Makefile.shlib')
|
||||||
->exec('sed -i.backup "441 s/^/#$/" ../src/Makefile.shlib');
|
->exec('sed -i.backup "402 s/^/# /" ../src/Makefile.shlib');
|
||||||
|
|
||||||
// configure
|
// configure
|
||||||
shell()->cd($this->source_dir . '/build')
|
shell()->cd($this->source_dir . '/build')
|
||||||
@ -72,7 +78,7 @@ trait postgresql
|
|||||||
'--with-readline ' .
|
'--with-readline ' .
|
||||||
'--with-libxml ' .
|
'--with-libxml ' .
|
||||||
($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') .
|
($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') .
|
||||||
($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
|
'--without-ldap ' .
|
||||||
($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') .
|
($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') .
|
||||||
($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') .
|
($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') .
|
||||||
'--without-lz4 ' .
|
'--without-lz4 ' .
|
||||||
@ -82,15 +88,14 @@ trait postgresql
|
|||||||
'--without-bonjour ' .
|
'--without-bonjour ' .
|
||||||
'--without-tcl '
|
'--without-tcl '
|
||||||
);
|
);
|
||||||
|
// ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
|
||||||
|
|
||||||
// build
|
// build
|
||||||
shell()->cd($this->source_dir . '/build')
|
shell()->cd($this->source_dir . '/build')
|
||||||
->exec($envs . ' make -C src/bin/pg_config install')
|
->exec($envs . ' make -C src/bin/pg_config install')
|
||||||
->exec($envs . ' make -C src/include install')
|
->exec($envs . ' make -C src/include install')
|
||||||
->exec($envs . ' make -C src/common 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/port install')
|
||||||
->exec($envs . ' make -C src/backend/libpq install')
|
|
||||||
->exec($envs . ' make -C src/interfaces/libpq install');
|
->exec($envs . ' make -C src/interfaces/libpq install');
|
||||||
|
|
||||||
// remove dynamic libs
|
// remove dynamic libs
|
||||||
|
|||||||
@ -3,6 +3,6 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
# If you want to test new extensions here, just modify it.
|
# 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,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;
|
echo $extensions;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user