mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 09:25:35 +08:00
install headers and modules from shared extensions
This commit is contained in:
@@ -233,8 +233,15 @@ abstract class BuilderBase
|
|||||||
*/
|
*/
|
||||||
abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE);
|
abstract public function buildPHP(int $build_target = BUILD_TARGET_NONE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws WrongUsageException
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
public function buildSharedExts(): void
|
public function buildSharedExts(): void
|
||||||
{
|
{
|
||||||
|
FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir="', 'extension_dir="' . BUILD_MODULES_PATH . '"');
|
||||||
|
FileSystem::createDir(BUILD_MODULES_PATH);
|
||||||
foreach ($this->getExts() as $ext) {
|
foreach ($this->getExts() as $ext) {
|
||||||
if (!$ext->isBuildShared()) {
|
if (!$ext->isBuildShared()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -242,6 +249,9 @@ abstract class BuilderBase
|
|||||||
logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)');
|
logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)');
|
||||||
$ext->buildShared();
|
$ext->buildShared();
|
||||||
}
|
}
|
||||||
|
if (getenv('EXTENSION_DIR')) {
|
||||||
|
FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir="', 'extension_dir="' . getenv('EXTENSION_DIR') . '"');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -319,10 +319,10 @@ class Extension
|
|||||||
->execWithEnv(BUILD_BIN_PATH . '/phpize')
|
->execWithEnv(BUILD_BIN_PATH . '/phpize')
|
||||||
->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static')
|
->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static')
|
||||||
->execWithEnv('make clean')
|
->execWithEnv('make clean')
|
||||||
->execWithEnv('make -j' . $this->builder->concurrency);
|
->execWithEnv('make -j' . $this->builder->concurrency)
|
||||||
|
->execWithEnv('make install');
|
||||||
|
|
||||||
// copy shared library
|
// copy shared library
|
||||||
FileSystem::createDir(BUILD_MODULES_PATH);
|
|
||||||
$extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so';
|
$extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so';
|
||||||
$sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so';
|
$sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so';
|
||||||
if (file_exists($extensionDirFile)) {
|
if (file_exists($extensionDirFile)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user