Subject: pkg/22807: pkgtools/pkg_install uses the wrong environment for libnbcompat
To: None <gnats-bugs@gnats.netbsd.org>
From: None <gavan@coolfactor.org>
List: netbsd-bugs
Date: 09/15/2003 17:15:23
>Number:         22807
>Category:       pkg
>Synopsis:       pkgtools/pkg_install uses the wrong environment for libnbcompat
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 15 16:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Gavan Fantom
>Release:        Solaris 9/x86, pkgsrc-current
>Organization:
>Environment:
	
	
System: SunOS hostname 5.9 Generic_112234-07 i86pc i386 i86pc
Architecture: i386
Machine: i86pc
>Description:
Since libnbcompat was moved to build directly within pkg_install, the configure
script for libnbcompat has been called without the usual pkgsrc guarding. This
means that the configure script for libnbcompat finds a different system to
the configure script for pkg_install proper. On my Solaris build box, this
causes pkg_install to fail to build because sys/cdefs.h is (correctly) not
found by pkgsrc gcc, but is found by non-pkgsrc gcc. This mismatch causes
the build of pkg_install to fail.

>How-To-Repeat:
Build pkgtools/pkg_install. To make the problem more visible, put a compiler
in your PATH which behaves differently from pkgsrc gcc, and specify USE_GCC2
or USE_GCC3.

>Fix:
This is one possible fix. Any fix should ensure that both configure scripts
are called within a pkgsrc configure environment, rather than just as
./configure in the pkg Makefile. This could be done with CONFIGURE_DIRS, but
there's presently no way with that mechanism to vary LIBS between configure
scripts.

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/Makefile,v
retrieving revision 1.84
diff -u -r1.84 Makefile
--- Makefile    2003/09/14 15:29:03     1.84
+++ Makefile    2003/09/15 16:05:00
@@ -20,6 +20,7 @@
 USE_BUILDLINK2=		# defined
 GNU_CONFIGURE=		# defined
 CONFIGURE_ARGS+=	--with-pkgdbdir=${PKG_DBDIR}
+CONFIGURE_SCRIPT=	./pkgconfigure

 NO_PKGTOOLS_REQD_CHECK=	# defined
 NO_BUILDLINK=		# defined
@@ -36,7 +37,6 @@

 CFLAGS+=		-I${LIBNBCOMPAT_SRCDIR}
 LDFLAGS+=		-L${LIBNBCOMPAT_SRCDIR}
-LIBS+=			-lnbcompat
  
 VERSION!=		${AWK} -F '"' '/PKGTOOLS_VERSION/ {print $$2}' \
 			${FILESDIR}/lib/version.h
@@ -47,9 +47,6 @@
 do-extract:
 	@${CP} -Rp ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_SRCDIR}
 	@${CP} -Rp ${FILESDIR} ${WRKSRC}
-
-pre-configure:
-       cd ${LIBNBCOMPAT_SRCDIR} && ./configure && ${MAKE_PROGRAM}

 post-install:
 	if [ ! -f ${PKG_DBDIR}/pkgdb.byfile.db ]; then                  \


And create files/pkgconfigure containing:

#!/bin/sh

(cd ../libnbcompat && ./configure && ${MAKE} ) && \
LIBS="${LIBS} -lnbcompat" ./configure $*


>Release-Note:
>Audit-Trail:
>Unformatted: