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