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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [readline/] [support/] [shlib-install] - Blame information for rev 107

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
#! /bin/sh
2
#
3
# shlib-install - install a shared library and do any necessary host-specific
4
#                 post-installation configuration (like ldconfig)
5
#
6
# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library
7
#
8
# Chet Ramey
9
# chet@po.cwru.edu
10
 
11
#
12
# defaults
13
#
14
INSTALLDIR=/usr/local/lib
15
LDCONFIG=ldconfig
16
 
17
PROGNAME=`basename $0`
18
USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library"
19
 
20
# process options
21
 
22
while [ $# -gt 0 ]; do
23
        case "$1" in
24
        -O)     shift; host_os="$1"; shift ;;
25
        -d)     shift; INSTALLDIR="$1"; shift ;;
26
        -i)     shift; INSTALLPROG="$1" ; shift ;;
27
        -D)     echo=echo ; shift ;;
28
        -U)     uninstall=true ; shift ;;
29
        -*)     echo "$USAGE" >&2 ; exit 2;;
30
        *)      break ;;
31
        esac
32
done
33
 
34
# set install target name
35
LIBNAME="$1"
36
 
37
if [ -z "$LIBNAME" ]; then
38
        echo "$USAGE" >&2
39
        exit 2
40
fi
41
 
42
OLDSUFF=old
43
MV=mv
44
RM="rm -f"
45
LN="ln -s"
46
 
47
# pre-install
48
 
49
if [ -z "$uninstall" ]; then
50
        ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
51
        if [ -f "$INSTALLDIR/$LIBNAME" ]; then
52
                ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
53
        fi
54
fi
55
 
56
# install/uninstall
57
 
58
if [ -z "$uninstall" ] ; then
59
        ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
60
else
61
        ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
62
fi
63
 
64
# post-install/uninstall
65
 
66
case "$LIBNAME" in
67
*.*.[0-9].[0-9])        # libname.so.M.N
68
        LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'`    # libname.so.M
69
        LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'`    # libname.so
70
        ;;
71
*.*.[0-9])              # libname.so.M
72
        LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'`           # libname.so
73
        ;;
74
esac
75
 
76
#
77
# Create symlinks to the installed library.  This section is incomplete.
78
#
79
case "$host_os" in
80
*linux*|bsdi4*)
81
        # libname.so.M -> libname.so.M.N
82
        ${echo} ${RM} ${INSTALLDIR}/$LINK2
83
        if [ -z "$uninstall" ]; then
84
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
85
        fi
86
 
87
        # libname.so -> libname.so.M.N
88
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
89
        if [ -z "$uninstall" ]; then
90
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
91
        fi
92
        ;;
93
 
94
solaris2*|aix4.[2-9]*|hpux1*)
95
        # libname.so -> libname.so.M
96
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
97
        if [ -z "$uninstall" ]; then
98
                ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
99
        fi
100
        ;;
101
 
102
*)      ;;
103
esac
104
 
105
exit 0

powered by: WebSVN 2.1.0

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