Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/5] kernel-shark: Improve the build system
@ 2021-01-05 15:54 Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 1/5] kernel-shark: Start using libtracecmd Yordan Karadzhov (VMware)
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-01-05 15:54 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

All changes and fixes from v8 of the "Start KernelShark v2 transformation"
patch-set that did not managed to go upstream.

Yordan Karadzhov (1):
  kernel-shark: Fix "github Actions" workflow

Yordan Karadzhov (VMware) (4):
  kernel-shark: Start using libtracecmd
  kernel-shark: Add missing SPDX license identifiers
  kernel-shark: Change default libraries install location
  kernel-shark: Split the installation in two components

 .github/workflows/main.yml       |   2 +
 CMakeLists.txt                   |  30 ++++++---
 build/FindTraceCmd.cmake         | 101 ++++++++++++++++++-------------
 build/FindTraceEvent.cmake       |   1 +
 build/FindTraceFS.cmake          |   1 +
 build/cmake_uninstall.sh         |  23 +++++--
 build/install_gui.sh             |   1 +
 build/install_libkshark-devel.sh |   1 +
 src/CMakeLists.txt               |  55 +++++++++++++----
 src/libkshark-tepdata.c          |  18 +++---
 src/plugins/CMakeLists.txt       |   3 +-
 11 files changed, 161 insertions(+), 75 deletions(-)
 create mode 100755 build/install_gui.sh
 create mode 100755 build/install_libkshark-devel.sh

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] kernel-shark: Start using libtracecmd
  2021-01-05 15:54 [PATCH 0/5] kernel-shark: Improve the build system Yordan Karadzhov (VMware)
