Subject: Re: use of LDD in pkgsrc/mk/bsd.pkg.mk?
To: Georg Schwarz <georg.schwarz@freenet.de>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 11/29/2005 14:06:02
On Tue, 29 Nov 2005, Georg Schwarz wrote:

> pkgsrc/mk/bsd.pkg.mk has
>
> $$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} 'NF == 3 { print
> $$3 }' | ${SORT} -u
>
> This means that only output lines of ldd with eactly three items are
> considered. On a current Debian Linux system for example I get:
>
> schwarz@kobe:~$ ldd `which lynx`|awk '{print NF}'
> 4
> 4
...
> So it should not work there???

I use (on Linux and NetBSD):

-                       requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) |
  ${AWK} 'NF == 3 { print $$3 }' | ${SORT} -u`; \
+                       requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) |
  ${AWK} '$$2 == "=>" && $$3 ~ "/" { print $$3 }' | ${SORT} -u`; \

I also use:

         case "${OBJECT_FMT}" in                                         \
-       ELF)    bins=`${SETENV} PREFIX=${PREFIX} ${AWK} '/^(bin|sbin|libexec)\//
  { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
-               libs=`${SETENV} PREFIX=${PREFIX} ${AWK} '/^lib\/lib.*\.so\.[0-9]
+$$/ { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
+       ELF)    bins=`${SETENV} PREFIX=${PREFIX} ${AWK} '/(^|\/)(bin|sbin|libexe
c)\// { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
+               libs=`${SETENV} PREFIX=${PREFIX} ${AWK} '/(^|\/)lib\/lib.*\.so\.
[0-9]+$$/ { print ENVIRON["PREFIX"] "/" $$0 }' ${PLIST} || ${TRUE}`; \
                 if ${TEST} "$$bins" != "" -o "$$libs" != ""; then


  Jeremy C. Reed

  	  	 	 BSD News, BSD tutorials, BSD links
 	  	 	 http://www.bsdnewsletter.com/