add qdbm for dba

This commit is contained in:
crazywhalecc
2024-04-12 12:44:26 +08:00
parent b4ed4ea956
commit f6c42e0fbf
8 changed files with 97 additions and 4 deletions

View File

@@ -43,7 +43,11 @@
},
"dba": {
"type": "builtin",
"arg-type-windows": "with"
"arg-type-windows": "with",
"arg-type-unix": "custom",
"lib-suggests-unix": [
"qdbm"
]
},
"dom": {
"type": "builtin",

View File

@@ -525,6 +525,12 @@
"zstd"
]
},
"qdbm": {
"source": "qdbm",
"static-libs-unix": [
"libqdbm.a"
]
},
"readline": {
"source": "readline",
"static-libs-unix": [

View File

@@ -551,6 +551,14 @@
"path": "LICENSE"
}
},
"qdbm": {
"type": "url",
"url": "https://master.dl.sourceforge.net/project/qdbm/qdbm/1.8.77/qdbm-1.8.77.tar.gz",
"license": {
"type": "file",
"path": "COPYING"
}
},
"rar": {
"type": "git",
"url": "https://github.com/static-php/php-rar.git",

View File

@@ -0,0 +1,18 @@
<?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;
}
}

View 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';
}

View 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';
}

View 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']);
}
}

View File

@@ -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`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'yac',
'Windows' => 'mbstring,pdo_sqlite,mbregex,yac',
'Linux', 'Darwin' => 'dba',
'Windows' => 'mbstring,pdo_sqlite,mbregex',
};
// 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' => '',
'Linux', 'Darwin' => 'qdbm',
'Windows' => '',
};