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

  1. #!/bin/sh
  2.  
  3. # Make an AIX shared library (tricky!!!)
  4. # Based on a script from Athanasios G. Gaitatzes (gaitat@vnet.ibm.com)
  5.  
  6.  
  7. # First argument is name of output library
  8. # Rest of arguments are object files
  9.  
  10.  
  11. # Name of the library which clients will link with (ex: libMesaGL.a)
  12. LIBRARY=$1
  13.  
  14. # BASENAME = LIBRARY without .a suffix
  15. BASENAME=`echo ${LIBRARY} | sed "s/\.a//g"`
  16.  
  17. # Name of exports file
  18. EXPFILE=${BASENAME}.exp
  19.  
  20. # Name of temporary shared lib file
  21. OFILE=shr.o
  22. ####OFILE=${BASENAME}.o
  23.  
  24. # List of object files to put into library
  25. shift 1
  26. OBJECTS=$*
  27.  
  28.  
  29. # Remove any old files from previous make
  30. rm -f ${LIBRARY} ${EXPFILE} ${OFILE}
  31.  
  32.  
  33. # Determine how to invoke nm depending on AIX version
  34. AIXVERSION=`uname -v`
  35. case ${AIXVERSION}
  36. {
  37.     3*)
  38.         NM=/usr/ucb/nm
  39.         ;;
  40.     4*)
  41.         NM=/usr/bin/nm -B
  42.         ;;
  43.     *)
  44.         echo "Error in mklib.aix!"
  45.         exit 1
  46.         ;;
  47. }
  48.  
  49.  
  50.  
  51.  
  52. # Other libraries which we may be dependent on.  Since we make the libraries
  53. # in the order libMesaGL.a, libMesaGLU.a, libMesatk.a, libMesaaux.a each
  54. # just depends on its predecessor.
  55. OTHERLIBS=`ls ../lib/lib*.a`
  56.  
  57. ##echo OTHERLIBS are ${OTHERLIBS}
  58.  
  59.  
  60.  
  61.  
  62. # Make exports (.exp) file header
  63. echo "#! ${LIBRARY}" > ${EXPFILE}
  64. echo "noentry" >> ${EXPFILE}
  65.  
  66. # Append list of exported symbols to exports file
  67. ${NM} ${OBJECTS} | awk '/ [BD] /{print $3}' | sort | uniq >> ${EXPFILE}
  68.  
  69.  
  70. # This next line is a hack to allow full compatibility with IBM's OpenGL
  71. # libraries.  IBM mistakenly exports glLoadIdentity from the libGLU.a
  72. # library.  We have to do the same thing.  Problem reported by Yemi Adesanya
  73. # (adesanya@afsmail.cern.ch) and Patrick Brown (pbrown@austin.ibm.com)
  74. if [ "${BASENAME}" = libMesaGLU ] ; then
  75.     echo "glLoadIdentity" >> ${EXPFILE}
  76. fi
  77.  
  78.  
  79. # Make the shared lib file
  80. cc -o ${OFILE} ${OBJECTS} -L../lib ${OTHERLIBS} -lX11 -lm -lc -bE:${EXPFILE} -bM:SRE -enoentry
  81.  
  82.  
  83. # Make the .a file
  84. ar ruv ${LIBRARY} ${OFILE}
  85.  
  86. # Put exports file in Mesa lib directory
  87. mv ${EXPFILE} ../lib
  88.  
  89. # Remove OFILE
  90. rm -f ${OFILE}
  91.  
  92.  
  93. #NOTES
  94. # AIX 4.x /usr/bin/nm -B patch from ssclift@mach.me.queensu.ca (Simon Clift)
  95.  
  96.