From patchwork Tue Jul 23 18:25:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 11055097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BBA11398 for ; Tue, 23 Jul 2019 18:25:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B033205AD for ; Tue, 23 Jul 2019 18:25:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 789AC286D6; Tue, 23 Jul 2019 18:25:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90EFA205AD for ; Tue, 23 Jul 2019 18:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730388AbfGWSZy (ORCPT ); Tue, 23 Jul 2019 14:25:54 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45433 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729661AbfGWSZy (ORCPT ); Tue, 23 Jul 2019 14:25:54 -0400 Received: by mail-wr1-f66.google.com with SMTP id f9so44169721wre.12 for ; Tue, 23 Jul 2019 11:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=erWKdgxOP/1bgXJZPh+MRbwZXHF74FJUsymsHCGoV6E=; b=Vfo2F2a4FV5h9WgcA6jx/O50UDTeoZDRVbriPQ1Hu2QY/A44YyLFPDXrNbBhq3W0r1 vtEA+ehP5l3ms3WQHrcKYwKv24c3F7Y3XM3UJ5rUfNZOen0JBFAj9N6LQXyzSk27lU2o 7XX5JTAcAhp2tt98YhzJSYyecBWCo5T2Ncx+ZocwVEF3CCzVMOHfwmtfuqtSedSU0Jap pfNE8QcBxaMMPlnXriwcovsuWdyHxToAOQqTi5PChLTEIm8LiSXuNOJOQ37+x1FHIYpz kNIhta6xR424bLPeLi4+zEtsjlgEwpaxmZSHH/YfSzAmdXBEgmob9YqRHGSIJWCFVU35 2YxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=erWKdgxOP/1bgXJZPh+MRbwZXHF74FJUsymsHCGoV6E=; b=a/spzyUzYPgDuste+qVmnQnb+XJEFl1RHFL6TizjnwYMlQKwfH0XAh4CcIyGDsdv4n 02D7myOeD9+mQt7AH2dP8kS1BRJcAm/jIeRDu9326HsZTpKMmxeqq/8hlPZFE3JesIfd FcAQFgxTuRZdYlPnaydAGY54gGD0fA+VOh80it9xrUnYl23a3Fuk2WBnpma+PK5VrLJk FVKY6MeNEq7TIuwtx4KkV4o2Jn0/Uxop0YPG8stGXlLzDgfF2IlTq1t/cbPh2X12dTE1 L2Gf4fQjoNW9IqAfmYQ6Xe7Y/fqehxRlOCzNBwHIKC+VbuFVa9FZhL9WqC7+5QVVgvNE Y7aw== X-Gm-Message-State: APjAAAUgu7GJPQMeTxoS9HeYTtgOK5+h84GnA31Lhdu00ypuZ3J2zLMw uxXgE7+mZ9ohjjWjhG9dK2U= X-Google-Smtp-Source: APXvYqy2AL98//WPwzltMqtpr/7Z8UkGvg5Nn17v6NOoL779rbrQ1wWUuTAtjL+v2BAEBEi5pnxGqw== X-Received: by 2002:adf:de10:: with SMTP id b16mr49458030wrm.296.1563906352030; Tue, 23 Jul 2019 11:25:52 -0700 (PDT) Received: from localhost.localdomain ([95.87.223.238]) by smtp.gmail.com with ESMTPSA id o185sm47027094wmo.45.2019.07.23.11.25.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 11:25:51 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, "Yordan Karadzhov (VMware)" Subject: [PATCH] kernel-shark: Get the path to trace-cmd executable from _INSTALL_PREFIX Date: Tue, 23 Jul 2019 21:25:42 +0300 Message-Id: <20190723182542.1295-1-y.karadz@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The absolute path to the trace-cmd executable gets derived from "_INSTALL_PREFIX", and the "Record" dialog will be using its installed version. This is done because nothing guaranties that the trace-cmd executable will be presented at the time when the KernelShark package is built. The rule has one exception and this is the case when the build type is "Debug". In "Debug" mode the "Record" dialog will try to use the version of the trace-cmd executable from the build location. Sugested-by: Steven Rostedt (VMware) Signed-off-by: Yordan Karadzhov (VMware) --- kernel-shark/CMakeLists.txt | 8 ++++---- kernel-shark/README | 7 ++++++- kernel-shark/build/FindTraceCmd.cmake | 10 ++++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt index 45c6f23..075c4af 100644 --- a/kernel-shark/CMakeLists.txt +++ b/kernel-shark/CMakeLists.txt @@ -13,6 +13,10 @@ message("\n project: Kernel Shark: (version: ${KS_VERSION_STRING})\n") set(KS_DIR ${CMAKE_SOURCE_DIR}) +if (NOT _INSTALL_PREFIX) + set(_INSTALL_PREFIX "/usr/local") +endif (NOT _INSTALL_PREFIX) + include(${KS_DIR}/build/FindTraceCmd.cmake) include(${KS_DIR}/build/FindJSONC.cmake) @@ -50,10 +54,6 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE) set(CMAKE_CXX_FLAGS_PACKAGE "-O3") endif (NOT CMAKE_CXX_FLAGS_PACKAGE) -if (NOT _INSTALL_PREFIX) - set(_INSTALL_PREFIX "/usr/local") -endif (NOT _INSTALL_PREFIX) - set(KS_PLUGIN_INSTALL_PREFIX ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/) set(KS_ICON KS_icon_shark.svg) diff --git a/kernel-shark/README b/kernel-shark/README index 7e50479..6c360bb 100644 --- a/kernel-shark/README +++ b/kernel-shark/README @@ -86,9 +86,14 @@ By default this build type adds the "-O2" compiler flag. Package maintainers can chose their own compiler flags by providing the corresponding CMAKE_XXXX_FLAGS_PACKAGE Command-Line options (see the example below). -Note that when built as a "Package" the RPATH-s of the executables are +-- Note that when built as a "Package" the RPATH-s of the executables are set directly to _INSTALL_PREFIX/lib/kernelshark/ +-- Note that when built as a "Debug" the "Record" dialog will try to use the +version of the trace-cmd executable from the build location. In all other cases +the dialog will derive the absolut path to the trace-cmd executable from +"_INSTALL_PREFIX", hence the dialog will use the installed version. + If no build types is specified, the type will be "RelWithDebInfo". Examples: diff --git a/kernel-shark/build/FindTraceCmd.cmake b/kernel-shark/build/FindTraceCmd.cmake index 2da4eee..d3e145c 100644 --- a/kernel-shark/build/FindTraceCmd.cmake +++ b/kernel-shark/build/FindTraceCmd.cmake @@ -21,6 +21,12 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) endif (CMAKE_BUILD_TYPE MATCHES Debug) +if (NOT TRACECMD_EXECUTABLE) + + set(TRACECMD_EXECUTABLE "${_INSTALL_PREFIX}/bin/trace-cmd") + +endif (NOT TRACECMD_EXECUTABLE) + find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h PATHS $ENV{TRACE_CMD}/include/ ${CMAKE_SOURCE_DIR}/../include/ @@ -43,11 +49,11 @@ find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h) find_library(TRACECMD_LIBRARY NAMES trace-cmd/libtracecmd.so) find_library(TRACEEVENT_LIBRARY NAMES traceevent/libtraceevent.so) -IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY AND TRACECMD_EXECUTABLE) +IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY) SET(TRACECMD_FOUND TRUE) -ENDIF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY AND TRACECMD_EXECUTABLE) +ENDIF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY) IF (TRACECMD_FOUND)