@ 2021-01-05 15:54 ` Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 2/5] kernel-shark: Add missing SPDX license identifiers Yordan Karadzhov (VMware)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-01-05 15:54 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

libtracecmd is now a stand-alone libraries, similar to libtraceevent
and libtracefs. Start building and linking KernelShark against this
independent library.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 CMakeLists.txt             |   4 +-
 build/FindTraceCmd.cmake   | 101 ++++++++++++++++++++++---------------
 build/FindTraceEvent.cmake |   1 -
 build/FindTraceFS.cmake    |   1 -
 src/CMakeLists.txt         |   2 +-
 src/libkshark-tepdata.c    |  18 +++----
 6 files changed, 72 insertions(+), 55 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 303e47e..59bbe72 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,11 +21,11 @@ if (NOT _LIBDIR)
     set(_LIBDIR "${_INSTALL_PREFIX}/lib")
 endif (NOT _LIBDIR)
 
-include(${KS_DIR}/build/FindTraceCmd.cmake)
-
 set(CMAKE_MODULE_PATH "${KS_DIR}/build")
 find_package(TraceEvent REQUIRED)
 find_package(TraceFS    REQUIRED)
+find_package(TraceCmd   REQUIRED)
+
 find_package(JSONC      REQUIRED)
 
 find_package(Doxygen)
diff --git a/build/FindTraceCmd.cmake b/build/FindTraceCmd.cmake
index 5df2789..23eefed 100644
--- a/build/FindTraceCmd.cmake
+++ b/build/FindTraceCmd.cmake
@@ -1,59 +1,78 @@
-# Find traceevent and trace-cmd
-# This module finds an installed trace-cmd package.
-#
-# It sets the following variables:
-#  TRACEEVENT_LIBRARY, traceevent the library.
-#  TRACEEVENT_FOUND, If false, do not try to use traceevent.
-#
-#  TRACECMD_INCLUDE_DIR, where to find trace-cmd header.
-#  TRACEFS_INCLUDE_DIR, where to find tracefs header.
-#  TRACEFS_LIBRARY, the tracefs library.
-#  TRACECMD_LIBRARY, the trace-cmd library.
-#  TRACECMD_FOUND, If false, do not try to use trace-cmd.
+# SPDX-License-Identifier: LGPL-2.1
 
-# MESSAGE(" Looking for trace-cmd ...")
+#[=======================================================================[.rst:
+FindTraceCmd
+-------
 
-# First search in the user provided paths.
-if (CMAKE_BUILD_TYPE MATCHES Debug)
+Finds the tracecmd library.
 
-  find_program(TRACECMD_EXECUTABLE   NAMES  trace-cmd
-                                     PATHS  $ENV{TRACE_CMD}/tracecmd/
-                                     NO_DEFAULT_PATH)
+Imported Targets
+^^^^^^^^^^^^^^^^
 
-endif (CMAKE_BUILD_TYPE MATCHES Debug)
+This module defines the :prop_tgt:`IMPORTED` targets:
 
-if (NOT TRACECMD_EXECUTABLE)
+``trace::cmd``
+ Defined if the system has libtracecmd.
 
-  set(TRACECMD_EXECUTABLE "${_INSTALL_PREFIX}/bin/trace-cmd")
+Result Variables
+^^^^^^^^^^^^^^^^
 
-endif (NOT TRACECMD_EXECUTABLE)
+``TraceCmd_FOUND``
+  True if the system has the libtracecmd library.
+``TraceCmd_VERSION``
+  The version of the libtracecmd library which was found.
+``TraceCmd_INCLUDE_DIRS``
+  Include directories needed to use libtracecmd.
+``TraceCmd_LIBRARIES``
+  Libraries needed to link to libtracecmd.
 
-find_path(TRACECMD_INCLUDE_DIR  NAMES  trace-cmd/trace-cmd.h
-                                PATHS  $ENV{TRACE_CMD}/include/
-                                NO_DEFAULT_PATH)
+Cache Variables
+^^^^^^^^^^^^^^^
 
-find_library(TRACECMD_LIBRARY   NAMES  trace-cmd/libtracecmd.a
-                                PATHS  $ENV{TRACE_CMD}/lib/
-                                NO_DEFAULT_PATH)
+``TraceCmd_INCLUDE_DIR``
+  The directory containing ``trace-cmd.h``.
+``TraceCmd_LIBRARY``
+  The path to the tracecmd library.
 
-# If not found, search in the default system paths. Note that if the previous
-# search was successful "find_path" will do nothing this time.
-find_program(TRACECMD_EXECUTABLE NAMES  trace-cmd)
-find_path(TRACECMD_INCLUDE_DIR   NAMES  trace-cmd/trace-cmd.h)
-find_library(TRACECMD_LIBRARY    NAMES  trace-cmd/libtracecmd.so)
+#]=======================================================================]
 
-IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY)
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_TraceCmd QUIET libtracecmd)
 
-  SET(TRACECMD_FOUND TRUE)
+set(TraceCmd_VERSION     ${PC_TraceCmd_VERSION})
+set(TraceCmd_DEFINITIONS ${PC_TraceCmd_CFLAGS_OTHER})
 
-ENDIF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY)
+find_path(TraceCmd_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h
+                               HINTS ${PC_TraceCmd_INCLUDE_DIRS}
+                                     ${PC_TraceCmd_INCLUDEDIR})
 
-IF (TRACECMD_FOUND)
+find_library(TraceCmd_LIBRARY  NAMES tracecmd libtracecmd
+                               HINTS ${PC_TraceCmd_LIBDIR}
+                                     ${PC_TraceCmdLIBRARY_DIRS})
 
-  MESSAGE(STATUS "Found trace-cmd: ${TRACECMD_LIBRARY}")
+mark_as_advanced(TraceCmd_INCLUDE_DIR TraceCmd_LIBRARY)
 
-ELSE (TRACECMD_FOUND)
+include(FindPackageHandleStandardArgs)
 
-  MESSAGE(FATAL_ERROR "\nCould not find trace-cmd!\n")
+find_package_handle_standard_args(TraceCmd DEFAULT_MSG
+                                  TraceCmd_LIBRARY TraceCmd_INCLUDE_DIR)
 
-ENDIF (TRACECMD_FOUND)
+if(TraceCmd_FOUND)
+
+  set(TraceCmd_LIBRARIES    ${TraceCmd_LIBRARY})
+  set(TraceCmd_INCLUDE_DIRS ${TraceCmd_INCLUDE_DIR})
+
+  if(NOT TARGET trace::cmd)
+    add_library(trace::cmd UNKNOWN IMPORTED)
+
+    set_target_properties(trace::cmd
+                          PROPERTIES
+                            INTERFACE_INCLUDE_DIRECTORIES "${TraceCmd_INCLUDE_DIRS}"
+                            INTERFACE_COMPILE_DEFINITIONS "${TraceCmd_DEFINITIONS}"
+                            IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+                            IMPORTED_LOCATION "${TraceCmd_LIBRARIES}")
+  endif()
+
+endif()
+
+find_program(TRACECMD_EXECUTABLE NAMES trace-cmd)
diff --git a/build/FindTraceEvent.cmake b/build/FindTraceEvent.cmake
index 8525697..f3feca9 100644
--- a/build/FindTraceEvent.cmake
+++ b/build/FindTraceEvent.cmake
@@ -1,4 +1,3 @@
-
 #[=======================================================================[.rst:
 FindTraceevent
 -------
diff --git a/build/FindTraceFS.cmake b/build/FindTraceFS.cmake
index 982a61d..2a5f7bd 100644
--- a/build/FindTraceFS.cmake
+++ b/build/FindTraceFS.cmake
@@ -1,4 +1,3 @@
-
 #[=======================================================================[.rst:
 FindTraceFS
 -------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 285f88a..b393468 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,7 @@ add_library(kshark SHARED libkshark.c
                           libkshark-configio.c
                           libkshark-collection.c)
 
-target_link_libraries(kshark ${TRACECMD_LIBRARY}
+target_link_libraries(kshark trace::cmd
                              trace::fs
                              trace::event
                              jsonc::jsonc
diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index a82f5c5..724cff2 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -277,7 +277,7 @@ static void free_rec_list(struct rec_list **rec_list, int n_cpus,
 			temp_rec = rec_list[cpu];
 			rec_list[cpu] = temp_rec->next;
 			if (type == REC_RECORD)
-				free_record(temp_rec->rec);
+				tracecmd_free_record(temp_rec->rec);
 			free(temp_rec);
 		}
 	}
@@ -379,7 +379,7 @@ static ssize_t get_records(struct kshark_context *kshark_ctx,
 				    tep_filter_match(adv_filter, rec) != FILTER_MATCH)
 					unset_event_filter_flag(kshark_ctx, entry);
 
-				free_record(rec);
+				tracecmd_free_record(rec);
 				break;
 			} /* REC_ENTRY */
 			}
@@ -571,7 +571,7 @@ static ssize_t tepdata_load_matrix(struct kshark_data_stream *stream,
  *
  * @param kshark_ctx: Input location for the session context pointer.
  * @param sd: Data stream identifier.
- * @param data_rows: Output location for the trace data. Use free_record()
+ * @param data_rows: Output location for the trace data. Use tracecmd_free_record()
  *	 	     to free the elements of the outputted array.
  *
  * @returns The size of the outputted data in the case of success, or a
@@ -657,7 +657,7 @@ static const int tepdata_get_event_id(struct kshark_data_stream *stream,
 		if (record)
 			event_id = tep_data_type(kshark_get_tep(stream), record);
 
-		free_record(record);
+		tracecmd_free_record(record);
 
 		pthread_mutex_unlock(&stream->input_mutex);
 	}
@@ -749,7 +749,7 @@ static const int tepdata_get_pid(struct kshark_data_stream *stream,
 		if (record)
 			pid = tep_data_pid(kshark_get_tep(stream), record);
 
-		free_record(record);
+		tracecmd_free_record(record);
 
 		pthread_mutex_unlock(&stream->input_mutex);
 	}
@@ -798,7 +798,7 @@ static char *tepdata_get_latency(struct kshark_data_stream *stream,
 	tep_print_event(kshark_get_tep(stream), &seq, record,
 			"%s", TEP_PRINT_LATENCY);
 
-	free_record(record);
+	tracecmd_free_record(record);
 
 	pthread_mutex_unlock(&stream->input_mutex);
 
@@ -869,7 +869,7 @@ static char *tepdata_get_info(struct kshark_data_stream *stream,
 	if (event)
 		info = get_info_str(stream, record, event);
 
-	free_record(record);
+	tracecmd_free_record(record);
 
 	pthread_mutex_unlock(&stream->input_mutex);
 
@@ -1178,7 +1178,7 @@ int tepdata_read_event_field(struct kshark_data_stream *stream,
 
 	ret = tep_read_number_field(evt_field, record->data,
 				    (unsigned long long *) val);
-	free_record(record);
+	tracecmd_free_record(record);
 
 	return ret;
 }
@@ -1308,7 +1308,7 @@ static int kshark_tep_stream_init(struct kshark_data_stream *stream,
 		goto fail;
 
 	tep_handle->input = input;
-	tep_handle->tep = tracecmd_get_pevent(tep_handle->input);
+	tep_handle->tep = tracecmd_get_tep(tep_handle->input);
 	if (!tep_handle->tep)
 		goto fail;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/5] kernel-shark: Add missing SPDX license identifiers
  2021-01-05 15:54 [PATCH 0/5] kernel-shark: Improve the build system Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 1/5] kernel-shark: Start using libtracecmd Yordan Karadzhov (VMware)
@ 2021-01-05 15:54 ` Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 3/5] kernel-shark: Change default libraries install location Yordan Karadzhov (VMware)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-01-05 15:54 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 build/FindTraceEvent.cmake | 2 ++
 build/FindTraceFS.cmake    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/build/FindTraceEvent.cmake b/build/FindTraceEvent.cmake
