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 -i install-prog [-U] library
14 INSTALLDIR
=/usr
/local
/lib
17 PROGNAME
=`basename $0`
18 USAGE
="$PROGNAME [-D] -O host_os -d installation-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 -i) shift; INSTALLPROG
="$1" ; shift ;;
27 -D) echo=echo ; shift ;;
28 -U) uninstall
=true
; shift ;;
29 -*) echo "$USAGE" >&2 ; exit 2;;
34 # set install target name
37 if [ -z "$LIBNAME" ]; then
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}
58 if [ -z "$uninstall" ] ; then
59 ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME}
61 ${echo} ${RM} ${INSTALLDIR}/${LIBNAME}
64 # post-install/uninstall
66 # HP-UX and Darwin/MacOS X require that a shared library have execute permission
68 hpux
*|darwin
*|macosx
*)
69 if [ -z "$uninstall" ]; then
70 chmod 555 ${INSTALLDIR}/${LIBNAME}
76 *.
*.
[0-9].
[0-9]) # libname.so.M.N
77 LINK2
=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'` # libname.so.M
78 LINK1
=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'` # libname.so
80 *.
*.
[0-9]) # libname.so.M
81 LINK1
=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so
84 LINK1
=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'` # libname
86 *.
[0-9].
[0-9].dylib
) # libname.M.N.dylib
87 LINK2
=`echo $LIBNAME | sed 's:\(.*\.[0-9]\)\.[0-9]:\1:'` # libname.M.dylib
88 LINK1
=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]\.[0-9]:\1:'` # libname.dylib
91 INSTALL_LINK1
='cd $INSTALLDIR ; ln -s $LIBNAME $LINK1'
92 INSTALL_LINK2
='cd $INSTALLDIR ; ln -s $LIBNAME $LINK2'
95 # Create symlinks to the installed library. This section is incomplete.
98 *linux
*|bsdi4
*|
*gnu
*|darwin
*|macosx
*)
99 # libname.so.M -> libname.so.M.N
100 ${echo} ${RM} ${INSTALLDIR}/$LINK2
101 if [ -z "$uninstall" ]; then
102 ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK2
105 # libname.so -> libname.so.M.N
106 ${echo} ${RM} ${INSTALLDIR}/$LINK1
107 if [ -z "$uninstall" ]; then
108 ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
112 solaris2
*|aix4.
[2-9]*|osf
*|irix
[56]*|sysv
[45]*|dgux
*)
113 # libname.so -> libname.so.M
114 ${echo} ${RM} ${INSTALLDIR}/$LINK1
115 if [ -z "$uninstall" ]; then
116 ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
121 # FreeBSD 3.x and above can have either a.out or ELF shared libraries
122 freebsd
[3-9]*|freebsdelf
[3-9]*|freebsdaout
[3-9]*)
123 if [ -x /usr
/bin
/objformat
] && [ "`/usr/bin/objformat`" = "elf" ]; then
124 # libname.so -> libname.so.M
125 ${echo} ${RM} ${INSTALLDIR}/$LINK1
126 if [ -z "$uninstall" ]; then
127 ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
130 # libname.so.M -> libname.so.M.N
131 ${echo} ${RM} ${INSTALLDIR}/$LINK2
132 if [ -z "$uninstall" ]; then
133 ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK2
136 # libname.so -> libname.so.M.N
137 ${echo} ${RM} ${INSTALLDIR}/$LINK1
138 if [ -z "$uninstall" ]; then
139 ${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
145 # libname.sl -> libname.M
146 ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
147 if [ -z "$uninstall" ]; then
148 # ${echo} ln -s $LIBNAME ${INSTALLDIR}/${LINK1}.sl
149 ${echo} ln -s $LIBNAME ${INSTALLDIR}/${LINK1}
This page took 0.034249 seconds and 5 git commands to generate.