Commit e8863cb7 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

configure: Allow to define custom libdir location



This is done mainly to align the final location with the one listed
in the .pc files created for each lib.

Signed-off-by: default avatarMichal Berger <michallinuxstuff@gmail.com>
Change-Id: I99d6875c9e26f8202723dd6d73bd865b6478bcf9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12978


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 642f8b3d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@ CONFIG_PREFIX="/usr/local"
# Target architecture
CONFIG_ARCH=native

# Destination directory for the libraries
CONFIG_LIBDIR=

# Prefix for cross compilation
CONFIG_CROSS_PREFIX=

+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ function usage() {
	echo ""
	echo " --cross-prefix=prefix     Prefix for cross compilation (default: none)"
	echo "                           example: aarch64-linux-gnu"
	echo " --libdir=path             Configure installation path for the libraries (default: \$prefix/lib)"
	echo ""
	echo " --enable-debug            Configure for debug builds"
	echo " --enable-werror           Treat compiler warnings as errors"
@@ -298,6 +299,9 @@ for i in "$@"; do
		--target-arch=*)
			CONFIG[ARCH]="${i#*=}"
			;;
		--libdir=*)
			CONFIG[LIBDIR]="${i#*=}"
			;;
		--enable-debug)
			CONFIG[DEBUG]=y
			;;
+4 −0
Original line number Diff line number Diff line
@@ -26,7 +26,11 @@ CONFIG_PREFIX=$(prefix)
endif

bindir?=$(CONFIG_PREFIX)/bin
ifeq ($(CONFIG_LIBDIR),)
libdir?=$(CONFIG_PREFIX)/lib
else
libdir?=$(CONFIG_LIBDIR)
endif
includedir?=$(CONFIG_PREFIX)/include

ifeq ($(MAKECMDGOALS),)
+3 −3
Original line number Diff line number Diff line
@@ -87,16 +87,16 @@ $(SHARED_REALNAME_LIB): $(LIB)
	$(call spdk_build_realname_shared_lib,$(COMPILER),$^,$(SPDK_MAP_FILE),$(LOCAL_SYS_LIBS),$(SPDK_DEP_LIBS))

define pkgconfig_create
	$(Q)$(SPDK_ROOT_DIR)/scripts/pc.sh $(1) $(LIBNAME) $(SO_SUFFIX) \
	$(Q)$(SPDK_ROOT_DIR)/scripts/pc.sh $(1) $(2) $(LIBNAME) $(SO_SUFFIX) \
		"$(DEPDIRS-$(LIBNAME):%=spdk_%) $(MODULES-$(LIBNAME))" \
		"" > $@
endef

$(PKGCONFIG): $(LIB)
	$(call pkgconfig_create,$(SPDK_ROOT_DIR)/build)
	$(call pkgconfig_create,$(SPDK_ROOT_DIR)/build "")

$(PKGCONFIG_INST): $(LIB)
	$(call pkgconfig_create,$(CONFIG_PREFIX))
	$(call pkgconfig_create,$(CONFIG_PREFIX),$(libdir))

$(LIB): $(OBJS)
	$(LIB_C)
+4 −0
Original line number Diff line number Diff line
@@ -105,6 +105,10 @@ build_macros() {
		fi
	fi

	if get_config libdir has-arg; then
		macros+=(-D "libdir $(get_config libdir print)")
	fi

	if [[ $deps == no ]]; then
		macros+=(-D "deps 0")
	fi
Loading