add uuid/libuuid for linux and macos (#363)

This commit is contained in:
Jerry Ma 2024-03-01 20:10:48 +08:00 committed by GitHub
parent 9664709f21
commit f5d1df5407
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 91 additions and 3 deletions

View File

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

View File

@ -337,6 +337,12 @@
"libtiff.a"
]
},
"libuuid": {
"source": "libuuid",
"static-libs-unix": [
"libuuid.a"
]
},
"libuv": {
"source": "libuv",
"static-libs-unix": [

View File

@ -100,6 +100,16 @@
"path": "LICENSE"
}
},
"ext-uuid": {
"type": "url",
"url": "https://pecl.php.net/get/uuid",
"path": "php-src/ext/uuid",
"filename": "uuid.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-uv": {
"type": "url",
"url": "https://pecl.php.net/get/uv",
@ -334,6 +344,15 @@
"path": "LICENSE.md"
}
},
"libuuid": {
"type": "git",
"url": "https://github.com/cloudbase/libuuid.git",
"rev": "master",
"license": {
"type": "file",
"path": "COPYING"
}
},
"libuv": {
"type": "ghtar",
"repo": "libuv/libuv",

View File

@ -25,7 +25,7 @@ use Symfony\Component\Console\Command\ListCommand;
*/
final class ConsoleApplication extends Application
{
public const VERSION = '2.1.2';
public const VERSION = '2.1.3';
public function __construct()
{

View File

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

View File

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

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
trait libuuid
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
shell()->cd($this->source_dir)
->exec('chmod +x configure')
->exec('chmod +x install-sh')
->exec(
'./configure ' .
'--enable-static --disable-shared ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['uuid.pc']);
}
}

View File

@ -13,13 +13,13 @@ declare(strict_types=1);
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'imagick,zstd,bz2,zip,xml,dom',
'Linux', 'Darwin' => 'uuid',
'Windows' => 'mbstring,pdo_sqlite,mbregex,ffi',
};
// 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' => 'xz',
'Linux', 'Darwin' => '',
'Windows' => '',
};