#!/bin/sh -x # Make a NetBSD ELF shared library # $Id: mklib.netbsd,v 1.1 2005/06/24 14:08: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 VERSION=$MAJOR.$MINOR OBJECTS=$* DEPLIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lGL -lGLU -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -lXmu -lm" ECHO_CMD=echo RM=rm AR=ar CC=cc STRIP_CMD=strip CP=cp LN=ln #--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}