Skip to content

Commit

Permalink
Added Serializers for Redis ext: lz4, lzf, zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Dec 1, 2022
1 parent 6e15be1 commit c64e92e
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 16 deletions.
102 changes: 87 additions & 15 deletions php_modules/redis/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,129 @@
all:
type: git
git_url: https://github.com/phpredis/phpredis
git_ref: $(git for-each-ref --format='%(refname)' refs/tags | grep -E 'tags/[.0-9]+$' | sed 's|.*tags/||g' | sort -V | tail -1)
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
pre: |
if [ -f /usr/include/liblzf/lzf.h ]; then \
ln -s /usr/include/liblzf/lzf.h /usr/include/; \
fi \
command: |
REDIS_ARGS=""; \
if [ -d "/usr/local/include/php/ext/igbinary" ]; then \
if php -m | grep -q "igbinary"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
fi; \
if [ -d "/usr/local/include/php/ext/msgpack" ]; then \
if php -m | grep -q "lz4"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
fi; \
if php -m | grep -q "lzf"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lzf --with-liblzf=/usr"; \
fi; \
if php -m | grep -q "msgpack"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
fi; \
if php -m | grep -q "zstd"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-zstd"; \
fi; \
phpize \
&& ./configure --enable-redis ${REDIS_ARGS} \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
build_dep:
- liblz4-dev
- liblzf-dev
- libzstd-dev
run_dep:
- liblz4-1
- liblzf1
- libzstd1

8.2:
# system liblzf not available
# lzf.h: No such file or directory
7.2:
type: git
git_url: https://github.com/phpredis/phpredis
git_ref: $(git for-each-ref --format='%(refname)' refs/tags | grep -E 'tags/[.0-9]+$' | sed 's|.*tags/||g' | sort -V | tail -1)
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
command: |
REDIS_ARGS=""; \
if [ -d "/usr/local/include/php/ext/igbinary" ]; then \
if php -m | grep -q "igbinary"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
fi; \
if [ -d "/usr/local/include/php/ext/msgpack" ]; then \
if php -m | grep -q "lz4"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
fi; \
if php -m | grep -q "msgpack"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
fi; \
if php -m | grep -q "zstd"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-zstd"; \
fi; \
phpize \
&& ./configure --enable-redis ${REDIS_ARGS} \
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' library.c \
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' redis_array_impl.c \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
build_dep:
- liblz4-dev
- libzstd-dev
run_dep:
- liblz4-1
- libzstd1

8.1:
# system liblzf not available
# lzf.h: No such file or directory
7.1:
type: git
git_url: https://github.com/phpredis/phpredis
git_ref: $(git for-each-ref --format='%(refname)' refs/tags | grep -E 'tags/[.0-9]+$' | sed 's|.*tags/||g' | sort -V | tail -1)
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
command: |
REDIS_ARGS=""; \
if [ -d "/usr/local/include/php/ext/igbinary" ]; then \
if php -m | grep -q "igbinary"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
fi; \
if [ -d "/usr/local/include/php/ext/msgpack" ]; then \
if php -m | grep -q "lz4"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
fi; \
if php -m | grep -q "msgpack"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
fi; \
if php -m | grep -q "zstd"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-zstd"; \
fi; \
phpize \
&& ./configure --enable-redis ${REDIS_ARGS} \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
build_dep:
- liblz4-dev
- libzstd-dev
run_dep:
- liblz4-1
- libzstd1

# system liblzf not available
# libzstd is 1.1.2, but >=1.3.0 is required
# lzf.h: No such file or directory
7.0:
type: git
git_url: https://github.com/phpredis/phpredis
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
command: |
REDIS_ARGS=""; \
if php -m | grep -q "igbinary"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
fi; \
if php -m | grep -q "lz4"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
fi; \
if php -m | grep -q "msgpack"; then \
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
fi; \
phpize \
&& ./configure --enable-redis ${REDIS_ARGS} \
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' library.c \
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' redis_array_impl.c \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
build_dep:
- liblz4-dev
run_dep:
- liblz4-1

5.6:
type: pecl
Expand Down
4 changes: 3 additions & 1 deletion php_modules/redis/options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ exclude: []
# the following modules must have been built first.
depends_build:
- igbinary
- lz4
- lzf
- msgpack
# - lzf # TODO: add lzf module to redis
- zstd

# In order for this module to function correctly,
# the following modules must be loaded before.
Expand Down

0 comments on commit c64e92e

Please sign in to comment.