diff mbox series

[v2,26/27] kernel-shark: Add pkg-config configuration for libkshark

Message ID 20210211103205.418588-27-y.karadz@gmail.com (mailing list archive)
State Accepted
Commit e203bded4c5dcc48f9619a9c26ab9234c8bedcd4
Headers show
Series Complete the KernelShark v2 transformation | expand

Commit Message

Yordan Karadzhov Feb. 11, 2021, 10:32 a.m. UTC
Add auto-generated pkg-config setup file to install for pkg-config.
To be used for building against libkshark.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 CMakeLists.txt           |  3 +++
 build/cmake_clean.sh     |  1 +
 build/libkshark.pc.cmake | 10 ++++++++++
 src/CMakeLists.txt       |  6 ++++++
 4 files changed, 20 insertions(+)
 create mode 100644 build/libkshark.pc.cmake
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ca33fd..efcccb1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -167,4 +167,7 @@  configure_file(${KS_DIR}/build/ks.desktop.cmake
 configure_file(${KS_DIR}/build/org.freedesktop.kshark-record.policy.cmake
                ${KS_DIR}/org.freedesktop.kshark-record.policy)
 
+configure_file(${KS_DIR}/build/libkshark.pc.cmake
+               ${KS_DIR}/libkshark.pc @ONLY)
+
 message("")
diff --git a/build/cmake_clean.sh b/build/cmake_clean.sh
index 2ca1136..d645c32 100755
--- a/build/cmake_clean.sh
+++ b/build/cmake_clean.sh
@@ -12,6 +12,7 @@  rm -rf Testing/
 rm -f ../tests/*.dat
 rm -f ../lib/*
 rm ../kernelshark.desktop
+rm ../libkshark.pc
 rm ../org.freedesktop.kshark-record.policy
 rm -f ../src/KsCmakeDef.hpp
 rm -f CMakeDoxyfile.in
diff --git a/build/libkshark.pc.cmake b/build/libkshark.pc.cmake
new file mode 100644
index 0000000..ad4ce34
--- /dev/null
+++ b/build/libkshark.pc.cmake
@@ -0,0 +1,10 @@ 
+prefix=@_INSTALL_PREFIX@
+libdir=@_LIBDIR@
+includedir=${prefix}/include/@KS_APP_NAME@
+
+Name: libkshark
+URL: https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/
+Description: Library for accessing ftrace file system
+Version: @KS_VERSION_STRING@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lkshark
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4158901..6a6eda1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -133,6 +133,12 @@  if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
             DESTINATION ${_INSTALL_PREFIX}/bin/
                 COMPONENT                 kernelshark)
 
+    execute_process(COMMAND  bash "-c" "pkg-config --variable pc_path pkg-config | cut -f 1 -d: -z"
+                    OUTPUT_VARIABLE PKG_CONGIG_DIR)
+    install(FILES "${KS_DIR}/libkshark.pc"
+            DESTINATION ${PKG_CONGIG_DIR}
+                COMPONENT                 libkshark-devel)
+
 endif (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
 
 add_subdirectory(plugins)