From 0923734c9f90c0a8411f4c42aa5cabc758f05cca Mon Sep 17 00:00:00 2001 From: Lance Hartmann Date: Tue, 14 Aug 2018 13:56:26 -0400 Subject: [PATCH] build: Conditionally builds single and separate shared libs Adds option to configure script (default is disabled) to build SPDK shared libraries, and enhances build correspondingly to do so. This includes the single, combined shared library encompassing all of the SPDK static libs, as well as production of individual SPDK shared libraries corresponding to each of the static ones. Although the SPDK shared libs conform with shared lib naming conventions complete with version numbering suffixes, this does not confer any ABI compatibility claims whatsoever at this time. It's merely conformance with the naming conventions. Finally, there are no built-in dependencies between SPDK shared libs, thus requiring one to specify all needed SPDK shared libs to resolve all symbols in the final link of an executable wishing to use said SPDK shared libs. Change-Id: Ia375c0e3fb6d150d45a39e84e3b226fbaea48545 Signed-off-by: Lance Hartmann Reviewed-on: https://review.gerrithub.io/422307 Reviewed-by: Jim Harris Reviewed-by: Dariusz Stojaczyk Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System --- CHANGELOG.md | 10 ++++++++++ CONFIG | 3 +++ Makefile | 4 +++- configure | 15 +++++++++++++-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dccaffc38f..18cef14ebe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ spdk_nvme_ns_get_extended_sector_size() was added. This function includes the metadata size per sector (if any). spdk_nvme_ns_get_sector_size() still returns only the data size per sector, not including metadata. +### Build System + +New `configure` options, `--with-shared` and `--without-shared` +[default], provide the capability to build, or not, SPDK shared libraries. +This includes the single SPDK shared lib encompassing all of the SPDK +static libs as well as individual SPDK shared libs corresponding to +each of the SPDK static ones. Although the production of the shared +libs conforms with conventional version naming practices, such naming +does not at this time confer any SPDK ABI compatibility claims. + ## v18.07: ### bdev diff --git a/CONFIG b/CONFIG index c41b6890ed..c3b30bcac8 100644 --- a/CONFIG +++ b/CONFIG @@ -107,3 +107,6 @@ CONFIG_RAID?=n # Enable the dependencies for building the crypto vbdev CONFIG_CRYPTO?=n + +# Build spdk shared libraries in addition to the static ones. +CONFIG_SHARED?=n diff --git a/Makefile b/Makefile index 273f0119e7..2bb661a839 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,9 @@ S := SPDK_ROOT_DIR := $(CURDIR) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk -DIRS-y += lib shared_lib examples app include +DIRS-y += lib +DIRS-$(CONFIG_SHARED) += shared_lib +DIRS-y += examples app include DIRS-$(CONFIG_TESTS) += test .PHONY: all clean $(DIRS-y) config.h CONFIG.local mk/cc.mk cc_version cxx_version diff --git a/configure b/configure index 8baa8e7fb1..3dd02e3791 100755 --- a/configure +++ b/configure @@ -51,6 +51,8 @@ function usage() echo " No path required." echo " rdma [disabled]" echo " No path required." + echo " shared Required to build spdk shared libraries." + echo " No path required." echo " iscsi-initiator [disabled]" echo " No path required." echo " raid [disabled]" @@ -158,6 +160,12 @@ for i in "$@"; do --without-rdma) CONFIG_RDMA=n ;; + --with-shared) + CONFIG_SHARED=y + ;; + --without-shared) + CONFIG_SHARED=n + ;; --with-iscsi-initiator) CONFIG_ISCSI_INITIATOR=y ;; @@ -291,7 +299,7 @@ if [ "$CONFIG_ASAN" = "y" -a "$CONFIG_TSAN" = "y" ]; then exit 1 fi -if [[ "$OSTYPE" == "FreeBSD"* ]]; then +if [[ "$OSTYPE" == "freebsd"* ]]; then # FreeBSD doesn't support all configurations if [[ "$CONFIG_COVERAGE" == "y" ]]; then echo "ERROR: CONFIG_COVERAGE not available on FreeBSD" @@ -369,6 +377,9 @@ fi if [ -n "$CONFIG_RDMA" ]; then echo "CONFIG_RDMA?=$CONFIG_RDMA" >> CONFIG.local fi +if [ -n "$CONFIG_SHARED" ]; then + echo "CONFIG_SHARED?=$CONFIG_SHARED" >> CONFIG.local +fi if [ -n "$CONFIG_ISCSI_INITIATOR" ]; then echo "CONFIG_ISCSI_INITIATOR?=$CONFIG_ISCSI_INITIATOR" >> CONFIG.local fi @@ -415,7 +426,7 @@ echo $python_command > PYTHON_COMMAND $python_command scripts/genconfig.py > config.h echo "done." -if [[ "$OSTYPE" == "FreeBSD"* ]]; then +if [[ "$OSTYPE" == "freebsd"* ]]; then echo "Type 'gmake' to build." else echo "Type 'make' to build."