mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
mimalloc WIP
This commit is contained in:
parent
0bc143cac3
commit
6447fec028
@ -589,6 +589,15 @@
|
|||||||
"openssl"
|
"openssl"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"mimalloc": {
|
||||||
|
"source": "mimalloc",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"mimalloc.o"
|
||||||
|
],
|
||||||
|
"static-libs-windows": [
|
||||||
|
"mimalloc.lib"
|
||||||
|
]
|
||||||
|
},
|
||||||
"ncurses": {
|
"ncurses": {
|
||||||
"source": "ncurses",
|
"source": "ncurses",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@ -636,6 +636,16 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mimalloc": {
|
||||||
|
"type": "ghtagtar",
|
||||||
|
"repo": "microsoft/mimalloc",
|
||||||
|
"match": "v2.+",
|
||||||
|
"provide-pre-built": false,
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mongodb": {
|
"mongodb": {
|
||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "mongodb/mongo-php-driver",
|
"repo": "mongodb/mongo-php-driver",
|
||||||
|
|||||||
12
src/SPC/builder/linux/library/mimalloc.php
Normal file
12
src/SPC/builder/linux/library/mimalloc.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class mimalloc extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\mimalloc;
|
||||||
|
|
||||||
|
public const NAME = 'mimalloc';
|
||||||
|
}
|
||||||
38
src/SPC/builder/unix/library/mimalloc.php
Normal file
38
src/SPC/builder/unix/library/mimalloc.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
trait mimalloc
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
$args = '';
|
||||||
|
if (getenv('SPC_LIBC') === 'musl') {
|
||||||
|
$args .= '-DMI_LIBC_MUSL=ON ';
|
||||||
|
}
|
||||||
|
$args .= '-DMI_BUILD_SHARED=OFF ';
|
||||||
|
$args .= '-DMI_INSTALL_TOPLEVEL=ON ';
|
||||||
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
|
shell()->cd($this->source_dir . '/build')
|
||||||
|
->exec(
|
||||||
|
'cmake ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
$args .
|
||||||
|
'..'
|
||||||
|
)
|
||||||
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
|
->exec('make install');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -69,14 +69,19 @@ class Downloader
|
|||||||
retry: self::getRetryTime()
|
retry: self::getRetryTime()
|
||||||
), true);
|
), true);
|
||||||
|
|
||||||
if (($source['prefer-stable'] ?? false) === false) {
|
$url = null;
|
||||||
$url = $data[0]['tarball_url'];
|
for ($i = 0; $i < count($data); ++$i) {
|
||||||
} else {
|
if (($data[$i]['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
|
||||||
$id = 0;
|
continue;
|
||||||
while ($data[$id]['prerelease'] === true) {
|
}
|
||||||
++$id;
|
if (!($source['match'] ?? null)) {
|
||||||
|
$url = $data[$i]['tarball_url'] ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (preg_match('|' . $source['match'] . '|', $data[$i]['tarball_url'])) {
|
||||||
|
$url = $data[$i]['tarball_url'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$url = $data[$id]['tarball_url'] ?? null;
|
|
||||||
}
|
}
|
||||||
if (!$url) {
|
if (!$url) {
|
||||||
throw new DownloaderException("failed to find {$name} source");
|
throw new DownloaderException("failed to find {$name} source");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user