3 # shlib-install - install a shared library and do any necessary host-specific
4 # post-installation configuration (like ldconfig)
6 # usage: shlib-install [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library
14 INSTALLDIR
=/usr
/local
/lib
17 PROGNAME
=`basename $0`
18 USAGE
="$PROGNAME [-D] -O host_os -d installation-dir [-b bin-dir] -i install-prog [-U] library"
22 while [ $# -gt 0 ]; do
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;;
35 # set install target name
38 if [ -z "$LIBNAME" ]; then
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}
59 if [ -z "$uninstall" ] ; then
60 ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
62 ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
65 # post-install/uninstall
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)
71 hpux
*|darwin
*|macosx
*)
72 if [ -z "$uninstall" ]; then
73 chmod 555 ${INSTALLDIR}/${LIBNAME}
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
83 ${echo} $MV ${INSTALLDIR}/${LIBNAME} ${BINDIR}/${LIBNAME}
84 ${echo} chmod a+x ${BINDIR}/${LIBNAME}
85 ${echo} eval ${INSTALLPROG} ${LIBNAME}.a \
86 ${INSTALLDIR}/${IMPLIBNAME}
88 ${echo} ${RM} ${BINDIR}/${LIBNAME}
89 ${echo} ${RM} ${INSTALLDIR}/${IMPLIBNAME}
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
100 *.
*.
[0-9]) # libname.so.M
101 LINK1
=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so
104 LINK1
=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'` # libname
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
111 INSTALL_LINK1
='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK1'
112 INSTALL_LINK2
='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
115 # Create symlinks to the installed library. This section is incomplete.
119 # libname.so.M -> libname.so.M.N
120 ${echo} ${RM} ${INSTALLDIR}/$LINK2
121 if [ -z "$uninstall" ]; then
125 # libname.so -> libname.so.M
126 ${echo} ${RM} ${INSTALLDIR}/$LINK1
127 if [ -z "$uninstall" ]; then
128 ${echo} cd $INSTALLDIR && ${echo} ${LN} $LINK2 $LINK1
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
139 # libname.so -> libname.so.M.N
140 ${echo} ${RM} ${INSTALLDIR}/$LINK1
141 if [ -z "$uninstall" ]; then
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
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
164 # libname.so.M -> libname.so.M.N
165 ${echo} ${RM} ${INSTALLDIR}/$LINK2
166 if [ -z "$uninstall" ]; then
170 # libname.so -> libname.so.M.N
171 ${echo} ${RM} ${INSTALLDIR}/$LINK1
172 if [ -z "$uninstall" ]; then
179 # libname.sl -> libname.M
180 ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
181 if [ -z "$uninstall" ]; then
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.
This page took 0.033299 seconds and 4 git commands to generate.