|
| 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