Skip to content

Commit d65e0bf

Browse files
authored
Merge pull request #4281 from david-goncalves-five9/feature/update-launch_darkly
feat: Update Launch darkly sdk
2 parents 15a9faf + f71b6f2 commit d65e0bf

6 files changed

Lines changed: 173 additions & 140 deletions

File tree

‎.gitmodules‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[submodule "modules/wolfssl/lib/wolfssl"]
22
path = modules/tls_wolfssl/lib/wolfssl
33
url = https://github.com/wolfSSL/wolfssl.git
4-
[submodule "modules/launch_darkly/lib/c-server-sdk"]
5-
path = modules/launch_darkly/lib/c-server-sdk
6-
url = https://github.com/launchdarkly/c-server-sdk.git
4+
[submodule "modules/launch_darkly/lib/cpp-sdks"]
5+
path = modules/launch_darkly/lib/cpp-sdks
6+
url = https://github.com/launchdarkly/cpp-sdks.git
77
[submodule "modules/http2d/lib/nghttp2"]
88
path = modules/http2d/lib/nghttp2
99
url = https://github.com/nghttp2/nghttp2

‎modules/launch_darkly/Makefile‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,39 @@ MOD_DIR ?= $(shell realpath `dirname $(_makefile_path)`)/modules/launch_darkly
99

1010
ifneq ($(LD_USE_SYSTEM),yes)
1111
LD_LOCALBASE ?= ./lib
12-
ifeq ($(LD_USE_SHARED),yes)
13-
LD_LIB_NAME ?= libldserverapi.so
14-
else
15-
LD_USE_SHARED = no
1612
LD_LIB_NAME ?= libldserverapi.a
17-
endif
1813
DEPS += lib/lib/$(LD_LIB_NAME)
1914
else
2015
LD_LOCALBASE ?= $(LOCALBASE)
2116
endif
2217

2318
DEFS+=-I$(LD_LOCALBASE)/include
24-
LIBS+=-L$(LD_LOCALBASE)/lib -l ldserverapi -l curl -l pthread -l m -l pcre
19+
# ldserverapi (built from LaunchDarkly's cpp-sdks, renamed to this legacy name)
20+
# is a static archive built with a C++ toolchain (Boost.JSON/URL/Coroutine +
21+
# OpenSSL, statically linked in) - -lstdc++ is required because this module
22+
# (a .c file) links it in
23+
LIBS+=-L$(LD_LOCALBASE)/lib -Wl,--start-group \
24+
-l ldserverapi \
25+
-l boost_json -l boost_url -l boost_coroutine -l boost_context -l boost_thread \
26+
-l ssl -l crypto \
27+
-Wl,--end-group -l pthread -l stdc++ -l m
2528

2629
include ../../Makefile.modules
2730

2831
ifneq ($(LD_USE_SYSTEM),yes)
2932
lib/build/Makefile:
3033
$(C)cmake \
31-
-DBUILD_SHARED_LIBS=$(LD_USE_SHARED) \
3234
-DBUILD_TESTING=Off \
33-
-DCMAKE_C_FLAGS=-fPIC \
35+
-DLD_BUILD_EXAMPLES=Off \
36+
-DLD_BUILD_CONTRACT_TESTS=Off \
37+
-DCMAKE_CXX_FLAGS=-fPIC \
3438
-DCMAKE_INSTALL_PREFIX=$(MOD_DIR)/lib \
35-
-S lib/c-server-sdk \
39+
-S lib/cpp-sdks \
3640
-B lib/build
3741

3842
lib/lib/$(LD_LIB_NAME): lib/build/Makefile
3943
$(Q)$(MAKE) -C ./lib/build install
44+
$(Q)mv $(MOD_DIR)/lib/lib/liblaunchdarkly-cpp-server.a $(MOD_DIR)/lib/lib/$(LD_LIB_NAME)
4045

4146
clean: clean-launch-darkly-lib
4247

‎modules/launch_darkly/README.md‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,32 @@ running OpenSIPS with this module loaded:
4040
- *ldserverapi*
4141

4242

43-
*ldserverapi* must be compiled and installed
44-
from the official
45-
[GITHUB repository](https://github.com/launchdarkly/c-server-sdk).
43+
*ldserverapi* must be compiled and installed.
44+
It is built from LaunchDarkly's C++ server-side SDK
45+
([cpp-sdks](https://github.com/launchdarkly/cpp-sdks), which also exposes
46+
a C API used by this module); the resulting archive is simply renamed to
47+
the legacy *ldserverapi* name expected by this module's Makefile. This
48+
replaces the older, deprecated
49+
[c-server-sdk](https://github.com/launchdarkly/c-server-sdk).
4650

4751

48-
The instructions for a quick installations of the library (note that it has to be compiled as shared lib in order to be compatible with the OpenSIPS modules):
52+
The instructions for a quick installation of the library (built as a
53+
static lib by default). Note that even though the SDK itself and OpenSSL
54+
are linked statically, Debian/Ubuntu's Boost CMake packages only ship
55+
shared library targets, so the module still ends up with a runtime
56+
dependency on the matching *libboost-json*, *libboost-url*,
57+
*libboost-coroutine*, *libboost-context*, *libboost-thread*,
58+
*libboost-system*, *libboost-date-time* and *libboost-filesystem* runtime
59+
packages (version 1.81) being installed wherever OpenSIPS actually runs:
4960

5061

5162
```bash
5263
...
53-
$ git clone https://github.com/launchdarkly/c-server-sdk.git
54-
$ cd c-server-sdk
55-
$ cmake -DBUILD_SHARED_LIBS=On -DBUILD_TESTING=OFF .
56-
$ sudo make install
64+
$ git clone -b launchdarkly-cpp-server-v3.9.1 https://github.com/launchdarkly/cpp-sdks.git
65+
$ cd cpp-sdks
66+
$ cmake -DBUILD_TESTING=Off -DLD_BUILD_EXAMPLES=Off -DLD_BUILD_CONTRACT_TESTS=Off .
67+
$ sudo cmake --build . --target install
68+
$ sudo mv /usr/local/lib/liblaunchdarkly-cpp-server.a /usr/local/lib/libldserverapi.a
5769
...
5870
```
5971

0 commit comments

Comments
 (0)