Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3904270imu; Fri, 30 Nov 2018 07:49:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/W4nsxi4tvDUK9y21TxM8Z8mbWaIexF1kaoXNto6vJvMEakZjREWmKe6/mxCDfe6jWlO+vB X-Received: by 2002:a17:902:9691:: with SMTP id n17mr6318154plp.9.1543592957795; Fri, 30 Nov 2018 07:49:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543592957; cv=none; d=google.com; s=arc-20160816; b=AOpYVYLEW3dtWQIXrrGUEqd4Cp5AIIZ+R9M7f3DTs+NGOyVr4lwqIx2knxAf9FFiUw KIUHfcUTf0DqOUbbpnfSwU/2EOBpkUdGdIefQz593nuzk0KXxgdsmrQTyJpkaLvSfHOL KstGwBP5uqPT7T3moHiTiO+WHv55JfNHWo6c/URX7VU3yzGg7ZdAJH1gzvDRxZk3w9fn 6hA4xUVLyvRMXcE5qgmKo0WB1cSniwSk1OHhOhjCZ0KriOk62l+2HYoCQjxQmD9wCEVD CF0+TV7pdoY9ljg1EKXKimXUoFEZziIN64jY7fmDaB1X9BXhMU+6aaUMKCcKd5JEwse0 n/pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id; bh=/kX90/P7Y8wMcZFSfplTNIb7sTqastu1MqIvOcwXW+Q=; b=TUgQnjbCFOD6a17eGH0Qx2swzAmSZRdRelaRi4hOehjF6ZM35CbUoVxe5JYL5ADRJq Y8QL9M+E7xTV7CtctGXcUE3CS93XCPmh6/jdSvlb4alOYFjmJfppmRVP8jQCNLpG9w4p jBLTiWfl3gguh7giT0ANeQrhsW+nNHsJ3V+E1nHGHNybUTGs5sab/Yq/7MOe/7gKAGjZ 66k9chktF9yuFX/ffRQcVLUbEyDukvWufB8ifwGSPR2hepBuzqnBhK/QVuA+DmKLZ8X7 Gj12L3ySJ7jgYf1nFu61JpuOII9jaTmfPCuxowYdWnuasL3HG7AucvmdhHeKFCvuBuB+ PbZQ== 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 a34si5069283pgb.458.2018.11.30.07.48.57; Fri, 30 Nov 2018 07:49:17 -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 S1727306AbeLAC4d (ORCPT + 99 others); Fri, 30 Nov 2018 21:56:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:35396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbeLAC4d (ORCPT ); Fri, 30 Nov 2018 21:56:33 -0500 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1AB622148E; Fri, 30 Nov 2018 15:46:48 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.91) (envelope-from ) id 1gSl0B-0005yc-3z; Fri, 30 Nov 2018 10:46:47 -0500 Message-Id: <20181130154647.022471992@goodmis.org> User-Agent: quilt/0.65 Date: Fri, 30 Nov 2018 10:44:05 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Jiri Olsa , Namhyung Kim , Andrew Morton , Tzvetomir Stoyanov Subject: [PATCH 2/9] tools/lib/traceevent: Added support for pkg-config References: <20181130154403.150474900@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tzvetomir Stoyanov 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 Signed-off-by: Steven Rostedt (VMware) --- tools/lib/traceevent/Makefile | 26 ++++++++++++++++--- .../lib/traceevent/libtraceevent.pc.template | 10 +++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 tools/lib/traceevent/libtraceevent.pc.template 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 -- 2.19.1