Skip to content

Commit c64e92e

Browse files
committed
Added Serializers for Redis ext: lz4, lzf, zstd
1 parent 6e15be1 commit c64e92e

File tree

2 files changed

+90
-16
lines changed

2 files changed

+90
-16
lines changed

php_modules/redis/build.yml

+87-15
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,129 @@
88
all:
99
type: git
1010
git_url: https://github.com/phpredis/phpredis
11-
git_ref: $(git for-each-ref --format='%(refname)' refs/tags | grep -E 'tags/[.0-9]+$' | sed 's|.*tags/||g' | sort -V | tail -1)
11+
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
12+
pre: |
13+
if [ -f /usr/include/liblzf/lzf.h ]; then \
14+
ln -s /usr/include/liblzf/lzf.h /usr/include/; \
15+
fi \
1216
command: |
1317
REDIS_ARGS=""; \
14-
if [ -d "/usr/local/include/php/ext/igbinary" ]; then \
18+
if php -m | grep -q "igbinary"; then \
1519
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
1620
fi; \
17-
if [ -d "/usr/local/include/php/ext/msgpack" ]; then \
21+
if php -m | grep -q "lz4"; then \
22+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
23+
fi; \
24+
if php -m | grep -q "lzf"; then \
25+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lzf --with-liblzf=/usr"; \
26+
fi; \
27+
if php -m | grep -q "msgpack"; then \
1828
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
1929
fi; \
30+
if php -m | grep -q "zstd"; then \
31+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-zstd"; \
32+
fi; \
2033
phpize \
2134
&& ./configure --enable-redis ${REDIS_ARGS} \
2235
&& make -j$(getconf _NPROCESSORS_ONLN) \
2336
&& make install \
37+
build_dep:
38+
- liblz4-dev
39+
- liblzf-dev
40+
- libzstd-dev
41+
run_dep:
42+
- liblz4-1
43+
- liblzf1
44+
- libzstd1
2445

25-
8.2:
46+
# system liblzf not available
47+
# lzf.h: No such file or directory
48+
7.2:
2649
type: git
2750
git_url: https://github.com/phpredis/phpredis
28-
git_ref: $(git for-each-ref --format='%(refname)' refs/tags | grep -E 'tags/[.0-9]+$' | sed 's|.*tags/||g' | sort -V | tail -1)
51+
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
2952
command: |
3053
REDIS_ARGS=""; \
31-
if [ -d "/usr/local/include/php/ext/igbinary" ]; then \
54+
if php -m | grep -q "igbinary"; then \
3255
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
3356
fi; \
34-
if [ -d "/usr/local/include/php/ext/msgpack" ]; then \
57+
if php -m | grep -q "lz4"; then \
58+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
59+
fi; \
60+
if php -m | grep -q "msgpack"; then \
3561
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
3662
fi; \
63+
if php -m | grep -q "zstd"; then \
64+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-zstd"; \
65+
fi; \
3766
phpize \
3867
&& ./configure --enable-redis ${REDIS_ARGS} \
39-
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' library.c \
40-
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' redis_array_impl.c \
4168
&& make -j$(getconf _NPROCESSORS_ONLN) \
4269
&& make install \
70+
build_dep:
71+
- liblz4-dev
72+
- libzstd-dev
73+
run_dep:
74+
- liblz4-1
75+
- libzstd1
4376

44-
8.1:
77+
# system liblzf not available
78+
# lzf.h: No such file or directory
79+
7.1:
4580
type: git
4681
git_url: https://github.com/phpredis/phpredis
47-
git_ref: $(git for-each-ref --format='%(refname)' refs/tags | grep -E 'tags/[.0-9]+$' | sed 's|.*tags/||g' | sort -V | tail -1)
82+
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
4883
command: |
4984
REDIS_ARGS=""; \
50-
if [ -d "/usr/local/include/php/ext/igbinary" ]; then \
85+
if php -m | grep -q "igbinary"; then \
5186
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
5287
fi; \
53-
if [ -d "/usr/local/include/php/ext/msgpack" ]; then \
88+
if php -m | grep -q "lz4"; then \
89+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
90+
fi; \
91+
if php -m | grep -q "msgpack"; then \
92+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
93+
fi; \
94+
if php -m | grep -q "zstd"; then \
95+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-zstd"; \
96+
fi; \
97+
phpize \
98+
&& ./configure --enable-redis ${REDIS_ARGS} \
99+
&& make -j$(getconf _NPROCESSORS_ONLN) \
100+
&& make install \
101+
build_dep:
102+
- liblz4-dev
103+
- libzstd-dev
104+
run_dep:
105+
- liblz4-1
106+
- libzstd1
107+
108+
# system liblzf not available
109+
# libzstd is 1.1.2, but >=1.3.0 is required
110+
# lzf.h: No such file or directory
111+
7.0:
112+
type: git
113+
git_url: https://github.com/phpredis/phpredis
114+
git_ref: $(git tag | grep -E '^[.0-9]+$' | sort -V | tail -1)
115+
command: |
116+
REDIS_ARGS=""; \
117+
if php -m | grep -q "igbinary"; then \
118+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-igbinary"; \
119+
fi; \
120+
if php -m | grep -q "lz4"; then \
121+
REDIS_ARGS="${REDIS_ARGS} --enable-redis-lz4 --with-liblz4=/usr"; \
122+
fi; \
123+
if php -m | grep -q "msgpack"; then \
54124
REDIS_ARGS="${REDIS_ARGS} --enable-redis-msgpack"; \
55125
fi; \
56126
phpize \
57127
&& ./configure --enable-redis ${REDIS_ARGS} \
58-
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' library.c \
59-
&& sed -i'' 's/ops->hash_init(ctx);/ops->hash_init(ctx, NULL);/g' redis_array_impl.c \
60128
&& make -j$(getconf _NPROCESSORS_ONLN) \
61129
&& make install \
130+
build_dep:
131+
- liblz4-dev
132+
run_dep:
133+
- liblz4-1
62134

63135
5.6:
64136
type: pecl

php_modules/redis/options.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ exclude: []
1010
# the following modules must have been built first.
1111
depends_build:
1212
- igbinary
13+
- lz4
14+
- lzf
1315
- msgpack
14-
# - lzf # TODO: add lzf module to redis
16+
- zstd
1517

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

0 commit comments

Comments
 (0)