Skip to content

Commit

Permalink
Move the same openssl make-foo code that has been copied and
Browse files Browse the repository at this point in the history
pasted around into a central location and include it from
there.
  • Loading branch information
sobomax committed Mar 23, 2023
1 parent 2422396 commit de4432a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 97 deletions.
27 changes: 27 additions & 0 deletions Makefile.openssl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# WARNING: do not run this directly, it should be included by other Makefiles

# Needed to build with openssl 3.x
DEFS += -Wno-deprecated-declarations

ifeq ($(CROSS_COMPILE),)
SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
echo 'pkg-config libssl'; \
fi)
endif

ifneq ($(SSL_BUILDER),)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/ssl/include \
-I$(LOCALBASE)/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-lssl -lcrypto
endif

# enable this flag to increase performance by not serializing openssl
# connect/accept/read/write operations, at the cost of possible crashes
#DEFS+= -DNO_SSL_GLOBAL_LOCK
19 changes: 1 addition & 18 deletions modules/identity/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@ include ../../Makefile.defs
auto_gen=
NAME=identity.so

ifeq ($(CROSS_COMPILE),)
SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
echo 'pkg-config libssl'; \
fi)
endif

ifneq ($(SSL_BUILDER),)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/ssl/include \
-I$(LOCALBASE)/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-lssl -lcrypto
endif

include ../../Makefile.openssl
include ../../Makefile.modules

18 changes: 1 addition & 17 deletions modules/osp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,7 @@ include ../../Makefile.defs
auto_gen=
NAME=osp.so

ifeq ($(CROSS_COMPILE),)
SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
echo 'pkg-config libssl'; \
fi)
endif

ifneq ($(SSL_BUILDER),)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/ssl/include \
-I$(LOCALBASE)/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-lssl -lcrypto
endif
include ../../Makefile.openssl

DEFS+=-D_POSIX_THREADS -I$(LOCALBASE)/include
LIBS+=-L$(LOCALBASE)/lib -losptk -lutf8proc -lpthread -lm
Expand Down
23 changes: 1 addition & 22 deletions modules/proto_tls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,5 @@ NAME=proto_tls.so

ETC_DIR?=../../etc/

ifeq ($(CROSS_COMPILE),)
SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
echo 'pkg-config libssl'; \
fi)
endif

ifneq ($(SSL_BUILDER),)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/ssl/include \
-I$(LOCALBASE)/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-lssl -lcrypto
endif

# enable this flag to increase performance by not serializing openssl
# connect/accept/read/write operations, at the cost of possible crashes
#DEFS+= -DNO_SSL_GLOBAL_LOCK

include ../../Makefile.openssl
include ../../Makefile.modules
23 changes: 1 addition & 22 deletions modules/proto_wss/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,5 @@ NAME=proto_wss.so

ETC_DIR?=../../etc/

ifeq ($(CROSS_COMPILE),)
SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
echo 'pkg-config libssl'; \
fi)
endif

ifneq ($(SSL_BUILDER),)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/ssl/include \
-I$(LOCALBASE)/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-lssl -lcrypto
endif

# enable this flag to increase performance by not serializing openssl
# connect/accept/read/write operations, at the cost of possible crashes
#DEFS+= -DNO_SSL_GLOBAL_LOCK

include ../../Makefile.openssl
include ../../Makefile.modules
19 changes: 1 addition & 18 deletions modules/tls_mgm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,7 @@ tls_configs=$(patsubst $(ETC_DIR)/%, %, $(wildcard $(ETC_DIR)/tls/*) \
$(wildcard $(ETC_DIR)/tls/rootCA/private/*) $(wildcard $(ETC_DIR)/tls/user/*))


ifeq ($(CROSS_COMPILE),)
SSL_BUILDER=$(shell \
if pkg-config --exists libssl; then \
echo 'pkg-config libssl'; \
fi)
endif

ifneq ($(SSL_BUILDER),)
DEFS += $(shell $(SSL_BUILDER) --cflags)
LIBS += $(shell $(SSL_BUILDER) --libs)
else
DEFS += -I$(LOCALBASE)/ssl/include \
-I$(LOCALBASE)/include
LIBS += -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib \
-L$(LOCALBASE)/lib64 -L$(LOCALBASE)/ssl/lib64 \
-lssl -lcrypto
endif

include ../../Makefile.openssl
include ../../Makefile.modules

install_module_custom:
Expand Down

0 comments on commit de4432a

Please sign in to comment.