mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] electric-fence: Add new package
Date: Wed, 30 May 2012 18:11:34 +0200	[thread overview]
Message-ID: <20120530161134.GC31687@pengutronix.de> (raw)
In-Reply-To: <1338208981-8681-9-git-send-email-bartvdrmeulen@gmail.com>

On Mon, May 28, 2012 at 02:42:35PM +0200, Bart vdr. Meulen wrote:
> From: "Bart vdr. Meulen" <bartvdrmeulen@gmail.com>
> 
> 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 <bartvdrmeulen@gmail.com>
> ---
>  .../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

Patch headers!

> --- /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

Use DESTDIR instead of INSTALL_DIR, that's already defined.

> + 
> + 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 <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_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)

remove this stage.

> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +ELECTRIC_FENCE_CONF_TOOL	:= NO
> +ELECTRIC_FENCE_MAKE_OPT		:= CC=$(CROSS_CC) AR=$(CROSS_AR)

ELECTRIC_FENCE_MAKE_OPT		:= $(CROSS_ENV_PROGS)
ELECTRIC_FENCE_MAKE_ENV		:= $(CROSS_ENV)

> +ELECTRIC_FENCE_INSTALL_OPT	:= \
> +	INSTALL_DIR=$(ELECTRIC_FENCE_PKGDIR) \

not needed if DESTDIR is used.

Michael

> +	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 <bartvdrmeulen@gmail.com>")
> +	@$(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
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

      reply	other threads:[~2012-05-30 16:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-28 12:42 Bart vdr. Meulen
2012-05-30 16:11 ` Michael Olbrich [this message]

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=20120530161134.GC31687@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --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