Subject: patch to fix libpthread.so for mk/buildlink2/fake-la for Linux
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 02/03/2004 13:09:29
Is it okay if I commit the following? I have asked a couple times (in
private emails) but never told to go ahead.

Please see http://www.NetBSD.org/cgi-bin/query-pr-single.pl?number=22052

Index: mk/buildlink2/fake-la
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink2/fake-la,v
retrieving revision 1.9
diff -b -u -r1.9 fake-la
--- mk/buildlink2/fake-la	2003/12/30 12:09:27	1.9
+++ mk/buildlink2/fake-la	2004/02/03 20:08:16
@@ -25,12 +25,19 @@

 case $libname in
 	*.so)
-		# no version in name which happens e.g. for libpthread.so on Linux
-		# Suse 8.1, Slackware 8.1 and others, but there, the library is a link
-		# to a library with a version in it
+		# no version in name which happens e.g. for libpthread.so on
+		# Linux
 		libbase=`${ECHO} $libname | ${SED} -e "s/\.so$//"`
 		if ${TEST} -h $reallib; then
+			# library is a link to library with a version in it,
+			# e.g. on Suse 8.1, Slackware 8.1 and others
 			liblinked=`ls -l $reallib | ${AWK} '{print $NF}'`
+			version=`${ECHO} $liblinked | ${SED} -e "s/.*\.so\.//;s/\./:/g"`
+		elif ${TEST} -f $reallib; then
+			# ordinary file could be a GNU ld link script
+			# (e.g. /usr/lib/libpthread.so on Suse 8.2)
+			# so filter out first element of GROUP directive
+			liblinked=`${AWK} '/^GROUP/ {print $3}' < $reallib`
 			version=`${ECHO} $liblinked | ${SED} -e "s/.*\.so\.//;s/\./:/g"`
 		else
 			# bail out




   Jeremy C. Reed
   http://www.reedmedia.net/