index f3feca9..ae391b6 100644
--- a/build/FindTraceEvent.cmake
+++ b/build/FindTraceEvent.cmake
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1
+
 #[=======================================================================[.rst:
 FindTraceevent
 -------
diff --git a/build/FindTraceFS.cmake b/build/FindTraceFS.cmake
index 2a5f7bd..82fa012 100644
--- a/build/FindTraceFS.cmake
+++ b/build/FindTraceFS.cmake
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1
+
 #[=======================================================================[.rst:
 FindTraceFS
 -------
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/5] kernel-shark: Change default libraries install location
  2021-01-05 15:54 [PATCH 0/5] kernel-shark: Improve the build system Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 1/5] kernel-shark: Start using libtracecmd Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 2/5] kernel-shark: Add missing SPDX license identifiers Yordan Karadzhov (VMware)
@ 2021-01-05 15:54 ` Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 4/5] kernel-shark: Split the installation in two components Yordan Karadzhov (VMware)
  2021-01-05 15:54 ` [PATCH 5/5] kernel-shark: Fix "github Actions" workflow Yordan Karadzhov (VMware)
  4 siblings, 0 replies; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-01-05 15:54 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

The default installation path for the KernelShark libraries changes from
/usr/local/lib/kernelshark/ to /usr/local/lib64 (or /usr/local/lib on
32 but systems). This is done in order to be consistent with the install
locations of libtraceevent, libtracefs and libtracecmd.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 CMakeLists.txt     | 28 ++++++++++++++++++++++------
 src/CMakeLists.txt |  6 +++---
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59bbe72..543d7da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,13 +13,28 @@ message("\n project: Kernel Shark: (version: ${KS_VERSION_STRING})\n")
 
 set(KS_DIR ${CMAKE_SOURCE_DIR})
 
