refactor macos builder

This commit is contained in:
crazywhalecc 2023-04-03 20:47:24 +08:00
parent 3709bcc5e4
commit 09e5c16570
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
23 changed files with 278 additions and 329 deletions

View File

@ -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 库对应的源码,如果不存在,则抛出异常
* *

View File

@ -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 {

View File

@ -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]);
} }
} }

View File

@ -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();

View File

@ -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 ' .
// '--debug-find ' .
'-DCMAKE_BUILD_TYPE=Release ' . '-DCMAKE_BUILD_TYPE=Release ' .
'-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} " .
'.. && ' . '..'
"cmake --build . -j {$this->builder->concurrency} && " . )
'make install DESTDIR="' . $destdir . '"' ->exec("cmake --build . -j {$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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
);
} }
} }

View File

@ -95,14 +95,12 @@ 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 ' .
// '--debug-find ' .
'-DCMAKE_BUILD_TYPE=Release ' . '-DCMAKE_BUILD_TYPE=Release ' .
'-DBUILD_SHARED_LIBS=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' .
$extra . $extra .
@ -110,9 +108,9 @@ class curl extends MacOSLibraryBase
"-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} && " . )
'make install DESTDIR="' . $destdir . '"' ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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 ' . '--enable-static --disable-shared --without-harfbuzz --prefix= ' .
$suggested . $suggested
'--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}");
);
} }
} }

View File

@ -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= && ' . // use prefix=/ '--prefix='
'make clean && ' . )
"make -j{$this->builder->concurrency} && " . ->exec('make clean')
'make install DESTDIR=' . $destdir ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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 && ' . )
"make -j{$this->builder->concurrency} && " . ->exec('make clean')
"make install DESTDIR={$destdir}" ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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} && " .
"{$this->builder->configure_env} " .
'./configure ' .
"--host={$this->builder->gnu_arch}-apple-darwin " . "--host={$this->builder->gnu_arch}-apple-darwin " .
'--disable-shared ' . '--disable-shared ' .
'--enable-static ' . '--enable-static ' .
'--enable-hardware-optimizations ' . '--enable-hardware-optimizations ' .
$optimizations . $optimizations .
'--prefix= && ' . // use prefix=/ '--prefix='
'make clean && ' . )
"make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la && " . ->exec('make clean')
'make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH . ' && ' . ->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la")
'cd ' . BUILD_LIB_PATH . ' && ' . ->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH)
'ln -sf libpng16.a libpng.a' ->cd(BUILD_LIB_PATH)
); ->exec('ln -sf libpng16.a libpng.a');
} }
} }

View File

@ -31,14 +31,12 @@ 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 ' .
// '--debug-find ' .
'-DCMAKE_BUILD_TYPE=Release ' . '-DCMAKE_BUILD_TYPE=Release ' .
'-DBUILD_SHARED_LIBS=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' .
'-DBUILD_EXAMPLES=OFF ' . '-DBUILD_EXAMPLES=OFF ' .
@ -48,9 +46,9 @@ class libssh2 extends MacOSLibraryBase
"-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} --target libssh2 && " . )
'make install DESTDIR="' . $destdir . '"' ->exec("cmake --build . -j {$this->builder->concurrency} --target libssh2")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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= && ' . // use prefix=/ '--prefix='
'make clean && ' . )
"make -j{$this->builder->concurrency} && " . ->exec('make clean')
'make install DESTDIR=' . $destdir ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -37,12 +37,11 @@ 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 ' .
@ -58,9 +57,9 @@ class libxml2 extends MacOSLibraryBase
"-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} && " . )
'make install DESTDIR="' . $destdir . '"' ->exec("cmake --build . -j {$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -72,12 +72,11 @@ 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 ' .
@ -87,9 +86,9 @@ EOF
"-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} && " . )
'make install DESTDIR=' . $destdir ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -72,12 +72,11 @@ 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 ' .
@ -93,9 +92,9 @@ class libzip extends MacOSLibraryBase
"-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} && " . )
'make install DESTDIR=' . $destdir ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -44,9 +44,8 @@ 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 ' .
@ -54,10 +53,10 @@ class nghttp2 extends MacOSLibraryBase
'--enable-lib-only ' . '--enable-lib-only ' .
'--with-boost=no ' . '--with-boost=no ' .
$args . ' ' . $args . ' ' .
'--prefix= && ' . // use prefix=/ '--prefix='
'make clean && ' . )
"make -j{$this->builder->concurrency} && " . ->exec('make clean')
"make install DESTDIR={$destdir}" ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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= && ' . // use prefix=/ '--prefix='
'make clean && ' . )
"make -j{$this->builder->concurrency} && " . ->exec('make clean')
'make install DESTDIR=' . $destdir ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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 && ' . )
"make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\" && " . ->exec('make clean')
'make install_sw DESTDIR=' . $destdir ->exec("make -j{$this->builder->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
); ->exec("make install_sw DESTDIR={$destdir}");
} }
} }

View File

@ -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
);
} }
} }

View File

@ -28,10 +28,9 @@ 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 ' .
@ -43,10 +42,10 @@ class xz extends MacOSLibraryBase
'--disable-scripts ' . '--disable-scripts ' .
'--disable-doc ' . '--disable-doc ' .
'--with-libiconv ' . '--with-libiconv ' .
'--prefix= && ' . // use prefix=/ '--prefix='
'make clean && ' . )
"make -j{$this->builder->concurrency} && " . ->exec('make clean')
'make install DESTDIR=' . $destdir ->exec("make -j{$this->builder->concurrency}")
); ->exec("make install DESTDIR={$destdir}");
} }
} }

View File

@ -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
);
} }
} }

View File

@ -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 . ' && ' . )
'cp lib/zdict.h lib/zstd_errors.h lib/zstd.h ' . BUILD_INCLUDE_PATH ->exec('cp lib/libzstd.a ' . BUILD_LIB_PATH)
); ->exec('cp lib/zdict.h lib/zstd_errors.h lib/zstd.h ' . BUILD_INCLUDE_PATH);
} }
} }