add lz4, igbinary support for redis

This commit is contained in:
crazywhalecc 2023-12-23 13:53:22 +08:00 committed by Jerry Ma
parent 3828ba7c77
commit 6bcda6a5a0
9 changed files with 92 additions and 33 deletions

View File

@ -143,4 +143,4 @@ jobs:
run: bin/spc download --for-extensions="$(php src/globals/test-extensions.php)" --with-php=${{ matrix.php }} --debug run: bin/spc download --for-extensions="$(php src/globals/test-extensions.php)" --with-php=${{ matrix.php }} --debug
- name: "Run Build Tests (build)" - name: "Run Build Tests (build)"
run: bin/spc build "$(php src/globals/test-extensions.php)" --build-cli --build-micro --build-fpm --debug run: bin/spc build $(php src/globals/test-extensions.php) --build-cli --build-micro --build-fpm --debug

View File

@ -150,6 +150,10 @@
"icu" "icu"
] ]
}, },
"igbinary": {
"type": "external",
"source": "igbinary"
},
"ldap": { "ldap": {
"type": "builtin", "type": "builtin",
"arg-type": "with-prefix", "arg-type": "with-prefix",
@ -331,7 +335,11 @@
"source": "redis", "source": "redis",
"arg-type": "custom", "arg-type": "custom",
"ext-suggests": [ "ext-suggests": [
"session" "session",
"igbinary"
],
"lib-suggests": [
"zstd"
] ]
}, },
"session": { "session": {

View File

@ -224,12 +224,6 @@
"libturbojpeg.a" "libturbojpeg.a"
] ]
}, },
"libmcrypt": {
"source": "libmcrypt",
"static-libs-unix": [
"libmcrypt.a"
]
},
"libmemcached": { "libmemcached": {
"source": "libmemcached", "source": "libmemcached",
"static-libs-unix": [ "static-libs-unix": [
@ -368,12 +362,6 @@
"openssl" "openssl"
] ]
}, },
"mcrypt": {
"source": "mcrypt",
"static-libs-unix": [
"libmcrypt.a"
]
},
"ncurses": { "ncurses": {
"source": "ncurses", "source": "ncurses",
"static-libs-unix": [ "static-libs-unix": [
@ -507,6 +495,12 @@
"libiconv" "libiconv"
] ]
}, },
"liblz4": {
"source": "liblz4",
"static-libs-unix": [
"liblz4.a"
]
},
"xz": { "xz": {
"source": "xz", "source": "xz",
"static-libs-unix": [ "static-libs-unix": [

View File

@ -224,12 +224,13 @@
"path": "LICENSE.md" "path": "LICENSE.md"
} }
}, },
"libmcrypt": { "liblz4": {
"type": "url", "type": "ghrel",
"url": "https://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz", "repo": "lz4/lz4",
"match": "lz4-.+\\.tar\\.gz",
"license": { "license": {
"type": "file", "type": "file",
"path": "COPYING" "path": "LICENSE"
} }
}, },
"libmemcached": { "libmemcached": {
@ -251,8 +252,9 @@
} }
}, },
"libsodium": { "libsodium": {
"type": "url", "type": "ghrel",
"url": "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz", "repo": "jedisct1/libsodium",
"match": "libsodium-\\d+(\\.\\d+)*\\.tar\\.gz",
"license": { "license": {
"type": "file", "type": "file",
"path": "LICENSE" "path": "LICENSE"
@ -310,14 +312,6 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"mcrypt": {
"type": "url",
"url": "https://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz",
"license": {
"type": "file",
"path": "COPYING"
}
},
"memcached": { "memcached": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/memcached", "url": "https://pecl.php.net/get/memcached",
@ -366,6 +360,16 @@
"path": "COPYING" "path": "COPYING"
} }
}, },
"igbinary": {
"type": "url",
"url": "https://pecl.php.net/get/igbinary",
"path": "php-src/ext/igbinary",
"filename": "igbinary.tgz",
"license": {
"type": "file",
"path": "COPYING"
}
},
"onig": { "onig": {
"type": "ghrel", "type": "ghrel",
"repo": "kkos/oniguruma", "repo": "kkos/oniguruma",

View File

@ -13,14 +13,14 @@ class redis extends Extension
public function getUnixConfigureArg(): string public function getUnixConfigureArg(): string
{ {
$arg = '--enable-redis'; $arg = '--enable-redis';
if (!$this->builder->getExt('session')) { $arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
$arg .= ' --disable-redis-session'; $arg .= $this->builder->getExt('igbinary') ? ' --enable-redis-igbinary' : ' --disable-redis-igbinary';
} else {
$arg .= ' --enable-redis-session';
}
if ($this->builder->getLib('zstd')) { if ($this->builder->getLib('zstd')) {
$arg .= ' --enable-redis-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"'; $arg .= ' --enable-redis-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"';
} }
if ($this->builder->getLib('liblz4')) {
$arg .= ' --enable-redis-lz4 --with-liblz4="' . BUILD_ROOT_PATH . '"';
}
return $arg; return $arg;
} }
} }

View File

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

View File

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

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
trait liblz4
{
protected function build()
{
shell()->cd($this->source_dir)
->exec("make PREFIX='' clean")
->exec("make -j{$this->builder->concurrency} PREFIX=''")
->exec("make install PREFIX='' DESTDIR=" . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['liblz4.pc']);
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
if (str_starts_with($filename, 'liblz4') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
unlink(BUILD_ROOT_PATH . '/lib/' . $filename);
}
}
}
}

View File

@ -9,4 +9,7 @@ if (PHP_OS_FAMILY === 'Darwin') {
$extensions .= ',sodium'; $extensions .= ',sodium';
} }
// test redis lz4, igbinary
$extensions .= ',igbinary,zstd --with-libs=liblz4';
echo $extensions; echo $extensions;