-if (NOT _INSTALL_PREFIX)
+execute_process(COMMAND bash "-c" "echo __LP64__ | ${CMAKE_C_COMPILER} -E -x c - | tail -n 1"
+                OUTPUT_VARIABLE __LP64__)
+
+if (NOT _INSTALL_PREFIX AND NOT _LIBDIR)
+
     set(_INSTALL_PREFIX "/usr/local")
-endif (NOT _INSTALL_PREFIX)
 
-if (NOT _LIBDIR)
-    set(_LIBDIR "${_INSTALL_PREFIX}/lib")
-endif (NOT _LIBDIR)
+    if (__LP64__ MATCHES 1)
+        set(_LIBDIR "/usr/local/lib64")
+    else (__LP64__ MATCHES 1)
+        set(_LIBDIR "/usr/local/lib")
+    endif (__LP64__ MATCHES 1)
+
+elseif (NOT _INSTALL_PREFIX)
+
+    set(_INSTALL_PREFIX "/usr/local")
+
+elseif (NOT _LIBDIR)
+
+   set(_LIBDIR "${_INSTALL_PREFIX}/lib")
+
+endif ()
 
 set(CMAKE_MODULE_PATH "${KS_DIR}/build")
 find_package(TraceEvent REQUIRED)
@@ -71,7 +86,8 @@ set(KS_ICON_FIN    KS_icon_fin.svg)
 set(KS_LOGO        KS_logo_symbol.svg)
 set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
 
