mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
rework configure args
This commit is contained in:
parent
95a2f4600b
commit
495e868a71
@ -79,6 +79,9 @@
|
||||
"xml"
|
||||
],
|
||||
"shared-ext-depends": [
|
||||
"libxml",
|
||||
"xmlreader",
|
||||
"xmlwriter",
|
||||
"xml"
|
||||
]
|
||||
},
|
||||
@ -413,22 +416,22 @@
|
||||
},
|
||||
"mysqli": {
|
||||
"type": "builtin",
|
||||
"target": [
|
||||
"static"
|
||||
],
|
||||
"arg-type": "with",
|
||||
"ext-depends": [
|
||||
"mysqlnd"
|
||||
],
|
||||
"target": [
|
||||
"static"
|
||||
]
|
||||
},
|
||||
"mysqlnd": {
|
||||
"type": "builtin",
|
||||
"target": [
|
||||
"static"
|
||||
],
|
||||
"arg-type-windows": "with",
|
||||
"lib-depends": [
|
||||
"zlib"
|
||||
],
|
||||
"target": [
|
||||
"static"
|
||||
]
|
||||
},
|
||||
"oci8": {
|
||||
|
||||
@ -257,7 +257,11 @@ abstract class BuilderBase
|
||||
continue;
|
||||
}
|
||||
if (Config::getExt($ext->getName(), 'type') === 'builtin') {
|
||||
logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)');
|
||||
if (file_exists(BUILD_MODULES_PATH . '/' . $ext->getName() . '.so')) {
|
||||
logger()->info('Shared extension [' . $ext->getName() . '] was already built by php-src/configure (' . $ext->getName() . '.so)');
|
||||
continue;
|
||||
}
|
||||
logger()->warning('Shared extension [' . $ext->getName() . '] was built statically by php-src/configure');
|
||||
continue;
|
||||
}
|
||||
logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)');
|
||||
|
||||
@ -24,9 +24,4 @@ class bz2 extends Extension
|
||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lbz2/', $this->getLibFilesString() . $frameworks);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return $shared ? '--with-bz2=' . BUILD_ROOT_PATH : '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ class curl extends Extension
|
||||
{
|
||||
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';
|
||||
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-lcurl/', $this->getLibFilesString() . $frameworks);
|
||||
$this->patchBeforeSharedConfigure();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -99,12 +100,6 @@ class curl extends Extension
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--with-curl';
|
||||
}
|
||||
|
||||
public function buildUnixShared(): void
|
||||
{
|
||||
if (!$this->builder instanceof LinuxBuilder) {
|
||||
|
||||
@ -12,7 +12,7 @@ class dba extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . BUILD_ROOT_PATH) : '';
|
||||
$qdbm = $this->builder->getLib('qdbm') ? (' --with-qdbm=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH) : '';
|
||||
return '--enable-dba' . $qdbm;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ class dom extends Extension
|
||||
*/
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$arg = '--enable-dom';
|
||||
$arg = '--enable-dom' . ($shared ? '=shared' : '');
|
||||
if (!$shared) {
|
||||
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ class ffi extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--with-ffi --enable-zend-signals';
|
||||
return '--with-ffi' . ($shared ? '=shared' : '') . ' --enable-zend-signals';
|
||||
}
|
||||
|
||||
public function getWindowsConfigureArg(bool $shared = false): string
|
||||
|
||||
@ -12,7 +12,7 @@ class gd extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$arg = '--enable-gd';
|
||||
$arg = '--enable-gd' . ($shared ? '=shared' : '');
|
||||
$arg .= $this->builder->getLib('freetype') ? ' --with-freetype' : '';
|
||||
$arg .= $this->builder->getLib('libjpeg') ? ' --with-jpeg' : '';
|
||||
$arg .= $this->builder->getLib('libwebp') ? ' --with-webp' : '';
|
||||
|
||||
@ -20,9 +20,4 @@ class ldap extends Extension
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--with-ldap=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class mbstring extends Extension
|
||||
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$arg = '--enable-mbstring';
|
||||
$arg = '--enable-mbstring' . ($shared ? '=shared' : '');
|
||||
if ($this->builder->getExt('mbregex') === null) {
|
||||
$arg .= ' --disable-mbregex';
|
||||
} else {
|
||||
|
||||
@ -29,9 +29,7 @@ class xml extends Extension
|
||||
'simplexml' => '--enable-simplexml',
|
||||
default => throw new RuntimeException('Not accept non-xml extension'),
|
||||
};
|
||||
if (!$shared) {
|
||||
$arg .= ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
$arg .= ($shared ? '=shared' : '' ) . ' --with-libxml="' . BUILD_ROOT_PATH . '"';
|
||||
return $arg;
|
||||
}
|
||||
|
||||
|
||||
@ -322,7 +322,7 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = ' . BUILD_MODULES_PATH . '|" Makefile')
|
||||
->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile')
|
||||
->exec(getenv('SPC_CMD_PREFIX_PHP_MAKE') . ' INSTALL_ROOT=' . BUILD_ROOT_PATH . " {$vars} install");
|
||||
$this->patchPhpScripts();
|
||||
}
|
||||
|
||||
@ -47,5 +47,6 @@ trait libxslt
|
||||
->execWithEnv("make -j{$this->builder->concurrency}")
|
||||
->execWithEnv('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
||||
$this->patchPkgconfPrefix(['libexslt.pc']);
|
||||
$this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class SourcePatcher
|
||||
*/
|
||||
public static function patchBeforeConfigure(BuilderBase $builder): void
|
||||
{
|
||||
foreach ($builder->getExts(false) as $ext) {
|
||||
foreach ($builder->getExts() as $ext) {
|
||||
if ($ext->patchBeforeConfigure() === true) {
|
||||
logger()->info('Extension [' . $ext->getName() . '] patched before configure');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user