mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
introduce library_path and ld_library_path options to linuxbuilder (some libs require it to load -lstdc++)
This commit is contained in:
parent
a83a457905
commit
da1cbeb79c
@ -434,7 +434,10 @@
|
|||||||
"readline"
|
"readline"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
"icu"
|
"icu",
|
||||||
|
"libxslt",
|
||||||
|
"ldap",
|
||||||
|
"zstd"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"pthreads4w": {
|
"pthreads4w": {
|
||||||
@ -464,10 +467,9 @@
|
|||||||
"libsnappy.a"
|
"libsnappy.a"
|
||||||
],
|
],
|
||||||
"headers-unix": [
|
"headers-unix": [
|
||||||
|
"snappy.h",
|
||||||
"snappy-c.h",
|
"snappy-c.h",
|
||||||
"snappy-sinksource.h",
|
"snappy-sinksource.h",
|
||||||
"snappy.h",
|
|
||||||
"snappy-stubs-internal.h",
|
|
||||||
"snappy-stubs-public.h"
|
"snappy-stubs-public.h"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
|
|||||||
@ -41,10 +41,14 @@ class LinuxBuilder extends BuilderBase
|
|||||||
if (SystemUtil::isMuslDist()) {
|
if (SystemUtil::isMuslDist()) {
|
||||||
$this->setOptionIfNotExist('cc', 'gcc');
|
$this->setOptionIfNotExist('cc', 'gcc');
|
||||||
$this->setOptionIfNotExist('cxx', 'g++');
|
$this->setOptionIfNotExist('cxx', 'g++');
|
||||||
|
$this->setOptionIfNotExist('library_path', '');
|
||||||
|
$this->setOptionIfNotExist('ld_library_path', '');
|
||||||
} else {
|
} else {
|
||||||
$arch = arch2gnu(php_uname('m'));
|
$arch = arch2gnu(php_uname('m'));
|
||||||
$this->setOptionIfNotExist('cc', "{$arch}-linux-musl-gcc");
|
$this->setOptionIfNotExist('cc', "{$arch}-linux-musl-gcc");
|
||||||
$this->setOptionIfNotExist('cxx', "{$arch}-linux-musl-g++");
|
$this->setOptionIfNotExist('cxx', "{$arch}-linux-musl-g++");
|
||||||
|
$this->setOptionIfNotExist('library_path', "LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib");
|
||||||
|
$this->setOptionIfNotExist('ld_library_path', "LD_LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib");
|
||||||
}
|
}
|
||||||
// set arch (default: current)
|
// set arch (default: current)
|
||||||
$this->setOptionIfNotExist('arch', php_uname('m'));
|
$this->setOptionIfNotExist('arch', php_uname('m'));
|
||||||
@ -174,7 +178,7 @@ class LinuxBuilder extends BuilderBase
|
|||||||
|
|
||||||
shell()->cd(SOURCE_PATH . '/php-src')
|
shell()->cd(SOURCE_PATH . '/php-src')
|
||||||
->exec(
|
->exec(
|
||||||
(!SystemUtil::isMuslDist() ? "LD_LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib " : '') .
|
"{$this->getOption('ld_library_path')} " .
|
||||||
'./configure ' .
|
'./configure ' .
|
||||||
'--prefix= ' .
|
'--prefix= ' .
|
||||||
'--with-valgrind=no ' .
|
'--with-valgrind=no ' .
|
||||||
|
|||||||
@ -4,20 +4,35 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\unix\library;
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\builder\linux\library\LinuxLibraryBase;
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
|
||||||
trait libxslt
|
trait libxslt
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
|
$required_libs = '';
|
||||||
|
foreach ($this->getDependencies() as $dep) {
|
||||||
|
if ($dep instanceof LinuxLibraryBase) {
|
||||||
|
$required_libs .= ' ' . $dep->getStaticLibFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
shell()->cd($this->source_dir)
|
shell()->cd($this->source_dir)
|
||||||
->exec(
|
->exec(
|
||||||
"{$this->builder->configure_env} ./configure " .
|
"{$this->builder->configure_env} " .
|
||||||
|
'CFLAGS="-I' . BUILD_INCLUDE_PATH . '" ' .
|
||||||
|
"{$this->builder->getOption('library_path')} " .
|
||||||
|
"{$this->builder->getOption('ld_library_path')} " .
|
||||||
|
'LDFLAGS="-L' . BUILD_LIB_PATH . '" ' .
|
||||||
|
"LIBS='{$required_libs} -lstdc++' " .
|
||||||
|
'./configure ' .
|
||||||
'--enable-static --disable-shared ' .
|
'--enable-static --disable-shared ' .
|
||||||
'--without-python ' .
|
'--without-python ' .
|
||||||
'--without-mem-debug ' .
|
'--without-mem-debug ' .
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user