-set(CMAKE_INSTALL_RPATH "${_LIBDIR}/${KS_APP_NAME}/")
+set(CMAKE_INSTALL_RPATH "${_LIBDIR}")
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 
 if (CMAKE_BUILD_TYPE MATCHES Package)
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b393468..fe3a3eb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,7 +17,7 @@ target_link_libraries(kshark trace::cmd
 
 set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
 
-install(TARGETS kshark LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
+install(TARGETS kshark LIBRARY DESTINATION ${_LIBDIR})
 
 if (OPENGL_FOUND)
 
@@ -31,7 +31,7 @@ if (OPENGL_FOUND)
 
     set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
 
-    install(TARGETS kshark-plot LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
+    install(TARGETS kshark-plot LIBRARY DESTINATION ${_LIBDIR})
 
 endif (OPENGL_FOUND)
 
@@ -84,7 +84,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
     install(TARGETS ${KS_APP_NAME} kshark-record kshark-gui
             RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/
-            LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME}/)
+            LIBRARY DESTINATION ${_LIBDIR})
 
     install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop"
             DESTINATION ${_INSTALL_PREFIX}/share/applications/)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/5] kernel-shark: Split the installation in two components
  2021-01-05 15:54 [PATCH 0/5] kernel-shark: Improve the build system Yordan Karadzhov (VMware)
                   ` (2 preceding siblings ...)
  2021-01-05 15:54 ` [PATCH 3/5] kernel-shark: Change default libraries install location Yordan Karadzhov (VMware)
