From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wg0-f50.google.com ([74.125.82.50]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SYzII-00089n-1a for ptxdist@pengutronix.de; Mon, 28 May 2012 14:44:05 +0200 Received: by wgbds11 with SMTP id ds11so2204114wgb.7 for ; Mon, 28 May 2012 05:43:24 -0700 (PDT) From: "Bart vdr. Meulen" Date: Mon, 28 May 2012 14:42:35 +0200 Message-Id: <1338208981-8681-9-git-send-email-bartvdrmeulen@gmail.com> Subject: [ptxdist] [PATCH] electric-fence: 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" Electric-fence is a memory debugger that can be used to detect memory underruns and overflows Added patch for cross-compilation Added patch for shared library building Signed-off-by: Bart vdr. Meulen --- .../100-update-makefile-for-crosscompilation.patch | 43 +++++++++++++ .../200-add-shared-library-build.patch | 62 +++++++++++++++++++ patches/electric-fence-2.1.13/series | 2 + rules/electric-fence.in | 12 ++++ rules/electric-fence.make | 65 ++++++++++++++++++++ 5 files changed, 184 insertions(+) create mode 100644 patches/electric-fence-2.1.13/100-update-makefile-for-crosscompilation.patch create mode 100644 patches/electric-fence-2.1.13/200-add-shared-library-build.patch create mode 100644 patches/electric-fence-2.1.13/series create mode 100644 rules/electric-fence.in create mode 100644 rules/electric-fence.make diff --git a/patches/electric-fence-2.1.13/100-update-makefile-for-crosscompilation.patch b/patches/electric-fence-2.1.13/100-update-makefile-for-crosscompilation.patch new file mode 100644 index 0000000..e56c36a --- /dev/null +++ b/patches/electric-fence-2.1.13/100-update-makefile-for-crosscompilation.patch @@ -0,0 +1,43 @@ +--- +electric-fence-2.1.13/Makefile | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +Index: electric-fence-2.1.13/Makefile +=================================================================== +--- electric-fence-2.1.13/Makefile ++++ electric-fence-2.1.13/Makefile +@@ -5,8 +5,8 @@ INSTALL= install + MV= mv + CHMOD= chmod + CFLAGS= -g +-LIB_INSTALL_DIR= /usr/lib +-MAN_INSTALL_DIR= /usr/man/man3 ++LIB_INSTALL_DIR= $(INSTALL_DIR)/usr/lib ++MAN_INSTALL_DIR= $(INSTALL_DIR)/usr/man/man3 + + PACKAGE_SOURCE= README libefence.3 Makefile efence.h \ + efence.c page.c print.c eftest.c tstheap.c CHANGES COPYING +@@ -28,7 +28,9 @@ PACKAGE_SOURCE= README libefence.3 Makef + + OBJECTS= efence.o page.o print.o + +-all: libefence.a tstheap eftest ++all: libefence.a ++ ++test: tstheap eftest + @ echo + @ echo "Testing Electric Fence." + @ echo "After the last test, it should print that the test has PASSED." +@@ -39,10 +41,8 @@ all: libefence.a tstheap eftest + @ echo + + install: libefence.a libefence.3 +- $(MV) libefence.a $(LIB_INSTALL_DIR) +- $(CHMOD) 644 $(LIB_INSTALL_DIR)/libefence.a +- $(INSTALL) libefence.3 $(MAN_INSTALL_DIR)/libefence.3 +- $(CHMOD) 644 $(MAN_INSTALL_DIR)/libefence.3 ++ $(INSTALL) -m 644 libefence.a $(LIB_INSTALL_DIR) ++ $(INSTALL) -m 644 libefence.3 $(MAN_INSTALL_DIR) + + clean: + - rm -f $(OBJECTS) tstheap.o eftest.o tstheap eftest libefence.a \ diff --git a/patches/electric-fence-2.1.13/200-add-shared-library-build.patch b/patches/electric-fence-2.1.13/200-add-shared-library-build.patch new file mode 100644 index 0000000..6f42c21 --- /dev/null +++ b/patches/electric-fence-2.1.13/200-add-shared-library-build.patch @@ -0,0 +1,62 @@ +--- + Makefile | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +Index: electric-fence-2.1.13/Makefile +=================================================================== +--- electric-fence-2.1.13.orig/Makefile ++++ electric-fence-2.1.13/Makefile +@@ -5,6 +5,7 @@ INSTALL= install + MV= mv + CHMOD= chmod + CFLAGS= -g ++CFLAGS_SO=-fPIC + LIB_INSTALL_DIR= $(INSTALL_DIR)/usr/lib + MAN_INSTALL_DIR= $(INSTALL_DIR)/usr/man/man3 + +@@ -28,7 +29,9 @@ PACKAGE_SOURCE= README libefence.3 Makef + + OBJECTS= efence.o page.o print.o + +-all: libefence.a ++SO_OBJECTS= efence_so.o page_so.o print_so.o ++ ++all: libefence.a libefence.so.0.0 + + test: tstheap eftest + @ echo +@@ -40,12 +43,15 @@ test: tstheap eftest + @ echo "Electric Fence confidence test PASSED." + @ echo + +-install: libefence.a libefence.3 ++install: libefence.a libefence.so.0.0 libefence.3 + $(INSTALL) -m 644 libefence.a $(LIB_INSTALL_DIR) ++ $(INSTALL) -m 644 libefence.so.0.0 $(LIB_INSTALL_DIR) ++ ln -s libefence.so.0.0 $(LIB_INSTALL_DIR)/libefence.so.0 ++ ln -s libefence.so.0.0 $(LIB_INSTALL_DIR)/libefence.so + $(INSTALL) -m 644 libefence.3 $(MAN_INSTALL_DIR) + + clean: +- - rm -f $(OBJECTS) tstheap.o eftest.o tstheap eftest libefence.a \ ++ - rm -f $(OBJECTS) $(SO_OBJECTS) tstheap.o eftest.o tstheap eftest libefence.a libefense.so.0.0 \ + libefence.cat ElectricFence.shar + + roff: +@@ -61,6 +67,9 @@ libefence.a: $(OBJECTS) + - rm -f libefence.a + $(AR) crv libefence.a $(OBJECTS) + ++libefence.so.0.0: $(SO_OBJECTS) ++ $(CC) $(CFLAGS) -shared -Wl,-soname,$@ -o $@ $(SO_OBJECTS) ++ + tstheap: libefence.a tstheap.o + - rm -f tstheap + $(CC) $(CFLAGS) tstheap.o libefence.a -o tstheap -lpthread +@@ -70,3 +79,6 @@ eftest: libefence.a eftest.o + $(CC) $(CFLAGS) eftest.o libefence.a -o eftest -lpthread + + $(OBJECTS) tstheap.o eftest.o: efence.h ++ ++$(SO_OBJECTS): %_so.o: %.c efence.h ++ $(CC) $(CFLAGS) $(CFLAGS_SO) -c $< -o $@ diff --git a/patches/electric-fence-2.1.13/series b/patches/electric-fence-2.1.13/series new file mode 100644 index 0000000..682e832 --- /dev/null +++ b/patches/electric-fence-2.1.13/series @@ -0,0 +1,2 @@ +100-update-makefile-for-crosscompilation.patch +200-add-shared-library-build.patch diff --git a/rules/electric-fence.in b/rules/electric-fence.in new file mode 100644 index 0000000..f48b239 --- /dev/null +++ b/rules/electric-fence.in @@ -0,0 +1,12 @@ +## SECTION=debug_tools + +config ELECTRIC_FENCE + tristate + prompt "electric-fence" + help + Electric Fence (or eFence) is a memory debugger. It consists of a + library which programmers can link into their code to override the + C standard library memory management functions. eFence triggers a + program crash when the memory error occurs, so a debugger can be + used to inspect the code that caused the error. + diff --git a/rules/electric-fence.make b/rules/electric-fence.make new file mode 100644 index 0000000..eb6a1d0 --- /dev/null +++ b/rules/electric-fence.make @@ -0,0 +1,65 @@ +# -*-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_ELECTRIC_FENCE) += electric-fence + +# +# Paths and names +# +ELECTRIC_FENCE_VERSION := 2.1.13 +ELECTRIC_FENCE_MD5 := 59e4e7817a30aff52d8971ce00e1ad35 +ELECTRIC_FENCE := electric-fence-$(ELECTRIC_FENCE_VERSION) +ELECTRIC_FENCE_SUFFIX := tar.gz +ELECTRIC_FENCE_URL := http://perens.com/FreeSoftware/ElectricFence/electric-fence_$(ELECTRIC_FENCE_VERSION)-0.1.$(ELECTRIC_FENCE_SUFFIX) +ELECTRIC_FENCE_SOURCE := $(SRCDIR)/electric-fence_$(ELECTRIC_FENCE_VERSION)-0.1.$(ELECTRIC_FENCE_SUFFIX) +ELECTRIC_FENCE_DIR := $(BUILDDIR)/$(ELECTRIC_FENCE) +ELECTRIC_FENCE_LICENSE := GPLv2 + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- + +$(ELECTRIC_FENCE_SOURCE): + @$(call targetinfo) + @$(call get, ELECTRIC_FENCE) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +ELECTRIC_FENCE_CONF_TOOL := NO +ELECTRIC_FENCE_MAKE_OPT := CC=$(CROSS_CC) AR=$(CROSS_AR) +ELECTRIC_FENCE_INSTALL_OPT := \ + INSTALL_DIR=$(ELECTRIC_FENCE_PKGDIR) \ + install + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/electric-fence.targetinstall: + @$(call targetinfo) + + @$(call install_init, electric-fence) + @$(call install_fixup, electric-fence,PRIORITY,optional) + @$(call install_fixup, electric-fence,SECTION,base) + @$(call install_fixup, electric-fence,AUTHOR,"Bart vdr. Meulen ") + @$(call install_fixup, electric-fence,DESCRIPTION,missing) + + @$(call install_lib, electric-fence, 0, 0, 0644, libefence) + + @$(call install_finish, electric-fence) + + @$(call touch) + +# vim: syntax=make -- 1.7.9.5 -- ptxdist mailing list ptxdist@pengutronix.de