redis-client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +190 -0
  3. data/CHANGELOG.md +3 -0
  4. data/Gemfile +23 -0
  5. data/Gemfile.lock +67 -0
  6. data/LICENSE.md +21 -0
  7. data/README.md +347 -0
  8. data/Rakefile +86 -0
  9. data/ext/redis_client/hiredis/extconf.rb +54 -0
  10. data/ext/redis_client/hiredis/hiredis_connection.c +696 -0
  11. data/ext/redis_client/hiredis/vendor/.gitignore +9 -0
  12. data/ext/redis_client/hiredis/vendor/.travis.yml +131 -0
  13. data/ext/redis_client/hiredis/vendor/CHANGELOG.md +364 -0
  14. data/ext/redis_client/hiredis/vendor/CMakeLists.txt +165 -0
  15. data/ext/redis_client/hiredis/vendor/COPYING +29 -0
  16. data/ext/redis_client/hiredis/vendor/Makefile +308 -0
  17. data/ext/redis_client/hiredis/vendor/README.md +664 -0
  18. data/ext/redis_client/hiredis/vendor/adapters/ae.h +130 -0
  19. data/ext/redis_client/hiredis/vendor/adapters/glib.h +156 -0
  20. data/ext/redis_client/hiredis/vendor/adapters/ivykis.h +84 -0
  21. data/ext/redis_client/hiredis/vendor/adapters/libev.h +179 -0
  22. data/ext/redis_client/hiredis/vendor/adapters/libevent.h +175 -0
  23. data/ext/redis_client/hiredis/vendor/adapters/libuv.h +117 -0
  24. data/ext/redis_client/hiredis/vendor/adapters/macosx.h +115 -0
  25. data/ext/redis_client/hiredis/vendor/adapters/qt.h +135 -0
  26. data/ext/redis_client/hiredis/vendor/alloc.c +86 -0
  27. data/ext/redis_client/hiredis/vendor/alloc.h +91 -0
  28. data/ext/redis_client/hiredis/vendor/appveyor.yml +24 -0
  29. data/ext/redis_client/hiredis/vendor/async.c +887 -0
  30. data/ext/redis_client/hiredis/vendor/async.h +147 -0
  31. data/ext/redis_client/hiredis/vendor/async_private.h +75 -0
  32. data/ext/redis_client/hiredis/vendor/dict.c +352 -0
  33. data/ext/redis_client/hiredis/vendor/dict.h +126 -0
  34. data/ext/redis_client/hiredis/vendor/fmacros.h +12 -0
  35. data/ext/redis_client/hiredis/vendor/hiredis-config.cmake.in +13 -0
  36. data/ext/redis_client/hiredis/vendor/hiredis.c +1174 -0
  37. data/ext/redis_client/hiredis/vendor/hiredis.h +336 -0
  38. data/ext/redis_client/hiredis/vendor/hiredis.pc.in +12 -0
  39. data/ext/redis_client/hiredis/vendor/hiredis_ssl-config.cmake.in +13 -0
  40. data/ext/redis_client/hiredis/vendor/hiredis_ssl.h +157 -0
  41. data/ext/redis_client/hiredis/vendor/hiredis_ssl.pc.in +12 -0
  42. data/ext/redis_client/hiredis/vendor/net.c +612 -0
  43. data/ext/redis_client/hiredis/vendor/net.h +56 -0
  44. data/ext/redis_client/hiredis/vendor/read.c +739 -0
  45. data/ext/redis_client/hiredis/vendor/read.h +129 -0
  46. data/ext/redis_client/hiredis/vendor/sds.c +1289 -0
  47. data/ext/redis_client/hiredis/vendor/sds.h +278 -0
  48. data/ext/redis_client/hiredis/vendor/sdsalloc.h +44 -0
  49. data/ext/redis_client/hiredis/vendor/sockcompat.c +248 -0
  50. data/ext/redis_client/hiredis/vendor/sockcompat.h +92 -0
  51. data/ext/redis_client/hiredis/vendor/ssl.c +544 -0
  52. data/ext/redis_client/hiredis/vendor/test.c +1401 -0
  53. data/ext/redis_client/hiredis/vendor/test.sh +78 -0
  54. data/ext/redis_client/hiredis/vendor/win32.h +56 -0
  55. data/lib/redis-client.rb +3 -0
  56. data/lib/redis_client/buffered_io.rb +149 -0
  57. data/lib/redis_client/config.rb +174 -0
  58. data/lib/redis_client/connection.rb +86 -0
  59. data/lib/redis_client/hiredis_connection.rb +78 -0
  60. data/lib/redis_client/pooled.rb +86 -0
  61. data/lib/redis_client/resp3.rb +225 -0
  62. data/lib/redis_client/sentinel_config.rb +134 -0
  63. data/lib/redis_client/version.rb +5 -0
  64. data/lib/redis_client.rb +438 -0
  65. data/redis-client.gemspec +34 -0
  66. metadata +125 -0
