add trace-cmd
[openwrt.git] / package / devel / trace-cmd / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=trace-cmd
4 PKG_VERSION:=v2.0.1
5 PKG_RELEASE=1
6
7 PKG_SOURCE_PROTO:=git
8 PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
9 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
10 PKG_SOURCE_VERSION:=1776cf9a24f95b2623fe7ee380d708bb8c6d8a73
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 # PKG_MIRROR_MD5SUM:=6a08dfa2519a969d184e7bb5bb390620
13 PKG_INSTALL:=1
14
15 PKG_BUILD_PARALLEL:=1
16
17 include $(INCLUDE_DIR)/package.mk
18
19 define Package/trace-cmd
20   SECTION:=devel
21   CATEGORY:=Development
22   TITLE:=Linux trace command line utility
23   DEPENDS:=
24 endef
25
26 define Package/trace-cmd-extra
27   SECTION:=devel
28   CATEGORY:=Development
29   TITLE:=Extra plugins for trace-cmd
30   DEPENDS:=
31 endef
32
33 MAKE_FLAGS += \
34         NO_PYTHON=1 \
35         prefix=/usr
36
37 PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/trace-cmd/plugins
38 PLUGINS_ALL = $(patsubst $(PLUGINS_DIR)/plugin_%.so,%,$(wildcard $(PLUGINS_DIR)/plugin_*.so))
39 PLUGINS_MAIN := function hrtimer mac80211 sched_switch
40 PLUGINS_EXTRA = $(filter-out $(PLUGINS_MAIN),$(PLUGINS_ALL))
41
42 TARGET_CFLAGS += --std=gnu99
43
44 define Package/trace-cmd/install
45         $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/trace-cmd/plugins
46         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/trace-cmd $(1)/usr/bin/
47         $(CP) \
48                 $(patsubst %,$(PLUGINS_DIR)/plugin_%.so,$(PLUGINS_MAIN)) \
49                 $(1)/usr/lib/trace-cmd/plugins
50 endef
51
52 define Package/trace-cmd-extra/install
53         $(INSTALL_DIR) $(1)/usr/lib/trace-cmd/plugins
54         $(CP) \
55                 $(patsubst %,$(PLUGINS_DIR)/plugin_%.so,$(PLUGINS_EXTRA)) \
56                 $(1)/usr/lib/trace-cmd/plugins
57 endef
58
59 $(eval $(call BuildPackage,trace-cmd))
60 $(eval $(call BuildPackage,trace-cmd-extra))