mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 15:25:41 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cb1764439 | ||
|
|
847535721c | ||
|
|
e3c542d9df | ||
|
|
b4ed4ea956 | ||
|
|
99aadd3e73 | ||
|
|
c77dc1af6c | ||
|
|
9fd56987ef | ||
|
|
1e494a2213 | ||
|
|
da6d9ffb4b |
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -168,4 +168,4 @@ jobs:
|
|||||||
bin/spc download --for-extensions="$(php src/globals/test-extensions.php extensions)" --for-libs="$(php src/globals/test-extensions.php libs)" --with-php=${{ matrix.php }} --ignore-cache-sources=php-src --debug
|
bin/spc download --for-extensions="$(php src/globals/test-extensions.php extensions)" --for-libs="$(php src/globals/test-extensions.php libs)" --with-php=${{ matrix.php }} --ignore-cache-sources=php-src --debug
|
||||||
|
|
||||||
- name: "Run Build Tests (build)"
|
- name: "Run Build Tests (build)"
|
||||||
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" $(php src/globals/test-extensions.php libs_cmd) --build-cli --build-micro --build-fpm --debug
|
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" --with-libs="$(php src/globals/test-extensions.php libs)" --build-cli --build-micro --build-fpm --debug
|
||||||
|
|||||||
@@ -43,7 +43,10 @@
|
|||||||
},
|
},
|
||||||
"dba": {
|
"dba": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type-windows": "with"
|
"arg-type": "custom",
|
||||||
|
"lib-suggests": [
|
||||||
|
"qdbm"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"dom": {
|
"dom": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
@@ -57,6 +60,10 @@
|
|||||||
"xml"
|
"xml"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"ds": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-ds"
|
||||||
|
},
|
||||||
"event": {
|
"event": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "ext-event",
|
"source": "ext-event",
|
||||||
@@ -378,6 +385,11 @@
|
|||||||
"shmop": {
|
"shmop": {
|
||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
|
"simdjson": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-simdjson",
|
||||||
|
"cpp-extension": true
|
||||||
|
},
|
||||||
"simplexml": {
|
"simplexml": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
@@ -614,6 +626,14 @@
|
|||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"yac": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "yac",
|
||||||
|
"arg-type-unix": "custom",
|
||||||
|
"ext-depends-unix": [
|
||||||
|
"igbinary"
|
||||||
|
]
|
||||||
|
},
|
||||||
"yaml": {
|
"yaml": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "yaml",
|
"source": "yaml",
|
||||||
|
|||||||
@@ -353,6 +353,9 @@
|
|||||||
"source": "libuuid",
|
"source": "libuuid",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libuuid.a"
|
"libuuid.a"
|
||||||
|
],
|
||||||
|
"headers": [
|
||||||
|
"uuid/uuid.h"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libuv": {
|
"libuv": {
|
||||||
@@ -525,6 +528,18 @@
|
|||||||
"zstd"
|
"zstd"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"qdbm": {
|
||||||
|
"source": "qdbm",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libqdbm.a"
|
||||||
|
],
|
||||||
|
"static-libs-windows": [
|
||||||
|
"qdbm_a.lib"
|
||||||
|
],
|
||||||
|
"headers-windows": [
|
||||||
|
"depot.h"
|
||||||
|
]
|
||||||
|
},
|
||||||
"readline": {
|
"readline": {
|
||||||
"source": "readline",
|
"source": "readline",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@@ -52,6 +52,16 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ext-ds": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/ds",
|
||||||
|
"path": "php-src/ext/ds",
|
||||||
|
"filename": "ds.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ext-event": {
|
"ext-event": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://bitbucket.org/osmanov/pecl-event/get/3.0.8.tar.gz",
|
"url": "https://bitbucket.org/osmanov/pecl-event/get/3.0.8.tar.gz",
|
||||||
@@ -90,6 +100,16 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ext-simdjson": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/simdjson",
|
||||||
|
"path": "php-src/ext/simdjson",
|
||||||
|
"filename": "simdjson.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ext-snappy": {
|
"ext-snappy": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"path": "php-src/ext/snappy",
|
"path": "php-src/ext/snappy",
|
||||||
@@ -365,7 +385,7 @@
|
|||||||
},
|
},
|
||||||
"libuuid": {
|
"libuuid": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/cloudbase/libuuid.git",
|
"url": "https://github.com/static-php/libuuid.git",
|
||||||
"rev": "master",
|
"rev": "master",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -531,6 +551,15 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"qdbm": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/static-php/qdbm.git",
|
||||||
|
"rev": "main",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "COPYING"
|
||||||
|
}
|
||||||
|
},
|
||||||
"rar": {
|
"rar": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/static-php/php-rar.git",
|
"url": "https://github.com/static-php/php-rar.git",
|
||||||
@@ -653,6 +682,16 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"yac": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/yac",
|
||||||
|
"path": "php-src/ext/yac",
|
||||||
|
"filename": "yac.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"yaml": {
|
"yaml": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"path": "php-src/ext/yaml",
|
"path": "php-src/ext/yaml",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use Symfony\Component\Console\Command\ListCommand;
|
|||||||
*/
|
*/
|
||||||
final class ConsoleApplication extends Application
|
final class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION = '2.1.6';
|
public const VERSION = '2.1.7';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
24
src/SPC/builder/extension/dba.php
Normal file
24
src/SPC/builder/extension/dba.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('dba')]
|
||||||
|
class dba extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
$qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . BUILD_ROOT_PATH) : '';
|
||||||
|
return '--enable-dba' . $qdbm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWindowsConfigureArg(): string
|
||||||
|
{
|
||||||
|
$qdbm = $this->builder->getLib('qdbm') ? ' --with-qdbm' : '';
|
||||||
|
return '--with-dba' . $qdbm;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/SPC/builder/extension/simdjson.php
Normal file
34
src/SPC/builder/extension/simdjson.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('simdjson')]
|
||||||
|
class simdjson extends Extension
|
||||||
|
{
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
$php_ver = $this->builder->getPHPVersionID();
|
||||||
|
FileSystem::replaceFileRegex(
|
||||||
|
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||||
|
'/php_version=(`.*`)$/m',
|
||||||
|
'php_version=' . strval($php_ver)
|
||||||
|
);
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||||
|
'if test -z "$PHP_CONFIG"; then',
|
||||||
|
'if false; then'
|
||||||
|
);
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
SOURCE_PATH . '/php-src/ext/simdjson/config.w32',
|
||||||
|
"'yes',",
|
||||||
|
'PHP_SIMDJSON_SHARED,'
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
src/SPC/builder/extension/yac.php
Normal file
26
src/SPC/builder/extension/yac.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('yac')]
|
||||||
|
class yac extends Extension
|
||||||
|
{
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/storage/allocator/yac_allocator.h', 'defined(HAVE_SHM_MMAP_ANON)', 'defined(YAC_ALLOCATOR_H)');
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/igbinary.c', '#ifdef YAC_ENABLE_IGBINARY', '#if 1');
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yac/serializer/json.c', '#if YAC_ENABLE_JSON', '#if 1');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
return '--enable-yac --enable-igbinary --enable-json';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ use SPC\builder\linux\SystemUtil;
|
|||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
class openssl extends LinuxLibraryBase
|
class openssl extends LinuxLibraryBase
|
||||||
{
|
{
|
||||||
@@ -76,5 +77,15 @@ class openssl extends LinuxLibraryBase
|
|||||||
->exec("make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
->exec("make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
||||||
->exec("make install_sw DESTDIR={$destdir}");
|
->exec("make install_sw DESTDIR={$destdir}");
|
||||||
$this->patchPkgconfPrefix(['libssl.pc', 'openssl.pc', 'libcrypto.pc']);
|
$this->patchPkgconfPrefix(['libssl.pc', 'openssl.pc', 'libcrypto.pc']);
|
||||||
|
// patch for openssl 3.3.0+
|
||||||
|
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/libssl.pc'), 'prefix=')) {
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/libssl.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||||
|
}
|
||||||
|
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/openssl.pc'), 'prefix=')) {
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/openssl.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||||
|
}
|
||||||
|
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc'), 'prefix=')) {
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/SPC/builder/linux/library/qdbm.php
Normal file
12
src/SPC/builder/linux/library/qdbm.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class qdbm extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\qdbm;
|
||||||
|
|
||||||
|
public const NAME = 'qdbm';
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ namespace SPC\builder\macos\library;
|
|||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
class openssl extends MacOSLibraryBase
|
class openssl extends MacOSLibraryBase
|
||||||
{
|
{
|
||||||
@@ -58,5 +59,15 @@ class openssl extends MacOSLibraryBase
|
|||||||
->exec("make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
->exec("make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
||||||
->exec("make install_sw DESTDIR={$destdir}");
|
->exec("make install_sw DESTDIR={$destdir}");
|
||||||
$this->patchPkgconfPrefix(['libssl.pc', 'openssl.pc', 'libcrypto.pc']);
|
$this->patchPkgconfPrefix(['libssl.pc', 'openssl.pc', 'libcrypto.pc']);
|
||||||
|
// patch for openssl 3.3.0+
|
||||||
|
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/libssl.pc'), 'prefix=')) {
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/libssl.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||||
|
}
|
||||||
|
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/openssl.pc'), 'prefix=')) {
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/openssl.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||||
|
}
|
||||||
|
if (!str_contains($file = FileSystem::readFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc'), 'prefix=')) {
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', 'prefix=' . BUILD_ROOT_PATH . "\n" . $file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/SPC/builder/macos/library/qdbm.php
Normal file
12
src/SPC/builder/macos/library/qdbm.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class qdbm extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\qdbm;
|
||||||
|
|
||||||
|
public const NAME = 'qdbm';
|
||||||
|
}
|
||||||
@@ -10,29 +10,37 @@ use SPC\store\FileSystem;
|
|||||||
|
|
||||||
trait libuuid
|
trait libuuid
|
||||||
{
|
{
|
||||||
public function patchBeforeBuild(): bool
|
|
||||||
{
|
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/configure', '-${am__api_version}', '');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
shell()->cd($this->source_dir)
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
->exec('chmod +x configure')
|
shell()->cd($this->source_dir . '/build')
|
||||||
->exec('chmod +x install-sh')
|
|
||||||
->exec(
|
->exec(
|
||||||
'./configure ' .
|
'cmake ' .
|
||||||
'--enable-static --disable-shared ' .
|
"{$this->builder->makeCmakeArgs()} " .
|
||||||
'--prefix='
|
'..'
|
||||||
)
|
)
|
||||||
->exec('make clean')
|
->exec("cmake --build . -j {$this->builder->concurrency}");
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
copy($this->source_dir . '/build/libuuid.a', BUILD_LIB_PATH . '/libuuid.a');
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
FileSystem::createDir(BUILD_INCLUDE_PATH . '/uuid');
|
||||||
$this->patchPkgconfPrefix(['uuid.pc']);
|
copy($this->source_dir . '/uuid.h', BUILD_INCLUDE_PATH . '/uuid/uuid.h');
|
||||||
|
$pc = FileSystem::readFile($this->source_dir . '/uuid.pc.in');
|
||||||
|
$pc = str_replace([
|
||||||
|
'@prefix@',
|
||||||
|
'@exec_prefix@',
|
||||||
|
'@libdir@',
|
||||||
|
'@includedir@',
|
||||||
|
'@LIBUUID_VERSION@',
|
||||||
|
], [
|
||||||
|
BUILD_ROOT_PATH,
|
||||||
|
'${prefix}',
|
||||||
|
'${prefix}/lib',
|
||||||
|
'${prefix}/include',
|
||||||
|
'1.0.3',
|
||||||
|
], $pc);
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/uuid.pc', $pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,26 +27,31 @@ trait postgresql
|
|||||||
'libxslt' => 'libxslt',
|
'libxslt' => 'libxslt',
|
||||||
'icu' => 'icu-i18n',
|
'icu' => 'icu-i18n',
|
||||||
];
|
];
|
||||||
|
$error_exec_cnt = 0;
|
||||||
|
|
||||||
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}");
|
$output = shell()->execWithResult("pkg-config --static {$pkg}");
|
||||||
|
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
||||||
logger()->info(var_export($output[1], true));
|
logger()->info(var_export($output[1], true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}");
|
$output = shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}");
|
||||||
|
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
||||||
if (!empty($output[1][0])) {
|
if (!empty($output[1][0])) {
|
||||||
$cppflags = $output[1][0];
|
$cppflags = $output[1][0];
|
||||||
$envs .= " CPPFLAGS=\"{$cppflags}\"";
|
$envs .= " CPPFLAGS=\"{$cppflags}\"";
|
||||||
}
|
}
|
||||||
$output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}");
|
$output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}");
|
||||||
|
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
||||||
if (!empty($output[1][0])) {
|
if (!empty($output[1][0])) {
|
||||||
$ldflags = $output[1][0];
|
$ldflags = $output[1][0];
|
||||||
$envs .= $this instanceof MacOSLibraryBase ? " LDFLAGS=\"{$ldflags}\" " : " LDFLAGS=\"{$ldflags} -static\" ";
|
$envs .= $this instanceof MacOSLibraryBase ? " LDFLAGS=\"{$ldflags}\" " : " LDFLAGS=\"{$ldflags} -static\" ";
|
||||||
}
|
}
|
||||||
$output = shell()->execWithResult("pkg-config --libs-only-l --static {$packages}");
|
$output = shell()->execWithResult("pkg-config --libs-only-l --static {$packages}");
|
||||||
|
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
||||||
if (!empty($output[1][0])) {
|
if (!empty($output[1][0])) {
|
||||||
$libs = $output[1][0];
|
$libs = $output[1][0];
|
||||||
$libcpp = '';
|
$libcpp = '';
|
||||||
@@ -55,6 +60,9 @@ trait postgresql
|
|||||||
}
|
}
|
||||||
$envs .= " LIBS=\"{$libs}{$libcpp}\" ";
|
$envs .= " LIBS=\"{$libs}{$libcpp}\" ";
|
||||||
}
|
}
|
||||||
|
if ($error_exec_cnt > 0) {
|
||||||
|
throw new RuntimeException('Failed to get pkg-config information!');
|
||||||
|
}
|
||||||
|
|
||||||
FileSystem::resetDir($this->source_dir . '/build');
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
|
|
||||||
|
|||||||
33
src/SPC/builder/unix/library/qdbm.php
Normal file
33
src/SPC/builder/unix/library/qdbm.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?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 qdbm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->exec(
|
||||||
|
'./configure ' .
|
||||||
|
'--enable-static --disable-shared ' .
|
||||||
|
'--prefix='
|
||||||
|
)
|
||||||
|
->exec('make clean');
|
||||||
|
FileSystem::replaceFileRegex($this->source_dir . '/Makefile', '/MYLIBS = libqdbm.a.*/m', 'MYLIBS = libqdbm.a');
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->exec("make -j{$this->builder->concurrency}" . ($this instanceof MacOSLibraryBase ? ' mac' : ''))
|
||||||
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
|
$this->patchPkgconfPrefix(['qdbm.pc']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,9 @@ class WindowsBuilder extends BuilderBase
|
|||||||
|
|
||||||
// make cmake toolchain
|
// make cmake toolchain
|
||||||
$this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile();
|
$this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile();
|
||||||
|
|
||||||
|
f_mkdir(BUILD_INCLUDE_PATH, recursive: true);
|
||||||
|
f_mkdir(BUILD_LIB_PATH, recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
24
src/SPC/builder/windows/library/qdbm.php
Normal file
24
src/SPC/builder/windows/library/qdbm.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\windows\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
class qdbm extends WindowsLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'qdbm';
|
||||||
|
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
cmd()->cd($this->source_dir)
|
||||||
|
->execWithWrapper(
|
||||||
|
$this->builder->makeSimpleWrapper('nmake'),
|
||||||
|
'/f VCMakefile'
|
||||||
|
);
|
||||||
|
copy($this->source_dir . '\qdbm_a.lib', BUILD_LIB_PATH . '\qdbm_a.lib');
|
||||||
|
copy($this->source_dir . '\depot.h', BUILD_INCLUDE_PATH . '\depot.h');
|
||||||
|
// FileSystem::copyDir($this->source_dir . '\include\curl', BUILD_INCLUDE_PATH . '\curl');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -74,6 +74,22 @@ class LinuxToolCheckList
|
|||||||
return CheckResult::ok();
|
return CheckResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AsCheckItem('if cmake version >= 3.18', limit_os: 'Linux')]
|
||||||
|
public function checkCMakeVersion(): ?CheckResult
|
||||||
|
{
|
||||||
|
$check_cmd = 'cmake --version';
|
||||||
|
$pattern = '/cmake version (.*)/m';
|
||||||
|
$out = shell()->execWithResult($check_cmd, false)[1][0];
|
||||||
|
if (preg_match($pattern, $out, $match)) {
|
||||||
|
$ver = $match[1];
|
||||||
|
if (version_compare($ver, '3.18.0') <= 0) {
|
||||||
|
return CheckResult::fail('cmake version is too low (' . $ver . '), please update it manually!');
|
||||||
|
}
|
||||||
|
return CheckResult::ok($match[1]);
|
||||||
|
}
|
||||||
|
return CheckResult::fail('Failed to get cmake version');
|
||||||
|
}
|
||||||
|
|
||||||
/** @noinspection PhpUnused */
|
/** @noinspection PhpUnused */
|
||||||
#[AsCheckItem('if necessary linux headers are installed', limit_os: 'Linux')]
|
#[AsCheckItem('if necessary linux headers are installed', limit_os: 'Linux')]
|
||||||
public function checkSystemOSPackages(): ?CheckResult
|
public function checkSystemOSPackages(): ?CheckResult
|
||||||
|
|||||||
@@ -37,10 +37,12 @@ class MacOSToolCheckList
|
|||||||
#[AsCheckItem('if homebrew has installed', limit_os: 'Darwin', level: 998)]
|
#[AsCheckItem('if homebrew has installed', limit_os: 'Darwin', level: 998)]
|
||||||
public function checkBrew(): ?CheckResult
|
public function checkBrew(): ?CheckResult
|
||||||
{
|
{
|
||||||
// 检查 homebrew 是否已经安装
|
if (($path = $this->findCommand('brew')) === null) {
|
||||||
if ($this->findCommand('brew') === null) {
|
|
||||||
return CheckResult::fail('Homebrew is not installed', 'brew');
|
return CheckResult::fail('Homebrew is not installed', 'brew');
|
||||||
}
|
}
|
||||||
|
if ($path !== '/opt/homebrew/bin/brew' && php_uname('m') === 'arm64') {
|
||||||
|
return CheckResult::fail('Current homebrew (/usr/local/bin/homebrew) is not installed for M1 Mac, please re-install homebrew in /opt/homebrew/ !');
|
||||||
|
}
|
||||||
return CheckResult::ok();
|
return CheckResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class OSCheckList
|
|||||||
return CheckResult::fail('Current OS is not supported: ' . PHP_OS_FAMILY);
|
return CheckResult::fail('Current OS is not supported: ' . PHP_OS_FAMILY);
|
||||||
}
|
}
|
||||||
$distro = PHP_OS_FAMILY === 'Linux' ? (' ' . SystemUtil::getOSRelease()['dist']) : '';
|
$distro = PHP_OS_FAMILY === 'Linux' ? (' ' . SystemUtil::getOSRelease()['dist']) : '';
|
||||||
$known_distro = PHP_OS_FAMILY === 'Linux' && in_array(SystemUtil::getOSRelease()['dist'], SystemUtil::getSupportedDistros());
|
$known_distro = PHP_OS_FAMILY !== 'Linux' || in_array(SystemUtil::getOSRelease()['dist'], SystemUtil::getSupportedDistros());
|
||||||
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported' . ($known_distro ? '' : ' (but not tested on this distro)'));
|
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported' . ($known_distro ? '' : ' (but not tested on this distro)'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||||
$extensions = match (PHP_OS_FAMILY) {
|
$extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'xml,imagick',
|
'Linux', 'Darwin' => 'uuid',
|
||||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,ffi',
|
'Windows' => 'mbstring,pdo_sqlite,mbregex',
|
||||||
};
|
};
|
||||||
|
|
||||||
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||||
$with_libs = match (PHP_OS_FAMILY) {
|
$with_libs = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'xz',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,7 +62,6 @@ $final_libs = trim($with_libs, $trim_value);
|
|||||||
|
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
$final_extensions_cmd = '"' . $final_extensions . '"';
|
$final_extensions_cmd = '"' . $final_extensions . '"';
|
||||||
$final_libs = $final_libs === '' ? '' : ('"' . $final_libs . '"');
|
|
||||||
} else {
|
} else {
|
||||||
$final_extensions_cmd = $final_extensions;
|
$final_extensions_cmd = $final_extensions;
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/globals/tests/uuid.php
Normal file
6
src/globals/tests/uuid.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
assert(function_exists('uuid_create'));
|
||||||
|
assert(strlen(uuid_create(0)) === 36);
|
||||||
Reference in New Issue
Block a user