#!/bin/sh # Make a Linux ELF shared library #--identification------------------------------------------------------ # $Id: mklib.linux,v 1.2 2004/04/09 14:47:13 wes Exp $ # $Log: mklib.linux,v $ # Revision 1.2 2004/04/09 14:47:13 wes # Added new build targets: linux-x86_64, linux-x86_64-debug, linux-x86_32, # and linux-x86_32-debug. # # Revision 1.1.1.1 2003/01/28 02:15:23 wes # Manual rebuild of rm150 repository. # # Revision 1.4 2002/11/14 15:30:36 wes # Modified to include dependency libs when making a Linux ELF # shared object library. Contribution from Joel Crisp. # # Revision 1.3 2001/06/03 20:56:31 wes # JDB enhancements. # # Revision 1.2 2000/10/03 11:36:50 wes # Replaced multiple IRIX mklibs with a single version that # accommodates all species of builds. # # Revision 1.1.1.1 2000/02/28 21:29:40 wes # OpenRM 1.2 Checkin # # Revision 1.1.1.1 2000/02/28 17:18:48 wes # Initial entry - pre-RM120 release, source base for OpenRM 1.2. # # Revision 1.3 1999/07/24 18:35:43 wes # Added debug targets for solaris, linux. # # Revision 1.2 1999/07/09 02:19:15 wes # Shared obj's for linux, solaris. # # Revision 1.8 1997/10/21 23:32:31 brianp # now takes major and minor version arguments # #--common-------------------------------------------------------------- # Usage: mklib # # are arcitecture specific build flags # is name of output library (LIBRARY) # is major version number (MAJOR) # is minor version number (MINOR) # remaining arguments are object files (OBJECTS) # # added local installation target prefix (RM_INSTALL) # tidied up the build # # 04/23/01 jdb # ARCHFLAGS=$1 shift 1 LIBRARY=$1 shift 1 MAJOR=$1 shift 1 MINOR=$1 shift 1 VERSION=$MAJOR.$MINOR OBJECTS=$* DEPLIBS="-lGL -lGLU -L/usr/X11R6/lib -lX11 -lXmu" #--platform------------------------------------------------------------ # build library objects echo "Building shared object $LIBRARY.so.$VERSION and the archive library $LIBRARY.a" \rm -f ${LIBRARY}.a ${LIBRARY}.so.${VERSION} ar qv ${LIBRARY}.a ${OBJECTS} # Stuff for x86_64 machines LDFLAGS="" case $ARCHFLAGS in 32*) LDFLAGS="-m32";; 64*) LDFLAGS="-m64" DEPLIBS="-lGL -L/usr/X11R6/lib64 -lX11";; esac # Linux specific build gcc ${LDFLAGS} -shared -Wl,-soname,${LIBRARY}.so.${VERSION} -o ${LIBRARY}.so.${VERSION} ${OBJECTS} ${DEPLIBS} if [[ ${ARCHFLAGS##*-} != "debug" ]]; then strip ${LIBRARY}.so.${VERSION} echo "library has been stripped (non-debug build)." fi # code tree cp ${LIBRARY}.a ${LIBRARY}.so.${VERSION} ../lib \rm -f ../lib/${LIBRARY}.so ln -s ${LIBRARY}.so.${VERSION} ${LIBRARY}.so # local install if [[ -n ${RM_INSTALL} ]]; then echo "Installing ${LIBRARY} librairies locally in ${RM_INSTALL}/lib..." \cp -f ${LIBRARY}.a ${LIBRARY}.so.${VERSION} ${RM_INSTALL}/lib \rm -f ${RM_INSTALL}/lib/${LIBRARY}.so ln -s ${RM_INSTALL}/lib/${LIBRARY}.so.${VERSION} ${RM_INSTALL}/lib/${LIBRARY}.so ldconfig echo "Local ${LIBRARY} librairies installed." fi