mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
refactor macos builder
This commit is contained in:
parent
3709bcc5e4
commit
09e5c16570
@ -202,6 +202,16 @@ abstract class BuilderBase
|
|||||||
return $this->libs_only;
|
return $this->libs_only;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前即将编译的 PHP 的版本 ID,五位数那个
|
||||||
|
*/
|
||||||
|
public function getPHPVersionID(): int
|
||||||
|
{
|
||||||
|
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||||
|
preg_match('/PHP_VERSION_ID (\d+)/', $file, $match);
|
||||||
|
return intval($match[1]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查是否存在 lib 库对应的源码,如果不存在,则抛出异常
|
* 检查是否存在 lib 库对应的源码,如果不存在,则抛出异常
|
||||||
*
|
*
|
||||||
|
|||||||
@ -174,6 +174,7 @@ class LinuxBuilder extends BuilderBase
|
|||||||
'--disable-all ' .
|
'--disable-all ' .
|
||||||
'--disable-cgi ' .
|
'--disable-cgi ' .
|
||||||
'--disable-phpdbg ' .
|
'--disable-phpdbg ' .
|
||||||
|
'--with-ffi ' .
|
||||||
'--enable-cli ' .
|
'--enable-cli ' .
|
||||||
'--enable-micro=all-static ' .
|
'--enable-micro=all-static ' .
|
||||||
($this->zts ? '--enable-zts' : '') . ' ' .
|
($this->zts ? '--enable-zts' : '') . ' ' .
|
||||||
@ -248,6 +249,9 @@ class LinuxBuilder extends BuilderBase
|
|||||||
*/
|
*/
|
||||||
public function buildMicro(string $extra_libs, string $use_lld, string $cflags): void
|
public function buildMicro(string $extra_libs, string $use_lld, string $cflags): void
|
||||||
{
|
{
|
||||||
|
if ($this->getPHPVersionID() < 80000) {
|
||||||
|
throw new RuntimeException('phpmicro only support PHP >= 8.0!');
|
||||||
|
}
|
||||||
if ($this->getExt('phar')) {
|
if ($this->getExt('phar')) {
|
||||||
$this->phar_patched = true;
|
$this->phar_patched = true;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -224,52 +224,31 @@ class MacOSBuilder extends BuilderBase
|
|||||||
$this->phar_patched = true;
|
$this->phar_patched = true;
|
||||||
try {
|
try {
|
||||||
// TODO: 未来改进一下 patch,让除了这种 patch 类型的文件以外可以恢复原文件
|
// TODO: 未来改进一下 patch,让除了这种 patch 类型的文件以外可以恢复原文件
|
||||||
f_passthru('cd ' . SOURCE_PATH . '/php-src && patch -p1 < sapi/micro/patches/phar.patch');
|
shell()->cd(SOURCE_PATH . '/php-src')->exec('patch -p1 < sapi/micro/patches/phar.patch');
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
logger()->error('failed to patch phat due to patch exit with code ' . $e->getCode());
|
logger()->error('failed to patch phat due to patch exit with code ' . $e->getCode());
|
||||||
$this->phar_patched = false;
|
$this->phar_patched = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd(SOURCE_PATH . '/php-src')
|
||||||
$this->set_x . ' && ' .
|
->exec("make -j{$this->concurrency} EXTRA_CFLAGS=\"-g -Os -fno-ident\" EXTRA_LIBS=\"{$extra_libs} -lresolv\" STRIP=\"dsymutil -f \" micro");
|
||||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
$this->deployBinary(BUILD_TYPE_MICRO);
|
||||||
"make -j{$this->concurrency} " .
|
|
||||||
'EXTRA_CFLAGS="-g -Os -fno-ident" ' .
|
|
||||||
"EXTRA_LIBS=\"{$extra_libs} -lresolv\" " .
|
|
||||||
'STRIP="dsymutil -f " ' .
|
|
||||||
// TODO: comment things
|
|
||||||
'micro'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建 cli
|
* 构建 cli
|
||||||
*
|
*
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
*/
|
*/
|
||||||
public function buildCli(string $extra_libs): void
|
public function buildCli(string $extra_libs): void
|
||||||
{
|
{
|
||||||
f_passthru(
|
shell()->cd(SOURCE_PATH . '/php-src')
|
||||||
$this->set_x . ' && ' .
|
// 生成调试信息、优化编译后的尺寸、禁用标识符(如变量、函数名)缩短
|
||||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
->exec("make -j{$this->concurrency} EXTRA_CFLAGS=\"-g -Os -fno-ident\" EXTRA_LIBS=\"{$extra_libs} -lresolv\" cli")
|
||||||
"make -j{$this->concurrency} " .
|
->exec('dsymutil -f sapi/cli/php')
|
||||||
'EXTRA_CFLAGS="-g -Os -fno-ident" ' . // 生成调试信息、优化编译后的尺寸、禁用标识符(如变量、函数名)缩短
|
->exec('strip sapi/cli/php');
|
||||||
"EXTRA_LIBS=\"{$extra_libs} -lresolv\" " .
|
$this->deployBinary(BUILD_TYPE_CLI);
|
||||||
// TODO: comment things
|
|
||||||
'cli &&' .
|
|
||||||
'dsymutil -f sapi/cli/php &&' .
|
|
||||||
'strip sapi/cli/php'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前即将编译的 PHP 的版本 ID,五位数那个
|
|
||||||
*/
|
|
||||||
public function getPHPVersionID(): int
|
|
||||||
{
|
|
||||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
|
||||||
preg_match('/PHP_VERSION_ID (\d+)/', $file, $match);
|
|
||||||
return intval($match[1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,15 +14,8 @@ abstract class MacOSLibraryBase extends LibraryBase
|
|||||||
{
|
{
|
||||||
use UnixLibraryTrait;
|
use UnixLibraryTrait;
|
||||||
|
|
||||||
protected array $static_libs;
|
|
||||||
|
|
||||||
protected array $headers;
|
protected array $headers;
|
||||||
|
|
||||||
/**
|
|
||||||
* 依赖的名字及是否可选,例如:curl => true,代表依赖 curl 但可选
|
|
||||||
*/
|
|
||||||
protected array $dep_names;
|
|
||||||
|
|
||||||
public function __construct(protected MacOSBuilder $builder)
|
public function __construct(protected MacOSBuilder $builder)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|||||||
@ -27,23 +27,21 @@ class brotli extends MacOSLibraryBase
|
|||||||
protected function build()
|
protected function build()
|
||||||
{
|
{
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
"{$this->builder->set_x} && " .
|
->exec('rm -rf build')
|
||||||
"cd {$this->source_dir} && " .
|
->exec('mkdir -p build')
|
||||||
'rm -rf build && ' .
|
->cd($this->source_dir . '/build')
|
||||||
'mkdir -p build && ' .
|
->exec(
|
||||||
'cd build && ' .
|
"{$this->builder->configure_env} cmake " .
|
||||||
"{$this->builder->configure_env} " . ' cmake ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
// '--debug-find ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
'..'
|
||||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
)
|
||||||
'.. && ' .
|
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||||
"cmake --build . -j {$this->builder->concurrency} && " .
|
->exec("make install DESTDIR={$destdir}");
|
||||||
'make install DESTDIR="' . $destdir . '"'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,14 +26,10 @@ class bzip2 extends MacOSLibraryBase
|
|||||||
|
|
||||||
protected function build()
|
protected function build()
|
||||||
{
|
{
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec("make {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' clean")
|
||||||
"cd {$this->source_dir} && " .
|
->exec("make -j{$this->builder->concurrency} {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' libbz2.a")
|
||||||
"make {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' clean" . ' && ' .
|
->exec('cp libbz2.a ' . BUILD_LIB_PATH)
|
||||||
"make -j{$this->builder->concurrency} {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' libbz2.a" . ' && ' .
|
->exec('cp bzlib.h ' . BUILD_INCLUDE_PATH);
|
||||||
// make install may fail when cross-compiling, so we copy files.
|
|
||||||
'cp libbz2.a ' . BUILD_LIB_PATH . ' && ' .
|
|
||||||
'cp bzlib.h ' . BUILD_INCLUDE_PATH
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,24 +95,22 @@ class curl extends MacOSLibraryBase
|
|||||||
|
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||||
// compile!
|
// compile!
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec('rm -rf build')
|
||||||
"cd {$this->source_dir} && " .
|
->exec('mkdir -p build')
|
||||||
'rm -rf build && ' .
|
->cd($this->source_dir . '/build')
|
||||||
'mkdir -p build && ' .
|
->exec(
|
||||||
'cd build && ' .
|
"{$this->builder->configure_env} cmake " .
|
||||||
"{$this->builder->configure_env} " . ' cmake ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
// '--debug-find ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
$extra .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DCMAKE_INSTALL_PREFIX= ' .
|
||||||
$extra .
|
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||||
'-DCMAKE_INSTALL_PREFIX= ' .
|
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
'..'
|
||||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
)
|
||||||
'.. && ' .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make install DESTDIR={$destdir}");
|
||||||
'make install DESTDIR="' . $destdir . '"'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,16 +23,14 @@ class freetype extends MacOSLibraryBase
|
|||||||
$suggested .= ($this->builder->getLib('brotli') instanceof MacOSLibraryBase) ? ('--with-brotli=' . BUILD_ROOT_PATH) : '--without-brotli';
|
$suggested .= ($this->builder->getLib('brotli') instanceof MacOSLibraryBase) ? ('--with-brotli=' . BUILD_ROOT_PATH) : '--without-brotli';
|
||||||
$suggested .= ' ';
|
$suggested .= ' ';
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec(
|
||||||
"cd {$this->source_dir} && " .
|
"{$this->builder->configure_env} ./configure " .
|
||||||
"{$this->builder->configure_env} ./configure " .
|
'--enable-static --disable-shared --without-harfbuzz --prefix= ' .
|
||||||
'--enable-static --disable-shared --without-harfbuzz ' .
|
$suggested
|
||||||
$suggested .
|
)
|
||||||
'--prefix= && ' . // use prefix=/
|
->exec('make clean')
|
||||||
'make clean && ' .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make install DESTDIR={$destdir}");
|
||||||
'make install DESTDIR=' . $destdir
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,15 +15,14 @@ class gmp extends MacOSLibraryBase
|
|||||||
{
|
{
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec(
|
||||||
"cd {$this->source_dir} && " .
|
"{$this->builder->configure_env} ./configure " .
|
||||||
"{$this->builder->configure_env} ./configure " .
|
'--enable-static --disable-shared ' .
|
||||||
'--enable-static --disable-shared ' .
|
'--prefix='
|
||||||
'--prefix= && ' . // use prefix=/
|
)
|
||||||
'make clean && ' .
|
->exec('make clean')
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
'make install DESTDIR=' . $destdir
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,20 +26,19 @@ class libffi extends MacOSLibraryBase
|
|||||||
|
|
||||||
protected function build()
|
protected function build()
|
||||||
{
|
{
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, , $destdir] = SEPARATED_PATH;
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec(
|
||||||
"cd {$this->source_dir} && " .
|
"{$this->builder->configure_env} ./configure " .
|
||||||
"{$this->builder->configure_env} ./configure " .
|
'--enable-static ' .
|
||||||
'--enable-static ' .
|
'--disable-shared ' .
|
||||||
'--disable-shared ' .
|
"--host={$this->builder->arch}-apple-darwin " .
|
||||||
"--host={$this->builder->arch}-apple-darwin " .
|
"--target={$this->builder->arch}-apple-darwin " .
|
||||||
"--target={$this->builder->arch}-apple-darwin " .
|
'--prefix= ' . // use prefix=/
|
||||||
'--prefix= ' . // use prefix=/
|
"--libdir={$lib}"
|
||||||
"--libdir={$lib} && " .
|
)
|
||||||
'make clean && ' .
|
->exec('make clean')
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
"make install DESTDIR={$destdir}"
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,23 +43,20 @@ class libpng extends MacOSLibraryBase
|
|||||||
|
|
||||||
// patch configure
|
// patch configure
|
||||||
Patcher::patchUnixLibpng();
|
Patcher::patchUnixLibpng();
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
f_passthru(
|
->exec(
|
||||||
$this->builder->set_x . ' && ' .
|
"{$this->builder->configure_env} ./configure " .
|
||||||
"cd {$this->source_dir} && " .
|
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
||||||
"{$this->builder->configure_env} " .
|
'--disable-shared ' .
|
||||||
'./configure ' .
|
'--enable-static ' .
|
||||||
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
'--enable-hardware-optimizations ' .
|
||||||
'--disable-shared ' .
|
$optimizations .
|
||||||
'--enable-static ' .
|
'--prefix='
|
||||||
'--enable-hardware-optimizations ' .
|
)
|
||||||
$optimizations .
|
->exec('make clean')
|
||||||
'--prefix= && ' . // use prefix=/
|
->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la")
|
||||||
'make clean && ' .
|
->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH)
|
||||||
"make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la && " .
|
->cd(BUILD_LIB_PATH)
|
||||||
'make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH . ' && ' .
|
->exec('ln -sf libpng16.a libpng.a');
|
||||||
'cd ' . BUILD_LIB_PATH . ' && ' .
|
|
||||||
'ln -sf libpng16.a libpng.a'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,26 +31,24 @@ class libssh2 extends MacOSLibraryBase
|
|||||||
|
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec('rm -rf build')
|
||||||
"cd {$this->source_dir} && " .
|
->exec('mkdir -p build')
|
||||||
'rm -rf build && ' .
|
->cd($this->source_dir . '/build')
|
||||||
'mkdir -p build && ' .
|
->exec(
|
||||||
'cd build && ' .
|
"{$this->builder->configure_env} " . ' cmake ' .
|
||||||
"{$this->builder->configure_env} " . ' cmake ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
// '--debug-find ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
'-DBUILD_EXAMPLES=OFF ' .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DBUILD_TESTING=OFF ' .
|
||||||
'-DBUILD_EXAMPLES=OFF ' .
|
"-DENABLE_ZLIB_COMPRESSION={$enable_zlib} " .
|
||||||
'-DBUILD_TESTING=OFF ' .
|
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||||
"-DENABLE_ZLIB_COMPRESSION={$enable_zlib} " .
|
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
'..'
|
||||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
)
|
||||||
'.. && ' .
|
->exec("cmake --build . -j {$this->builder->concurrency} --target libssh2")
|
||||||
"cmake --build . -j {$this->builder->concurrency} --target libssh2 && " .
|
->exec("make install DESTDIR={$destdir}");
|
||||||
'make install DESTDIR="' . $destdir . '"'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,15 +15,14 @@ class libuv extends MacOSLibraryBase
|
|||||||
{
|
{
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec(
|
||||||
"cd {$this->source_dir} && " .
|
"{$this->builder->configure_env} ./configure " .
|
||||||
"{$this->builder->configure_env} ./configure " .
|
'--enable-static --disable-shared ' .
|
||||||
'--enable-static --disable-shared ' .
|
'--prefix='
|
||||||
'--prefix= && ' . // use prefix=/
|
)
|
||||||
'make clean && ' .
|
->exec('make clean')
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
'make install DESTDIR=' . $destdir
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,30 +37,29 @@ class libxml2 extends MacOSLibraryBase
|
|||||||
|
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec('rm -rf build')
|
||||||
"cd {$this->source_dir} && " .
|
->exec('mkdir -p build')
|
||||||
'rm -rf build && ' .
|
->cd($this->source_dir . '/build')
|
||||||
'mkdir -p build && ' .
|
->exec(
|
||||||
'cd build && ' .
|
"{$this->builder->configure_env} " . ' cmake ' .
|
||||||
"{$this->builder->configure_env} " . ' cmake ' .
|
// '--debug-find ' .
|
||||||
// '--debug-find ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DLIBXML2_WITH_ICONV=ON ' .
|
||||||
'-DLIBXML2_WITH_ICONV=ON ' .
|
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
|
||||||
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
|
"-DLIBXML2_WITH_ICU={$enable_icu} " .
|
||||||
"-DLIBXML2_WITH_ICU={$enable_icu} " .
|
"-DLIBXML2_WITH_LZMA={$enable_xz} " .
|
||||||
"-DLIBXML2_WITH_LZMA={$enable_xz} " .
|
'-DLIBXML2_WITH_PYTHON=OFF ' .
|
||||||
'-DLIBXML2_WITH_PYTHON=OFF ' .
|
'-DLIBXML2_WITH_PROGRAMS=OFF ' .
|
||||||
'-DLIBXML2_WITH_PROGRAMS=OFF ' .
|
'-DLIBXML2_WITH_TESTS=OFF ' .
|
||||||
'-DLIBXML2_WITH_TESTS=OFF ' .
|
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
'..'
|
||||||
'.. && ' .
|
)
|
||||||
"cmake --build . -j {$this->builder->concurrency} && " .
|
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||||
'make install DESTDIR="' . $destdir . '"'
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,24 +72,23 @@ EOF
|
|||||||
|
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec('rm -rf build')
|
||||||
"cd {$this->source_dir} && " .
|
->exec('mkdir -p build')
|
||||||
'rm -rf build && ' .
|
->cd($this->source_dir . '/build')
|
||||||
'mkdir -p build && ' .
|
->exec(
|
||||||
'cd build && ' .
|
"{$this->builder->configure_env} " . ' cmake ' .
|
||||||
"{$this->builder->configure_env} " . ' cmake ' .
|
// '--debug-find ' .
|
||||||
// '--debug-find ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
'-DBUILD_TESTING=OFF ' .
|
||||||
'-DBUILD_TESTING=OFF ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
'..'
|
||||||
'.. && ' .
|
)
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
'make install DESTDIR=' . $destdir
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,30 +72,29 @@ class libzip extends MacOSLibraryBase
|
|||||||
|
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec('rm -rf build')
|
||||||
"cd {$this->source_dir} && " .
|
->exec('mkdir -p build')
|
||||||
'rm -rf build && ' .
|
->cd($this->source_dir . '/build')
|
||||||
'mkdir -p build && ' .
|
->exec(
|
||||||
'cd build && ' .
|
"{$this->builder->configure_env} " . ' cmake ' .
|
||||||
"{$this->builder->configure_env} " . ' cmake ' .
|
// '--debug-find ' .
|
||||||
// '--debug-find ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
'-DENABLE_GNUTLS=OFF ' .
|
||||||
'-DENABLE_GNUTLS=OFF ' .
|
'-DENABLE_MBEDTLS=OFF ' .
|
||||||
'-DENABLE_MBEDTLS=OFF ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DBUILD_DOC=OFF ' .
|
||||||
'-DBUILD_DOC=OFF ' .
|
'-DBUILD_EXAMPLES=OFF ' .
|
||||||
'-DBUILD_EXAMPLES=OFF ' .
|
'-DBUILD_REGRESS=OFF ' .
|
||||||
'-DBUILD_REGRESS=OFF ' .
|
'-DBUILD_TOOLS=OFF ' .
|
||||||
'-DBUILD_TOOLS=OFF ' .
|
$extra .
|
||||||
$extra .
|
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
||||||
'-DCMAKE_INSTALL_PREFIX=/ ' .
|
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
||||||
"-DCMAKE_INSTALL_LIBDIR={$lib} " .
|
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
||||||
"-DCMAKE_INSTALL_INCLUDEDIR={$include} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
'..'
|
||||||
'.. && ' .
|
)
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
'make install DESTDIR=' . $destdir
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,20 +44,19 @@ class nghttp2 extends MacOSLibraryBase
|
|||||||
|
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec(
|
||||||
"cd {$this->source_dir} && " .
|
"{$this->builder->configure_env} " . ' ./configure ' .
|
||||||
"{$this->builder->configure_env} " . ' ./configure ' .
|
'--enable-static ' .
|
||||||
'--enable-static ' .
|
'--disable-shared ' .
|
||||||
'--disable-shared ' .
|
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
||||||
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
'--enable-lib-only ' .
|
||||||
'--enable-lib-only ' .
|
'--with-boost=no ' .
|
||||||
'--with-boost=no ' .
|
$args . ' ' .
|
||||||
$args . ' ' .
|
'--prefix='
|
||||||
'--prefix= && ' . // use prefix=/
|
)
|
||||||
'make clean && ' .
|
->exec('make clean')
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
"make install DESTDIR={$destdir}"
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,17 +28,16 @@ class onig extends MacOSLibraryBase
|
|||||||
{
|
{
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec(
|
||||||
"cd {$this->source_dir} && " .
|
"{$this->builder->configure_env} " . ' ./configure ' .
|
||||||
"{$this->builder->configure_env} " . ' ./configure ' .
|
'--enable-static ' .
|
||||||
'--enable-static ' .
|
'--disable-shared ' .
|
||||||
'--disable-shared ' .
|
"--host={$this->builder->arch}-apple-darwin " .
|
||||||
"--host={$this->builder->arch}-apple-darwin " .
|
'--prefix='
|
||||||
'--prefix= && ' . // use prefix=/
|
)
|
||||||
'make clean && ' .
|
->exec('make clean')
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
'make install DESTDIR=' . $destdir
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,16 +37,15 @@ class openssl extends MacOSLibraryBase
|
|||||||
$ex_lib = trim($zlib->getStaticLibFiles() . ' ' . $ex_lib);
|
$ex_lib = trim($zlib->getStaticLibFiles() . ' ' . $ex_lib);
|
||||||
}
|
}
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec(
|
||||||
"cd {$this->source_dir} && " .
|
"{$this->builder->configure_env} ./Configure no-shared {$extra} " .
|
||||||
"{$this->builder->configure_env} ./Configure no-shared {$extra} " .
|
'--prefix=/ ' . // use prefix=/
|
||||||
'--prefix=/ ' . // use prefix=/
|
"--libdir={$lib} " .
|
||||||
"--libdir={$lib} " .
|
" darwin64-{$this->builder->arch}-cc"
|
||||||
" darwin64-{$this->builder->arch}-cc && " .
|
)
|
||||||
'make clean && ' .
|
->exec('make clean')
|
||||||
"make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\" && " .
|
->exec("make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
||||||
'make install_sw DESTDIR=' . $destdir
|
->exec("make install_sw DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,16 +11,10 @@ class sqlite extends MacOSLibraryBase
|
|||||||
protected function build()
|
protected function build()
|
||||||
{
|
{
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
f_passthru(
|
->exec("{$this->builder->configure_env} ./configure --enable-static --disable-shared --prefix=")
|
||||||
$this->builder->set_x . ' && ' .
|
->exec('make clean')
|
||||||
"cd {$this->source_dir} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
"{$this->builder->configure_env} ./configure " .
|
->exec("make install DESTDIR={$destdir}");
|
||||||
'--enable-static --disable-shared ' .
|
|
||||||
'--prefix= && ' . // use prefix=/
|
|
||||||
'make clean && ' .
|
|
||||||
"make -j{$this->builder->concurrency} && " .
|
|
||||||
'make install DESTDIR=' . $destdir
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,25 +28,24 @@ class xz extends MacOSLibraryBase
|
|||||||
{
|
{
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec('autoreconf -i --force')
|
||||||
"cd {$this->source_dir} && " .
|
->exec(
|
||||||
'autoreconf -i --force && ' .
|
"{$this->builder->configure_env} ./configure " .
|
||||||
"{$this->builder->configure_env} ./configure " .
|
'--enable-static ' .
|
||||||
'--enable-static ' .
|
'--disable-shared ' .
|
||||||
'--disable-shared ' .
|
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
||||||
"--host={$this->builder->gnu_arch}-apple-darwin " .
|
'--disable-xz ' .
|
||||||
'--disable-xz ' .
|
'--disable-xzdec ' .
|
||||||
'--disable-xzdec ' .
|
'--disable-lzmadec ' .
|
||||||
'--disable-lzmadec ' .
|
'--disable-lzmainfo ' .
|
||||||
'--disable-lzmainfo ' .
|
'--disable-scripts ' .
|
||||||
'--disable-scripts ' .
|
'--disable-doc ' .
|
||||||
'--disable-doc ' .
|
'--with-libiconv ' .
|
||||||
'--with-libiconv ' .
|
'--prefix='
|
||||||
'--prefix= && ' . // use prefix=/
|
)
|
||||||
'make clean && ' .
|
->exec('make clean')
|
||||||
"make -j{$this->builder->concurrency} && " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
'make install DESTDIR=' . $destdir
|
->exec("make install DESTDIR={$destdir}");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,15 +28,10 @@ class zlib extends MacOSLibraryBase
|
|||||||
{
|
{
|
||||||
[,,$destdir] = SEPARATED_PATH;
|
[,,$destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec("{$this->builder->configure_env} ./configure --static --prefix=")
|
||||||
"cd {$this->source_dir} && " .
|
->exec('make clean')
|
||||||
"{$this->builder->configure_env} ./configure " .
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
'--static ' .
|
->exec("make install DESTDIR={$destdir}");
|
||||||
'--prefix= && ' . // use prefix=/
|
|
||||||
'make clean && ' .
|
|
||||||
"make -j{$this->builder->concurrency} && " .
|
|
||||||
'make install DESTDIR=' . $destdir
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,16 +26,15 @@ class zstd extends MacOSLibraryBase
|
|||||||
|
|
||||||
protected function build()
|
protected function build()
|
||||||
{
|
{
|
||||||
f_passthru(
|
shell()->cd($this->source_dir)
|
||||||
$this->builder->set_x . ' && ' .
|
->exec("make {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' clean")
|
||||||
"cd {$this->source_dir} && " .
|
->exec(
|
||||||
"make {$this->builder->configure_env} PREFIX='" . BUILD_ROOT_PATH . "' clean" . ' && ' .
|
"make -j{$this->builder->concurrency} " .
|
||||||
"make -j{$this->builder->concurrency} " .
|
"{$this->builder->configure_env} " .
|
||||||
"{$this->builder->configure_env} " .
|
"PREFIX='" . BUILD_ROOT_PATH . "' " .
|
||||||
"PREFIX='" . BUILD_ROOT_PATH . "' " .
|
'-C lib libzstd.a CPPFLAGS_STATLIB=-DZSTD_MULTITHREAD'
|
||||||
'-C lib libzstd.a CPPFLAGS_STATLIB=-DZSTD_MULTITHREAD && ' .
|
)
|
||||||
'cp lib/libzstd.a ' . BUILD_LIB_PATH . ' && ' .
|
->exec('cp lib/libzstd.a ' . BUILD_LIB_PATH)
|
||||||
'cp lib/zdict.h lib/zstd_errors.h lib/zstd.h ' . BUILD_INCLUDE_PATH
|
->exec('cp lib/zdict.h lib/zstd_errors.h lib/zstd.h ' . BUILD_INCLUDE_PATH);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user