Commit Graph

153 Commits

Author SHA1 Message Date
Ruoyu Zhong
77bcc73ebb Makefile: correctly handle version suffixes on macOS
On macOS, the version suffix of a shared library comes before the
`.dylib` suffix, which is different from the convention on other
systems. Currently, the Makefile only overrides `DYLIB_MINOR_NAME` for
macOS, but does not handle the other similar variables, namely
`DYLIB_MAJOR_NAME`, `SSL_DYLIB_MINOR_NAME`, and `SSL_DYLIB_MAJOR_NAME`.

This commit fixes the issue by overriding all these variables for macOS.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2025-02-10 14:10:17 -08:00
Romain Geissler
bff171c9fc Allow disabling the -Werror flag. 2023-07-13 11:27:05 -07:00
Yossi Gottlieb
d543baba67 Install major version symlink of shared objects.
This change addresses the issue discussed in #1202 and should make it
possible in the future to update minor versions without requiring
re-linking binaries.
2023-07-10 08:44:57 -07:00
Yossi Gottlieb
5cbd1f2960
Add -Werror as a default. (#1193) 2023-06-01 19:03:24 +03:00
michael-grunder
aacb84b8d4 Fix typo in makefile. 2023-04-14 12:42:14 -07:00
michael-grunder
4ca8e73f66 Rework searching for openssl 2023-03-09 15:53:55 -08:00
Victor Polevoy
cd208812f9 Attempt to find the correct path for openssl.
The installation path for openssl may vary depending on the way
used for its installation and the macOS version.

This commit attempts to find the correct path for openssl to use.
2023-03-09 15:53:55 -08:00
Bjorn Svensson
3b15a04b59
Fixup of PR734: Coverage of hiredis.c (#1124)
Improve coverage (#734)

* Remove duplicate tests

- double covered by:
  "Can parse RESP3 doubles"
- bool covered via:
  "Can parse RESP3 bool"

* Make (connect) timeout in test config general

* Set error string in Unix connect with invalid timeout

Restructure testcase since redisConnectWithTimeout() and
redisConnectUnixWithTimeout() now behaves similar.

* Use quiet flag in lcov/genhtml instead of piping to /dev/null

* Fixup of redisCommandArgv test case

* Update test case to match what it covers

Use new test case info text since the previous one seemed copy&pasted.
The sought coverage was the handling of the parent-chaining
for a double object, which the test case now focuses on.

Co-authored-by: Ariel <ashtul@gmail.com>
2022-10-14 08:11:40 -07:00
Bjorn Svensson
722e3409c7
Additional include directory given by pkg-config (#1118)
* Update include example in README

* Update pkg-config installed via CMake

Gives the include directory to enable the use of:
 #include <hiredis/hiredis.h>

but keeps the existing include dir. for backwards compatibility.

Example:
> pkg-config hiredis --cflags
-D_FILE_OFFSET_BITS=64 -I/usr/local/include/hiredis -I/usr/local/include

* Update pkg-config installed via Make

Gives the include directory to enable the use of:
  #include <hiredis/hiredis.h>
but keeps the existing include path for backwards compatibility.

Example:
> pkg-config hiredis --cflags
-D_FILE_OFFSET_BITS=64 -I/usr/local/include/hiredis -I/usr/local/include
2022-09-19 10:49:55 -07:00
michael-grunder
d756f68a59 Add libhv example to our standard Makefile
See #904
2022-09-07 15:20:28 -07:00
michael-grunder
eaae7321c2 Polling adapter requires sockcompat.h
We need to install our socket compatibility header as the new polling
adapter needs it.
2022-09-01 00:50:23 -07:00
Kristján Valur Jónsson
8491a65a95
Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
* Add docker support to test.sh
specifying a REDIS_DOCKER env var will run this as a server.
* Add initial test workflow
* Add workflow test to test 32 bit build
* Add ARM x compilation tests
* Add tests for windows platform
* Test with valgrind
2022-08-29 14:30:08 -07:00
Kristján Valur Jónsson
31c91408ef Polling adapter and example 2022-07-05 11:14:03 +00:00
MichaelSuen
e73ab2f232
Add timeout support for libuv adapter (#1016)
Add timeout to libuv adapter

Co-authored-by: sunmingqi <sunmingqi@corp.netease.com>
Co-authored-by: sunmingqi <smq222@126.com>
Co-authored-by: Michael Grunder <michael.grunder@gmail.com>
Co-authored-by: Viktor Söderqvist <viktor@zuiderkwast.se>
2022-01-18 10:59:18 -08:00
michael-grunder
799edfaadf Don't link with crypto libs if USE_SSL isn't set. 2021-12-24 11:13:28 -08:00
zhenwei pi
f74b08182c Makefile: move SSL options into a block and refine rules
Move SSL options into two blocks to make it easy to read:
  1, first part: SSL variables part
  1, second part: SSL building rules part
and change global rules to make it easy to maintain. For the further
step, it gets extensible to add another type.

New version of the library building rule:
	static: $(STLIBNAME) $(SSL_STLIB)
	dynamic: $(DYLIBNAME) $(SSL_DYLIB)

Compare with the orignal version:
	dynamic: $(DYLIBNAME)
	static: $(STLIBNAME)
	ifeq ($(USE_SSL),1)
	dynamic: $(SSL_DYLIBNAME)
	static: $(SSL_STLIBNAME)
	endif

If we want to add a new type(Ex, RDMA), for the new version, we can
do like this:
	########### RDMA variables start ###############
	.....
	########### RDMA variables end   ###############

	static: $(STLIBNAME) $(SSL_STLIB) $(RDMA_STLIB)
	dynamic: $(DYLIBNAME) $(SSL_DYLIB) $(RDMA_DYLIB)

	########### RDMA building rules start ###############
	.....
	########### RDMA building rules end   ###############

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2021-12-23 17:26:35 +08:00
Michael Grunder
e3a479e409
FreeBSD build fixes + CI (#1026)
* BSD linkage fix proposal

* Touch up the Makefile to fix BSD builds

Fixes #984

* Add a build in FreeBSD to GitHub Actions

Lots of people use hiredis in FreeBSD so this should reduce some pain
moving forward.

Co-authored-by: David Carlier <devnexen@gmail.com>
2021-12-16 12:36:05 -08:00
Björn Svensson
648763c36e Add build options for enabling async tests
Asynchronous testcases that requires the event library `libevent`
can be built and enabled by using the added build flags:
- ENABLE_ASYNC_TESTS when using CMake
- TEST_ASYNC when using Make

The async tests are disabled by default to avoid adding new requirements,
but the testcases are built and run in CI.
2021-10-26 09:54:44 +02:00
Bjorn Svensson
c98c6994de
Correcting the build target coverage for enabled SSL (#1009)
* Exclude includes from /usr in coverage reporting

* Correct build target `coverage` for enabled ssl

`USE_SSL=1 make coverage` will now build the test binary with the
forwarded define HIREDIS_TEST_SSL. This avoids inconsistency between
built test binary and the testrunner `test.sh`.
This enables test coverage measurements for SSL too.
2021-10-21 13:17:21 -07:00
Yunier Perez
9eca1f36f4 Allow to override OPENSSL_PREFIX in Linux 2021-10-03 10:58:27 -07:00
Michael Grunder
2e7d7cbabd
Resp3 oob push support (#841)
Proper support for RESP3 PUSH messages.

By default, PUSH messages are now intercepted and the reply memory freed.  
This means existing code should work unchanged when connecting to Redis
>= 6.0.0 even if `CLIENT TRACKING` were then enabled.

Additionally, we define two callbacks users can configure if they wish to handle
these messages in a custom way:

void redisPushFn(void *privdata, void *reply);
void redisAsyncPushFn(redisAsyncContext *ac, void *reply);

See #825
2020-07-19 18:54:42 -07:00
Michael Grunder
8e0264cfd6
Allow users to replace allocator and handle OOM everywhere. (#800)
* Adds an indirection to every allocation/deallocation to allow users to 
  plug in ones of their choosing (use custom functions, jemalloc, etc).

* Gracefully handle OOM everywhere in hiredis.  This should make it possible
  for users of the library to have more flexibility in how they handle such situations.

* Changes `redisReaderTask->elements` from an `int` to a `long long` to prevent
  a possible overflow when transferring the task elements into a `redisReply`.

* Adds a configurable `max elements` member to `redisReader` that defaults to
  2^32 - 1.  This can be set to "unlimited" by setting the value to zero.
2020-05-22 09:27:49 -07:00
Yossi Gottlieb
243099ccd2
Fix missing SSL build/install options. (#812)
* Fix missing SSL build/install options.

* Use different build commands for non-Linux linkers.
* Add missing install targets.

Fixes #809
2020-05-19 10:13:32 -07:00
Michael Grunder
2cb203c1e9
Attempt to fix compilation on Solaris (#796)
See #757
2020-04-23 14:15:59 -07:00
Michael Grunder
b484021859
Fix USE_SSL=1 make/cmake on OSX and CMake tests (#789)
* Fix linker problems when building with SSL enabled on OSX
* Corrects `HIREDIS_SSL=ON` to `USE_SSL=ON` so we test building with
  SSL enabled on travis.
2020-04-13 09:32:32 -07:00
akichan
3ae4739799 install alloc.h
alloc.h added in # 754
But not added to INSTALL_INCLUDE_PATH
2020-01-29 17:26:34 +09:00
Michael Grunder
669ac9d0c8
Safe allocation wrappers (#754)
Create allocation wrappers with a configurable OOM handler (defaults to abort()).

See #752, #747
2020-01-28 12:13:05 -08:00
Yossi Gottlieb
d952ed877a Add SSL mode tests.
This repeats all existing tests in SSL mode, but does not yet provide
SSL-specific tests.
2019-09-16 17:30:35 +03:00
Yossi Gottlieb
5872d818d9 Separate hiredis and hiredis_ssl library build. 2019-09-01 13:46:27 +03:00
Yossi Gottlieb
df68d7d8bd Rename sslio. 2019-08-29 22:14:09 +03:00
Yossi Gottlieb
8715ba5c82 wip: SSL code reorganization, see #705. 2019-08-29 22:09:37 +03:00
m
dc6d19b9ec Port network layer to Winsock
With this change, Hiredis builds with MinGW and runs on Windows.
2019-04-01 11:54:37 +02:00
Mark Nunberg
1ec4aefba6 Fix ifeq condition (thanks @regae) 2019-02-21 06:21:53 -05:00
Mark Nunberg
3949c8a153 Disable SSL by default 2019-02-20 09:11:10 -05:00
valentino
271f33953f fix pkg config 2019-02-20 09:11:10 -05:00
valentino
389e694abe Fix compilation on Ubuntu 2019-02-20 09:10:10 -05:00
Mark Nunberg
f51363a70c Don't warn on missing field initializers 2019-02-20 09:10:10 -05:00
Mark Nunberg
d329cc952a Use SSL by default 2019-02-20 09:10:10 -05:00
Mark Nunberg
bc2a8f372a Minor SSL-related fixes 2019-02-20 09:10:10 -05:00
Mark Nunberg
82549a53de Disable SSL by default 2019-02-20 09:10:10 -05:00
Mark Nunberg
08efa46599 SSL for async I/O 2019-02-20 09:10:10 -05:00
Mark Nunberg
0c14544906 Initial SSL (sync) implementation 2019-02-20 09:10:10 -05:00
Jörg Thalheim
2fa34e37af
Makefile: use predefined AR
This allows to override it for cross compilation.
2018-12-04 20:47:37 +00:00
Tom Lee
3bcf286356 Add CPPFLAGS to REAL_CFLAGS 2018-09-26 13:25:24 -07:00
Ryan Schmidt
a65537a672 Use -dynamiclib instead of -shared on macOS
-dynamiclib is the correct documented flag to use to create dynamic
libraries on macOS. Newer toolchains recognize -shared as a synonym
of -dynamiclib but older toolchains don't.
2018-05-31 02:52:45 -05:00
michael-grunder
dbde4f68cf Merge branch 'master' of github.com:redis/hiredis 2018-05-16 09:57:40 -07:00
michael-grunder
9d3b4ec703 Make sure we've got a path separator before the actual dylib name 2018-05-16 09:08:00 -07:00
Ryan Schmidt
0e9af8acb6
Use cp -pPR instead of cp -a
This should be equivalent but compatible with older versions of cp.
2018-05-14 17:37:14 -05:00
Ryan Schmidt
881fcb776d
Use absolute install_name
Fixes #437.
2018-05-14 14:32:05 -05:00
Jan-Erik Rediger
43284ee495
Merge pull request #561 from zshipko/master
Fix "make install" on OpenBSD
2018-01-05 15:50:31 +01:00