Apply patch by Joachim Koenig-Baltes (joachim at handshake dot de) in

followup to PR pkg/20529:

Some libraries (in this example, a given Linux's native libpthread) don't
come with a version number at all and/or are in fact symlinks.  Test for
this and act accordingly in fake-la.

This allows packages that use pthread to buildlink under various Linuxen.

Should close PR pkg/20529 and PR pkg/21854.  Thanks, Joachim.
This commit is contained in:
jschauma 2003-06-19 17:20:41 +00:00
parent 8abe09af63
commit 07aec53fd8
2 changed files with 23 additions and 5 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: bsd.buildlink2.mk,v 1.84 2003/05/06 17:42:02 jmmv Exp $
# $NetBSD: bsd.buildlink2.mk,v 1.85 2003/06/19 17:20:41 jschauma Exp $
#
# An example package buildlink2.mk file:
#
@ -934,6 +934,7 @@ ${_BLNK_FAKE_LA}: ${.CURDIR}/../../mk/buildlink2/fake-la
-e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR}|g" \
-e "s|@BUILDLINK_X11_DIR@|${BUILDLINK_X11_DIR}|g" \
-e "s|@BUILDLINK_SHELL@|${BUILDLINK_SHELL}|g" \
-e "s|@AWK@|${AWK:Q}|g" \
-e "s|@BASENAME@|${BASENAME:Q}|g" \
-e "s|@CC@|${BUILDLINK_CC:Q}|g" \
-e "s|@CP@|${CP:Q}|g" \

View file

@ -1,7 +1,8 @@
#!@BUILDLINK_SHELL@
#
# $NetBSD: fake-la,v 1.4 2003/01/06 04:30:12 jlam Exp $
# $NetBSD: fake-la,v 1.5 2003/06/19 17:20:42 jschauma Exp $
AWK="@AWK@"
BASENAME="@BASENAME@"
CC="@CC@"
CP="@CP@"
@ -21,8 +22,22 @@ realdir=`${DIRNAME} $reallib`
libname=`${BASENAME} $reallib`
tmpdir=${BUILDLINK_DIR}/.tmp
if ${TEST} ! -f $tmpdir/inst/$libbase.la; then
case $libname in
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
libbase=`${ECHO} $libname | ${SED} -e "s/\.so$//"`
if ${TEST} -h $reallib; then
liblinked=`ls -l $reallib | ${AWK} '{print $NF}'`
version=`${ECHO} $liblinked | ${SED} -e "s/.*\.so\.//;s/\./:/g"`
else
# bail out
${ECHO} "could not determine version of $reallib"
exit 1
fi
;;
*.so.[0-9]*)
libbase=`${ECHO} $libname | ${SED} -e "s/\.so\.[0-9.]*$//"`
version=`${ECHO} $libname | ${SED} -e "s/.*\.so\.//;s/\./:/g"`
@ -32,7 +47,9 @@ if ${TEST} ! -f $tmpdir/inst/$libbase.la; then
libbase=`${ECHO} $libname | ${SED} -e "s/\.[0-9.]*\.dylib$//"`
version=`${ECHO} $libname | ${SED} -e "s/^[^.]*\.\([0-9]*\.[0-9]*\)\.dylib/\1/;s/\./:/g"`
;;
esac
esac
if ${TEST} ! -f $tmpdir/inst/$libbase.la; then
${MKDIR} $tmpdir/inst
cd $tmpdir
${ECHO} "static int i;" > nonempty.c # create a nonempty input file