add sqlsrv support

This commit is contained in:
crazywhalecc 2023-12-21 14:02:32 +08:00 committed by Jerry Ma
parent a39cd9a238
commit 1e0265e673
8 changed files with 100 additions and 0 deletions

View File

@ -391,6 +391,17 @@
"sqlite"
]
},
"sqlsrv": {
"type": "external",
"source": "sqlsrv",
"lib-depends": [
"unixodbc"
],
"cpp-extension": true,
"ext-depends-linux": [
"pcntl"
]
},
"ssh2": {
"type": "external",
"source": "ext-ssh2",

View File

@ -496,6 +496,17 @@
"libtidy.a"
]
},
"unixodbc": {
"source": "unixodbc",
"static-libs-unix": [
"libodbc.a",
"libodbccr.a",
"libodbcinst.a"
],
"lib-depends": [
"libiconv"
]
},
"xz": {
"source": "xz",
"static-libs-unix": [

View File

@ -457,6 +457,16 @@
"text": "The author disclaims copyright to this source code. In place of\na legal notice, here is a blessing:\n\n * May you do good and not evil.\n * May you find forgiveness for yourself and forgive others.\n * May you share freely, never taking more than you give."
}
},
"sqlsrv": {
"type": "url",
"url": "https://pecl.php.net/get/sqlsrv",
"path": "php-src/ext/sqlsrv",
"filename": "sqlsrv.tgz",
"license": {
"type": "text",
"text": "TODO"
}
},
"swoole": {
"type": "ghtar",
"path": "php-src/ext/swoole",
@ -486,6 +496,14 @@
"path": "README/LICENSE.md"
}
},
"unixodbc": {
"type": "url",
"url": "https://www.unixodbc.org/unixODBC-2.3.12.tar.gz",
"license": {
"type": "text",
"text": "TODO"
}
},
"xlswriter": {
"type": "url",
"url": "https://pecl.php.net/get/xlswriter",

View File

@ -144,6 +144,7 @@ class LinuxBuilder extends BuilderBase
// prepare build php envs
$envs_build_php = SystemUtil::makeEnvVarString([
'CFLAGS' => $cflags,
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
'LIBS' => '-ldl -lpthread',
]);

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class unixodbc extends LinuxLibraryBase
{
use \SPC\builder\unix\library\unixodbc;
public const NAME = 'unixodbc';
}

View File

@ -163,6 +163,7 @@ class MacOSBuilder extends BuilderBase
'--enable-shared=no ' .
'--enable-static=yes ' .
"CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " .
"CPPFLAGS='-I" . BUILD_INCLUDE_PATH . "' " .
'--disable-all ' .
'--disable-cgi ' .
'--disable-phpdbg ' .

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class unixodbc extends MacOSLibraryBase
{
use \SPC\builder\unix\library\unixodbc;
public const NAME = 'unixodbc';
}

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
trait unixodbc
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
shell()->cd($this->source_dir)
->exec(
'./configure ' .
'--enable-static --disable-shared ' .
'--disable-debug ' .
'--disable-dependency-tracking ' .
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
'--enable-gui=no ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
$this->cleanLaFiles();
}
}