cfaa1ad9ff
correct manipulation of variables containing values with escaped metacharacters by the shell. The new code only does partial caching, which doesn't cache "special" arguments that contain escaped metacharacters or other oddly quoted values. On certain platforms listed in _BLNK_CACHE_ALL in bsd.buildlink2.mk, we do full caching, which has enormous speed benefits since it avoids an extra sed invocation per "special" argument. Known working platforms: MacOS X 10.1.5 (schmonz) MacOS X 10.2 (grant) NetBSD 1.6 [full caching] (jlam) OpenBSD (cjep) Solaris 8 (grant) Solaris 9 (salo)
49 lines
1.3 KiB
Text
49 lines
1.3 KiB
Text
#!@BUILDLINK_SHELL@
|
|
#
|
|
# $NetBSD: fake-la,v 1.3 2002/12/22 19:02:44 jlam Exp $
|
|
|
|
BASENAME="@BASENAME@"
|
|
CC="@CC@"
|
|
CP="@CP@"
|
|
DIRNAME="@DIRNAME@"
|
|
ECHO="@ECHO@"
|
|
LIBTOOL="@LIBTOOL@ --quiet"
|
|
MKDIR="@MKDIR@"
|
|
MV="@MV@"
|
|
RM="@RM@"
|
|
SED="@SED@"
|
|
TEST="@TEST@"
|
|
|
|
BUILDLINK_DIR="@BUILDLINK_DIR@"
|
|
|
|
reallib="$1"
|
|
realdir=`${DIRNAME} $reallib`
|
|
libname=`${BASENAME} $reallib`
|
|
tmpdir=${BUILDLINK_DIR}/.tmp
|
|
|
|
if ! ${TEST} -f $tmpdir/inst/$libbase.la; then
|
|
case $libname in
|
|
*.so.[0-9]*)
|
|
libbase=`${ECHO} $libname | ${SED} -e "s/\.so\.[0-9.]*$//"`
|
|
version=`${ECHO} $libname | ${SED} -e "s/.*\.so\.//;s/\./:/g"`
|
|
;;
|
|
|
|
*[0-9].dylib)
|
|
libbase=`${ECHO} $libname | ${SED} -e "s/\.[0-9.]*\.dylib$//"`
|
|
version=`${ECHO} $libname | ${SED} -e "s/^[^.]*\.\([0-9]*\.[0-9]*\)\.dylib/\1/;s/\./:/g"`
|
|
;;
|
|
esac
|
|
${MKDIR} $tmpdir/inst
|
|
cd $tmpdir
|
|
${ECHO} "static int i;" > nonempty.c # create a nonempty input file
|
|
${LIBTOOL} --mode=compile ${CC} -c nonempty.c
|
|
${LIBTOOL} ${CC} -o $libbase.la nonempty.lo -rpath $tmpdir/inst -version-info $version
|
|
${LIBTOOL} --mode=install ${CP} $libbase.la $tmpdir/inst >/dev/null
|
|
|
|
# Reset the ld.so cache as "libtool --mode=install" may have executed
|
|
# ldconfig to add "$tmpdir/inst" to the cache.
|
|
#
|
|
@RESET_LD_SO_CACHE@ >/dev/null 2>&1
|
|
|
|
fi
|
|
${SED} -e "s,$tmpdir/inst,$realdir,g" $tmpdir/inst/$libbase.la
|