313df759219182630c513c2f367656e136c39ce1
[openwrt/openwrt.git] / package / devel / valgrind / Makefile
1 #
2 # Copyright (C) 2006-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=valgrind
11 PKG_VERSION:=3.23.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=https://sourceware.org/pub/valgrind/
16 PKG_HASH:=c5c34a3380457b9b75606df890102e7df2c702b9420c2ebef9540f8b5d56264d
17
18 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
19 PKG_LICENSE:=GPL-2.0+
20 PKG_CPE_ID:=cpe:/a:valgrind:valgrind
21
22 PKG_FIXUP = autoreconf
23 PKG_INSTALL := 1
24 PKG_BUILD_PARALLEL := 1
25 PKG_BUILD_FLAGS:=no-mips16
26 PKG_SSP:=0
27
28 STRIP:=:
29
30 include $(INCLUDE_DIR)/package.mk
31 include $(INCLUDE_DIR)/kernel.mk
32
33 define Package/valgrind
34 SECTION:=devel
35 CATEGORY:=Development
36 DEPENDS:=@mips||mipsel||mips64||mips64el||i386||x86_64||powerpc||arm_v7||aarch64 +libpthread +librt
37 TITLE:=debugging and profiling tools for Linux
38 URL:=http://www.valgrind.org
39 endef
40
41 define Package/valgrind/default
42 $(Package/valgrind)
43 DEPENDS := valgrind
44 endef
45
46 define Package/valgrind-cachegrind
47 $(Package/valgrind/default)
48 TITLE += (cache profiling)
49 endef
50
51 define Package/valgrind-callgrind
52 $(Package/valgrind/default)
53 TITLE += (callgraph profiling)
54 endef
55
56 define Package/valgrind-drd
57 $(Package/valgrind/default)
58 TITLE += (thread error detection)
59 endef
60
61 define Package/valgrind-massif
62 $(Package/valgrind/default)
63 TITLE += (heap profiling)
64 endef
65
66 define Package/valgrind-helgrind
67 $(Package/valgrind/default)
68 TITLE += (thread debugging)
69 endef
70
71 define Package/valgrind-vgdb
72 $(Package/valgrind/default)
73 TITLE += (GDB interface)
74 endef
75
76 define Package/valgrind/description
77 Valgrind is an award-winning suite of tools for debugging and
78 profiling Linux programs. With the tools that come with Valgrind,
79 you can automatically detect many memory management and threading
80 bugs, avoiding hours of frustrating bug-hunting, making your
81 programs more stable. You can also perform detailed profiling,
82 to speed up and reduce memory use of your programs.
83 endef
84
85 CPU := $(patsubst x86_64,amd64,$(patsubst x86,i386,$(patsubst um,$(ARCH),$(LINUX_KARCH))))
86
87 CONFIGURE_VARS += \
88 UNAME_R=$(LINUX_VERSION)
89
90 ifeq ($(CONFIG_ARCH_64BIT),y)
91 CONFIGURE_ARGS += \
92 --enable-only64bit
93 BITS := 64bit
94 else
95 CONFIGURE_ARGS += \
96 --enable-only32bit
97 BITS := 32bit
98 endif
99
100 ifeq ($(CONFIG_arm_v7),y)
101 CONFIGURE_ARGS += --host=armv7-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))
102 endif
103
104 CONFIGURE_ARGS += \
105 --enable-lto \
106 --enable-tls \
107 --without-mpicc \
108
109 define Package/valgrind/install
110 $(INSTALL_DIR) $(1)/usr/bin
111 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/valgrind* $(1)/usr/bin/
112 $(INSTALL_DIR) $(1)/usr/lib/valgrind
113 $(CP) \
114 ./files/default.supp \
115 $(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
116 $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_core*.so \
117 $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-core*.xml \
118 $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-linux*.xml \
119 $(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-* \
120 $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_memcheck*.so \
121 $(1)/usr/lib/valgrind/
122
123 ifneq ($(ARCH),aarch64)
124 $(CP) \
125 $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(CPU)-*.xml \
126 $(1)/usr/lib/valgrind/
127 endif
128 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
129 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) \
130 $(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
131 $(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-*
132 endef
133
134 define Package/valgrind-cachegrind/install
135 $(INSTALL_DIR) $(1)/usr/bin
136 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cg_* $(1)/usr/bin/
137 $(INSTALL_DIR) $(1)/usr/lib/valgrind
138 $(CP) \
139 $(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-* \
140 $(1)/usr/lib/valgrind/
141 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
142 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-*
143 endef
144
145 define Package/valgrind-callgrind/install
146 $(INSTALL_DIR) $(1)/usr/bin
147 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/callgrind* $(1)/usr/bin/
148 $(INSTALL_DIR) $(1)/usr/lib/valgrind
149 $(CP) \
150 $(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-* \
151 $(1)/usr/lib/valgrind/
152 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
153 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-*
154 endef
155
156 define Package/valgrind-drd/install
157 $(INSTALL_DIR) $(1)/usr/lib/valgrind
158 $(CP) \
159 $(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-* \
160 $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_drd*.so \
161 $(1)/usr/lib/valgrind/
162 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
163 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-*
164 endef
165
166 define Package/valgrind-massif/install
167 $(INSTALL_DIR) $(1)/usr/bin
168 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ms_print $(1)/usr/bin/
169 $(INSTALL_DIR) $(1)/usr/lib/valgrind
170 $(CP) \
171 $(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-* \
172 $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_massif*.so \
173 $(1)/usr/lib/valgrind/
174 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
175 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-*
176 endef
177
178 define Package/valgrind-helgrind/install
179 $(INSTALL_DIR) $(1)/usr/lib/valgrind
180 $(CP) \
181 $(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-* \
182 $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_helgrind*.so \
183 $(1)/usr/lib/valgrind/
184 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
185 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-*
186 endef
187
188 define Package/valgrind-vgdb/install
189 $(INSTALL_DIR) $(1)/usr/bin
190 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgdb $(1)/usr/bin/
191 $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
192 endef
193
194 $(eval $(call BuildPackage,valgrind))
195 $(eval $(call BuildPackage,valgrind-cachegrind))
196 $(eval $(call BuildPackage,valgrind-callgrind))
197 $(eval $(call BuildPackage,valgrind-drd))
198 $(eval $(call BuildPackage,valgrind-massif))
199 $(eval $(call BuildPackage,valgrind-helgrind))
200 $(eval $(call BuildPackage,valgrind-vgdb))