1999-08-03 01:48:02 +02:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# shlib-install - install a shared library and do any necessary host-specific
|
|
|
|
# post-installation configuration (like ldconfig)
|
|
|
|
#
|
|
|
|
# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library
|
|
|
|
#
|
|
|
|
# Chet Ramey
|
|
|
|
# chet@po.cwru.edu
|
|
|
|
|
|
|
|
#
|
|
|
|
# defaults
|
|
|
|
#
|
|
|
|
INSTALLDIR=/usr/local/lib
|
|
|
|
LDCONFIG=ldconfig
|
|
|
|
|
|
|
|
PROGNAME=`basename $0`
|
|
|
|
USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library"
|
|
|
|
|
|
|
|
# process options
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
-O) shift; host_os="$1"; shift ;;
|
|
|
|
-d) shift; INSTALLDIR="$1"; shift ;;
|
|
|
|
-i) shift; INSTALLPROG="$1" ; shift ;;
|
|
|
|
-D) echo=echo ; shift ;;
|
|
|
|
-U) uninstall=true ; shift ;;
|
|
|
|
-*) echo "$USAGE" >&2 ; exit 2;;
|
|
|
|
*) break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# set install target name
|
|
|
|
LIBNAME="$1"
|
|
|
|
|
|
|
|
if [ -z "$LIBNAME" ]; then
|
|
|
|
echo "$USAGE" >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
OLDSUFF=old
|
|
|
|
MV=mv
|
|
|
|
RM="rm -f"
|
|
|
|
LN="ln -s"
|
|
|
|
|
|
|
|
# pre-install
|
|
|
|
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
|
|
|
|
if [ -f "$INSTALLDIR/$LIBNAME" ]; then
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
|
1999-08-03 01:48:02 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install/uninstall
|
|
|
|
|
|
|
|
if [ -z "$uninstall" ] ; then
|
|
|
|
${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
|
|
|
|
else
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# post-install/uninstall
|
|
|
|
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
# HP-UX requires that a shared library have execute permission
|
|
|
|
case "$host_os" in
|
|
|
|
hpux*) if [ -z "$uninstall" ]; then
|
|
|
|
chmod 755 ${INSTALLDIR}/${LIBNAME}
|
|
|
|
fi ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
case "$LIBNAME" in
|
|
|
|
*.*.[0-9].[0-9]) # libname.so.M.N
|
|
|
|
LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'` # libname.so.M
|
|
|
|
LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'` # libname.so
|
|
|
|
;;
|
|
|
|
*.*.[0-9]) # libname.so.M
|
|
|
|
LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so
|
|
|
|
;;
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
*.[0-9]) # libname.M
|
|
|
|
LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'` # libname
|
|
|
|
;;
|
1999-08-03 01:48:02 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create symlinks to the installed library. This section is incomplete.
|
|
|
|
#
|
|
|
|
case "$host_os" in
|
|
|
|
*linux*|bsdi4*)
|
|
|
|
# libname.so.M -> libname.so.M.N
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/$LINK2
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
|
|
|
|
fi
|
|
|
|
|
|
|
|
# libname.so -> libname.so.M.N
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/$LINK1
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
solaris2*|aix4.[2-9]*|osf*|irix[56]*)
|
1999-08-03 01:48:02 +02:00
|
|
|
# libname.so -> libname.so.M
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/$LINK1
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
|
|
|
|
# FreeBSD 3.x can have either a.out or ELF shared libraries
|
|
|
|
freebsd3*)
|
|
|
|
if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
|
|
|
|
# libname.so -> libname.so.M
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/$LINK1
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# libname.so.M -> libname.so.M.N
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/$LINK2
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
|
|
|
|
fi
|
|
|
|
|
|
|
|
# libname.so -> libname.so.M.N
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/$LINK1
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
hpux1*)
|
|
|
|
# libname.sl -> libname.M
|
|
|
|
${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
|
|
|
|
if [ -z "$uninstall" ]; then
|
|
|
|
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
1999-08-03 01:48:02 +02:00
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|