Commit cc03e1a8 authored by Tzvetomir Stoyanov's avatar Tzvetomir Stoyanov Committed by Arnaldo Carvalho de Melo

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: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20181130154647.022471992@goodmis.orgSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 477be10c
...@@ -25,6 +25,7 @@ endef ...@@ -25,6 +25,7 @@ endef
$(call allow-override,CC,$(CROSS_COMPILE)gcc) $(call allow-override,CC,$(CROSS_COMPILE)gcc)
$(call allow-override,AR,$(CROSS_COMPILE)ar) $(call allow-override,AR,$(CROSS_COMPILE)ar)
$(call allow-override,NM,$(CROSS_COMPILE)nm) $(call allow-override,NM,$(CROSS_COMPILE)nm)
$(call allow-override,PKG_CONFIG,pkg-config)
EXT = -std=gnu99 EXT = -std=gnu99
INSTALL = install INSTALL = install
...@@ -47,6 +48,8 @@ prefix ?= /usr/local ...@@ -47,6 +48,8 @@ prefix ?= /usr/local
libdir = $(prefix)/$(libdir_relative) libdir = $(prefix)/$(libdir_relative)
man_dir = $(prefix)/share/man man_dir = $(prefix)/share/man
man_dir_SQ = '$(subst ','\'',$(man_dir))' 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 man_dir man_dir_SQ INSTALL
export DESTDIR DESTDIR_SQ export DESTDIR DESTDIR_SQ
...@@ -270,7 +273,19 @@ define do_generate_dynamic_list_file ...@@ -270,7 +273,19 @@ define do_generate_dynamic_list_file
fi fi
endef 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 QUIET_INSTALL, $(LIB_TARGET)) \
$(call do_install_mkdir,$(libdir_SQ)); \ $(call do_install_mkdir,$(libdir_SQ)); \
cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ) cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
...@@ -279,6 +294,10 @@ install_plugins: $(PLUGINS) ...@@ -279,6 +294,10 @@ install_plugins: $(PLUGINS)
$(call QUIET_INSTALL, trace_plugins) \ $(call QUIET_INSTALL, trace_plugins) \
$(call do_install_plugins, $(PLUGINS)) $(call do_install_plugins, $(PLUGINS))
install_pkgconfig:
$(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \
$(call do_install_pkgconfig_file,$(prefix))
install_headers: install_headers:
$(call QUIET_INSTALL, headers) \ $(call QUIET_INSTALL, headers) \
$(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \ $(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
...@@ -289,8 +308,9 @@ install: install_lib ...@@ -289,8 +308,9 @@ install: install_lib
clean: clean:
$(call QUIET_CLEAN, libtraceevent) \ $(call QUIET_CLEAN, libtraceevent) \
$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \ $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \
$(RM) TRACEEVENT-CFLAGS tags TAGS $(RM) TRACEEVENT-CFLAGS tags TAGS; \
$(RM) $(PKG_CONFIG_FILE)
PHONY += force plugins PHONY += force plugins
force: force:
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment