Subject: pkg/4942: pkg
To: None <gnats-bugs@gnats.netbsd.org>
From: Chris Jones <cjones@pmax.math.montana.edu>
List: netbsd-bugs
Date: 02/05/1998 14:17:17
>Number:         4942
>Category:       pkg
>Synopsis:       lib-depends target fixed for ELF
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb  5 13:20:02 1998
>Last-Modified:
>Originator:     Chris Jones
>Organization:
-------------------------------------------------------------------------------
Chris Jones                                    cjones@rupert.honors.montana.edu
           Mad scientist in training...
"Is this going to be a stand-up programming session, sir, or another bug hunt?"
>Release:        <NetBSD-current source date>today
>Environment:
	
System: NetBSD pmax.math.montana.edu 1.3 NetBSD 1.3 (PMAX) #0: Wed Jan 28 15:23:19 MST 1998 root@pmax.math.montana.edu:/usr/src/sys/arch/pmax/compile/PMAX pmax


/usr/share/mk/bsd.port.mk:#	$NetBSD: bsd.port.mk,v 1.43 1998/02/02 08:11:49 hubertf Exp $
/usr/share/mk/bsd.port.subdir.mk:#	$NetBSD: bsd.port.subdir.mk,v 1.7 1998/01/30 14:33:48 agc Exp $
/usr/share/mk/bsd.own.mk:#	$NetBSD: bsd.own.mk,v 1.58 1998/01/15 09:37:25 agc Exp $

>Description:
As discussed on current-users, bsd.port.mk can't detect already-installed
libraries on the ELF systems (alpha, mips).  This is due to a lack of
"ldconfig -r".
	
>How-To-Repeat:
cd /usr/pkgsrc/graphics/jpeg && make install
cd ../netpbm && make lib-depends
	
>Fix:

This is an ugly hack, but it works for me on both pmax and i386
architectures.  No guarantees about alpha, since I don't have one of
those.

*** bsd.port.mk.orig	Mon Feb  2 05:45:45 1998
--- bsd.port.mk	Thu Feb  5 13:32:22 1998
***************
*** 1,7 ****
  #-*- mode: Fundamental; tab-width: 4; -*-
  # ex:ts=4
  #
! #	$NetBSD: bsd.port.mk,v 1.43 1998/02/02 08:11:49 hubertf Exp $
  #
  #	bsd.port.mk - 940820 Jordan K. Hubbard.
  #	This file is in the public domain.
--- 1,7 ----
  #-*- mode: Fundamental; tab-width: 4; -*-
  # ex:ts=4
  #
! #	$NetBSD: $
  #
  #	bsd.port.mk - 940820 Jordan K. Hubbard.
  #	This file is in the public domain.
***************
*** 1664,1674 ****
--- 1664,1681 ----
  build-depends:	_DEPENDS_USE
  run-depends:	_DEPENDS_USE
  
+ .if (${MACHINE_ARCH} == "alpha") || (${MACHINE_ARCH} == "mips")
+ _ELF_CMD1=lib=`${ECHO} $$lib | ${SED} -e 's|\([^\\]\)\\\\\.|\1.so\\\\.|'`;
+ _ELF_CMD2=reallib=`${LDCONFIG} -p | ${GREP} -e "ELF lib$$libname" | ${AWK} '{ print $$NF }'`;
+ .else
+ _ELF_CMD2=reallib=`${LDCONFIG} -r | ${GREP} -e "-l$$libname" | ${AWK} '{ print $$NF }'`;
+ .endif
  lib-depends:
  .if defined(LIB_DEPENDS)
  .if !defined(NO_DEPENDS)
  	@for i in ${LIB_DEPENDS}; do \
  		lib=`${ECHO} $$i | ${SED} -e 's/:.*//' -e 's|\([^\\]\)\.|\1\\\\.|g'`; \
+ 		${_ELF_CMD1} \
  		dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
  		if expr "$$dir" : '.*:' > /dev/null; then \
  			target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
***************
*** 1677,1683 ****
  			target=${DEPENDS_TARGET}; \
  		fi; \
  		libname=`${ECHO} $$lib | ${SED} -e 's|\\\\||g'`; \
! 		reallib=`${LDCONFIG} -r | ${GREP} -e "-l$$lib" | awk '{ print $$3 }'`; \
  		if [ "X$$reallib" = X"" ]; then \
  			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$libname - not found"; \
  			${ECHO_MSG} "===>  Verifying $$target for $$libname in $$dir"; \
--- 1684,1690 ----
  			target=${DEPENDS_TARGET}; \
  		fi; \
  		libname=`${ECHO} $$lib | ${SED} -e 's|\\\\||g'`; \
! 		${_ELF_CMD2} \
  		if [ "X$$reallib" = X"" ]; then \
  			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$libname - not found"; \
  			${ECHO_MSG} "===>  Verifying $$target for $$libname in $$dir"; \
	
>Audit-Trail:
>Unformatted: