OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [readline/] [support/] [shlib-install] - Diff between revs 107 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
#! /bin/sh
#! /bin/sh
#
#
# shlib-install - install a shared library and do any necessary host-specific
# shlib-install - install a shared library and do any necessary host-specific
#                 post-installation configuration (like ldconfig)
#                 post-installation configuration (like ldconfig)
#
#
# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library
# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library
#
#
# Chet Ramey
# Chet Ramey
# chet@po.cwru.edu
# chet@po.cwru.edu
#
#
# defaults
# defaults
#
#
INSTALLDIR=/usr/local/lib
INSTALLDIR=/usr/local/lib
LDCONFIG=ldconfig
LDCONFIG=ldconfig
PROGNAME=`basename $0`
PROGNAME=`basename $0`
USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library"
USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library"
# process options
# process options
while [ $# -gt 0 ]; do
while [ $# -gt 0 ]; do
        case "$1" in
        case "$1" in
        -O)     shift; host_os="$1"; shift ;;
        -O)     shift; host_os="$1"; shift ;;
        -d)     shift; INSTALLDIR="$1"; shift ;;
        -d)     shift; INSTALLDIR="$1"; shift ;;
        -i)     shift; INSTALLPROG="$1" ; shift ;;
        -i)     shift; INSTALLPROG="$1" ; shift ;;
        -D)     echo=echo ; shift ;;
        -D)     echo=echo ; shift ;;
        -U)     uninstall=true ; shift ;;
        -U)     uninstall=true ; shift ;;
        -*)     echo "$USAGE" >&2 ; exit 2;;
        -*)     echo "$USAGE" >&2 ; exit 2;;
        *)      break ;;
        *)      break ;;
        esac
        esac
done
done
# set install target name
# set install target name
LIBNAME="$1"
LIBNAME="$1"
if [ -z "$LIBNAME" ]; then
if [ -z "$LIBNAME" ]; then
        echo "$USAGE" >&2
        echo "$USAGE" >&2
        exit 2
        exit 2
fi
fi
OLDSUFF=old
OLDSUFF=old
MV=mv
MV=mv
RM="rm -f"
RM="rm -f"
LN="ln -s"
LN="ln -s"
# pre-install
# pre-install
if [ -z "$uninstall" ]; then
if [ -z "$uninstall" ]; then
        ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
        ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
        if [ -f "$INSTALLDIR/$LIBNAME" ]; then
        if [ -f "$INSTALLDIR/$LIBNAME" ]; then
                ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
                ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
        fi
        fi
fi
fi
# install/uninstall
# install/uninstall
if [ -z "$uninstall" ] ; then
if [ -z "$uninstall" ] ; then
        ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
        ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
else
else
        ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
        ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
fi
fi
# post-install/uninstall
# post-install/uninstall
case "$LIBNAME" in
case "$LIBNAME" in
*.*.[0-9].[0-9])        # libname.so.M.N
*.*.[0-9].[0-9])        # libname.so.M.N
        LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'`    # libname.so.M
        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
        LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'`    # libname.so
        ;;
        ;;
*.*.[0-9])              # libname.so.M
*.*.[0-9])              # libname.so.M
        LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'`           # libname.so
        LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'`           # libname.so
        ;;
        ;;
esac
esac
#
#
# Create symlinks to the installed library.  This section is incomplete.
# Create symlinks to the installed library.  This section is incomplete.
#
#
case "$host_os" in
case "$host_os" in
*linux*|bsdi4*)
*linux*|bsdi4*)
        # libname.so.M -> libname.so.M.N
        # libname.so.M -> libname.so.M.N
        ${echo} ${RM} ${INSTALLDIR}/$LINK2
        ${echo} ${RM} ${INSTALLDIR}/$LINK2
        if [ -z "$uninstall" ]; then
        if [ -z "$uninstall" ]; then
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
        fi
        fi
        # libname.so -> libname.so.M.N
        # libname.so -> libname.so.M.N
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
        if [ -z "$uninstall" ]; then
        if [ -z "$uninstall" ]; then
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
        fi
        fi
        ;;
        ;;
solaris2*|aix4.[2-9]*|hpux1*)
solaris2*|aix4.[2-9]*|hpux1*)
        # libname.so -> libname.so.M
        # libname.so -> libname.so.M
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
        if [ -z "$uninstall" ]; then
        if [ -z "$uninstall" ]; then
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
        fi
        fi
        ;;
        ;;
*)      ;;
*)      ;;
esac
esac
exit 0
exit 0
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.