@ 2021-01-05 15:54 ` Yordan Karadzhov (VMware)
  2021-01-05 21:29   ` Steven Rostedt
  2021-01-05 15:54 ` [PATCH 5/5] kernel-shark: Fix "github Actions" workflow Yordan Karadzhov (VMware)
  4 siblings, 1 reply; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-01-05 15:54 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

The user can choose to install only the KernelShark GUI via
"install_gui.sh". It is also possible to install the library headers
and this can be done via "install_libkshark-devel.sh".

The changes implemented in this patch are inspired by the talk
"Deep CMake For Library Authors" presented at CppCon 2019 by Craig Scott.
https://crascit.com/2019/10/16/cppcon-2019-deep-cmake-for-library-authors/

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 CMakeLists.txt                   |  2 +-
 build/cmake_uninstall.sh         | 23 ++++++++++----
 build/install_gui.sh             |  1 +
 build/install_libkshark-devel.sh |  1 +
 src/CMakeLists.txt               | 53 ++++++++++++++++++++++++++------
 src/plugins/CMakeLists.txt       |  3 +-
 6 files changed, 65 insertions(+), 18 deletions(-)
 create mode 100755 build/install_gui.sh
 create mode 100755 build/install_libkshark-devel.sh

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 543d7da..9abacd0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,7 +86,7 @@ set(KS_ICON_FIN    KS_icon_fin.svg)
 set(KS_LOGO        KS_logo_symbol.svg)
 set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
 
-set(CMAKE_INSTALL_RPATH "${_LIBDIR}")
+set(CMAKE_INSTALL_RPATH "${_LIBDIR}" "$ORIGIN")
 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 
 if (CMAKE_BUILD_TYPE MATCHES Package)
diff --git a/build/cmake_uninstall.sh b/build/cmake_uninstall.sh
index ae9eab5..0d93a8d 100755
--- a/build/cmake_uninstall.sh
+++ b/build/cmake_uninstall.sh
@@ -4,14 +4,25 @@ CYAN='\e[36m'
 PURPLE='\e[35m'
 NC='\e[0m' # No Color
 
+uninstall () {
+    NAME=$1
+    NAME=${NAME##*_}
+    NAME=${NAME%.*}
+    NAME=${NAME/manifest/the project}
+    if [ -e $1 ]
+    then
+        echo -e "${CYAN}Uninstall " $NAME"...${NC}"
+        xargs rm -v < $1
+        rm -f $1
+    fi
+}
+
 if [[ $EUID -ne 0 ]]; then
    echo -e "${PURPLE}Permission denied${NC}" 1>&2
    exit 100
 fi
 
-if [ -e install_manifest.txt ]
-then
-    echo -e "${CYAN}Uninstall the project...${NC}"
-    xargs rm -v < install_manifest.txt
-    rm -f install_manifest.txt
-fi
+for manifest in "$search_dir"${PWD}/install_manifest*
+do
+   uninstall $manifest
+done
diff --git a/build/install_gui.sh b/build/install_gui.sh
new file mode 100755
index 0000000..1583fb9
--- /dev/null
+++ b/build/install_gui.sh
@@ -0,0 +1 @@
+sudo cmake -DCOMPONENT=kernelshark -P cmake_install.cmake
diff --git a/build/install_libkshark-devel.sh b/build/install_libkshark-devel.sh
new file mode 100755
index 0000000..a7e420d
--- /dev/null
+++ b/build/install_libkshark-devel.sh
@@ -0,0 +1 @@
+sudo cmake -DCOMPONENT=libkshark-devel -P cmake_install.cmake
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fe3a3eb..e35b436 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,7 @@
 message("\n src ...")
 
+set(KS_INCLUDS_DESTINATION "${_INSTALL_PREFIX}/include/${KS_APP_NAME}")
+
 message(STATUS "libkshark")
 add_library(kshark SHARED libkshark.c
                           libkshark-hash.c
@@ -15,9 +17,25 @@ target_link_libraries(kshark trace::cmd
                              jsonc::jsonc
                              ${CMAKE_DL_LIBS})
 
-set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
+set_target_properties(kshark  PROPERTIES
+                                  SOVERSION ${KS_VERSION_MAJOR}
+                                  VERSION   ${KS_VERSION_STRING})
+
+
+install(TARGETS kshark
+        LIBRARY DESTINATION    ${_LIBDIR}
+            COMPONENT              kernelshark
+            NAMELINK_COMPONENT     libkshark-devel
+        INCLUDES DESTINATION   ${_INSTALL_PREFIX}/include/${KS_APP_NAME}
+            COMPONENT              libkshark-devel
+        ARCHIVE DESTINATION    ${_LIBDIR}
+            COMPONENT              libkshark-devel)
 
-install(TARGETS kshark LIBRARY DESTINATION ${_LIBDIR})
+install(FILES "${KS_DIR}/src/libkshark.h"
+              "${KS_DIR}/src/libkshark-model.h"
+              "${KS_DIR}/src/libkshark-plugin.h"
+        DESTINATION ${KS_INCLUDS_DESTINATION}
+            COMPONENT libkshark-devel)
 
 if (OPENGL_FOUND)
 
@@ -29,9 +47,18 @@ if (OPENGL_FOUND)
                                        ${GLUT_LIBRARY}
                                        ${OPENGL_LIBRARIES})
 
-    set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
+    set_target_properties(kshark-plot PROPERTIES
+                                          SOVERSION ${KS_VERSION_MAJOR}
+                                          VERSION   ${KS_VERSION_STRING})
 
-    install(TARGETS kshark-plot LIBRARY DESTINATION ${_LIBDIR})
+    install(TARGETS kshark-plot
+            LIBRARY DESTINATION    ${_LIBDIR}
+                COMPONENT              kernelshark
+                NAMELINK_COMPONENT     libkshark-devel
+            INCLUDES DESTINATION   ${_INSTALL_PREFIX}/include/${KS_APP_NAME}
+                COMPONENT              libkshark-devel
+            ARCHIVE DESTINATION    ${_LIBDIR}
+                COMPONENT              libkshark-devel)
 
 endif (OPENGL_FOUND)
 
@@ -83,21 +110,27 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
     target_link_libraries(kshark-record kshark-gui)
 
     install(TARGETS ${KS_APP_NAME} kshark-record kshark-gui
-            RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/
-            LIBRARY DESTINATION ${_LIBDIR})
+            RUNTIME DESTINATION       ${_INSTALL_PREFIX}/bin/
+                COMPONENT                 kernelshark
+            LIBRARY DESTINATION       ${_LIBDIR}
+                COMPONENT                 kernelshark)
 
     install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop"
-            DESTINATION ${_INSTALL_PREFIX}/share/applications/)
+            DESTINATION ${_INSTALL_PREFIX}/share/applications/
+                COMPONENT                 kernelshark)
 
     install(FILES "${KS_DIR}/icons/${KS_ICON}"
                   "${KS_DIR}/icons/${KS_ICON_FIN}"
-            DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME})
+            DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME}
+                COMPONENT                 kernelshark)
 
     install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
-            DESTINATION /usr/share/polkit-1/actions/)
+            DESTINATION /usr/share/polkit-1/actions/
+                COMPONENT                 kernelshark)
 
     install(PROGRAMS "${KS_DIR}/bin/kshark-su-record"
-            DESTINATION ${_INSTALL_PREFIX}/bin/)
+            DESTINATION ${_INSTALL_PREFIX}/bin/
+                COMPONENT                 kernelshark)
 
 endif (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 6c77179..2da73f8 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -28,6 +28,7 @@ BUILD_PLUGIN(NAME missed_events
 list(APPEND PLUGIN_LIST "missed_events default") # This plugin will be loaded by default
 
 install(TARGETS sched_events missed_events
-        LIBRARY DESTINATION ${KS_PLUGIN_INSTALL_PREFIX})
+        LIBRARY DESTINATION ${KS_PLUGIN_INSTALL_PREFIX}
+        COMPONENT kernelshark)
 
 set(PLUGINS ${PLUGIN_LIST} PARENT_SCOPE)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/5] kernel-shark: Fix "github Actions" workflow
  2021-01-05 15:54 [PATCH 0/5] kernel-shark: Improve the build system Yordan Karadzhov (VMware)
                   ` (3 preceding siblings ...)
  2021-01-05 15:54 ` [PATCH 4/5] kernel-shark: Split the installation in two components Yordan Karadzhov (VMware)
@ 2021-01-05 15:54 ` Yordan Karadzhov (VMware)
  4 siblings, 0 replies; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-01-05 15:54 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

