Makefile 6.2 KB

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