ports/86145: devel/m4 should not build its own getopt and regex

Mikhail T. mi at aldan.algebra.com
Thu Sep 15 06:10:07 UTC 2005


>Number:         86145
>Category:       ports
>Synopsis:       devel/m4 should not build its own getopt and regex
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 15 06:10:06 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Mikhail T.
>Release:        FreeBSD 6.0-BETA4 amd64
>Organization:
Virtual Estates, Inc.
>Environment:
System: FreeBSD blue.virtual-estates.net 6.0-BETA4 FreeBSD 6.0-BETA4 #0: Mon Sep 12 19:48:18 EDT 2005 mi at blue.virtual-estates.net:/var/obj/var/src/sys/SILVER amd64

>Description:
	GNU's m4 comes with its own copy of GNU regex and getopt (and
	getopt_long) implementations. Since the main OS install supplies
	these functions (in -lgnuregex and via USE_GETOPT_LONG), no port
	should be building their own. It is wasteful and bug-prone --
	I noticed the problem in the first place because of the amount
	of compiler warnings raised on amd64.

	The port also uses the .gz tarball, when the (much smaller) .bz2
	is available. The difference, however, is, probably, not worth
	the consequence of mirrors carrying both -- I'm not sure.
	May be, USE_BZIP2 should be commented out until the next release
	by the vendor.

	The resulting gm4 executable ends up being about 30% smaller.

>How-To-Repeat:

>Fix:

cvs diff: Diffing .
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/m4/Makefile,v
retrieving revision 1.26
diff -U2 -r1.26 Makefile
--- Makefile	2 Sep 2005 19:46:54 -0000	1.26
+++ Makefile	15 Sep 2005 06:06:06 -0000
@@ -8,4 +8,5 @@
 PORTNAME=	m4
 PORTVERSION=	1.4.3
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_GNU}
@@ -15,4 +16,5 @@
 COMMENT=	GNU m4
 
+USE_BZIP2=	yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--program-prefix=g
@@ -25,4 +27,18 @@
 
 EXAMPLESDIR=	share/examples/gm4
+USE_REINPLACE=	yes
+USE_GETOPT_LONG=yes
+EXCLUDE=lib/getopt* lib/regex*
+EXTRACT_AFTER_ARGS=	|${TAR} -xf -	\
+	${EXCLUDE:S,^,--exclude ${PORTNAME}-${PORTVERSION}/,}
+
+post-patch:
+	@if [ -f /usr/include/gnu/regex.h ]; then	\
+		header=gnu/regex.h;			\
+	else						\
+		header=gnuregex.h;			\
+	fi;						\
+	${GREP} -Fl '"regex.h"' ${WRKSRC}/*/*.[ch] |	\
+	    ${XARGS} ${REINPLACE_CMD} "s,\"regex.h\",<$$header>,"
 
 post-install:
Index: distinfo
===================================================================
RCS file: /home/pcvs/ports/devel/m4/distinfo,v
retrieving revision 1.5
diff -U2 -r1.5 distinfo
--- distinfo	5 Apr 2005 07:39:55 -0000	1.5
+++ distinfo	15 Sep 2005 06:06:06 -0000
@@ -1,2 +1,2 @@
-MD5 (m4-1.4.3.tar.gz) = 073048d747f2dbb3298e713059dd9ab3
-SIZE (m4-1.4.3.tar.gz) = 383347
+MD5 (m4-1.4.3.tar.bz2) = 1f7d7eba70a0525c44c2edc3998925c7
+SIZE (m4-1.4.3.tar.bz2) = 305598
cvs diff: Diffing files
Index: files/patch-no-redundancy
===================================================================
RCS file: files/patch-no-redundancy
diff -N files/patch-no-redundancy
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-no-redundancy	15 Sep 2005 06:06:06 -0000
@@ -0,0 +1,31 @@
+--- lib/Makefile.in	Wed Feb  9 15:48:35 2005
++++ lib/Makefile.in	Tue Sep 13 00:46:36 2005
+@@ -39,8 +39,8 @@
+ INCLUDES = -I.. -I$(srcdir)
+ 
+-HEADERS = getopt.h obstack.h regex.h
+-SOURCES = regex.c getopt.c getopt1.c error.c obstack.c xmalloc.c \
++HEADERS = obstack.h
++SOURCES = error.c obstack.c xmalloc.c \
+ xstrdup.c alloca.c strtol.c
+-OBJECTS = regex.o getopt.o getopt1.o error.o obstack.o xmalloc.o \
++OBJECTS = error.o obstack.o xmalloc.o \
+ xstrdup.o @ALLOCA@ @LIBOBJS@
+ 
+--- src/Makefile.in	Thu Mar 31 04:46:09 2005
++++ src/Makefile.in	Tue Sep 13 01:25:38 2005
+@@ -79,5 +79,4 @@
+ 
+ $(OBJECTS): $(ANSI2KNR) ../config.h m4.h ../lib/obstack.h
+-builtin$O: ../lib/regex.h
+ 
+ ansi2knr: ansi2knr.o
+--- Makefile.in	Thu Mar 31 06:56:34 2005
++++ Makefile.in	Tue Sep 13 01:39:46 2005
+@@ -37,5 +37,5 @@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ LDFLAGS = @LDFLAGS@
+-LIBS = @LIBS@
++LIBS = @LIBS@ -lgnuregex
+ 
+ prefix = @prefix@
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list