hiredis 0.5.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Rakefile +8 -6
- data/ext/hiredis_ext/connection.c +4 -3
- data/ext/hiredis_ext/extconf.rb +25 -10
- data/ext/hiredis_ext/reader.c +12 -6
- data/lib/hiredis/version.rb +1 -1
- data/vendor/hiredis/Makefile +119 -54
- data/vendor/hiredis/async.c +121 -27
- data/vendor/hiredis/async.h +5 -0
- data/vendor/hiredis/dict.c +2 -2
- data/vendor/hiredis/fmacros.h +5 -9
- data/vendor/hiredis/hiredis.c +275 -554
- data/vendor/hiredis/hiredis.h +64 -75
- data/vendor/hiredis/net.c +242 -56
- data/vendor/hiredis/net.h +12 -10
- data/vendor/hiredis/read.c +598 -0
- data/vendor/hiredis/read.h +111 -0
- data/vendor/hiredis/sds.c +847 -180
- data/vendor/hiredis/sds.h +203 -18
- data/vendor/hiredis/sdsalloc.h +42 -0
- data/vendor/hiredis/test.c +286 -19
- data/vendor/hiredis/win32.h +42 -0
- metadata +46 -28
- data/lib/hiredis/errors.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1f07127ae47561dfa27e69e75ec20141aea1ec0f25c9e0a6ebf85d28c0fd0ab5
|
4
|
+
data.tar.gz: 71b64366a9ec6eb8eaef1ca8c6dee1aaab91c1608198d2fbc0dd928d31e36cca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3e5d4387c7e4d625fc81349d1224ac34cc43aae5a6d49c648515462eab5404bd18bb0deae1a166ab42e0ab93f91ef7344dd1a8a0c4ea54fd040bfe97a4a983f
|
7
|
+
data.tar.gz: 59504af0292497549b26ae7f970e2495363d0a66b9e15cb8c98b1fdcc748805a11a2c7e800fc9cce41dc81a85dc08273d62558d5481f89b2625f8611bbb50019
|
data/Rakefile
CHANGED
@@ -5,7 +5,13 @@ require "rbconfig"
|
|
5
5
|
require "rake/testtask"
|
6
6
|
require "rake/extensiontask"
|
7
7
|
|
8
|
-
|
8
|
+
if RUBY_PLATFORM =~ /java|mswin|mingw/i
|
9
|
+
|
10
|
+
task :rebuild do
|
11
|
+
# no-op
|
12
|
+
end
|
13
|
+
|
14
|
+
else
|
9
15
|
|
10
16
|
Rake::ExtensionTask.new('hiredis_ext') do |task|
|
11
17
|
# Pass --with-foo-config args to extconf.rb
|
@@ -34,13 +40,9 @@ unless defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
|
34
40
|
# Build from scratch
|
35
41
|
task :rebuild => [:clean, :compile]
|
36
42
|
|
37
|
-
|
43
|
+
end
|
38
44
|
|
39
|
-
task :rebuild do
|
40
|
-
# no-op
|
41
|
-
end
|
42
45
|
|
43
|
-
end
|
44
46
|
|
45
47
|
task :default => [:rebuild, :test]
|
46
48
|
|
@@ -27,9 +27,10 @@ static void parent_context_try_free(redisParentContext *pc) {
|
|
27
27
|
}
|
28
28
|
|
29
29
|
static void parent_context_mark(redisParentContext *pc) {
|
30
|
-
|
30
|
+
// volatile until rb_gc_mark
|
31
|
+
volatile VALUE root;
|
31
32
|
if (pc->context && pc->context->reader) {
|
32
|
-
root = (VALUE)
|
33
|
+
root = (VALUE)redisReaderGetObject(pc->context->reader);
|
33
34
|
if (root != 0 && TYPE(root) == T_ARRAY) {
|
34
35
|
rb_gc_mark(root);
|
35
36
|
}
|
@@ -448,7 +449,7 @@ static int __get_reply(redisParentContext *pc, VALUE *reply) {
|
|
448
449
|
|
449
450
|
static VALUE connection_read(VALUE self) {
|
450
451
|
redisParentContext *pc;
|
451
|
-
VALUE reply;
|
452
|
+
volatile VALUE reply;
|
452
453
|
|
453
454
|
Data_Get_Struct(self,redisParentContext,pc);
|
454
455
|
if (!pc->context)
|
data/ext/hiredis_ext/extconf.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
+
build_hiredis = true
|
4
|
+
unless have_header('sys/socket.h')
|
5
|
+
puts "Could not find <sys/socket.h> (Likely Windows)."
|
6
|
+
puts "Skipping building hiredis. The slower, pure-ruby implementation will be used instead."
|
7
|
+
build_hiredis = false
|
8
|
+
end
|
9
|
+
|
3
10
|
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
4
11
|
|
5
12
|
hiredis_dir = File.join(File.dirname(__FILE__), %w{.. .. vendor hiredis})
|
@@ -19,15 +26,23 @@ else
|
|
19
26
|
'make'
|
20
27
|
end
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
if build_hiredis
|
30
|
+
# Make sure hiredis is built...
|
31
|
+
Dir.chdir(hiredis_dir) do
|
32
|
+
success = system("#{make_program} static")
|
33
|
+
raise "Building hiredis failed" if !success
|
34
|
+
end
|
27
35
|
|
28
|
-
# Statically link to hiredis (mkmf can't do this for us)
|
29
|
-
$CFLAGS << " -I#{hiredis_dir}"
|
30
|
-
$LDFLAGS << " #{hiredis_dir}/libhiredis.a"
|
36
|
+
# Statically link to hiredis (mkmf can't do this for us)
|
37
|
+
$CFLAGS << " -I#{hiredis_dir}"
|
38
|
+
$LDFLAGS << " #{hiredis_dir}/libhiredis.a"
|
31
39
|
|
32
|
-
have_func("rb_thread_fd_select")
|
33
|
-
create_makefile('hiredis/ext/hiredis_ext')
|
40
|
+
have_func("rb_thread_fd_select")
|
41
|
+
create_makefile('hiredis/ext/hiredis_ext')
|
42
|
+
else
|
43
|
+
File.open("Makefile", "wb") do |f|
|
44
|
+
dummy_makefile(".").each do |line|
|
45
|
+
f.puts(line)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/ext/hiredis_ext/reader.c
CHANGED
@@ -10,7 +10,7 @@ static ID str_force_encoding = 0;
|
|
10
10
|
* Note that the parent should always be of type T_ARRAY. */
|
11
11
|
static void *tryParentize(const redisReadTask *task, VALUE v) {
|
12
12
|
if (task && task->parent != NULL) {
|
13
|
-
VALUE parent = (VALUE)task->parent->obj;
|
13
|
+
volatile VALUE parent = (VALUE)task->parent->obj;
|
14
14
|
assert(TYPE(parent) == T_ARRAY);
|
15
15
|
rb_ary_store(parent,task->idx,v);
|
16
16
|
}
|
@@ -18,7 +18,7 @@ static void *tryParentize(const redisReadTask *task, VALUE v) {
|
|
18
18
|
}
|
19
19
|
|
20
20
|
static void *createStringObject(const redisReadTask *task, char *str, size_t len) {
|
21
|
-
VALUE v, enc;
|
21
|
+
volatile VALUE v, enc;
|
22
22
|
v = rb_str_new(str,len);
|
23
23
|
|
24
24
|
/* Force default external encoding if possible. */
|
@@ -35,12 +35,12 @@ static void *createStringObject(const redisReadTask *task, char *str, size_t len
|
|
35
35
|
}
|
36
36
|
|
37
37
|
static void *createArrayObject(const redisReadTask *task, int elements) {
|
38
|
-
VALUE v = rb_ary_new2(elements);
|
38
|
+
volatile VALUE v = rb_ary_new2(elements);
|
39
39
|
return tryParentize(task,v);
|
40
40
|
}
|
41
41
|
|
42
42
|
static void *createIntegerObject(const redisReadTask *task, long long value) {
|
43
|
-
VALUE v = LL2NUM(value);
|
43
|
+
volatile VALUE v = LL2NUM(value);
|
44
44
|
return tryParentize(task,v);
|
45
45
|
}
|
46
46
|
|
@@ -62,7 +62,13 @@ redisReplyObjectFunctions redisExtReplyObjectFunctions = {
|
|
62
62
|
};
|
63
63
|
|
64
64
|
static void reader_mark(redisReader *reader) {
|
65
|
-
|
65
|
+
// volatile until rb_gc_mark
|
66
|
+
volatile VALUE root = (VALUE)reader->reply;
|
67
|
+
// FIXME - PCO - checking root for 0 is checkign to see if the value is
|
68
|
+
// Qfalse. I suspect that is not what is intended here. Checking the
|
69
|
+
// redisReader code might clarify. It would be unfortunate if the reply, a
|
70
|
+
// void* was using NULL to indicate not set but that may be the nature of
|
71
|
+
// the redisReader library. It is worth checking anyway.
|
66
72
|
if (root != 0 && TYPE(root) == T_ARRAY) rb_gc_mark(root);
|
67
73
|
}
|
68
74
|
|
@@ -85,7 +91,7 @@ static VALUE reader_feed(VALUE klass, VALUE str) {
|
|
85
91
|
|
86
92
|
static VALUE reader_gets(VALUE klass) {
|
87
93
|
redisReader *reader;
|
88
|
-
VALUE reply;
|
94
|
+
volatile VALUE reply;
|
89
95
|
|
90
96
|
Data_Get_Struct(klass, redisReader, reader);
|
91
97
|
if (redisReaderGetReply(reader,(void**)&reply) != REDIS_OK)
|
data/lib/hiredis/version.rb
CHANGED
data/vendor/hiredis/Makefile
CHANGED
@@ -3,24 +3,50 @@
|
|
3
3
|
# Copyright (C) 2010-2011 Pieter Noordhuis <pcnoordhuis at gmail dot com>
|
4
4
|
# This file is released under the BSD license, see the COPYING file
|
5
5
|
|
6
|
-
OBJ=net.o hiredis.o sds.o async.o
|
7
|
-
|
6
|
+
OBJ=net.o hiredis.o sds.o async.o read.o
|
7
|
+
EXAMPLES=hiredis-example hiredis-example-libevent hiredis-example-libev hiredis-example-glib
|
8
|
+
TESTS=hiredis-test
|
8
9
|
LIBNAME=libhiredis
|
10
|
+
PKGCONFNAME=hiredis.pc
|
9
11
|
|
10
|
-
HIREDIS_MAJOR
|
11
|
-
HIREDIS_MINOR
|
12
|
+
HIREDIS_MAJOR=$(shell grep HIREDIS_MAJOR hiredis.h | awk '{print $$3}')
|
13
|
+
HIREDIS_MINOR=$(shell grep HIREDIS_MINOR hiredis.h | awk '{print $$3}')
|
14
|
+
HIREDIS_PATCH=$(shell grep HIREDIS_PATCH hiredis.h | awk '{print $$3}')
|
15
|
+
HIREDIS_SONAME=$(shell grep HIREDIS_SONAME hiredis.h | awk '{print $$3}')
|
16
|
+
|
17
|
+
# Installation related variables and target
|
18
|
+
PREFIX?=/usr/local
|
19
|
+
INCLUDE_PATH?=include/hiredis
|
20
|
+
LIBRARY_PATH?=lib
|
21
|
+
PKGCONF_PATH?=pkgconfig
|
22
|
+
INSTALL_INCLUDE_PATH= $(DESTDIR)$(PREFIX)/$(INCLUDE_PATH)
|
23
|
+
INSTALL_LIBRARY_PATH= $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)
|
24
|
+
INSTALL_PKGCONF_PATH= $(INSTALL_LIBRARY_PATH)/$(PKGCONF_PATH)
|
25
|
+
|
26
|
+
# redis-server configuration used for testing
|
27
|
+
REDIS_PORT=56379
|
28
|
+
REDIS_SERVER=redis-server
|
29
|
+
define REDIS_TEST_CONFIG
|
30
|
+
daemonize yes
|
31
|
+
pidfile /tmp/hiredis-test-redis.pid
|
32
|
+
port $(REDIS_PORT)
|
33
|
+
bind 127.0.0.1
|
34
|
+
unixsocket /tmp/hiredis-test-redis.sock
|
35
|
+
endef
|
36
|
+
export REDIS_TEST_CONFIG
|
12
37
|
|
13
38
|
# Fallback to gcc when $CC is not in $PATH.
|
14
|
-
CC:=$(shell sh -c 'type
|
39
|
+
CC:=$(shell sh -c 'type $${CC%% *} >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
|
40
|
+
CXX:=$(shell sh -c 'type $${CXX%% *} >/dev/null 2>/dev/null && echo $(CXX) || echo g++')
|
15
41
|
OPTIMIZATION?=-O3
|
16
42
|
WARNINGS=-Wall -W -Wstrict-prototypes -Wwrite-strings
|
17
|
-
|
18
|
-
REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(
|
19
|
-
REAL_LDFLAGS=$(LDFLAGS)
|
43
|
+
DEBUG_FLAGS?= -g -ggdb
|
44
|
+
REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG_FLAGS)
|
45
|
+
REAL_LDFLAGS=$(LDFLAGS)
|
20
46
|
|
21
47
|
DYLIBSUFFIX=so
|
22
48
|
STLIBSUFFIX=a
|
23
|
-
DYLIB_MINOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(
|
49
|
+
DYLIB_MINOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_SONAME)
|
24
50
|
DYLIB_MAJOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
|
25
51
|
DYLIBNAME=$(LIBNAME).$(DYLIBSUFFIX)
|
26
52
|
DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
|
@@ -32,24 +58,23 @@ uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
|
32
58
|
ifeq ($(uname_S),SunOS)
|
33
59
|
REAL_LDFLAGS+= -ldl -lnsl -lsocket
|
34
60
|
DYLIB_MAKE_CMD=$(CC) -G -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME) $(LDFLAGS)
|
35
|
-
INSTALL= cp -r
|
36
61
|
endif
|
37
62
|
ifeq ($(uname_S),Darwin)
|
38
63
|
DYLIBSUFFIX=dylib
|
39
|
-
DYLIB_MINOR_NAME=$(LIBNAME).$(
|
40
|
-
|
41
|
-
DYLIB_MAKE_CMD=$(CC) -shared -Wl,-install_name,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
|
64
|
+
DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX)
|
65
|
+
DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
|
42
66
|
endif
|
43
67
|
|
44
|
-
all: $(DYLIBNAME) $(
|
68
|
+
all: $(DYLIBNAME) $(STLIBNAME) hiredis-test $(PKGCONFNAME)
|
45
69
|
|
46
70
|
# Deps (use make dep to generate this)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
71
|
+
async.o: async.c fmacros.h async.h hiredis.h read.h sds.h net.h dict.c dict.h
|
72
|
+
dict.o: dict.c fmacros.h dict.h
|
73
|
+
hiredis.o: hiredis.c fmacros.h hiredis.h read.h sds.h net.h
|
74
|
+
net.o: net.c fmacros.h net.h hiredis.h read.h sds.h
|
75
|
+
read.o: read.c fmacros.h read.h sds.h
|
51
76
|
sds.o: sds.c sds.h
|
52
|
-
test.o: test.c hiredis.h
|
77
|
+
test.o: test.c fmacros.h hiredis.h read.h sds.h
|
53
78
|
|
54
79
|
$(DYLIBNAME): $(OBJ)
|
55
80
|
$(DYLIB_MAKE_CMD) $(OBJ)
|
@@ -61,36 +86,68 @@ dynamic: $(DYLIBNAME)
|
|
61
86
|
static: $(STLIBNAME)
|
62
87
|
|
63
88
|
# Binaries:
|
64
|
-
hiredis-example-libevent: example-libevent.c adapters/libevent.h $(STLIBNAME)
|
65
|
-
$(CC) -o
|
89
|
+
hiredis-example-libevent: examples/example-libevent.c adapters/libevent.h $(STLIBNAME)
|
90
|
+
$(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. $< -levent $(STLIBNAME)
|
91
|
+
|
92
|
+
hiredis-example-libev: examples/example-libev.c adapters/libev.h $(STLIBNAME)
|
93
|
+
$(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. $< -lev $(STLIBNAME)
|
94
|
+
|
95
|
+
hiredis-example-glib: examples/example-glib.c adapters/glib.h $(STLIBNAME)
|
96
|
+
$(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. $< $(shell pkg-config --cflags --libs glib-2.0) $(STLIBNAME)
|
97
|
+
|
98
|
+
hiredis-example-ivykis: examples/example-ivykis.c adapters/ivykis.h $(STLIBNAME)
|
99
|
+
$(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. $< -livykis $(STLIBNAME)
|
66
100
|
|
67
|
-
hiredis-example-
|
68
|
-
$(CC) -o
|
101
|
+
hiredis-example-macosx: examples/example-macosx.c adapters/macosx.h $(STLIBNAME)
|
102
|
+
$(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. $< -framework CoreFoundation $(STLIBNAME)
|
69
103
|
|
70
104
|
ifndef AE_DIR
|
71
105
|
hiredis-example-ae:
|
72
106
|
@echo "Please specify AE_DIR (e.g. <redis repository>/src)"
|
73
107
|
@false
|
74
108
|
else
|
75
|
-
hiredis-example-ae: example-ae.c adapters/ae.h $(STLIBNAME)
|
76
|
-
$(CC) -o
|
109
|
+
hiredis-example-ae: examples/example-ae.c adapters/ae.h $(STLIBNAME)
|
110
|
+
$(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)
|
77
111
|
endif
|
78
112
|
|
113
|
+
ifndef LIBUV_DIR
|
114
|
+
hiredis-example-libuv:
|
115
|
+
@echo "Please specify LIBUV_DIR (e.g. ../libuv/)"
|
116
|
+
@false
|
117
|
+
else
|
118
|
+
hiredis-example-libuv: examples/example-libuv.c adapters/libuv.h $(STLIBNAME)
|
119
|
+
$(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. -I$(LIBUV_DIR)/include $< $(LIBUV_DIR)/.libs/libuv.a -lpthread -lrt $(STLIBNAME)
|
120
|
+
endif
|
121
|
+
|
122
|
+
ifeq ($(and $(QT_MOC),$(QT_INCLUDE_DIR),$(QT_LIBRARY_DIR)),)
|
123
|
+
hiredis-example-qt:
|
124
|
+
@echo "Please specify QT_MOC, QT_INCLUDE_DIR AND QT_LIBRARY_DIR"
|
125
|
+
@false
|
126
|
+
else
|
127
|
+
hiredis-example-qt: examples/example-qt.cpp adapters/qt.h $(STLIBNAME)
|
128
|
+
$(QT_MOC) adapters/qt.h -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore | \
|
129
|
+
$(CXX) -x c++ -o qt-adapter-moc.o -c - $(REAL_CFLAGS) -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore
|
130
|
+
$(QT_MOC) examples/example-qt.h -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore | \
|
131
|
+
$(CXX) -x c++ -o qt-example-moc.o -c - $(REAL_CFLAGS) -I. -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore
|
132
|
+
$(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
|
133
|
+
endif
|
134
|
+
|
135
|
+
hiredis-example: examples/example.c $(STLIBNAME)
|
136
|
+
$(CC) -o examples/$@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I. $< $(STLIBNAME)
|
137
|
+
|
138
|
+
examples: $(EXAMPLES)
|
139
|
+
|
140
|
+
hiredis-test: test.o $(STLIBNAME)
|
141
|
+
|
79
142
|
hiredis-%: %.o $(STLIBNAME)
|
80
|
-
$(CC) -o $@ $(REAL_LDFLAGS) $< $(STLIBNAME)
|
143
|
+
$(CC) $(REAL_CFLAGS) -o $@ $(REAL_LDFLAGS) $< $(STLIBNAME)
|
81
144
|
|
82
145
|
test: hiredis-test
|
83
146
|
./hiredis-test
|
84
147
|
|
85
148
|
check: hiredis-test
|
86
|
-
echo
|
87
|
-
|
88
|
-
"pidfile /tmp/hiredis-test-redis.pid\n" \
|
89
|
-
"port 56379\n" \
|
90
|
-
"bind 127.0.0.1\n" \
|
91
|
-
"unixsocket /tmp/hiredis-test-redis.sock" \
|
92
|
-
| redis-server -
|
93
|
-
./hiredis-test -h 127.0.0.1 -p 56379 -s /tmp/hiredis-test-redis.sock || \
|
149
|
+
@echo "$$REDIS_TEST_CONFIG" | $(REDIS_SERVER) -
|
150
|
+
$(PRE) ./hiredis-test -h 127.0.0.1 -p $(REDIS_PORT) -s /tmp/hiredis-test-redis.sock || \
|
94
151
|
( kill `cat /tmp/hiredis-test-redis.pid` && false )
|
95
152
|
kill `cat /tmp/hiredis-test-redis.pid`
|
96
153
|
|
@@ -98,31 +155,35 @@ check: hiredis-test
|
|
98
155
|
$(CC) -std=c99 -pedantic -c $(REAL_CFLAGS) $<
|
99
156
|
|
100
157
|
clean:
|
101
|
-
rm -rf $(DYLIBNAME) $(STLIBNAME) $(
|
158
|
+
rm -rf $(DYLIBNAME) $(STLIBNAME) $(TESTS) $(PKGCONFNAME) examples/hiredis-example* *.o *.gcda *.gcno *.gcov
|
102
159
|
|
103
160
|
dep:
|
104
161
|
$(CC) -MM *.c
|
105
162
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
163
|
+
INSTALL?= cp -pPR
|
164
|
+
|
165
|
+
$(PKGCONFNAME): hiredis.h
|
166
|
+
@echo "Generating $@ for pkgconfig..."
|
167
|
+
@echo prefix=$(PREFIX) > $@
|
168
|
+
@echo exec_prefix=\$${prefix} >> $@
|
169
|
+
@echo libdir=$(PREFIX)/$(LIBRARY_PATH) >> $@
|
170
|
+
@echo includedir=$(PREFIX)/$(INCLUDE_PATH) >> $@
|
171
|
+
@echo >> $@
|
172
|
+
@echo Name: hiredis >> $@
|
173
|
+
@echo Description: Minimalistic C client library for Redis. >> $@
|
174
|
+
@echo Version: $(HIREDIS_MAJOR).$(HIREDIS_MINOR).$(HIREDIS_PATCH) >> $@
|
175
|
+
@echo Libs: -L\$${libdir} -lhiredis >> $@
|
176
|
+
@echo Cflags: -I\$${includedir} -D_FILE_OFFSET_BITS=64 >> $@
|
177
|
+
|
178
|
+
install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME)
|
179
|
+
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_INCLUDE_PATH)/adapters $(INSTALL_LIBRARY_PATH)
|
180
|
+
$(INSTALL) hiredis.h async.h read.h sds.h $(INSTALL_INCLUDE_PATH)
|
181
|
+
$(INSTALL) adapters/*.h $(INSTALL_INCLUDE_PATH)/adapters
|
122
182
|
$(INSTALL) $(DYLIBNAME) $(INSTALL_LIBRARY_PATH)/$(DYLIB_MINOR_NAME)
|
123
|
-
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MINOR_NAME) $(
|
124
|
-
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MAJOR_NAME) $(DYLIBNAME)
|
183
|
+
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MINOR_NAME) $(DYLIBNAME)
|
125
184
|
$(INSTALL) $(STLIBNAME) $(INSTALL_LIBRARY_PATH)
|
185
|
+
mkdir -p $(INSTALL_PKGCONF_PATH)
|
186
|
+
$(INSTALL) $(PKGCONFNAME) $(INSTALL_PKGCONF_PATH)
|
126
187
|
|
127
188
|
32bit:
|
128
189
|
@echo ""
|
@@ -130,6 +191,10 @@ install: $(DYLIBNAME) $(STLIBNAME)
|
|
130
191
|
@echo ""
|
131
192
|
$(MAKE) CFLAGS="-m32" LDFLAGS="-m32"
|
132
193
|
|
194
|
+
32bit-vars:
|
195
|
+
$(eval CFLAGS=-m32)
|
196
|
+
$(eval LDFLAGS=-m32)
|
197
|
+
|
133
198
|
gprof:
|
134
199
|
$(MAKE) CFLAGS="-pg" LDFLAGS="-pg"
|
135
200
|
|
@@ -145,4 +210,4 @@ coverage: gcov
|
|
145
210
|
noopt:
|
146
211
|
$(MAKE) OPTIMIZATION=""
|
147
212
|
|
148
|
-
.PHONY: all test check clean dep install 32bit gprof gcov noopt
|
213
|
+
.PHONY: all test check clean dep install 32bit 32bit-vars gprof gcov noopt
|