Skip to content

Commit bb036f0

Browse files
committed
Make: add BoringSSL build configs.
1 parent 5b1b99a commit bb036f0

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

build/build-boringssl-static.mk

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Build static module with BoringSSL
3+
#
4+
5+
LIBSSL_SRCDIR = $(BORINGSSL_SOURCE_DIR)
6+
LIBSSL_BUILDDIR = $(NGINX_BUILD_DIR)/lib/boringssl
7+
8+
# pass SSL library location to openssl-sys
9+
10+
BUILD_ENV += OPENSSL_INCLUDE_DIR="$(LIBSSL_SRCDIR)/include"
11+
BUILD_ENV += OPENSSL_LIB_DIR="$(LIBSSL_BUILDDIR)"
12+
BUILD_ENV += OPENSSL_STATIC=1
13+
14+
NGINX_CONFIGURE = \
15+
$(NGINX_CONFIGURE_BASE) \
16+
--with-cc-opt="-I$(LIBSSL_SRCDIR)/include" \
17+
--with-ld-opt="-L$(LIBSSL_BUILDDIR) -lstdc++" \
18+
--with-debug \
19+
--add-module="$(CURDIR)"
20+
21+
22+
$(LIBSSL_BUILDDIR)/CMakeCache.txt: $(LIBSSL_SRCDIR)/CMakeLists.txt
23+
cmake -S $(LIBSSL_SRCDIR) \
24+
-B $(LIBSSL_BUILDDIR) \
25+
-DBUILD_TESTING:BOOL=OFF \
26+
-DCMAKE_BUILD_TYPE=RelWithDebInfo
27+
28+
$(LIBSSL_BUILDDIR)/libssl.a: $(LIBSSL_BUILDDIR)/CMakeCache.txt
29+
cmake --build $(LIBSSL_BUILDDIR)
30+
31+
$(NGINX_BUILD_DIR)/Makefile: $(LIBSSL_BUILDDIR)/libssl.a

build/build-boringssl.mk

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# Build dynamic module with BoringSSL
3+
#
4+
# This build flavor requires shared BoringSSL, because:
5+
#
6+
# * we use libssl objects created by nginx, and thus have to link to the same
7+
# library
8+
#
9+
# * linking static libssl.a to the nginx binary alone results in missing
10+
# symbols during module load
11+
#
12+
# * linking static libssl.a to both the binary and the module results in two
13+
# different sets of static globals
14+
#
15+
16+
LIBSSL_SRCDIR = $(BORINGSSL_SOURCE_DIR)
17+
LIBSSL_BUILDDIR = $(NGINX_BUILD_DIR)/lib/boringssl
18+
19+
# pass SSL library location to openssl-sys
20+
21+
BUILD_ENV += OPENSSL_INCLUDE_DIR="$(LIBSSL_SRCDIR)/include"
22+
BUILD_ENV += OPENSSL_LIB_DIR="$(LIBSSL_BUILDDIR)"
23+
BUILD_ENV += OPENSSL_STATIC=0
24+
25+
TEST_ENV += LD_LIBRARY_PATH="$(LIBSSL_BUILDDIR)"
26+
TEST_NGINX_GLOBALS += load_module $(NGINX_BUILT_MODULE);
27+
28+
NGINX_CONFIGURE = \
29+
$(NGINX_CONFIGURE_BASE) \
30+
--with-cc-opt="-I$(LIBSSL_SRCDIR)/include" \
31+
--with-ld-opt="-L$(LIBSSL_BUILDDIR) -lstdc++" \
32+
--with-debug \
33+
--add-dynamic-module="$(CURDIR)"
34+
35+
36+
build: $(NGINX_BUILT_MODULE)
37+
38+
$(LIBSSL_BUILDDIR)/CMakeCache.txt: $(LIBSSL_SRCDIR)/CMakeLists.txt
39+
cmake -S $(LIBSSL_SRCDIR) \
40+
-B $(LIBSSL_BUILDDIR) \
41+
-DBUILD_SHARED_LIBS:BOOL=ON \
42+
-DBUILD_TESTING:BOOL=OFF \
43+
-DCMAKE_BUILD_TYPE=RelWithDebInfo
44+
45+
$(LIBSSL_BUILDDIR)/libssl$(SHLIB_EXT): $(LIBSSL_BUILDDIR)/CMakeCache.txt
46+
cmake --build $(LIBSSL_BUILDDIR)
47+
48+
$(NGINX_BUILD_DIR)/Makefile: $(LIBSSL_BUILDDIR)/libssl$(SHLIB_EXT)

0 commit comments

Comments
 (0)