mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Fix libuuid build source (#411)
* fix libuuid build source * fix libuuid build source tests
This commit is contained in:
parent
847535721c
commit
4cb1764439
@ -353,6 +353,9 @@
|
|||||||
"source": "libuuid",
|
"source": "libuuid",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libuuid.a"
|
"libuuid.a"
|
||||||
|
],
|
||||||
|
"headers": [
|
||||||
|
"uuid/uuid.h"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libuv": {
|
"libuv": {
|
||||||
|
|||||||
@ -385,7 +385,7 @@
|
|||||||
},
|
},
|
||||||
"libuuid": {
|
"libuuid": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/cloudbase/libuuid.git",
|
"url": "https://github.com/static-php/libuuid.git",
|
||||||
"rev": "master",
|
"rev": "master",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
|
|||||||
@ -10,29 +10,37 @@ use SPC\store\FileSystem;
|
|||||||
|
|
||||||
trait libuuid
|
trait libuuid
|
||||||
{
|
{
|
||||||
public function patchBeforeBuild(): bool
|
|
||||||
{
|
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/configure', '-${am__api_version}', '');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
shell()->cd($this->source_dir)
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
->exec('chmod +x configure')
|
shell()->cd($this->source_dir . '/build')
|
||||||
->exec('chmod +x install-sh')
|
|
||||||
->exec(
|
->exec(
|
||||||
'./configure ' .
|
'cmake ' .
|
||||||
'--enable-static --disable-shared ' .
|
"{$this->builder->makeCmakeArgs()} " .
|
||||||
'--prefix='
|
'..'
|
||||||
)
|
)
|
||||||
->exec('make clean')
|
->exec("cmake --build . -j {$this->builder->concurrency}");
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
copy($this->source_dir . '/build/libuuid.a', BUILD_LIB_PATH . '/libuuid.a');
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
FileSystem::createDir(BUILD_INCLUDE_PATH . '/uuid');
|
||||||
$this->patchPkgconfPrefix(['uuid.pc']);
|
copy($this->source_dir . '/uuid.h', BUILD_INCLUDE_PATH . '/uuid/uuid.h');
|
||||||
|
$pc = FileSystem::readFile($this->source_dir . '/uuid.pc.in');
|
||||||
|
$pc = str_replace([
|
||||||
|
'@prefix@',
|
||||||
|
'@exec_prefix@',
|
||||||
|
'@libdir@',
|
||||||
|
'@includedir@',
|
||||||
|
'@LIBUUID_VERSION@',
|
||||||
|
], [
|
||||||
|
BUILD_ROOT_PATH,
|
||||||
|
'${prefix}',
|
||||||
|
'${prefix}/lib',
|
||||||
|
'${prefix}/include',
|
||||||
|
'1.0.3',
|
||||||
|
], $pc);
|
||||||
|
FileSystem::writeFile(BUILD_LIB_PATH . '/pkgconfig/uuid.pc', $pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,14 +13,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||||
$extensions = match (PHP_OS_FAMILY) {
|
$extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'dba',
|
'Linux', 'Darwin' => 'uuid',
|
||||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,dba',
|
'Windows' => 'mbstring,pdo_sqlite,mbregex',
|
||||||
};
|
};
|
||||||
|
|
||||||
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||||
$with_libs = match (PHP_OS_FAMILY) {
|
$with_libs = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'qdbm',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => 'qdbm',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Please change your test base combination. We recommend testing with `common`.
|
// Please change your test base combination. We recommend testing with `common`.
|
||||||
|
|||||||
6
src/globals/tests/uuid.php
Normal file
6
src/globals/tests/uuid.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
assert(function_exists('uuid_create'));
|
||||||
|
assert(strlen(uuid_create(0)) === 36);
|
||||||
Loading…
x
Reference in New Issue
Block a user