Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mklib.aix 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #!/bin/ksh
  2. # Make an AIX shared library (tricky!!!)
  3. # Based on a script from Athanasios G. Gaitatzes (gaitat@vnet.ibm.com)
  4. # Improved by Greg Thompson <gregt@visix.com> -gt
  5. #--identification------------------------------------------------------
  6. # $Id: mklib.aix,v 1.1 1999/08/19 13:52:56 brianp Exp $
  7. # $Log: mklib.aix,v $
  8. # Revision 1.1 1999/08/19 13:52:56 brianp
  9. # initial check-in (post-crash)
  10. #
  11. #--common--------------------------------------------------------------
  12. # Usage: mklib libname major minor file.o ...
  13. #
  14. # First argument is name of output library (LIBRARY)
  15. # Second arg is major version number (MAJOR)
  16. # Third arg is minor version number (MINOR)
  17. # Rest of arguments are object files (OBJECTS)
  18. LIBRARY=$1
  19. shift 1
  20. MAJOR=$1
  21. shift 1
  22. MINOR=$1
  23. shift 1
  24. OBJECTS=$*
  25. #--platform------------------------------------------------------------
  26. # BASENAME = LIBRARY without .a suffix
  27. BASENAME=`echo ${LIBRARY} | sed "s/\.a//g"`
  28. # Name of exports file
  29. EXPFILE=${BASENAME}.exp
  30. # Name of temporary shared lib file
  31. OFILE=shr.o
  32. ####OFILE=${BASENAME}.o
  33. # Remove any old files from previous make
  34. rm -f ${LIBRARY} ${EXPFILE} ${OFILE}
  35. # Pick a way to use nm -gt
  36. NM=${NM-/bin/nm -eC}
  37. # Determine which version of AIX this is
  38. AIXVERSION=`uname -v`
  39. # Pick a way to tell the linker there's no entrypoint -gt
  40. case ${AIXVERSION}
  41. {
  42. 3*)
  43. ENTRY='-e _nostart'
  44. ;;
  45. 4*)
  46. ENTRY=-bnoentry
  47. ;;
  48. *)
  49. echo "Error in mklib.aix!"
  50. exit 1
  51. ;;
  52. }
  53. # Other libraries which we may be dependent on. Since we make the libraries
  54. # in the order libGL.a, libaGLU.a, libglut.a just depends on its predecessor.
  55. # modified to make otherlibs in the form of -lfoo -gt
  56. OTHERLIBS=`ls ../lib/*.a | sed "s/..\/lib\/lib/-l/g" | sed "s/\.a//g"`
  57. ##echo OTHERLIBS are ${OTHERLIBS}
  58. # Make exports (.exp) file header
  59. echo "#! ${LIBRARY}" > ${EXPFILE}
  60. # Append list of exported symbols to exports file -gt
  61. case ${AIXVERSION}
  62. {
  63. 3*)
  64. ${NM} ${OBJECTS} | awk -F'|' '{
  65. if ($3 != "extern" || substr($7,1,1) == " ") continue
  66. sub (" *", "", $1); sub (" *", "", $7)
  67. if ( (($7 == ".text") || ($7 == ".data") || ($7 == ".bss")) \
  68. && ( substr($1,1,1) != ".")) {
  69. if (substr ($1, 1, 7) != "__sinit" &&
  70. substr ($1, 1, 7) != "__sterm") {
  71. if (substr ($1, 1, 5) == "__tf1")
  72. print (substr ($1, 7))
  73. else if (substr ($1, 1, 5) == "__tf9")
  74. print (substr ($1, 15))
  75. else
  76. print $1
  77. }
  78. }
  79. }' | sort -u >> ${EXPFILE}
  80. ;;
  81. 4*)
  82. ${NM} ${OBJECTS} | awk '{
  83. if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
  84. && ( substr($1,1,1) != ".")) {
  85. if (substr ($1, 1, 7) != "__sinit" &&
  86. substr ($1, 1, 7) != "__sterm") {
  87. if (substr ($1, 1, 5) == "__tf1")
  88. print (substr ($1, 7))
  89. else if (substr ($1, 1, 5) == "__tf9")
  90. print (substr ($1, 15))
  91. else
  92. print $1
  93. }
  94. }
  95. }' | sort -u >> ${EXPFILE}
  96. ;;
  97. }
  98. # This next line is a hack to allow full compatibility with IBM's OpenGL
  99. # libraries. IBM mistakenly exports glLoadIdentity from the libGLU.a
  100. # library. We have to do the same thing. Problem reported by Yemi Adesanya
  101. # (adesanya@afsmail.cern.ch) and Patrick Brown (pbrown@austin.ibm.com)
  102. if [ "${BASENAME}" = libGLU ] ; then
  103. echo "glLoadIdentity" >> ${EXPFILE}
  104. fi
  105. # Make the shared lib file
  106. cc -o ${OFILE} ${OBJECTS} -L../lib ${OTHERLIBS} -lX11 -lXext -lXmu -lXi -lm -lc -bE:${EXPFILE} -bM:SRE ${ENTRY}
  107. # Make the .a file
  108. ar ruv ${LIBRARY} ${OFILE}
  109. # Put exports file in Mesa lib directory
  110. mv ${EXPFILE} ../lib
  111. # Remove OFILE
  112. rm -f ${OFILE}
  113. #NOTES
  114. # AIX 4.x /usr/bin/nm -B patch from ssclift@mach.me.queensu.ca (Simon Clift)
  115. # Robustified symbol extraction for AIX 3 and 4
  116. # Greg Thompson <gregt@visix.com>