From: "Bart vdr. Meulen" <bartvdrmeulen@gmail.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] DUMA: Add new package
Date: Mon, 28 May 2012 14:42:36 +0200 [thread overview]
Message-ID: <1338208981-8681-10-git-send-email-bartvdrmeulen@gmail.com> (raw)
From: "Bart vdr. Meulen" <bartvdrmeulen@gmail.com>
DUMA is a memory debugging library. It can detect memory leaks
and buffer overruns (or underruns) in a malloc() / new memory buffer
Added patch for cross compilation and predefining some calues
which can get the incorrect value when building for 32bit target
on 64 bit host
Signed-off-by: Bart vdr. Meulen <bartvdrmeulen@gmail.com>
---
patches/duma_2_5_15/100-cross-compilation.patch | 115 +++++++++++++++++++++++
patches/duma_2_5_15/series | 1 +
rules/duma.in | 10 ++
rules/duma.make | 79 ++++++++++++++++
4 files changed, 205 insertions(+)
create mode 100644 patches/duma_2_5_15/100-cross-compilation.patch
create mode 100644 patches/duma_2_5_15/series
create mode 100644 rules/duma.in
create mode 100644 rules/duma.make
diff --git a/patches/duma_2_5_15/100-cross-compilation.patch b/patches/duma_2_5_15/100-cross-compilation.patch
new file mode 100644
index 0000000..01fce53
--- /dev/null
+++ b/patches/duma_2_5_15/100-cross-compilation.patch
@@ -0,0 +1,115 @@
+---
+ GNUmakefile | 18 +++++++++++++++---
+ createconf.c | 22 ++++++++++++++++++++++
+ 2 files changed, 37 insertions(+), 3 deletions(-)
+
+Index: duma_2_5_15/GNUmakefile
+===================================================================
+--- duma_2_5_15.orig/GNUmakefile
++++ duma_2_5_15/GNUmakefile
+@@ -94,6 +94,7 @@ DUMA_SO_OPTIONS=$(PIC) -DDUMA_SO_LIBRARY
+
+ # some defaults:
+ CC=gcc
++CC_FOR_BUILD=$(CC)
+ CXX=g++
+ AR=ar
+ RANLIB=ranlib
+@@ -240,7 +241,18 @@ ifndef BSWITCH
+ EXEPOSTFIX=
+ endif
+
+-
++ifdef DUMA_PAGE_SIZE
++ DUMA_OPTIONS+= -DDUMA_PAGE_SIZE=$(DUMA_PAGE_SIZE)
++endif
++ifdef DUMA_MIN_ALIGNMENT
++ DUMA_OPTIONS+= -DDUMA_MIN_ALIGNMENT=$(DUMA_MIN_ALIGNMENT)
++endif
++ifdef DUMA_ADDR
++ DUMA_OPTIONS += -DDUMA_ADDR="\"$(DUMA_ADDR)\""
++endif
++ifdef DUMA_SIZE
++ DUMA_OPTIONS += -DDUMA_SIZE="\"$(DUMA_SIZE)\""
++endif
+ ############################################################
+
+ MAN_INSTALL_DIR=$(prefix)/share/man/man3
+@@ -471,7 +483,7 @@ dos2unix:
+
+ createconf$(EXEPOSTFIX): createconf.o
+ - $(RMFORCE) createconf$(EXEPOSTFIX)
+- $(CC) $(CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf$(EXEPOSTFIX)
++ $(CC_FOR_BUILD) $(CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf$(EXEPOSTFIX)
+
+ tstheap$(EXEPOSTFIX): libduma.a tstheap.o
+ - $(RMFORCE) tstheap$(EXEPOSTFIX)
+@@ -532,7 +544,7 @@ endif
+ # define rules how to build objects for createconf
+ #
+ createconf.o:
+- $(CC) $(CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
++ $(CC_FOR_BUILD) $(CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
+
+
+ #
+Index: duma_2_5_15/createconf.c
+===================================================================
+--- duma_2_5_15.orig/createconf.c
++++ duma_2_5_15/createconf.c
+@@ -676,13 +676,24 @@ void writeFile(const char * filename, un
+ fprintf(f, "/*\n");
+ fprintf(f, " * Number of bytes per virtual-memory page, as returned by Page_Size().\n");
+ fprintf(f, " */\n");
++#ifndef DUMA_PAGE_SIZE
+ fprintf(f, "#define DUMA_PAGE_SIZE %lu\n", pagesize);
++#else
++ (void)pagesize;
++ fprintf(f, "#define DUMA_PAGE_SIZE %d\n", DUMA_PAGE_SIZE);
++#endif
+
+ fprintf(f, "\n");
+ fprintf(f, "/*\n");
+ fprintf(f, " * Minimum required alignment by CPU.\n");
+ fprintf(f, " */\n");
++#ifndef DUMA_MIN_ALIGNMENT
+ fprintf(f, "#define DUMA_MIN_ALIGNMENT %d\n", alignment);
++#else
++ (void)alignment;
++ fprintf(f, "#define DUMA_MIN_ALIGNMENT %d\n", DUMA_MIN_ALIGNMENT);
++#endif
++
+
+ fprintf(f, "\n");
+ fprintf(f, "/*\n");
+@@ -697,19 +708,30 @@ void writeFile(const char * filename, un
+ fprintf(f, "/*\n");
+ fprintf(f, " * An integer type with same size as 'void *'\n");
+ fprintf(f, " */\n");
++#ifndef DUMA_ADDR
+ if (addrIdx >= 0)
+ fprintf(f, "typedef unsigned %s DUMA_ADDR;\n", sIntTypes[addrIdx].type);
+ else
+ fprintf(f, "/* Error: No datatype for DUMA_ADDR found! */\n");
++#else
++ (void)addrIdx;
++ fprintf(f, "typedef unsigned %s DUMA_ADDR;\n", DUMA_ADDR);
++#endif
+
+ fprintf(f, "\n");
+ fprintf(f, "/*\n");
+ fprintf(f, " * An integer type with same size as 'size_t'\n");
+ fprintf(f, " */\n");
++#ifndef DUMA_SIZE
+ if (sizeIdx >= 0)
+ fprintf(f, "typedef unsigned %s DUMA_SIZE;\n", sIntTypes[sizeIdx].type);
+ else
+ fprintf(f, "/* No datatype for DUMA_SIZE found! */\n");
++#else
++ (void)sizeIdx;
++ fprintf(f, "typedef unsigned %s DUMA_SIZE;\n", DUMA_SIZE);
++ #endif
++
+
+
+ fprintf(f, "\n");
diff --git a/patches/duma_2_5_15/series b/patches/duma_2_5_15/series
new file mode 100644
index 0000000..a0dee75
--- /dev/null
+++ b/patches/duma_2_5_15/series
@@ -0,0 +1 @@
+100-cross-compilation.patch
diff --git a/rules/duma.in b/rules/duma.in
new file mode 100644
index 0000000..b90a4bf
--- /dev/null
+++ b/rules/duma.in
@@ -0,0 +1,10 @@
+## SECTION=debug_tools
+
+config DUMA
+ tristate
+ prompt "duma"
+ help
+ DUMA (Detect Unintended Memory Access) is a multi-platform memory
+ debugging library. It can detect memory leaks and buffer overruns
+ (or underruns) in a malloc() / new memory buffer.
+
diff --git a/rules/duma.make b/rules/duma.make
new file mode 100644
index 0000000..f0c4ce5
--- /dev/null
+++ b/rules/duma.make
@@ -0,0 +1,79 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2010 by Bart vdr. Meulen <bartvdrmeulen@gmail.com>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_DUMA) += duma
+
+#
+# Paths and names
+#
+DUMA_VERSION := 2_5_15
+DUMA_MD5 := fe630c69cbaa39caf225a3d9ed2fda1f
+DUMA := duma_$(DUMA_VERSION)
+DUMA_SUFFIX := tar.gz
+DUMA_URL := $(PTXCONF_SETUP_SFMIRROR)/duma/$(DUMA).$(DUMA_SUFFIX)
+DUMA_SOURCE := $(SRCDIR)/$(DUMA).$(DUMA_SUFFIX)
+DUMA_DIR := $(BUILDDIR)/$(DUMA)
+DUMA_LICENSE := GPLv2
+
+# ----------------------------------------------------------------------------
+# Get
+# ----------------------------------------------------------------------------
+
+$(DUMA_SOURCE):
+ @$(call targetinfo)
+ @$(call get, DUMA)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+DUMA_CONF_TOOL := NO
+DUMA_MAKE_OPT := \
+ $(CROSS_ENV) \
+ prefix=$(DUMA_PKGDIR)/usr \
+ OS=linux \
+ DUMA_PAGE_SIZE=4096 \
+ DUMA_MIN_ALIGNMENT=1 \
+ DUMA_ADDR="int" \
+ DUMA_SIZE="int"
+DUMA_INSTALL_OPT := prefix=$(DUMA_PKGDIR)/usr OS=linux install
+DUMA_MAKE_PAR := NO
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/duma.targetinstall:
+ @$(call targetinfo)
+
+ @$(call install_init, duma)
+ @$(call install_fixup, duma,PRIORITY,optional)
+ @$(call install_fixup, duma,SECTION,base)
+ @$(call install_fixup, duma,AUTHOR,"Bart vdr. Meulen <bartvdrmeulen@gmail.com>")
+ @$(call install_fixup, duma,DESCRIPTION,missing)
+
+ @$(call install_lib, duma, 0, 0, 0644, libduma)
+
+ @$(call install_finish, duma)
+
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+#$(STATEDIR)/duma.clean:
+# @$(call targetinfo)
+# @$(call clean_pkg, DUMA)
+
+# vim: syntax=make
--
1.7.9.5
--
ptxdist mailing list
ptxdist@pengutronix.de
next reply other threads:[~2012-05-28 12:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-28 12:42 Bart vdr. Meulen [this message]
2012-05-30 16:14 ` Michael Olbrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338208981-8681-10-git-send-email-bartvdrmeulen@gmail.com \
--to=bartvdrmeulen@gmail.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox