Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp14498imu; Fri, 14 Dec 2018 12:37:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/W/PrkiqVQ7MklTwGcHMrzixStN6lXsymRlkQSsq2zLJBdULSToZfZ9McxvdhQYaviAsHF3 X-Received: by 2002:a63:c503:: with SMTP id f3mr3836562pgd.431.1544819834552; Fri, 14 Dec 2018 12:37:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544819834; cv=none; d=google.com; s=arc-20160816; b=rgB862aNYX/EPviuhXDVAnuonBkVF5PqRtsnp/ebo5pVppw7WBw3rBNuiNSFG7qW+0 ttdaMJPLNLl6BdItvIUpoWGSXbgDuzxTSj70qTlTo9SMM7QEqyWgctCFf0AQVc3TxsJR Vrp8lfZhHHzSFyrKRvPT6LTFJCa89AM7+53wgUTQ7vcjvgaNhOkYiMI3rzbV/uvdyk0x h/+wKw4WgLaj2ZSaA6HIT73Hwixxsb2WWYynY/B6CivRNZqCr9WaOF/BcJPgPUkjO21I WAgJWDd+n1mEA8kD9eZv9PC5d9t8FjsvE9O3/g0JHQZDndNBi0itLoUE6/Q+p/ULAJ+q QupA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=p8E8ilmUchGFMGF0hiZs7HVrXIwa+fsMGKsyy+Gb6Os=; b=oQiNY2r1xIe8z8GhJHxrJfTiZ75KofaCs13QbUwmr4G5nlfraSJLVFkRP4KwbZnMjJ Zw0e12rsWpffSAn4pCBy4VLttJbMr0yh5rE1bQ6WLv6iy9nOLv7Nc3cSxNF9w9E/LJaW yIFa8Ta3vVXyAumfW7viODJLdcvOMdLcSheVXfmFPtVRi7F+HK2vK+Mr1Pqn8/tBZk2g GnaUiW7wMOj4RAzJP64uNi34EJ6Nqm2EybP9rtjjD1HIbDWufQSERVH/JLpahyeVPEnF uM1p9/5pzG013iNzSqL90BJu413zlhiy3eAqmBmmO9QuMXyOoUfPhH49fplbrDrykeDy 39rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13si4736763pgj.199.2018.12.14.12.36.59; Fri, 14 Dec 2018 12:37:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730855AbeLNUfA (ORCPT + 99 others); Fri, 14 Dec 2018 15:35:00 -0500 Received: from terminus.zytor.com ([198.137.202.136]:44121 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730709AbeLNUfA (ORCPT ); Fri, 14 Dec 2018 15:35:00 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wBEKYpsh1454868 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 14 Dec 2018 12:34:51 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wBEKYp8F1454865; Fri, 14 Dec 2018 12:34:51 -0800 Date: Fri, 14 Dec 2018 12:34:51 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Tzvetomir Stoyanov Message-ID: Cc: tglx@linutronix.de, akpm@linux-foundation.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, tstoyanov@vmware.com, mingo@kernel.org, hpa@zytor.com, jolsa@redhat.com, acme@redhat.com, rostedt@goodmis.org Reply-To: jolsa@redhat.com, rostedt@goodmis.org, acme@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, tstoyanov@vmware.com, hpa@zytor.com, mingo@kernel.org, namhyung@kernel.org, akpm@linux-foundation.org In-Reply-To: <20181130154647.022471992@goodmis.org> References: <20181130154647.022471992@goodmis.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools lib traceevent: Added support for pkg-config Git-Commit-ID: cadb29db628d761b190875e54e9d5b65a30b1925 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-1.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: cadb29db628d761b190875e54e9d5b65a30b1925 Gitweb: https://git.kernel.org/tip/cadb29db628d761b190875e54e9d5b65a30b1925 Author: Tzvetomir Stoyanov AuthorDate: Fri, 30 Nov 2018 10:44:05 -0500 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 30 Nov 2018 17:14:53 -0300 tools lib traceevent: Added support for pkg-config This patch implements integration with pkg-config framework. pkg-config can be used by the library users to determine required CFLAGS and LDFLAGS in order to use the library Signed-off-by: Tzvetomir Stoyanov Cc: Andrew Morton Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/r/20181130154647.022471992@goodmis.org Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/traceevent/Makefile | 26 +++++++++++++++++++++++--- tools/lib/traceevent/libtraceevent.pc.template | 10 ++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index 0b4e833088a4..adb16f845ab3 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile @@ -25,6 +25,7 @@ endef $(call allow-override,CC,$(CROSS_COMPILE)gcc) $(call allow-override,AR,$(CROSS_COMPILE)ar) $(call allow-override,NM,$(CROSS_COMPILE)nm) +$(call allow-override,PKG_CONFIG,pkg-config) EXT = -std=gnu99 INSTALL = install @@ -47,6 +48,8 @@ prefix ?= /usr/local libdir = $(prefix)/$(libdir_relative) man_dir = $(prefix)/share/man man_dir_SQ = '$(subst ','\'',$(man_dir))' +pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) \ + --variable pc_path pkg-config | tr ":" " ")) export man_dir man_dir_SQ INSTALL export DESTDIR DESTDIR_SQ @@ -270,7 +273,19 @@ define do_generate_dynamic_list_file fi endef -install_lib: all_cmd install_plugins +PKG_CONFIG_FILE = libtraceevent.pc +define do_install_pkgconfig_file + if [ -n "${pkgconfig_dir}" ]; then \ + cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE}; \ + sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; \ + sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \ + $(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); \ + else \ + (echo Failed to locate pkg-config directory) 1>&2; \ + fi +endef + +install_lib: all_cmd install_plugins install_pkgconfig $(call QUIET_INSTALL, $(LIB_TARGET)) \ $(call do_install_mkdir,$(libdir_SQ)); \ cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ) @@ -279,6 +294,10 @@ install_plugins: $(PLUGINS) $(call QUIET_INSTALL, trace_plugins) \ $(call do_install_plugins, $(PLUGINS)) +install_pkgconfig: + $(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \ + $(call do_install_pkgconfig_file,$(prefix)) + install_headers: $(call QUIET_INSTALL, headers) \ $(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \ @@ -289,8 +308,9 @@ install: install_lib clean: $(call QUIET_CLEAN, libtraceevent) \ - $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \ - $(RM) TRACEEVENT-CFLAGS tags TAGS + $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \ + $(RM) TRACEEVENT-CFLAGS tags TAGS; \ + $(RM) $(PKG_CONFIG_FILE) PHONY += force plugins force: diff --git a/tools/lib/traceevent/libtraceevent.pc.template b/tools/lib/traceevent/libtraceevent.pc.template new file mode 100644 index 000000000000..42e4d6cb6b9e --- /dev/null +++ b/tools/lib/traceevent/libtraceevent.pc.template @@ -0,0 +1,10 @@ +prefix=INSTALL_PREFIX +libdir=${prefix}/lib64 +includedir=${prefix}/include/traceevent + +Name: libtraceevent +URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git +Description: Linux kernel trace event library +Version: LIB_VERSION +Cflags: -I${includedir} +Libs: -L${libdir} -ltraceevent