home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / mklib.linux < prev    next >
Text File  |  1996-05-27  |  1KB  |  49 lines

  1. #!/bin/sh
  2.  
  3. # Make a Linux ELF shared library
  4.  
  5. # First argument is name of output library
  6. # Rest of arguments are object files
  7.  
  8. LIBRARY=$1
  9.  
  10. shift 1
  11. OBJECTS=$*
  12.  
  13. # the following provided by Thomas Hiller (Hiller@tu-harburg.d400.de)
  14.  
  15. LIBMAJOR=1
  16. LIBMINOR=2
  17. LIBTINY=8
  18. VERSION="${LIBMAJOR}.${LIBMINOR}.${LIBTINY}"
  19.  
  20. LIBNAME=`basename $LIBRARY`
  21. ARNAME=`basename $LIBNAME .so`.a
  22. DIRNAME=`dirname $LIBRARY`
  23.  
  24. gcc -shared -Wl,-soname,${LIBNAME}.${LIBMAJOR} -o ${LIBRARY}.${VERSION} ${OBJECTS}
  25. (cd $DIRNAME; ln -s ${LIBNAME}.${VERSION} ${LIBNAME}.${LIBMAJOR})
  26.  
  27. ln -s ${LIBNAME}.${LIBMAJOR} ${LIBRARY}
  28.  
  29.  
  30. # also make regular .a files,
  31. # provided by Danek Duvall (duvall@dhduvall.student.princeton.edu)
  32.  
  33. ar cq ${DIRNAME}/${ARNAME} ${OBJECTS}
  34. ranlib ${DIRNAME}/${ARNAME}
  35.  
  36.  
  37. # Print a reminder about shared libs:
  38. DIR=`cd .. ; pwd`
  39. echo
  40. echo "******Be sure to add" ${DIR}"/lib to your LD_LIBRARY_PATH variable"
  41. echo
  42. sleep 2
  43.  
  44.  
  45.  
  46. #### NOTES:
  47. # One Mesa user reports having to run the "ldconfig -v" command to make
  48. # Linux aware of the shared libs.
  49.