From f5d1df54076723a4ed15f98f84e8f873ffab7a29 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Fri, 1 Mar 2024 20:10:48 +0800 Subject: [PATCH] add uuid/libuuid for linux and macos (#363) --- config/ext.json | 8 ++++++ config/lib.json | 6 +++++ config/source.json | 19 ++++++++++++++ src/SPC/ConsoleApplication.php | 2 +- src/SPC/builder/linux/library/libuuid.php | 12 +++++++++ src/SPC/builder/macos/library/libuuid.php | 12 +++++++++ src/SPC/builder/unix/library/libuuid.php | 31 +++++++++++++++++++++++ src/globals/test-extensions.php | 4 +-- 8 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 src/SPC/builder/linux/library/libuuid.php create mode 100644 src/SPC/builder/macos/library/libuuid.php create mode 100644 src/SPC/builder/unix/library/libuuid.php diff --git a/config/ext.json b/config/ext.json index 0106f6e5..32c6ea34 100644 --- a/config/ext.json +++ b/config/ext.json @@ -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", diff --git a/config/lib.json b/config/lib.json index b64cc7c4..586e3f96 100644 --- a/config/lib.json +++ b/config/lib.json @@ -337,6 +337,12 @@ "libtiff.a" ] }, + "libuuid": { + "source": "libuuid", + "static-libs-unix": [ + "libuuid.a" + ] + }, "libuv": { "source": "libuv", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index 37b5a7e0..c9d8c687 100644 --- a/config/source.json +++ b/config/source.json @@ -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", diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 35330406..63eae94e 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -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() { diff --git a/src/SPC/builder/linux/library/libuuid.php b/src/SPC/builder/linux/library/libuuid.php new file mode 100644 index 00000000..85f0d215 --- /dev/null +++ b/src/SPC/builder/linux/library/libuuid.php @@ -0,0 +1,12 @@ +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']); + } +} diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index ba11efbb..c01071be 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -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' => '', };