Fix the part of the script that installs the third party libraries.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 .github/workflows/main.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e818f46..a35f003 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -16,6 +16,7 @@ jobs:
     - name: Install Dependencies
       shell: bash
       run: |
+        sudo apt-get update
         sudo apt-get install build-essential git cmake libjson-c-dev -y
         sudo apt-get install freeglut3-dev libxmu-dev libxi-dev -y
         sudo apt-get install qtbase5-dev libboost-all-dev -y
@@ -32,6 +33,7 @@ jobs:
         git clone git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git
         cd trace-cmd
         make
+        sudo make install
         sudo make install_libs
     - name: Create Build Environment
       # Some projects don't allow in-source building, so create a separate build directory
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] kernel-shark: Split the installation in two components
  2021-01-05 15:54 ` [PATCH 4/5] kernel-shark: Split the installation in two components Yordan Karadzhov (VMware)
@ 2021-01-05 21:29   ` Steven Rostedt
  2021-01-06 11:20     ` Yordan Karadzhov (VMware)
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2021-01-05 21:29 UTC (permalink / raw)
  To: Yordan Karadzhov (VMware); +Cc: linux-trace-devel

On Tue,  5 Jan 2021 17:54:52 +0200
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> The user can choose to install only the KernelShark GUI via
> "install_gui.sh". It is also possible to install the library headers
> and this can be done via "install_libkshark-devel.sh".
> 
> The changes implemented in this patch are inspired by the talk
> "Deep CMake For Library Authors" presented at CppCon 2019 by Craig Scott.
> https://crascit.com/2019/10/16/cppcon-2019-deep-cmake-for-library-authors/
> 

I applied the series. But is there a way to install in a specific directory
and not in the system directories? (I didn't watch the talk).

For example, I can do:

 $ mkdir /tmp/install
 $ make DESTDIR=/tmp/install/ install

for libtraceveent, libtracefs and trace-cmd / libtracecmd and it will
install into /tmp/install/... just like it would have installed in /. The
big difference is, I don't need to be root to run that command.

Then what I can do is:

 $ cd /tmp/install
 $ tar -cvjf ../package.tar.bz2 .
 $ scp ../package.tar.bz2 root@somebox:/tmp
 $ ssh root@somebox
 # cd /
 # tar -xvjf /tmp/package.tar.bz2

And that would have installed the package on to the machine "somebox".

-- Steve

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] kernel-shark: Split the installation in two components
  2021-01-05 21:29   ` Steven Rostedt
