Guido van Rossum | a93b504 | 1996-08-08 19:06:31 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # |
| 3 | # ============================================================================ |
| 4 | # FILE: defmakexp_aix |
| 5 | # TYPE: standalone executable |
| 6 | # SYSTEM: AIX, Solaris |
| 7 | # |
| 8 | # DESCRIPTION: This script creates the default export list file "python.exp" |
| 9 | # for AIX platforms which has to be included in the Modules |
| 10 | # directory of the python source tree. |
| 11 | # It contains all global symbols defined in the following files: |
| 12 | # a) main.o config.o getpath.o |
| 13 | # b) libModules.a libPython.a libObjects.a libParser.a |
| 14 | # |
| 15 | # The script should be run after a new unpack, configure & make |
| 16 | # of the python release, without any options nor changes to |
| 17 | # Modules/Setup.in (i.e. a default static build). |
| 18 | # |
| 19 | # USAGE: defmakexp_aix [path] |
| 20 | # |
| 21 | # where [path] points to the Python source root directory. |
| 22 | # ============================================================================ |
| 23 | # |
| 24 | |
| 25 | |
| 26 | # |
| 27 | # Check for AIX or Solaris |
| 28 | # |
| 29 | if (test `uname -s` != "AIX") && |
| 30 | (test `uname -s` != "IRIX") && |
| 31 | (test `uname -s` != "SunOS" || test `uname -r | cut -d. -f1` != "5"); then |
| 32 | echo "*** Make sure you are running AIX or Solaris" |
| 33 | exit 1 |
| 34 | fi |
| 35 | |
| 36 | if test "$*" = ""; then |
| 37 | echo "Usage: defmakexp_aix [path to python's source root directory]" |
| 38 | exit 1 |
| 39 | fi |
| 40 | |
| 41 | # |
| 42 | # Variables |
| 43 | # |
| 44 | ROOTDIR=$1 |
| 45 | MODSDIR=$ROOTDIR/Modules |
| 46 | PYTHDIR=$ROOTDIR/Python |
| 47 | OBJSDIR=$ROOTDIR/Objects |
| 48 | PARSDIR=$ROOTDIR/Parser |
| 49 | |
| 50 | OBJFILES="$MODSDIR/main.o $MODSDIR/config.o $MODSDIR/getpath.o" |
| 51 | LIBFILES="$MODSDIR/libModules.a $OBJSDIR/libObjects.a $PARSDIR/libParser.a" |
| 52 | LIBFILES="$LIBFILES $PYTHDIR/libPython.a" |
| 53 | ALLFILES="$OBJFILES $LIBFILES" |
| 54 | |
| 55 | # |
| 56 | # Check for object and library files |
| 57 | # |
| 58 | for i in $ALLFILES; do |
| 59 | echo "checking for $i" |
| 60 | if test ! -f $i; then echo "*** Cannot find $i"; exit 1; fi |
| 61 | done |
| 62 | |
| 63 | # |
| 64 | # Setup the header of Modules/python.exp |
| 65 | # |
| 66 | pyexp=$MODSDIR/python.exp |
| 67 | echo "making export list $pyexp" |
| 68 | echo "#!" > $pyexp |
| 69 | echo "*" >> $pyexp |
| 70 | echo "* ========================================================= " >> $pyexp |
| 71 | echo "* This is the default export list of the python executable. " >> $pyexp |
| 72 | echo "* This file is used for the AIX platform ONLY. It provides " >> $pyexp |
| 73 | echo "* a list of all variables in the python executable that are " >> $pyexp |
| 74 | echo "* "exported" -- that is, which may be used by any extension " >> $pyexp |
| 75 | echo "* modules that are created. This file should be used as an " >> $pyexp |
| 76 | echo "* AIX "import" file when creating extension modules on that " >> $pyexp |
| 77 | echo "* platform. " >> $pyexp |
| 78 | echo "* " >> $pyexp |
| 79 | echo "* This file was generated from the default configuration of " >> $pyexp |
| 80 | echo "* the distribution (that is, from a build in which NONE of " >> $pyexp |
| 81 | echo "* the python Modules were built as shared libraries). " >> $pyexp |
| 82 | echo "* " >> $pyexp |
| 83 | echo "* THIS FILE IS OVERWRITTEN anytime the python executable is " >> $pyexp |
| 84 | echo "* re-built using a Modules/Setup file that was customized " >> $pyexp |
| 85 | echo "* to call for the building of some or all python Modules as " >> $pyexp |
| 86 | echo "* shared libraries and with the definition of LINKCC having " >> $pyexp |
| 87 | echo "* been uncommented. A new python.exp will be generated by " >> $pyexp |
| 88 | echo "* such a build; it will list ONLY the global symbols which " >> $pyexp |
| 89 | echo "* are defined in the statically-bound modules and libraries." >> $pyexp |
| 90 | echo "* ========================================================= " >> $pyexp |
| 91 | echo "*" >> $pyexp |
| 92 | |
| 93 | # |
| 94 | # Make the export list |
| 95 | # |
| 96 | if test `uname -s` = "AIX"; then |
| 97 | nmflags='-Bex' |
| 98 | else |
| 99 | nmflags='-p' |
| 100 | fi |
| 101 | : ${nm=nm} |
| 102 | $nm $nmflags $ALLFILES \ |
| 103 | | sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' \ |
| 104 | | sort | uniq >> $pyexp |
| 105 | |
| 106 | echo "done" |