mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
add qdbm for dba (#409)
* add qdbm for dba * add windows support for dba-qdbm * fix test scripts * fix test scripts
This commit is contained in:
parent
b4ed4ea956
commit
e3c542d9df
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
|
||||
|
||||
- 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": {
|
||||
"type": "builtin",
|
||||
"arg-type-windows": "with"
|
||||
"arg-type": "custom",
|
||||
"lib-suggests": [
|
||||
"qdbm"
|
||||
]
|
||||
},
|
||||
"dom": {
|
||||
"type": "builtin",
|
||||
|
||||
@ -525,6 +525,18 @@
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
"qdbm": {
|
||||
"source": "qdbm",
|
||||
"static-libs-unix": [
|
||||
"libqdbm.a"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"qdbm_a.lib"
|
||||
],
|
||||
"headers-windows": [
|
||||
"depot.h"
|
||||
]
|
||||
},
|
||||
"readline": {
|
||||
"source": "readline",
|
||||
"static-libs-unix": [
|
||||
|
||||
@ -551,6 +551,15 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"qdbm": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/qdbm.git",
|
||||
"rev": "main",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"rar": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/static-php/php-rar.git",
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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';
|
||||
}
|
||||
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';
|
||||
}
|
||||
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
|
||||
$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');
|
||||
}
|
||||
}
|
||||
@ -13,14 +13,14 @@ declare(strict_types=1);
|
||||
|
||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||
$extensions = match (PHP_OS_FAMILY) {
|
||||
'Linux', 'Darwin' => 'yac',
|
||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,yac',
|
||||
'Linux', 'Darwin' => 'dba',
|
||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,dba',
|
||||
};
|
||||
|
||||
// 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' => '',
|
||||
'Windows' => '',
|
||||
'Linux', 'Darwin' => 'qdbm',
|
||||
'Windows' => 'qdbm',
|
||||
};
|
||||
|
||||
// Please change your test base combination. We recommend testing with `common`.
|
||||
@ -62,7 +62,6 @@ $final_libs = trim($with_libs, $trim_value);
|
||||
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
$final_extensions_cmd = '"' . $final_extensions . '"';
|
||||
$final_libs = $final_libs === '' ? '' : ('"' . $final_libs . '"');
|
||||
} else {
|
||||
$final_extensions_cmd = $final_extensions;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user