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: Michal 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: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
642f8b3da5
commit
e8863cb76b
3
CONFIG
3
CONFIG
@ -10,6 +10,9 @@ CONFIG_PREFIX="/usr/local"
|
|||||||
# Target architecture
|
# Target architecture
|
||||||
CONFIG_ARCH=native
|
CONFIG_ARCH=native
|
||||||
|
|
||||||
|
# Destination directory for the libraries
|
||||||
|
CONFIG_LIBDIR=
|
||||||
|
|
||||||
# Prefix for cross compilation
|
# Prefix for cross compilation
|
||||||
CONFIG_CROSS_PREFIX=
|
CONFIG_CROSS_PREFIX=
|
||||||
|
|
||||||
|
4
configure
vendored
4
configure
vendored
@ -22,6 +22,7 @@ function usage() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo " --cross-prefix=prefix Prefix for cross compilation (default: none)"
|
echo " --cross-prefix=prefix Prefix for cross compilation (default: none)"
|
||||||
echo " example: aarch64-linux-gnu"
|
echo " example: aarch64-linux-gnu"
|
||||||
|
echo " --libdir=path Configure installation path for the libraries (default: \$prefix/lib)"
|
||||||
echo ""
|
echo ""
|
||||||
echo " --enable-debug Configure for debug builds"
|
echo " --enable-debug Configure for debug builds"
|
||||||
echo " --enable-werror Treat compiler warnings as errors"
|
echo " --enable-werror Treat compiler warnings as errors"
|
||||||
@ -298,6 +299,9 @@ for i in "$@"; do
|
|||||||
--target-arch=*)
|
--target-arch=*)
|
||||||
CONFIG[ARCH]="${i#*=}"
|
CONFIG[ARCH]="${i#*=}"
|
||||||
;;
|
;;
|
||||||
|
--libdir=*)
|
||||||
|
CONFIG[LIBDIR]="${i#*=}"
|
||||||
|
;;
|
||||||
--enable-debug)
|
--enable-debug)
|
||||||
CONFIG[DEBUG]=y
|
CONFIG[DEBUG]=y
|
||||||
;;
|
;;
|
||||||
|
@ -26,7 +26,11 @@ CONFIG_PREFIX=$(prefix)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
bindir?=$(CONFIG_PREFIX)/bin
|
bindir?=$(CONFIG_PREFIX)/bin
|
||||||
|
ifeq ($(CONFIG_LIBDIR),)
|
||||||
libdir?=$(CONFIG_PREFIX)/lib
|
libdir?=$(CONFIG_PREFIX)/lib
|
||||||
|
else
|
||||||
|
libdir?=$(CONFIG_LIBDIR)
|
||||||
|
endif
|
||||||
includedir?=$(CONFIG_PREFIX)/include
|
includedir?=$(CONFIG_PREFIX)/include
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),)
|
ifeq ($(MAKECMDGOALS),)
|
||||||
|
@ -87,16 +87,16 @@ $(SHARED_REALNAME_LIB): $(LIB)
|
|||||||
$(call spdk_build_realname_shared_lib,$(COMPILER),$^,$(SPDK_MAP_FILE),$(LOCAL_SYS_LIBS),$(SPDK_DEP_LIBS))
|
$(call spdk_build_realname_shared_lib,$(COMPILER),$^,$(SPDK_MAP_FILE),$(LOCAL_SYS_LIBS),$(SPDK_DEP_LIBS))
|
||||||
|
|
||||||
define pkgconfig_create
|
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))" \
|
"$(DEPDIRS-$(LIBNAME):%=spdk_%) $(MODULES-$(LIBNAME))" \
|
||||||
"" > $@
|
"" > $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(PKGCONFIG): $(LIB)
|
$(PKGCONFIG): $(LIB)
|
||||||
$(call pkgconfig_create,$(SPDK_ROOT_DIR)/build)
|
$(call pkgconfig_create,$(SPDK_ROOT_DIR)/build "")
|
||||||
|
|
||||||
$(PKGCONFIG_INST): $(LIB)
|
$(PKGCONFIG_INST): $(LIB)
|
||||||
$(call pkgconfig_create,$(CONFIG_PREFIX))
|
$(call pkgconfig_create,$(CONFIG_PREFIX),$(libdir))
|
||||||
|
|
||||||
$(LIB): $(OBJS)
|
$(LIB): $(OBJS)
|
||||||
$(LIB_C)
|
$(LIB_C)
|
||||||
|
@ -105,6 +105,10 @@ build_macros() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if get_config libdir has-arg; then
|
||||||
|
macros+=(-D "libdir $(get_config libdir print)")
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $deps == no ]]; then
|
if [[ $deps == no ]]; then
|
||||||
macros+=(-D "deps 0")
|
macros+=(-D "deps 0")
|
||||||
fi
|
fi
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
%{!?requirements:%define requirements 0}
|
%{!?requirements:%define requirements 0}
|
||||||
%{!?build_requirements:%define build_requirements 0}
|
%{!?build_requirements:%define build_requirements 0}
|
||||||
%{!?shared:%define shared 0}
|
%{!?shared:%define shared 0}
|
||||||
|
%{!?libdir:%define libdir /usr/local/lib}
|
||||||
|
|
||||||
# Spec metadata
|
# Spec metadata
|
||||||
Name: spdk
|
Name: spdk
|
||||||
@ -87,7 +88,7 @@ mkdir -p %{buildroot}/etc/ld.so.conf.d
|
|||||||
mkdir -p %{buildroot}%{python3_sitelib}
|
mkdir -p %{buildroot}%{python3_sitelib}
|
||||||
|
|
||||||
cat <<-EOF > %{buildroot}/etc/ld.so.conf.d/spdk.conf
|
cat <<-EOF > %{buildroot}/etc/ld.so.conf.d/spdk.conf
|
||||||
/usr/local/lib
|
%{libdir}
|
||||||
/usr/local/lib/dpdk
|
/usr/local/lib/dpdk
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ SPDK development libraries and headers
|
|||||||
%files devel
|
%files devel
|
||||||
/usr/local/include/*
|
/usr/local/include/*
|
||||||
%if %{shared}
|
%if %{shared}
|
||||||
/usr/local/lib/lib*.so
|
%{libdir}/lib*.so
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%package libs
|
%package libs
|
||||||
@ -138,10 +139,10 @@ SPDK libraries
|
|||||||
|
|
||||||
%files libs
|
%files libs
|
||||||
/etc/ld.so.conf.d/*
|
/etc/ld.so.conf.d/*
|
||||||
/usr/local/lib/lib*.a
|
%{libdir}/lib*.a
|
||||||
/usr/local/lib/pkgconfig/*.pc
|
%{libdir}/pkgconfig/*.pc
|
||||||
%if %{shared}
|
%if %{shared}
|
||||||
/usr/local/lib/lib*.so.*
|
%{libdir}/lib*.so.*
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%post libs
|
%post libs
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Description: SPDK $2 library
|
Description: SPDK $3 library
|
||||||
Name: spdk_$2
|
Name: spdk_$3
|
||||||
Version: $3
|
Version: $4
|
||||||
Libs: -L$1/lib -lspdk_$2
|
Libs: -L${2:-"$1/lib"} -lspdk_$3
|
||||||
Requires: $4
|
Requires: $5
|
||||||
Libs.private: $5
|
Libs.private: $6
|
||||||
Cflags: -I$1/include
|
Cflags: -I$1/include
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user