#!/bin/sh # Make a FreeBSD ELF shared library # $Id: mklib.netbsd-pkgsrc,v 1.1 2005/06/26 18:46:29 wes Exp $ #--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 # # 12/11/03 Contributor: Igor_Pokrovsky at yahoo dot com # ARCHFLAGS=$1 shift 1 LIBRARY=$1 shift 1 MAJOR=$1 shift 1 MINOR=$1 shift 1 # we don't care about ${MINOR} here VERSION=$MAJOR.$MINOR OBJECTS=$* DEPLIBS="-Wl,-R${LOCALBASE}/lib -L${LOCALBASE}/lib -lGL -lGLU -Wl,-R${X11BASE}/lib -L${X11BASE}/lib -lXmu -lm" #--platform------------------------------------------------------------ # build library objects ${ECHO_CMD} "Building shared object $LIBRARY.so.$VERSION and the archive library $LIBRARY.a" ${RM} -f ${LIBRARY}.a ${LIBRARY}.so.${VERSION} ${AR} qv ${LIBRARY}.a ${OBJECTS} # FreeBSD specific build ${CC} -shared -Wl,-soname,${LIBRARY}.so.${VERSION} -o ${LIBRARY}.so.${VERSION} ${OBJECTS} ${DEPLIBS} if [ ${ARCHFLAGS##*-} != "debug" ]; then ${STRIP_CMD} ${LIBRARY}.so.${VERSION} ${ECHO_CMD} "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 ${LN} -s ${LIBRARY}.so.${VERSION} ${LIBRARY}.so.${MAJOR}