Add uv/libuv support (#296)

* add uv/libuv support

* sort config
This commit is contained in:
Jerry Ma 2023-12-23 16:23:37 +08:00 committed by GitHub
parent 584f96484c
commit 6b8df97282
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 93 additions and 2 deletions

View File

@ -471,6 +471,14 @@
"tokenizer": {
"type": "builtin"
},
"uv": {
"type": "external",
"source": "ext-uv",
"arg-type": "with-prefix",
"lib-depends": [
"libuv"
]
},
"xlswriter": {
"type": "external",
"source": "xlswriter",

View File

@ -284,6 +284,12 @@
"zlib"
]
},
"libuv": {
"source": "libuv",
"static-libs-unix": [
"libuv.a"
]
},
"libwebp": {
"source": "libwebp",
"static-libs-unix": [

View File

@ -100,6 +100,16 @@
"path": "LICENSE"
}
},
"ext-uv": {
"type": "url",
"url": "https://pecl.php.net/get/uv",
"path": "php-src/ext/uv",
"filename": "uv.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-zstd": {
"type": "git",
"path": "php-src/ext/zstd",
@ -279,6 +289,20 @@
"path": "COPYING"
}
},
"libuv": {
"type": "ghtar",
"repo": "libuv/libuv",
"license": [
{
"type": "file",
"path": "LICENSE"
},
{
"type": "file",
"path": "LICENSE-extra"
}
]
},
"libwebp": {
"type": "url",
"url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz",

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class libuv extends LinuxLibraryBase
{
use \SPC\builder\unix\library\libuv;
public const NAME = 'libuv';
}

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class libuv extends MacOSLibraryBase
{
use \SPC\builder\unix\library\libuv;
public const NAME = 'libuv';
}

View File

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
trait libuv
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
// CMake needs a clean build directory
FileSystem::resetDir($this->source_dir . '/build');
// Start build
shell()->cd($this->source_dir . '/build')
->exec("cmake {$this->builder->makeCmakeArgs()} -DLIBUV_BUILD_SHARED=OFF ..")
->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
// patch pkgconfig
$this->patchPkgconfPrefix(['libuv-static.pc']);
}
}

View File

@ -9,10 +9,10 @@ $extensions = 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gm
$additional_libs = 'libwebp,libavif,libjpeg,freetype';
# If you want to test additional extensions, add them below. (comma start)
$extensions .= ',igbinary';
$extensions .= ',uv';
# If you want to test additional features for extensions, add libs below. (comma start like extensions)
$additional_libs .= ',liblz4';
$additional_libs .= '';
if (!isset($argv[1])) {
exit("Please use 'extensions', 'cmd' or 'libs' as output type");