@@ -0,0 +1,29 @@
1
+ Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
2
+ Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
3
+
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Redis nor the names of its contributors may be used
17
+ to endorse or promote products derived from this software without specific
18
+ prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
24
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,308 @@
1
+ # Hiredis Makefile
2
+ # Copyright (C) 2010-2011 Salvatore Sanfilippo <antirez at gmail dot com>
3
+ # Copyright (C) 2010-2011 Pieter Noordhuis <pcnoordhuis at gmail dot com>
4
+ # This file is released under the BSD license, see the COPYING file
5
+
6
+ OBJ=alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o
7
+ SSL_OBJ=ssl.o
8
+ EXAMPLES=hiredis-example hiredis-example-libevent hiredis-example-libev hiredis-example-glib hiredis-example-push
9
+ ifeq ($(USE_SSL),1)
10
+ EXAMPLES+=hiredis-example-ssl hiredis-example-libevent-ssl
11
+ endif
12
+ TESTS=hiredis-test
13
+ LIBNAME=libhiredis
14
+ PKGCONFNAME=hiredis.pc
15
+ SSL_LIBNAME=libhiredis_ssl
16
+ SSL_PKGCONFNAME=hiredis_ssl.pc
17
+
18
+ HIREDIS_MAJOR=$(shell grep HIREDIS_MAJOR hiredis.h | awk '{print $$3}')
19
+ HIREDIS_MINOR=$(shell grep HIREDIS_MINOR hiredis.h | awk '{print $$3}')
20
+ HIREDIS_PATCH=$(shell grep HIREDIS_PATCH hiredis.h | awk '{print $$3}')
21
+ HIREDIS_SONAME=$(shell grep HIREDIS_SONAME hiredis.h | awk '{print $$3}')
22
+
23
+ # Installation related variables and target
24
+ PREFIX?=/usr/local
25
+ INCLUDE_PATH?=include/hiredis
26
+ LIBRARY_PATH?=lib
27
+ PKGCONF_PATH?=pkgconfig
28
+ INSTALL_INCLUDE_PATH= $(DESTDIR)$(PREFIX)/$(INCLUDE_PATH)
29
+ INSTALL_LIBRARY_PATH= $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)
30
+ INSTALL_PKGCONF_PATH= $(INSTALL_LIBRARY_PATH)/$(PKGCONF_PATH)
31
+
32
+ # redis-server configuration used for testing
33
+ REDIS_PORT=56379
34
+ REDIS_SERVER=redis-server
35
+ define REDIS_TEST_CONFIG
36
+ daemonize yes
37
+ pidfile /tmp/hiredis-test-redis.pid
38
+ port $(REDIS_PORT)
39
+ bind 127.0.0.1
40
+ unixsocket /tmp/hiredis-test-redis.sock
41
+ endef
42
+ export REDIS_TEST_CONFIG
43
+
44
+ # Fallback to gcc when $CC is not in $PATH.
45
+ CC:=$(shell sh -c 'type $${CC%% *} >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
46
+ CXX:=$(shell sh -c 'type $${CXX%% *} >/dev/null 2>/dev/null && echo $(CXX) || echo g++')
47
+ OPTIMIZATION?=-O3
48
+ WARNINGS=-Wall -W -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers
49
+ DEBUG_FLAGS?= -g -ggdb
50
+ REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CPPFLAGS) $(CFLAGS) $(WARNINGS) $(DEBUG_FLAGS)
51
+ REAL_LDFLAGS=$(LDFLAGS)
52
+
53
+ DYLIBSUFFIX=so
54
+ STLIBSUFFIX=a
55
+ DYLIB_MINOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_SONAME)
56
+ DYLIB_MAJOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
57
+ DYLIBNAME=$(LIBNAME).$(DYLIBSUFFIX)
58
+
59
+ DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(DYLIB_MINOR_NAME)
60
+ STLIBNAME=$(LIBNAME).$(STLIBSUFFIX)
61
+ STLIB_MAKE_CMD=$(AR) rcs
62
+
63
+ SSL_DYLIB_MINOR_NAME=$(SSL_LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_SONAME)
64
+ SSL_DYLIB_MAJOR_NAME=$(SSL_LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
65
+ SSL_DYLIBNAME=$(SSL_LIBNAME).$(DYLIBSUFFIX)
66
+ SSL_STLIBNAME=$(SSL_LIBNAME).$(STLIBSUFFIX)
67
+ SSL_DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(SSL_DYLIB_MINOR_NAME)
68
+
69
+ # Platform-specific overrides
70
+ uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
71
+
72
+ USE_SSL?=0
73
+
74
+ # This is required for test.c only
75
+ ifeq ($(USE_SSL),1)
76
+ CFLAGS+=-DHIREDIS_TEST_SSL
77
+ endif
78
+
79
+ ifeq ($(uname_S),Linux)
80
+ SSL_LDFLAGS=-lssl -lcrypto
81
+ else
82
+ OPENSSL_PREFIX?=/usr/local/opt/openssl
83
+ CFLAGS+=-I$(OPENSSL_PREFIX)/include
84
+ SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
85
+ endif
86
+
87
+ ifeq ($(uname_S),SunOS)
88
+ IS_SUN_CC=$(shell sh -c '$(CC) -V 2>&1 |egrep -i -c "sun|studio"')
89
+ ifeq ($(IS_SUN_CC),1)
90
+ SUN_SHARED_FLAG=-G
91
+ else
92
+ SUN_SHARED_FLAG=-shared
93
+ endif
94
+ REAL_LDFLAGS+= -ldl -lnsl -lsocket
95
+ DYLIB_MAKE_CMD=$(CC) $(SUN_SHARED_FLAG) -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME) $(LDFLAGS)
96
+ SSL_DYLIB_MAKE_CMD=$(CC) $(SUN_SHARED_FLAG) -o $(SSL_DYLIBNAME) -h $(SSL_DYLIB_MINOR_NAME) $(LDFLAGS) $(SSL_LDFLAGS)
97
+ endif
98
+ ifeq ($(uname_S),Darwin)
99
+ DYLIBSUFFIX=dylib
100
+ DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX)
101
+ DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
102
+ SSL_DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(SSL_DYLIB_MINOR_NAME) -o $(SSL_DYLIBNAME) $(LDFLAGS) $(SSL_LDFLAGS)
103
+ DYLIB_PLUGIN=-Wl,-undefined -Wl,dynamic_lookup
104
+ endif
105
+
106
+ all: $(DYLIBNAME) $(STLIBNAME) hiredis-test $(PKGCONFNAME)
107
+ ifeq ($(USE_SSL),1)
108
+ all: $(SSL_DYLIBNAME) $(SSL_STLIBNAME) $(SSL_PKGCONFNAME)
109
+ endif
110
+
111
+ # Deps (use make dep to generate this)
112
+ alloc.o: alloc.c fmacros.h alloc.h
113
+ async.o: async.c fmacros.h alloc.h async.h hiredis.h read.h sds.h net.h dict.c dict.h win32.h async_private.h
114
+ dict.o: dict.c fmacros.h alloc.h dict.h
115
+ hiredis.o: hiredis.c fmacros.h hiredis.h read.h sds.h alloc.h net.h async.h win32.h
116
+ net.o: net.c fmacros.h net.h hiredis.h read.h sds.h alloc.h sockcompat.h win32.h
117
+ read.o: read.c fmacros.h alloc.h read.h sds.h win32.h
118
+ sds.o: sds.c sds.h sdsalloc.h alloc.h
119
+ sockcompat.o: sockcompat.c sockcompat.h
120
+ ssl.o: ssl.c hiredis.h read.h sds.h alloc.h async.h win32.h async_private.h
121
+ test.o: test.c fmacros.h hiredis.h read.h sds.h alloc.h net.h sockcompat.h win32.h
122
+
123
+ $(DYLIBNAME): $(OBJ)
124
+ $(DYLIB_MAKE_CMD) -o $(DYLIBNAME) $(OBJ) $(REAL_LDFLAGS)
125
+
126
+ $(STLIBNAME): $(OBJ)
127
+ $(STLIB_MAKE_CMD) $(STLIBNAME) $(OBJ)
128
+
129
+ $(SSL_DYLIBNAME): $(SSL_OBJ)
130
+ $(SSL_DYLIB_MAKE_CMD) $(DYLIB_PLUGIN) -o $(SSL_DYLIBNAME) $(SSL_OBJ) $(REAL_LDFLAGS) $(LDFLAGS) $(SSL_LDFLAGS)
131
+
132
+ $(SSL_STLIBNAME): $(SSL_OBJ)
133
+ $(STLIB_MAKE_CMD) $(SSL_STLIBNAME) $(SSL_OBJ)
134
+
135
+ dynamic: $(DYLIBNAME)
136
+ static: $(STLIBNAME)
137
+ ifeq ($(USE_SSL),1)
138
+ dynamic: $(SSL_DYLIBNAME)
139
+ static: $(SSL_STLIBNAME)
140
+ endif
141
+
142
+ # Binaries:
143
+ hiredis-example-libevent: examples/example-libevent.c adapters/libevent.h $(STLIBNAME)
144
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< -levent $(STLIBNAME) $(REAL_LDFLAGS)
145
+
146
+ hiredis-example-libevent-ssl: examples/example-libevent-ssl.c adapters/libevent.h $(STLIBNAME) $(SSL_STLIBNAME)
147
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< -levent $(STLIBNAME) $(SSL_STLIBNAME) $(REAL_LDFLAGS) $(SSL_LDFLAGS)
148
+
149
+ hiredis-example-libev: examples/example-libev.c adapters/libev.h $(STLIBNAME)
150
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< -lev $(STLIBNAME) $(REAL_LDFLAGS)
151
+
152
+ hiredis-example-glib: examples/example-glib.c adapters/glib.h $(STLIBNAME)
153
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< $(shell pkg-config --cflags --libs glib-2.0) $(STLIBNAME) $(REAL_LDFLAGS)
154
+
155
+ hiredis-example-ivykis: examples/example-ivykis.c adapters/ivykis.h $(STLIBNAME)
156
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< -livykis $(STLIBNAME) $(REAL_LDFLAGS)
157
+
158
+ hiredis-example-macosx: examples/example-macosx.c adapters/macosx.h $(STLIBNAME)
159
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< -framework CoreFoundation $(STLIBNAME) $(REAL_LDFLAGS)
160
+
161
+ hiredis-example-ssl: examples/example-ssl.c $(STLIBNAME) $(SSL_STLIBNAME)
162
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< $(STLIBNAME) $(SSL_STLIBNAME) $(REAL_LDFLAGS) $(SSL_LDFLAGS)
163
+
164
+
165
+ ifndef AE_DIR
166
+ hiredis-example-ae:
167
+ @echo "Please specify AE_DIR (e.g. <redis repository>/src)"
168
+ @false
169
+ else
170
+ hiredis-example-ae: examples/example-ae.c adapters/ae.h $(STLIBNAME)
171
+ $(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. -I$(AE_DIR) $< $(AE_DIR)/ae.o $(AE_DIR)/zmalloc.o $(AE_DIR)/../deps/jemalloc/lib/libjemalloc.a -pthread $(STLIBNAME)
172
+ endif
173
+
174
+ ifndef LIBUV_DIR
175
+ hiredis-example-libuv:
176
+ @echo "Please specify LIBUV_DIR (e.g. ../libuv/)"
177
+ @false
178
+ else
179
+ hiredis-example-libuv: examples/example-libuv.c adapters/libuv.h $(STLIBNAME)
180
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. -I$(LIBUV_DIR)/include $< $(LIBUV_DIR)/.libs/libuv.a -lpthread -lrt $(STLIBNAME) $(REAL_LDFLAGS)
181
+ endif
182
+
183
+ ifeq ($(and $(QT_MOC),$(QT_INCLUDE_DIR),$(QT_LIBRARY_DIR)),)
184
+ hiredis-example-qt:
185
+ @echo "Please specify QT_MOC, QT_INCLUDE_DIR AND QT_LIBRARY_DIR"
186
+ @false
187
+ else
188
+ hiredis-example-qt: examples/example-qt.cpp adapters/qt.h $(STLIBNAME)
189
+ $(QT_MOC) adapters/qt.h -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore | \
190
+ $(CXX) -x c++ -o qt-adapter-moc.o -c - $(REAL_CFLAGS) -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore
191
+ $(QT_MOC) examples/example-qt.h -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore | \
192
+ $(CXX) -x c++ -o qt-example-moc.o -c - $(REAL_CFLAGS) -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore
193
+ $(CXX) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore -L$(QT_LIBRARY_DIR) qt-adapter-moc.o qt-example-moc.o $< -pthread $(STLIBNAME) -lQtCore
194
+ endif
195
+
196
+ hiredis-example: examples/example.c $(STLIBNAME)
197
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< $(STLIBNAME) $(REAL_LDFLAGS)
198
+
199
+ hiredis-example-push: examples/example-push.c $(STLIBNAME)
200
+ $(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< $(STLIBNAME) $(REAL_LDFLAGS)
201
+
202
+ examples: $(EXAMPLES)
203
+
204
+ TEST_LIBS = $(STLIBNAME)
205
+ ifeq ($(USE_SSL),1)
206
+ TEST_LIBS += $(SSL_STLIBNAME)
207
+ TEST_LDFLAGS = $(SSL_LDFLAGS) -lssl -lcrypto -lpthread
208
+ endif
209
+
210
+ hiredis-test: test.o $(TEST_LIBS)
211
+ $(CC) -o $@ $(REAL_CFLAGS) -I. $^ $(REAL_LDFLAGS) $(TEST_LDFLAGS)
212
+
213
+ hiredis-%: %.o $(STLIBNAME)
214
+ $(CC) $(REAL_CFLAGS) -o $@ $< $(TEST_LIBS) $(REAL_LDFLAGS)
215
+
216
+ test: hiredis-test
217
+ ./hiredis-test
218
+
219
+ check: hiredis-test
220
+ TEST_SSL=$(USE_SSL) ./test.sh
221
+
222
+ .c.o:
223
+ $(CC) -std=c99 -pedantic -c $(REAL_CFLAGS) $<
224
+
225
+ clean:
226
+ rm -rf $(DYLIBNAME) $(STLIBNAME) $(SSL_DYLIBNAME) $(SSL_STLIBNAME) $(TESTS) $(PKGCONFNAME) examples/hiredis-example* *.o *.gcda *.gcno *.gcov
227
+
228
+ dep:
229
+ $(CC) $(CPPFLAGS) $(CFLAGS) -MM *.c
230
+
231
+ INSTALL?= cp -pPR
232
+
233
+ $(PKGCONFNAME): hiredis.h
234
+ @echo "Generating $@ for pkgconfig..."
235
+ @echo prefix=$(PREFIX) > $@
236
+ @echo exec_prefix=\$${prefix} >> $@
237
+ @echo libdir=$(PREFIX)/$(LIBRARY_PATH) >> $@
238
+ @echo includedir=$(PREFIX)/$(INCLUDE_PATH) >> $@
239
+ @echo >> $@
240
+ @echo Name: hiredis >> $@
241
+ @echo Description: Minimalistic C client library for Redis. >> $@
242
+ @echo Version: $(HIREDIS_MAJOR).$(HIREDIS_MINOR).$(HIREDIS_PATCH) >> $@
243
+ @echo Libs: -L\$${libdir} -lhiredis >> $@
244
+ @echo Cflags: -I\$${includedir} -D_FILE_OFFSET_BITS=64 >> $@
245
+
246
+ $(SSL_PKGCONFNAME): hiredis_ssl.h
247
+ @echo "Generating $@ for pkgconfig..."
248
+ @echo prefix=$(PREFIX) > $@
249
+ @echo exec_prefix=\$${prefix} >> $@
250
+ @echo libdir=$(PREFIX)/$(LIBRARY_PATH) >> $@
251
+ @echo includedir=$(PREFIX)/$(INCLUDE_PATH) >> $@
252
+ @echo >> $@
253
+ @echo Name: hiredis_ssl >> $@
254
+ @echo Description: SSL Support for hiredis. >> $@
255
+ @echo Version: $(HIREDIS_MAJOR).$(HIREDIS_MINOR).$(HIREDIS_PATCH) >> $@
256
+ @echo Requires: hiredis >> $@
257
+ @echo Libs: -L\$${libdir} -lhiredis_ssl >> $@
258
+ @echo Libs.private: -lssl -lcrypto >> $@
259
+
260
+ install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME)
261
+ mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_INCLUDE_PATH)/adapters $(INSTALL_LIBRARY_PATH)
262
+ $(INSTALL) hiredis.h async.h read.h sds.h alloc.h $(INSTALL_INCLUDE_PATH)
263
+ $(INSTALL) adapters/*.h $(INSTALL_INCLUDE_PATH)/adapters
264
+ $(INSTALL) $(DYLIBNAME) $(INSTALL_LIBRARY_PATH)/$(DYLIB_MINOR_NAME)
265
+ cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MINOR_NAME) $(DYLIBNAME)
266
+ $(INSTALL) $(STLIBNAME) $(INSTALL_LIBRARY_PATH)
267
+ mkdir -p $(INSTALL_PKGCONF_PATH)
268
+ $(INSTALL) $(PKGCONFNAME) $(INSTALL_PKGCONF_PATH)
269
+
270
+ ifeq ($(USE_SSL),1)
271
+ install: install-ssl
272
+
273
+ install-ssl: $(SSL_DYLIBNAME) $(SSL_STLIBNAME) $(SSL_PKGCONFNAME)
274
+ mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
275
+ $(INSTALL) hiredis_ssl.h $(INSTALL_INCLUDE_PATH)
276
+ $(INSTALL) $(SSL_DYLIBNAME) $(INSTALL_LIBRARY_PATH)/$(SSL_DYLIB_MINOR_NAME)
277
+ cd $(INSTALL_LIBRARY_PATH) && ln -sf $(SSL_DYLIB_MINOR_NAME) $(SSL_DYLIBNAME)
278
+ $(INSTALL) $(SSL_STLIBNAME) $(INSTALL_LIBRARY_PATH)
279
+ mkdir -p $(INSTALL_PKGCONF_PATH)
280
+ $(INSTALL) $(SSL_PKGCONFNAME) $(INSTALL_PKGCONF_PATH)
281
+ endif
282
+
283
+ 32bit:
284
+ @echo ""
285
+ @echo "WARNING: if this fails under Linux you probably need to install libc6-dev-i386"
286
+ @echo ""
287
+ $(MAKE) CFLAGS="-m32" LDFLAGS="-m32"
288
+
289
+ 32bit-vars:
290
+ $(eval CFLAGS=-m32)
291
+ $(eval LDFLAGS=-m32)
292
+
293
+ gprof:
294
+ $(MAKE) CFLAGS="-pg" LDFLAGS="-pg"
295
+
296
+ gcov:
297
+ $(MAKE) CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs"
298
+
299
+ coverage: gcov
300
+ make check
301
+ mkdir -p tmp/lcov
302
+ lcov -d . -c -o tmp/lcov/hiredis.info
303
+ genhtml --legend -o tmp/lcov/report tmp/lcov/hiredis.info
304
+
305
+ noopt:
306
+ $(MAKE) OPTIMIZATION=""
307
+
308
+ .PHONY: all test check clean dep install 32bit 32bit-vars gprof gcov noopt