blob: 23895d2d3737ac7ae620a7fd814a88fb2f0705a8 [file] [log] [blame]
#! /bin/sh
#
# ============================================================================
# FILE: defmakexp_aix
# TYPE: standalone executable
# SYSTEM: AIX, Solaris
#
# DESCRIPTION: This script creates the default export list file "python.exp"
# for AIX platforms which has to be included in the Modules
# directory of the python source tree.
# It contains all global symbols defined in the following files:
# a) main.o config.o getpath.o
# b) libModules.a libPython.a libObjects.a libParser.a
#
# The script should be run after a new unpack, configure & make
# of the python release, without any options nor changes to
# Modules/Setup.in (i.e. a default static build).
#
# USAGE: defmakexp_aix [path]
#
# where [path] points to the Python source root directory.
# ============================================================================
#
#
# Check for AIX or Solaris
#
if (test `uname -s` != "AIX") &&
(test `uname -s` != "IRIX") &&
(test `uname -s` != "SunOS" || test `uname -r | cut -d. -f1` != "5"); then
echo "*** Make sure you are running AIX or Solaris"
exit 1
fi
if test "$*" = ""; then
echo "Usage: defmakexp_aix [path to python's source root directory]"
exit 1
fi
#
# Variables
#
ROOTDIR=$1
MODSDIR=$ROOTDIR/Modules
PYTHDIR=$ROOTDIR/Python
OBJSDIR=$ROOTDIR/Objects
PARSDIR=$ROOTDIR/Parser
OBJFILES="$MODSDIR/main.o $MODSDIR/config.o $MODSDIR/getpath.o"
LIBFILES="$MODSDIR/libModules.a $OBJSDIR/libObjects.a $PARSDIR/libParser.a"
LIBFILES="$LIBFILES $PYTHDIR/libPython.a"
ALLFILES="$OBJFILES $LIBFILES"
#
# Check for object and library files
#
for i in $ALLFILES; do
echo "checking for $i"
if test ! -f $i; then echo "*** Cannot find $i"; exit 1; fi
done
#
# Setup the header of Modules/python.exp
#
pyexp=$MODSDIR/python.exp
echo "making export list $pyexp"
echo "#!" > $pyexp
echo "*" >> $pyexp
echo "* ========================================================= " >> $pyexp
echo "* This is the default export list of the python executable. " >> $pyexp
echo "* This file is used for the AIX platform ONLY. It provides " >> $pyexp
echo "* a list of all variables in the python executable that are " >> $pyexp
echo "* "exported" -- that is, which may be used by any extension " >> $pyexp
echo "* modules that are created. This file should be used as an " >> $pyexp
echo "* AIX "import" file when creating extension modules on that " >> $pyexp
echo "* platform. " >> $pyexp
echo "* " >> $pyexp
echo "* This file was generated from the default configuration of " >> $pyexp
echo "* the distribution (that is, from a build in which NONE of " >> $pyexp
echo "* the python Modules were built as shared libraries). " >> $pyexp
echo "* " >> $pyexp
echo "* THIS FILE IS OVERWRITTEN anytime the python executable is " >> $pyexp
echo "* re-built using a Modules/Setup file that was customized " >> $pyexp
echo "* to call for the building of some or all python Modules as " >> $pyexp
echo "* shared libraries and with the definition of LINKCC having " >> $pyexp
echo "* been uncommented. A new python.exp will be generated by " >> $pyexp
echo "* such a build; it will list ONLY the global symbols which " >> $pyexp
echo "* are defined in the statically-bound modules and libraries." >> $pyexp
echo "* ========================================================= " >> $pyexp
echo "*" >> $pyexp
#
# Make the export list
#
if test `uname -s` = "AIX"; then
nmflags='-Bex'
else
nmflags='-p'
fi
: ${nm=nm}
$nm $nmflags $ALLFILES \
| sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' \
| sort | uniq >> $pyexp
echo "done"