mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
mimalloc on mac (untested)
This commit is contained in:
parent
0ce2c894e9
commit
3477857584
@ -593,9 +593,6 @@
|
||||
"source": "mimalloc",
|
||||
"static-libs-unix": [
|
||||
"mimalloc.o"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"mimalloc.lib"
|
||||
]
|
||||
},
|
||||
"ncurses": {
|
||||
|
||||
@ -148,10 +148,12 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
$enableEmbed = ($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED;
|
||||
|
||||
// prepare build php envs
|
||||
$mimallocLibs = $this->getLib('mimalloc') !== null ? BUILD_LIB_PATH . '/mimalloc.o ' : '';
|
||||
$envs_build_php = SystemUtil::makeEnvVarString([
|
||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
|
||||
'CPPFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS'),
|
||||
'LDFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS'),
|
||||
'LIBS' => $mimallocLibs . getenv('SPC_CMD_VAR_PHP_CONFIGURE_LIBS'),
|
||||
]);
|
||||
|
||||
if ($this->getLib('postgresql')) {
|
||||
@ -298,6 +300,12 @@ class MacOSBuilder extends UnixBuilderBase
|
||||
->exec('rm ' . BUILD_ROOT_PATH . '/lib/libphp.a')
|
||||
->exec('ar rcs ' . BUILD_ROOT_PATH . '/lib/libphp.a *.o')
|
||||
->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o');
|
||||
|
||||
$php_config_str = FileSystem::readFile(BUILD_BIN_PATH . '/php-config');
|
||||
str_replace('prefix=""', 'prefix="' . BUILD_ROOT_PATH . '"', $php_config_str);
|
||||
// move mimalloc to the beginning of libs
|
||||
$php_config_str = preg_replace('/(libs=")(.*?)\s*(' . preg_quote(BUILD_LIB_PATH, '/') . '\/mimalloc\.o)\s*(.*?)"/', '$1$3 $2 $4"', $php_config_str);
|
||||
FileSystem::writeFile(BUILD_BIN_PATH . '/php-config', $php_config_str);
|
||||
}
|
||||
|
||||
private function getMakeExtraVars(): array
|
||||
|
||||
12
src/SPC/builder/macos/library/mimalloc.php
Normal file
12
src/SPC/builder/macos/library/mimalloc.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class mimalloc extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\mimalloc;
|
||||
|
||||
public const NAME = 'mimalloc';
|
||||
}
|
||||
@ -46,7 +46,7 @@ $extensions = match (PHP_OS_FAMILY) {
|
||||
|
||||
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||
$with_libs = match (PHP_OS_FAMILY) {
|
||||
'Linux', 'Darwin' => 'freetype',
|
||||
'Linux', 'Darwin' => 'mimalloc',
|
||||
'Windows' => 'libjpeg,libavif,freetype,libwebp',
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user