blob: 4b941498621f33e799f411225760627b120fcbb3 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#
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
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=valgrind
11PKG_VERSION:=3.23.0
12PKG_RELEASE:=1
13
14PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15PKG_SOURCE_URL:=https://sourceware.org/pub/valgrind/
16PKG_HASH:=c5c34a3380457b9b75606df890102e7df2c702b9420c2ebef9540f8b5d56264d
17
18PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
19PKG_LICENSE:=GPL-2.0+
20PKG_CPE_ID:=cpe:/a:valgrind:valgrind
21
22PKG_FIXUP = autoreconf
23PKG_INSTALL := 1
24PKG_BUILD_PARALLEL := 1
25PKG_BUILD_FLAGS:=no-mips16
26PKG_SSP:=0
27
28STRIP:=:
29
30include $(INCLUDE_DIR)/package.mk
31include $(INCLUDE_DIR)/kernel.mk
32
33define Package/valgrind
34 SECTION:=devel
35 CATEGORY:=Development
36 DEPENDS:=@mips||mipsel||mips64||mips64el||i386||x86_64||powerpc||arm_v7||arm +libpthread +librt
37 TITLE:=debugging and profiling tools for Linux
38 URL:=http://www.valgrind.org
39endef
40
41define Package/valgrind/default
42 $(Package/valgrind)
43 DEPENDS := valgrind
44endef
45
46define Package/valgrind-cachegrind
47 $(Package/valgrind/default)
48 TITLE += (cache profiling)
49endef
50
51define Package/valgrind-callgrind
52 $(Package/valgrind/default)
53 TITLE += (callgraph profiling)
54endef
55
56define Package/valgrind-drd
57 $(Package/valgrind/default)
58 TITLE += (thread error detection)
59endef
60
61define Package/valgrind-massif
62 $(Package/valgrind/default)
63 TITLE += (heap profiling)
64endef
65
66define Package/valgrind-helgrind
67 $(Package/valgrind/default)
68 TITLE += (thread debugging)
69endef
70
71define Package/valgrind-vgdb
72 $(Package/valgrind/default)
73 TITLE += (GDB interface)
74endef
75
76define 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.
83endef
84
85CPU := $(patsubst x86_64,amd64,$(patsubst x86,i386,$(patsubst um,$(ARCH),$(LINUX_KARCH))))
86
87CONFIGURE_VARS += \
88 UNAME_R=$(LINUX_VERSION)
89
90ifeq ($(CONFIG_ARCH_64BIT),y)
91 CONFIGURE_ARGS += \
92 --enable-only64bit
93 BITS := 64bit
94else
95 CONFIGURE_ARGS += \
96 --enable-only32bit
97 BITS := 32bit
98endif
99
100ifeq ($(CONFIG_arm_v7),y)
101 CONFIGURE_ARGS += --host=armv7-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))
102endif
103
104CONFIGURE_ARGS += \
105 --enable-lto \
106 --enable-tls \
107 --without-mpicc \
108
109define 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
123ifneq ($(ARCH),aarch64)
124 $(CP) \
125 $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(CPU)-*.xml \
126 $(1)/usr/lib/valgrind/
127endif
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-*
132endef
133
134define 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-*
143endef
144
145define 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-*
154endef
155
156define 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-*
164endef
165
166define 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-*
176endef
177
178define 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-*
186endef
187
188define 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
192endef
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))