fix pdo_sqlsrv

This commit is contained in:
henderkes 2025-05-19 16:30:34 +07:00
parent 5bd53ed714
commit 7ba1948101
2 changed files with 40 additions and 10 deletions

View File

@ -322,16 +322,6 @@ class Extension
->execWithEnv('make -j' . $this->builder->concurrency)
->execWithEnv('make install');
// copy shared library
$extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so';
$sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so';
if (file_exists($extensionDirFile)) {
copy($extensionDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so');
} elseif (file_exists($sourceDirFile)) {
copy($sourceDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so');
} else {
throw new RuntimeException('extension ' . $this->getName() . ' built successfully, but into an unexpected location.');
}
// check shared extension with php-cli
if (file_exists(BUILD_BIN_PATH . '/php')) {
$this->runSharedExtensionCheckUnix();

View File

@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
use SPC\util\SPCConfigUtil;
#[CustomExt('pdo_sqlsrv')]
class pdo_sqlsrv extends Extension
{
public function buildUnixShared(): void
{
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()]);
$env = [
'CFLAGS' => $config['cflags'],
'CXXFLAGS' => $config['cflags'],
'LDFLAGS' => $config['ldflags'],
'LIBS' => $config['libs'],
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
];
// prepare configure args
shell()->cd($this->source_dir)
->setEnv($env)
->execWithEnv(BUILD_BIN_PATH . '/phpize')
->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static')
->execWithEnv('make clean')
->execWithEnv('make -j' . $this->builder->concurrency)
->execWithEnv('make install');
// check shared extension with php-cli
if (file_exists(BUILD_BIN_PATH . '/php')) {
$this->runSharedExtensionCheckUnix();
}
}
}