package: add the duma memory debugging library
authorReuben Dowle <reuben.dowle@4rf.com>
Thu, 14 Feb 2013 23:05:53 +0000 (23:05 +0000)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 13 Aug 2013 20:46:58 +0000 (22:46 +0200)
Add the duma memory debugging library. This is based on an earlier
patch by Baruch Siach, with minor changes to build for latest
buildroot sources.

[Thomas P: misc cleanups, drop non-C++ support as it wasn't compiling,
added thread dependency.]

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/Config.in
package/duma/Config.in [new file with mode: 0644]
package/duma/duma-01-fix-cross-compilation.patch [new file with mode: 0644]
package/duma/duma.mk [new file with mode: 0644]

index 4fcff65360cc543504bc7bda71a8f596510b54c0..2ee843ed5e47062316b0c892d3007152981a8818 100644 (file)
@@ -23,6 +23,7 @@ source "package/dhrystone/Config.in"
 source "package/dstat/Config.in"
 source "package/dmalloc/Config.in"
 source "package/dropwatch/Config.in"
+source "package/duma/Config.in"
 source "package/gdb/Config.in"
 source "package/iozone/Config.in"
 source "package/kexec/Config.in"
diff --git a/package/duma/Config.in b/package/duma/Config.in
new file mode 100644 (file)
index 0000000..d233062
--- /dev/null
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_DUMA
+       bool "duma"
+       depends on BR2_INSTALL_LIBSTDCPP
+       depends on BR2_TOOLCHAIN_HAS_THREADS
+       help
+         D.U.M.A. - Detect Unintended Memory Access. A fork of the
+         Electric Fence library. Detects buffer overflow and
+         underflow, and also memory leaks.
+
+         http://duma.sourceforge.net
+
+if BR2_PACKAGE_DUMA
+
+config BR2_PACKAGE_DUMA_NO_LEAKDETECTION
+       bool "disable memory leak detection"
+
+endif # BR2_PACKAGE_DUMA
+
+comment "duma requires C++ and thread support in toolchain"
+       depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/duma/duma-01-fix-cross-compilation.patch b/package/duma/duma-01-fix-cross-compilation.patch
new file mode 100644 (file)
index 0000000..eceaf06
--- /dev/null
@@ -0,0 +1,37 @@
+Allow cross compilation. Adapted from crosstool-ng.
+
+Signed-off-by: Baruch Siach <baruch at tkos.co.il>
+
+Index: b/GNUmakefile
+===================================================================
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -93,10 +93,6 @@
+ # also define 'WIN32'
+ # some defaults:
+-CC=gcc
+-CXX=g++
+-AR=ar
+-RANLIB=ranlib
+ INSTALL=install
+ RM=rm
+ RMFORCE=rm -f
+@@ -471,7 +467,7 @@
+ createconf$(EXEPOSTFIX): createconf.o
+       - $(RMFORCE) createconf$(EXEPOSTFIX)
+-      $(CC) $(CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf$(EXEPOSTFIX)
++      $(CC_FOR_BUILD) $(HOST_CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf$(EXEPOSTFIX)
+ tstheap$(EXEPOSTFIX): libduma.a tstheap.o
+       - $(RMFORCE) tstheap$(EXEPOSTFIX)
+@@ -532,7 +528,7 @@
+ # define rules how to build objects for createconf
+ #
+ createconf.o:
+-      $(CC) $(CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
++      $(CC_FOR_BUILD) $(HOST_CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
+ #
diff --git a/package/duma/duma.mk b/package/duma/duma.mk
new file mode 100644 (file)
index 0000000..93ae16e
--- /dev/null
@@ -0,0 +1,34 @@
+################################################################################
+#
+# duma
+#
+################################################################################
+
+DUMA_VERSION = 2_5_15
+DUMA_SOURCE = duma_$(DUMA_VERSION).tar.gz
+DUMA_SITE = http://downloads.sourceforge.net/project/duma/duma/2.5.15
+DUMA_LICENSE = GPLv2+ LGPLv2.1+
+DUMA_LICENSE_FILES = COPYING-GPL COPYING-LGPL
+
+DUMA_INSTALL_STAGING = YES
+
+DUMA_OPTIONS = \
+       $(if $(BR2_PACKAGE_DUMA_NO_LEAKDETECTION),-DDUMA_LIB_NO_LEAKDETECTION)
+
+# The dependency of some source files in duma_config.h, which is generated at
+# build time, is not specified in the Makefile. Force non-parallel build.
+define DUMA_BUILD_CMDS
+       $(MAKE1) $(TARGET_CONFIGURE_OPTS)       \
+               DUMA_OPTIONS="$(DUMA_OPTIONS)"   \
+               $(DUMA_CPP) -C $(@D)
+endef
+
+define DUMA_INSTALL_STAGING_CMDS
+       $(MAKE) prefix=$(STAGING_DIR)/usr install -C $(@D)
+endef
+
+define DUMA_INSTALL_TARGET_CMDS
+       $(MAKE) prefix=$(TARGET_DIR)/usr install -C $(@D)
+endef
+
+$(eval $(generic-package))