Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3896379imu; Tue, 18 Dec 2018 06:04:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xn5ra0S442q2FKygayufz1oD3NLVP9bgmsIllOhwBk/waFbl0343AZ9MNn4TOaqiVoVNXv X-Received: by 2002:a17:902:7614:: with SMTP id k20mr16764226pll.285.1545141848851; Tue, 18 Dec 2018 06:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545141848; cv=none; d=google.com; s=arc-20160816; b=SCW9DhEZoSe/6yBmdCwFaexN1x1+il65v1yB0eaQ81gZhubbgIysZpZC4EqUtceR8b LnLwFO5U5zKmVKruervsiEw/qLzgp5oLOLW0taRGnUnNHvlVqF1q290ojyfg1xxaxd+5 XmlSOzm+xkVqN5D7ay4b8WyWoxzDpkdPpyGtbvHQthvH3rphLdOYv/UAr6skq38WUyyv QnAjMwKjUzsMikKPm65C38D7R2/l5WaxYYJQTdM67YOwr1PsTfSeTVn2duPR4blf8kh4 pg6OXrDjNBncG6O95K+6/fcfvCnnuvSU+RN1/rRwSxi5Rtw08dwcV5Vl1ny167/sQ5+C +GIw== 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=oCDrBkDA8tGDw8n6vzX2GUy4++eMfeyEWxzlZX66tJg=; b=ks0GvpCPFhh1qWos2psx7zAoR51Uz+aVEQtXPME2XfRSduxrk/PsPgVrGrDdkRoUF4 vTt7Kh0ZIAxk0R7tXablMetsbplamIYLAxlQo9TuwODZ42QHrj5Gqy+IHZ8czzTrvB/9 +aifLphgD47didHKAqaTFsGF+sVGRuHZi4hZAyFABFwOtNceWIm/oJ3w1jqbftUr+1bj XIX12b1nwiZZeNzizIFcevMWIwhnUOftk7NGxqZV5f2wrFNdzWvP3EfRDA40z2UqhyI5 XFJ6wcz7bMcyentIkdLJer1l4fB2pePXCSYyqNhEqJi7cznlJoKubpQgBmCpcHGSwKf5 HooA== 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 9si13355806pgm.112.2018.12.18.06.03.51; Tue, 18 Dec 2018 06:04:08 -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 S1726817AbeLROCI (ORCPT + 99 others); Tue, 18 Dec 2018 09:02:08 -0500 Received: from terminus.zytor.com ([198.137.202.136]:38231 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbeLROCI (ORCPT ); Tue, 18 Dec 2018 09:02:08 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wBIE1nrU2852555 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 18 Dec 2018 06:01:49 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wBIE1mfq2852552; Tue, 18 Dec 2018 06:01:48 -0800 Date: Tue, 18 Dec 2018 06:01:48 -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: mingo@kernel.org, rostedt@goodmis.org, hpa@zytor.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, tstoyanov@vmware.com, tglx@linutronix.de, akpm@linux-foundation.org, jolsa@redhat.com, acme@redhat.com Reply-To: namhyung@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, rostedt@goodmis.org, hpa@zytor.com, acme@redhat.com, jolsa@redhat.com, akpm@linux-foundation.org, tstoyanov@vmware.com, tglx@linutronix.de 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: cc03e1a8f82dff36fb329469c28cbfe7d2e6156a 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=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham 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: cc03e1a8f82dff36fb329469c28cbfe7d2e6156a Gitweb: https://git.kernel.org/tip/cc03e1a8f82dff36fb329469c28cbfe7d2e6156a Author: Tzvetomir Stoyanov AuthorDate: Fri, 30 Nov 2018 10:44:05 -0500 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 17 Dec 2018 14:55:55 -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