[sr-dev] git:master:3e7278f2: tls: Makefile - option to link against libssl static libs

Daniel-Constantin Mierla miconda at gmail.com
Tue May 26 14:57:43 CEST 2020


Module: kamailio
Branch: master
Commit: 3e7278f28c43b830a197e2f7b212ec6f06e5acbf
URL: https://github.com/kamailio/kamailio/commit/3e7278f28c43b830a197e2f7b212ec6f06e5acbf

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-05-26T14:56:47+02:00

tls: Makefile - option to link against libssl static libs

---

Modified: src/modules/tls/Makefile

---

Diff:  https://github.com/kamailio/kamailio/commit/3e7278f28c43b830a197e2f7b212ec6f06e5acbf.diff
Patch: https://github.com/kamailio/kamailio/commit/3e7278f28c43b830a197e2f7b212ec6f06e5acbf.patch

---

diff --git a/src/modules/tls/Makefile b/src/modules/tls/Makefile
index 1505bc64ea..f3c15bb724 100644
--- a/src/modules/tls/Makefile
+++ b/src/modules/tls/Makefile
@@ -8,6 +8,13 @@ include ../../Makefile.defs
 auto_gen=
 NAME=tls.so
 
+# set to yes when wanting to link with static libraries
+LIBSSL_STATIC ?= no
+# set to yes when wanting to link with static libraries compiled from source
+LIBSSL_STATIC_SRCLIB ?= no
+# set to the path of the folder with static libraries compiled from source
+LIBSSL_STATIC_SRCPATH ?= /usr/local/src/openssl
+
 ifeq ($(CROSS_COMPILE),)
 SSL_BUILDER=$(shell \
 	if pkg-config --exists libssl; then \
@@ -16,8 +23,21 @@ SSL_BUILDER=$(shell \
 endif
 
 ifneq ($(SSL_BUILDER),)
+ifneq ($(LIBSSL_STATIC),yes)
 	DEFS += $(shell $(SSL_BUILDER) --cflags)
 	LIBS += $(shell $(SSL_BUILDER) --libs)
+else
+ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
+	## when static libs (*.a) from packages are compiled with -fPIC
+	DEFS += $(shell $(SSL_BUILDER) --cflags)
+	LIBS += $(shell $(SSL_BUILDER) --libs-only-L)
+	LIBS += -l:libssl.a -l:libcrypto.a -l:libz.a -l:libdl.a
+else
+	## when linking against static libs compiled from sources
+	DEFS += -I$(LIBSSL_STATIC_SRCPATH)/include
+	LIBS += $(LIBSSL_STATIC_SRCPATH)/libssl.a $(LIBSSL_STATIC_SRCPATH)/libcrypto.a
+endif # ifneq ($(LIBSSL_STATIC_SRCLIB),yes)
+endif # ifneq ($(LIBSSL_STATIC),yes)
 else
 	DEFS += -I$(LOCALBASE)/ssl/include
 	LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \




More information about the sr-dev mailing list