diff --git a/CMakeLists.txt b/CMakeLists.txt index f420a66b0..c06f68b57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,9 @@ set(IBVERBS_PROVIDER_SUFFIX "-rdmav${IBVERBS_PABI_VERSION}.so") if (IN_PLACE) set(CMAKE_INSTALL_SYSCONFDIR "${CMAKE_BINARY_DIR}/etc") set(CMAKE_INSTALL_BINDIR "${CMAKE_BINARY_DIR}/bin") + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}") + set(CMAKE_INSTALL_LIBDIR "lib") + set(CMAKE_INSTALL_INCLUDEDIR "include") endif() include(GNUInstallDirs) @@ -368,10 +371,6 @@ if (ENABLE_RESOLVE_NEIGH) set(NL_KIND 3) set(NL_INCLUDE_DIRS ${NL3_INCLUDE_DIRS}) set(NL_LIBRARIES ${NL3_LIBRARIES}) - set(NL_CFLAGS ${NL3_CFLAGS}) - set(NL_LDFLAGS ${NL3_LDFLAGS}) - # CMake separates ldflags with a semicolon, cannot be used in a command - string(REPLACE ";" " " NL_LDFLAGS "${NL_LDFLAGS}") else() # FIXME: I don't know why we have this fallback, all supported distros # have libnl3 @@ -380,8 +379,6 @@ if (ENABLE_RESOLVE_NEIGH) set(NL_KIND 1) set(NL_INCLUDE_DIRS ${NL1_INCLUDE_DIRS}) set(NL_LIBRARIES ${NL1_LIBRARIES}) - set(NL_LDFLAGS ${NL1_LDFLAGS}) - set(NL_CFLAGS ${NL1_CFLAGS}) else() message(FATAL_ERROR "Cannot find libnl-3.0 or libnl-1") endif() diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake index c400afdd0..f7c83d106 100644 --- a/buildlib/rdma_functions.cmake +++ b/buildlib/rdma_functions.cmake @@ -267,11 +267,18 @@ function(rdma_finalize_libs) endfunction() # Generate a pkg-config file -function(rdma_pkg_config PC_LIB_NAME PC_LIB_PRIVATE PC_INCLUDE_PRIVATE PC_REQUIRES) +function(rdma_pkg_config PC_LIB_NAME PC_REQUIRES_PRIVATE PC_LIB_PRIVATE) set(PC_LIB_NAME "${PC_LIB_NAME}") set(PC_LIB_PRIVATE "${PC_LIB_PRIVATE}") - set(PC_INCLUDE_PRIVATE "${PC_INCLUDE_PRIVATE}") - set(PC_REQUIRES "${PC_REQUIRES}") - configure_file(${CMAKE_SOURCE_DIR}/buildlib/template.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lib${PC_LIB_NAME}.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${PC_LIB_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + set(PC_REQUIRES_PRIVATE "${PC_REQUIRES_PRIVATE}") + get_target_property(PC_VERSION ${PC_LIB_NAME} VERSION) + + # With IN_PLACE=1 the install step is not ran, so generate the file in the build dir + if (IN_PLACE) + set(PC_RPATH "-Wl,-rpath,\${libdir}") + configure_file(${CMAKE_SOURCE_DIR}/buildlib/template.pc.in ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/lib${PC_LIB_NAME}.pc @ONLY) + else() + configure_file(${CMAKE_SOURCE_DIR}/buildlib/template.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lib${PC_LIB_NAME}.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${PC_LIB_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + endif() endfunction() diff --git a/buildlib/template.pc.in b/buildlib/template.pc.in index 10750a92b..99a798464 100644 --- a/buildlib/template.pc.in +++ b/buildlib/template.pc.in @@ -5,8 +5,9 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ Name: lib@PC_LIB_NAME@ Description: RDMA Core Userspace Library -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -l@PC_LIB_NAME@ +URL: https://github.com/linux-rdma/rdma-core +Version: @PC_VERSION@ Libs.private: @PC_LIB_PRIVATE@ -Cflags: -I${includedir} @PC_INCLUDE_PRIVATE@ -Requires: @PC_REQUIRES@ +Libs: -L${libdir} -l@PC_LIB_NAME@ @PC_RPATH@ +Requires.private: @PC_REQUIRES_PRIVATE@ +Cflags: -I${includedir} diff --git a/debian/control b/debian/control index 1e3dad9e1..1c3d031f5 100644 --- a/debian/control +++ b/debian/control @@ -127,8 +127,6 @@ Architecture: linux-any Multi-Arch: same Depends: ibverbs-providers (= ${binary:Version}), libibverbs1 (= ${binary:Version}), - libnl-3-dev, - libnl-route-3-dev, ${misc:Depends} Description: Development files for the libibverbs library libibverbs is a library that allows userspace processes to use RDMA diff --git a/debian/libibverbs-dev.install b/debian/libibverbs-dev.install index cd00115f3..e50b800f2 100644 --- a/debian/libibverbs-dev.install +++ b/debian/libibverbs-dev.install @@ -14,6 +14,8 @@ usr/lib/*/libibverbs*.so usr/lib/*/libmlx4.so usr/lib/*/libmlx5.so usr/lib/*/pkgconfig/libibverbs.pc +usr/lib/*/pkgconfig/libmlx4.pc +usr/lib/*/pkgconfig/libmlx5.pc usr/share/man/man3/ibv_* usr/share/man/man3/mbps_to_ibv_rate.3 usr/share/man/man3/mlx4dv_*.3 diff --git a/libibumad/CMakeLists.txt b/libibumad/CMakeLists.txt index 2ebc9b76c..1f600a022 100644 --- a/libibumad/CMakeLists.txt +++ b/libibumad/CMakeLists.txt @@ -16,4 +16,4 @@ rdma_library(ibumad libibumad.map umad_str.c ) -rdma_pkg_config("ibumad" "" "" "libibverbs") +rdma_pkg_config("ibumad" "" "") diff --git a/libibverbs/CMakeLists.txt b/libibverbs/CMakeLists.txt index a8007c85b..738e5e15a 100644 --- a/libibverbs/CMakeLists.txt +++ b/libibverbs/CMakeLists.txt @@ -53,4 +53,4 @@ target_link_libraries(ibverbs LINK_PRIVATE kern-abi ) -rdma_pkg_config("ibverbs" "${NL_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT}" "${NL_CFLAGS}" "") +rdma_pkg_config("ibverbs" "" "${CMAKE_THREAD_LIBS_INIT}") diff --git a/librdmacm/CMakeLists.txt b/librdmacm/CMakeLists.txt index beb40be4c..f71e4076f 100644 --- a/librdmacm/CMakeLists.txt +++ b/librdmacm/CMakeLists.txt @@ -42,4 +42,4 @@ install(TARGETS rspreload DESTINATION "${CMAKE_INSTALL_LIBDIR}/rsocket/") rdma_install_symlink("librspreload.so" "${CMAKE_INSTALL_LIBDIR}/rsocket/librspreload.so.1") rdma_install_symlink("librspreload.so" "${CMAKE_INSTALL_LIBDIR}/rsocket/librspreload.so.1.0.0") -rdma_pkg_config("rdmacm" "" "" "libibverbs") +rdma_pkg_config("rdmacm" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") diff --git a/providers/mlx4/CMakeLists.txt b/providers/mlx4/CMakeLists.txt index 2cd668cbb..ad849f105 100644 --- a/providers/mlx4/CMakeLists.txt +++ b/providers/mlx4/CMakeLists.txt @@ -14,3 +14,5 @@ publish_headers(infiniband ) install(FILES "mlx4.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/") + +rdma_pkg_config("mlx4" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") diff --git a/providers/mlx5/CMakeLists.txt b/providers/mlx5/CMakeLists.txt index 7328c5615..4a0f88bcd 100644 --- a/providers/mlx5/CMakeLists.txt +++ b/providers/mlx5/CMakeLists.txt @@ -26,3 +26,5 @@ publish_headers(infiniband mlx5_api.h mlx5dv.h ) + +rdma_pkg_config("mlx5" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")