Skip to content

Commit

Permalink
update(cmake): Install libraries into CMAKE_INSTALL_LIBDIR
Browse files Browse the repository at this point in the history
Pull in and update a patch from Dima Kogan which installs libraries into
CMAKE_INSTALL_LIBDIR:

https://salsa.debian.org/debian/falcosecurity-libs/-/blob/master/debian/patches/fix-library-install-path.patch

This simplifies things when BUILD_SHARED_LIBS is enabled since it
reduces the need to mess with LD_LIBRARY_PATH or DYLD_LIBRARY_PATH.

Signed-off-by: Gerald Combs <[email protected]>
  • Loading branch information
geraldcombs authored and poiana committed Nov 10, 2023
1 parent efda90b commit 289df4f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
- name: Test sinsp-example runtime linker
run: |
cd userspace/libsinsp/examples
export LD_LIBRARY_PATH=/tmp/libs-test/lib/falcosecurity
export LD_LIBRARY_PATH=/tmp/libs-test/lib
./sinsp-example -h
build-libs-others-amd64:
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
- name: Test sinsp-example runtime linker 🧪
run: |
cd userspace/libsinsp/examples
export DYLD_LIBRARY_PATH=/tmp/libs-test/lib/falcosecurity
export DYLD_LIBRARY_PATH=/tmp/libs-test/lib
./sinsp-example -h
# This job run all engine tests and scap-open
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/libscap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ string(REPLACE ";" " " LIBSCAP_LINK_LIBDIRS_FLAGS "${libscap_link_libdirs}")
configure_file(${LIBSCAP_DIR}/userspace/libscap/libscap.pc.in ${PROJECT_BINARY_DIR}/libscap/libscap.pc @ONLY)

install(TARGETS ${LIBSCAP_INSTALL_LIBS}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT "scap" OPTIONAL)
install(DIRECTORY "${LIBSCAP_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/libsinsp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ endfunction()

add_subdirectory(${LIBSINSP_DIR}/userspace/libsinsp ${CMAKE_BINARY_DIR}/libsinsp)
install(TARGETS sinsp
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT "sinsp")
install(DIRECTORY "${LIBSINSP_DIR}/userspace/libsinsp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}/userspace"
Expand Down
2 changes: 1 addition & 1 deletion userspace/libscap/libscap.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Name: libscap
Description: lib for System CAPture
Version: @FALCOSECURITY_LIBS_VERSION@

Libs: -L${libdir}/@LIBS_PACKAGE_NAME@ @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@
Libs: -L${libdir} @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@
Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/userspace/libscap
2 changes: 1 addition & 1 deletion userspace/libsinsp/libsinsp.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Description: lib for System INSPection
Version: @FALCOSECURITY_LIBS_VERSION@

Requires: libscap
Libs: -L${libdir}/@LIBS_PACKAGE_NAME@ -lsinsp @SINSP_PKG_CONFIG_LIBDIRS@ @SINSP_PKG_CONFIG_LIBS@
Libs: -L${libdir} -lsinsp @SINSP_PKG_CONFIG_LIBDIRS@ @SINSP_PKG_CONFIG_LIBS@
Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/userspace/libsinsp @SINSP_PKG_CONFIG_INCLUDES@

0 comments on commit 289df4f

Please sign in to comment.