blob: 23895d2d3737ac7ae620a7fd814a88fb2f0705a8 [file] [log] [blame]
Guido van Rossuma93b5041996-08-08 19:06:31 +00001#! /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#
29if (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
34fi
35
36if test "$*" = ""; then
37 echo "Usage: defmakexp_aix [path to python's source root directory]"
38 exit 1
39fi
40
41#
42# Variables
43#
44ROOTDIR=$1
45MODSDIR=$ROOTDIR/Modules
46PYTHDIR=$ROOTDIR/Python
47OBJSDIR=$ROOTDIR/Objects
48PARSDIR=$ROOTDIR/Parser
49
50OBJFILES="$MODSDIR/main.o $MODSDIR/config.o $MODSDIR/getpath.o"
51LIBFILES="$MODSDIR/libModules.a $OBJSDIR/libObjects.a $PARSDIR/libParser.a"
52LIBFILES="$LIBFILES $PYTHDIR/libPython.a"
53ALLFILES="$OBJFILES $LIBFILES"
54
55#
56# Check for object and library files
57#
58for i in $ALLFILES; do
59 echo "checking for $i"
60 if test ! -f $i; then echo "*** Cannot find $i"; exit 1; fi
61done
62
63#
64# Setup the header of Modules/python.exp
65#
66pyexp=$MODSDIR/python.exp
67echo "making export list $pyexp"
68echo "#!" > $pyexp
69echo "*" >> $pyexp
70echo "* ========================================================= " >> $pyexp
71echo "* This is the default export list of the python executable. " >> $pyexp
72echo "* This file is used for the AIX platform ONLY. It provides " >> $pyexp
73echo "* a list of all variables in the python executable that are " >> $pyexp
74echo "* "exported" -- that is, which may be used by any extension " >> $pyexp
75echo "* modules that are created. This file should be used as an " >> $pyexp
76echo "* AIX "import" file when creating extension modules on that " >> $pyexp
77echo "* platform. " >> $pyexp
78echo "* " >> $pyexp
79echo "* This file was generated from the default configuration of " >> $pyexp
80echo "* the distribution (that is, from a build in which NONE of " >> $pyexp
81echo "* the python Modules were built as shared libraries). " >> $pyexp
82echo "* " >> $pyexp
83echo "* THIS FILE IS OVERWRITTEN anytime the python executable is " >> $pyexp
84echo "* re-built using a Modules/Setup file that was customized " >> $pyexp
85echo "* to call for the building of some or all python Modules as " >> $pyexp
86echo "* shared libraries and with the definition of LINKCC having " >> $pyexp
87echo "* been uncommented. A new python.exp will be generated by " >> $pyexp
88echo "* such a build; it will list ONLY the global symbols which " >> $pyexp
89echo "* are defined in the statically-bound modules and libraries." >> $pyexp
90echo "* ========================================================= " >> $pyexp
91echo "*" >> $pyexp
92
93#
94# Make the export list
95#
96if test `uname -s` = "AIX"; then
97 nmflags='-Bex'
98else
99 nmflags='-p'
100fi
101: ${nm=nm}
102$nm $nmflags $ALLFILES \
103| sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' \
104| sort | uniq >> $pyexp
105
106echo "done"