1################################################################################ 2# 3# valgrind 4# 5################################################################################ 6 7VALGRIND_VERSION = 3.18.1 8VALGRIND_SITE = https://sourceware.org/pub/valgrind 9VALGRIND_SOURCE = valgrind-$(VALGRIND_VERSION).tar.bz2 10VALGRIND_LICENSE = GPL-2.0, GFDL-1.2 11VALGRIND_LICENSE_FILES = COPYING COPYING.DOCS 12VALGRIND_CPE_ID_VENDOR = valgrind 13VALGRIND_CONF_OPTS = \ 14 --disable-ubsan \ 15 --without-mpicc 16VALGRIND_INSTALL_STAGING = YES 17 18# Valgrind must be compiled with no stack protection, so forcefully 19# pass -fno-stack-protector to override what Buildroot may have in 20# TARGET_CFLAGS if BR2_SSP_* support is enabled. 21VALGRIND_CFLAGS = \ 22 $(TARGET_CFLAGS) \ 23 -fno-stack-protector 24 25# When Valgrind detects a 32-bit MIPS architecture, it forcibly adds 26# -march=mips32 to CFLAGS; when it detects a 64-bit MIPS architecture, 27# it forcibly adds -march=mips64. This causes Valgrind to be built 28# always for the first ISA revision level (R1), even when the user has 29# configured Buildroot for the second ISA revision level (R2). 30# 31# Override the CFLAGS variable (which Valgrind appends to its CFLAGS) 32# and pass the right -march option, so they take precedence over 33# Valgrind's wrongfully detected value. 34ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) 35VALGRIND_CFLAGS += -march="$(GCC_TARGET_ARCH)" 36endif 37 38VALGRIND_CONF_ENV = CFLAGS="$(VALGRIND_CFLAGS)" 39 40# fix uclibc configure c99 support detection 41VALGRIND_CONF_ENV += ac_cv_prog_cc_c99='-std=gnu99' 42 43# On ARM, Valgrind only supports ARMv7, and uses the arch part of the 44# host tuple to determine whether it's being built for ARMv7 or 45# not. Therefore, we adjust the host tuple to specify we're on 46# ARMv7. The valgrind package is guaranteed, through Config.in, to 47# only be selected on ARMv7-A/ARMv8-A platforms. 48ifeq ($(BR2_ARM_CPU_ARMV7A)$(BR2_ARM_CPU_ARMV8A):$(BR2_arm),y:y) 49VALGRIND_CONF_OPTS += \ 50 --host=$(patsubst arm-%,armv7-%,$(GNU_TARGET_NAME)) 51endif 52 53ifeq ($(BR2_GCC_ENABLE_LTO),y) 54VALGRIND_CONF_OPTS += --enable-lto 55else 56VALGRIND_CONF_OPTS += --disable-lto 57endif 58 59define VALGRIND_INSTALL_UCLIBC_SUPP 60 $(INSTALL) -D -m 0644 package/valgrind/uclibc.supp $(TARGET_DIR)/usr/lib/valgrind/uclibc.supp 61endef 62 63VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_INSTALL_UCLIBC_SUPP 64 65ifeq ($(BR2_PACKAGE_VALGRIND_MEMCHECK),) 66define VALGRIND_REMOVE_MEMCHECK 67 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*memcheck* 68endef 69 70VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_MEMCHECK 71endif 72 73ifeq ($(BR2_PACKAGE_VALGRIND_CACHEGRIND),) 74define VALGRIND_REMOVE_CACHEGRIND 75 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*cachegrind* 76 for i in cg_annotate cg_diff cg_merge; do \ 77 rm -f $(TARGET_DIR)/usr/bin/$$i ; \ 78 done 79endef 80 81VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_CACHEGRIND 82endif 83 84ifeq ($(BR2_PACKAGE_VALGRIND_CALLGRIND),) 85define VALGRIND_REMOVE_CALLGRIND 86 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*callgrind* 87 for i in callgrind_annotate callgrind_control ; do \ 88 rm -f $(TARGET_DIR)/usr/bin/$$i ; \ 89 done 90endef 91 92VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_CALLGRIND 93endif 94 95ifeq ($(BR2_PACKAGE_VALGRIND_HELGRIND),) 96define VALGRIND_REMOVE_HELGRIND 97 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*helgrind* 98endef 99 100VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_HELGRIND 101endif 102 103ifeq ($(BR2_PACKAGE_VALGRIND_DRD),) 104define VALGRIND_REMOVE_DRD 105 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*drd* 106endef 107 108VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_DRD 109endif 110 111ifeq ($(BR2_PACKAGE_VALGRIND_MASSIF),) 112define VALGRIND_REMOVE_MASSIF 113 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*massif* 114 rm -f $(TARGET_DIR)/usr/bin/ms_print 115endef 116 117VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_MASSIF 118endif 119 120ifeq ($(BR2_PACKAGE_VALGRIND_DHAT),) 121define VALGRIND_REMOVE_DHAT 122 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*dhat* 123endef 124 125VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_DHAT 126endif 127 128ifeq ($(BR2_PACKAGE_VALGRIND_SGCHECK),) 129define VALGRIND_REMOVE_SGCHECK 130 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*sgcheck* 131endef 132 133VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_SGCHECK 134endif 135 136ifeq ($(BR2_PACKAGE_VALGRIND_BBV),) 137define VALGRIND_REMOVE_BBV 138 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*bbv* 139endef 140 141VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_BBV 142endif 143 144ifeq ($(BR2_PACKAGE_VALGRIND_LACKEY),) 145define VALGRIND_REMOVE_LACKEY 146 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*lackey* 147endef 148 149VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_LACKEY 150endif 151 152ifeq ($(BR2_PACKAGE_VALGRIND_NULGRIND),) 153define VALGRIND_REMOVE_NULGRIND 154 rm -f $(TARGET_DIR)/usr/libexec/valgrind/*none* 155endef 156 157VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_NULGRIND 158endif 159 160$(eval $(autotools-package)) 161