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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [readline/] [support/] [shlib-install] - Blame information for rev 841

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
#! /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 [-b bin-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 [-b bin-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
        -b)     shift; BINDIR="$1" ; shift ;;
27
        -i)     shift; INSTALLPROG="$1" ; shift ;;
28
        -D)     echo=echo ; shift ;;
29
        -U)     uninstall=true ; shift ;;
30
        -*)     echo "$USAGE" >&2 ; exit 2;;
31
        *)      break ;;
32
        esac
33
done
34
 
35
# set install target name
36
LIBNAME="$1"
37
 
38
if [ -z "$LIBNAME" ]; then
39
        echo "$USAGE" >&2
40
        exit 2
41
fi
42
 
43
OLDSUFF=old
44
MV=mv
45
RM="rm -f"
46
LN="ln -s"
47
 
48
# pre-install
49
 
50
if [ -z "$uninstall" ]; then
51
        ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
52
        if [ -f "$INSTALLDIR/$LIBNAME" ]; then
53
                ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
54
        fi
55
fi
56
 
57
# install/uninstall
58
 
59
if [ -z "$uninstall" ] ; then
60
        ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
61
else
62
        ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
63
fi
64
 
65
# post-install/uninstall
66
 
67
# HP-UX and Darwin/MacOS X require that a shared library have execute permission
68
# Cygwin installs both a dll (which must go in $BINDIR) and an implicit
69
# link library (in $libdir)
70
case "$host_os" in
71
hpux*|darwin*|macosx*)
72
        if [ -z "$uninstall" ]; then
73
                chmod 555 ${INSTALLDIR}/${LIBNAME}
74
        fi ;;
75
cygwin*)
76
        IMPLIBNAME=`echo ${LIBNAME} \
77
                | sed -e 's,^cyg,lib,' -e 's,[0-9]*.dll$,.dll.a,'`
78
        if [ -z "$uninstall" ]; then
79
                ${echo} $RM ${BINDIR}/${LIBNAME}.${OLDSUFF}
80
                if [ -f "$BINDIR/$LIBNAME" ]; then
81
                        ${echo} $MV $BINDIR/$LIBNAME $BINDIR/$LIBNAME.$OLDSUFF
82
                fi
83
                ${echo} $MV ${INSTALLDIR}/${LIBNAME} ${BINDIR}/${LIBNAME}
84
                ${echo} chmod a+x ${BINDIR}/${LIBNAME}
85
                ${echo} eval ${INSTALLPROG} ${LIBNAME}.a \
86
                        ${INSTALLDIR}/${IMPLIBNAME}
87
        else
88
                ${echo} ${RM} ${BINDIR}/${LIBNAME}
89
                ${echo} ${RM} ${INSTALLDIR}/${IMPLIBNAME}
90
        fi ;;
91
 
92
*)      ;;
93
esac
94
 
95
case "$LIBNAME" in
96
*.*.[0-9].[0-9])        # libname.so.M.N
97
        LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'`    # libname.so.M
98
        LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'`    # libname.so
99
        ;;
100
*.*.[0-9])              # libname.so.M
101
        LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'`           # libname.so
102
        ;;
103
*.[0-9])                # libname.M
104
        LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'`               # libname
105
        ;;
106
*.[0-9].[0-9].dylib)    # libname.M.N.dylib
107
        LINK2=`echo $LIBNAME | sed 's:\(.*\.[0-9]\)\.[0-9]:\1:'`        # libname.M.dylib
108
        LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]\.[0-9]:\1:'`        # libname.dylib
109
esac
110
 
111
INSTALL_LINK1='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
112
INSTALL_LINK2='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
113
 
114
#
115
# Create symlinks to the installed library.  This section is incomplete.
116
#
117
case "$host_os" in
118
*linux*)
119
        # libname.so.M -> libname.so.M.N
120
        ${echo} ${RM} ${INSTALLDIR}/$LINK2
121
        if [ -z "$uninstall" ]; then
122
                eval $INSTALL_LINK2
123
        fi
124
 
125
        # libname.so -> libname.so.M
126
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
127
        if [ -z "$uninstall" ]; then
128
                ${echo} cd $INSTALLDIR && ${echo} ${LN} $LINK2 $LINK1
129
        fi
130
        ;;
131
 
132
bsdi4*|*gnu*|darwin*|macosx*|k*bsd*-gnu)
133
        # libname.so.M -> libname.so.M.N
134
        ${echo} ${RM} ${INSTALLDIR}/$LINK2
135
        if [ -z "$uninstall" ]; then
136
                eval $INSTALL_LINK2
137
        fi
138
 
139
        # libname.so -> libname.so.M.N
140
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
141
        if [ -z "$uninstall" ]; then
142
                eval $INSTALL_LINK1
143
        fi
144
        ;;
145
 
146
solaris2*|aix4.[2-9]*|osf*|irix[56]*|sysv[45]*|dgux*)
147
        # libname.so -> libname.so.M
148
        ${echo} ${RM} ${INSTALLDIR}/$LINK1
149
        if [ -z "$uninstall" ]; then
150
                eval $INSTALL_LINK1
151
        fi
152
        ;;
153
 
154
 
155
# FreeBSD 3.x and above can have either a.out or ELF shared libraries
156
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*)
157
        if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
158
                # libname.so -> libname.so.M
159
                ${echo} ${RM} ${INSTALLDIR}/$LINK1
160
                if [ -z "$uninstall" ]; then
161
                        eval $INSTALL_LINK1
162
                fi
163
        else
164
                # libname.so.M -> libname.so.M.N
165
                ${echo} ${RM} ${INSTALLDIR}/$LINK2
166
                if [ -z "$uninstall" ]; then
167
                        eval $INSTALL_LINK2
168
                fi
169
 
170
                # libname.so -> libname.so.M.N
171
                ${echo} ${RM} ${INSTALLDIR}/$LINK1
172
                if [ -z "$uninstall" ]; then
173
                        eval $INSTALL_LINK1
174
                fi
175
        fi
176
        ;;
177
 
178
hpux1*)
179
        # libname.sl -> libname.M
180
        ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
181
        if [ -z "$uninstall" ]; then
182
                eval $INSTALL_LINK1
183
        fi
184
        ;;
185
 
186
cygwin*)
187
        # Links to .dlls don't work.  Hence shobj-conf used DLLVERSION.dll
188
        # instead of so.SHLIB_MAJOR.SHLIB_MINOR.  The postinstall above
189
        # took care of everything else.
190
        ;;
191
 
192
*)      ;;
193
esac
194
 
195
exit 0

powered by: WebSVN 2.1.0

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