add windows support for dba-qdbm

This commit is contained in:
crazywhalecc
2024-04-12 15:32:26 +08:00
parent f6c42e0fbf
commit ee8416c0c6
7 changed files with 46 additions and 7 deletions

View File

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

View File

@@ -529,6 +529,12 @@
"source": "qdbm",
"static-libs-unix": [
"libqdbm.a"
],
"static-libs-windows": [
"qdbm_a.lib"
],
"headers-windows": [
"depot.h"
]
},
"readline": {

View File

@@ -552,8 +552,9 @@
}
},
"qdbm": {
"type": "url",
"url": "https://master.dl.sourceforge.net/project/qdbm/qdbm/1.8.77/qdbm-1.8.77.tar.gz",
"type": "git",
"url": "https://github.com/static-php/qdbm.git",
"rev": "main",
"license": {
"type": "file",
"path": "COPYING"

View File

@@ -15,4 +15,10 @@ class dba extends Extension
$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;
}
}

View File

@@ -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);
}
/**

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

View File

@@ -14,13 +14,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' => 'dba',
'Windows' => 'mbstring,pdo_sqlite,mbregex',
'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' => 'qdbm',
'Windows' => '',
'Windows' => 'qdbm',
};
// Please change your test base combination. We recommend testing with `common`.