Subject: pkg/28239: devel/binutils does not build properly for pkgsrc
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Greg A. Woods <woods@weird.com>
List: pkgsrc-bugs
Date: 11/12/2004 07:59:00
>Number:         28239
>Category:       pkg
>Synopsis:       devel/binutils does not build properly for pkgsrc
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 12 07:59:00 +0000 2004
>Originator:     Greg A. Woods
>Release:        NetBSD 1.6.2_STABLE
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD 1.6.2_STABLE
Architecture: alpha
Machine: alpha
>Description:

	binutils is not properly configured to use libtool yet it uses
	it exclusively during its build

	configuration is done without an autoconf config.cache file
	greatly increasing the unnecessary overhead of building
	binutils

	the combination of these first two problems requires explicit
	configuration of each sub-package so that the automated
	LIBTOOL_OVERRIDE tricks can actually take effect

	a small patch is needed to make sure LDFLAGS from MAKE_ENV
	actually makes it into the build process for sub-directories

	building of anything and everything using any automake newer
	than 1.4 really should _always_ use GNU Make (even when
	dependency tracking has been disabled and maintainer mode is
	not being used)

	some compilation and construction is done as root during install

>How-To-Repeat:

	build and install devel/binutils and note that no programs
	were built with the desired LDFLAGS and note that the wrong
	libtool program was used and so on...

>Fix:

cvs diff: Diffing devel/binutils
Index: devel/binutils/Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/devel/binutils/Makefile,v
retrieving revision 1.23
diff -u -r1.23 Makefile
--- devel/binutils/Makefile	13 Aug 2004 18:47:49 -0000	1.23
+++ devel/binutils/Makefile	12 Nov 2004 07:43:51 -0000
@@ -14,12 +14,25 @@
 USE_BUILDLINK3=		yes
 USE_PKGLOCALEDIR=	yes
 
+USE_LIBTOOL=		yes
 USE_MAKEINFO=		yes
 TEXINFO_REQD=		4.0
 MAKEFLAGS+=		TEXINFO_LOCALE=no
 
 GNU_CONFIGURE=		yes
+USE_GNU_TOOLS=		make
 CONFIGURE_ARGS+=	--with-lib-path='/lib:/usr/lib'
+CONFIGURE_ARGS+=	--cache-file=${WRKSRC}/config.cache
+CONFIGURE_DIRS=		${WRKSRC}
+CONFIGURE_DIRS+=	${WRKSRC}/bfd
+CONFIGURE_DIRS+=	${WRKSRC}/binutils
+CONFIGURE_DIRS+=	${WRKSRC}/etc
+CONFIGURE_DIRS+=	${WRKSRC}/gas
+CONFIGURE_DIRS+=	${WRKSRC}/gprof
+CONFIGURE_DIRS+=	${WRKSRC}/intl
+CONFIGURE_DIRS+=	${WRKSRC}/ld
+CONFIGURE_DIRS+=	${WRKSRC}/libiberty
+CONFIGURE_DIRS+=	${WRKSRC}/opcodes
 BINUTILS_PREFIX=	${PREFIX}/${MACHINE_GNU_PLATFORM}
 
 PLIST_SRC=	${PKGDIR}/PLIST.common
@@ -38,6 +51,14 @@
 INFO_FILES+=	gprof.info
 .endif
 
+# XXX it would be _real_ nice if we could use this too....
+#
+#.if defined(GNU_PROGRAM_PREFIX)
+#CONFIGURE_ARGS+=        --program-prefix=${GNU_PROGRAM_PREFIX}
+#.endif
+#PLIST_SUBST+=           GNU_PROGRAM_PREFIX=${GNU_PROGRAM_PREFIX}
+#BUILD_DEFS+=            GNU_PROGRAM_PREFIX
+
 # Prevent the need to run texi2pod.pl and pod2man hence
 # the need for perl as build dependency.
 #
@@ -48,6 +69,11 @@
 	fi
 .endfor
 
+# make sure we don't need to actually build anything as root!
+#
+post-build:
+	cd ${WRKSRC}/bfd/doc && ${SETENV} ${BUILD_ENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} -f ${MAKEFILE} info
+
 post-install:
 	${FIND} ${BINUTILS_PREFIX}/lib/ldscripts -type f -print		\
 		| ${SORT} -r						\
Index: devel/binutils/distinfo
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/devel/binutils/distinfo,v
retrieving revision 1.4
diff -u -r1.4 distinfo
--- devel/binutils/distinfo	30 Jun 2004 16:18:03 -0000	1.4
+++ devel/binutils/distinfo	11 Nov 2004 22:50:23 -0000
@@ -3,3 +3,4 @@
 SHA1 (binutils-2.15.tar.gz) = 4caf693b8cbaf1118d2bfddb40a2fc91eaf51a6f
 Size (binutils-2.15.tar.gz) = 15134701 bytes
 SHA1 (patch-aa) = 34f4efe9ab793c38eccb016bd9498a7db1494953
+SHA1 (patch-za) = e9f418100643c5a1c2f5d244c287956bbbde6f5f
cvs diff: Diffing devel/binutils/patches
Index: devel/binutils/patches/patch-za
===================================================================
RCS file: devel/binutils/patches/patch-za
diff -N devel/binutils/patches/patch-za
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ devel/binutils/patches/patch-za	11 Nov 2004 22:50:18 -0000
@@ -0,0 +1,11 @@
+--- Makefile.in.orig	Mon May 17 15:38:54 2004
++++ Makefile.in	Thu Nov 11 17:49:50 2004
+@@ -228,7 +228,7 @@
+ NM = @NM@
+ 
+ LD = @LD@
+-LDFLAGS = 
++LDFLAGS = @LDFLAGS@
+ 
+ RANLIB = @RANLIB@
+