From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-we0-f172.google.com ([74.125.82.172]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SYzIM-00089r-VD for ptxdist@pengutronix.de; Mon, 28 May 2012 14:43:46 +0200 Received: by werb13 with SMTP id b13so2404486wer.31 for ; Mon, 28 May 2012 05:43:25 -0700 (PDT) From: "Bart vdr. Meulen" Date: Mon, 28 May 2012 14:42:36 +0200 Message-Id: <1338208981-8681-10-git-send-email-bartvdrmeulen@gmail.com> Subject: [ptxdist] [PATCH] DUMA: Add new package Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de From: "Bart vdr. Meulen" 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 --- 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 +# +# 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 ") + @$(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