mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +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"
|
||||
],
|
||||
"lib-suggests": [
|
||||
"icu"
|
||||
"icu",
|
||||
"libxslt",
|
||||
"ldap",
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
"pthreads4w": {
|
||||
@ -464,10 +467,9 @@
|
||||
"libsnappy.a"
|
||||
],
|
||||
"headers-unix": [
|
||||
"snappy.h",
|
||||
"snappy-c.h",
|
||||
"snappy-sinksource.h",
|
||||
"snappy.h",
|
||||
"snappy-stubs-internal.h",
|
||||
"snappy-stubs-public.h"
|
||||
],
|
||||
"lib-depends": [
|
||||
|
||||
@ -41,10 +41,14 @@ class LinuxBuilder extends BuilderBase
|
||||
if (SystemUtil::isMuslDist()) {
|
||||
$this->setOptionIfNotExist('cc', 'gcc');
|
||||
$this->setOptionIfNotExist('cxx', 'g++');
|
||||
$this->setOptionIfNotExist('library_path', '');
|
||||
$this->setOptionIfNotExist('ld_library_path', '');
|
||||
} else {
|
||||
$arch = arch2gnu(php_uname('m'));
|
||||
$this->setOptionIfNotExist('cc', "{$arch}-linux-musl-gcc");
|
||||
$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)
|
||||
$this->setOptionIfNotExist('arch', php_uname('m'));
|
||||
@ -174,7 +178,7 @@ class LinuxBuilder extends BuilderBase
|
||||
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec(
|
||||
(!SystemUtil::isMuslDist() ? "LD_LIBRARY_PATH=/usr/local/musl/{$arch}-linux-musl/lib " : '') .
|
||||
"{$this->getOption('ld_library_path')} " .
|
||||
'./configure ' .
|
||||
'--prefix= ' .
|
||||
'--with-valgrind=no ' .
|
||||
|
||||
@ -4,20 +4,35 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\builder\linux\library\LinuxLibraryBase;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
|
||||
trait libxslt
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
$required_libs = '';
|
||||
foreach ($this->getDependencies() as $dep) {
|
||||
if ($dep instanceof LinuxLibraryBase) {
|
||||
$required_libs .= ' ' . $dep->getStaticLibFiles();
|
||||
}
|
||||
}
|
||||
shell()->cd($this->source_dir)
|
||||
->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 ' .
|
||||
'--without-python ' .
|
||||
'--without-mem-debug ' .
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user