@ 2021-01-06 11:20     ` Yordan Karadzhov (VMware)
  0 siblings, 0 replies; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-01-06 11:20 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel

Hi Steven,

On 5.01.21 г. 23:29 ч., Steven Rostedt wrote:
> On Tue,  5 Jan 2021 17:54:52 +0200
> "Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:
> 
>> The user can choose to install only the KernelShark GUI via
>> "install_gui.sh". It is also possible to install the library headers
>> and this can be done via "install_libkshark-devel.sh".
>>
>> The changes implemented in this patch are inspired by the talk
>> "Deep CMake For Library Authors" presented at CppCon 2019 by Craig Scott.
>> https://crascit.com/2019/10/16/cppcon-2019-deep-cmake-for-library-authors/
>>
> 
> I applied the series. But is there a way to install in a specific directory
> and not in the system directories? (I didn't watch the talk).
> 
> For example, I can do:
> 
>   $ mkdir /tmp/install
>   $ make DESTDIR=/tmp/install/ install
> 
> for libtraceveent, libtracefs and trace-cmd / libtracecmd and it will
> install into /tmp/install/... just like it would have installed in /. The
> big difference is, I don't need to be root to run that command.
> 

Yes, we have a similar functionality since the very beginning of KS 1.0 
and it is not been changed here. You can specify the install destination 
using a cmake command line argument like this:

cmake -D_INSTALL_PREFIX=/tmp/install/ ..

All this is documented in the README file. The only difference is that 
in your case you provide the destination at the very end when you do 
"make install", while here it has to be done at the very beginning when 
you call cmake.

Note that the two new helper scripts (install_gui.sh and 
install_libkshark-devel.sh) can be used instead of "sudo make install" 
but this is needed only if you want to split the installation. A normal 
"make install" will just install everything.

However, you are right that it is probably better if we remove the sudo 
from the two helper scripts.

Thanks!
Yordan


> Then what I can do is:
> 
>   $ cd /tmp/install
>   $ tar -cvjf ../package.tar.bz2 .
>   $ scp ../package.tar.bz2 root@somebox:/tmp
>   $ ssh root@somebox
>   # cd /
>   # tar -xvjf /tmp/package.tar.bz2
> 
> And that would have installed the package on to the machine "somebox".
> 
> -- Steve
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 15:54 [PATCH 0/5] kernel-shark: Improve the build system Yordan Karadzhov (VMware)
2021-01-05 15:54 ` [PATCH 1/5] kernel-shark: Start using libtracecmd Yordan Karadzhov (VMware)
2021-01-05 15:54 ` [PATCH 2/5] kernel-shark: Add missing SPDX license identifiers Yordan Karadzhov (VMware)
2021-01-05 15:54 ` [PATCH 3/5] kernel-shark: Change default libraries install location Yordan Karadzhov (VMware)
2021-01-05 15:54 ` [PATCH 4/5] kernel-shark: Split the installation in two components Yordan Karadzhov (VMware)
2021-01-05 21:29   ` Steven Rostedt
2021-01-06 11:20     ` Yordan Karadzhov (VMware)
2021-01-05 15:54 ` [PATCH 5/5] kernel-shark: Fix "github Actions" workflow Yordan Karadzhov (VMware)

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git