Latest AIX changes from Vlad

This commit is contained in:
Guido van Rossum 1996-08-08 19:06:31 +00:00
parent b6b43e00f8
commit a93b504a23
2 changed files with 131 additions and 11 deletions

106
Modules/defmakexp_aix Executable file
View File

@ -0,0 +1,106 @@
#! /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"

View File

@ -8,8 +8,15 @@
# DESCRIPTION: Creates a shareable .o from a pre-compiled (unshared)
# .o file
#
# ARGUMENTS: Same as for "ld". The -bM, -bE, -bI, -H, -T, and -lc
# arguments of "ld" will be supplied by this script.
# USAGE: ld_so_aix [CC] [arguments]
#
# ARGUMENTS: Same as for "ld". The -bM, -bE, -bI, -H, -T, and -lm
# arguments will be supplied by this script. The compiler
# specific ("-lc" or "-lc_r", "-lpthreads", etc) arguments
# will be automatically passed to "ld" according to the CC
# command provided as a first argument to this script.
# Usually, the same CC command was used to produce the
# pre-compiled .o file.
#
# NOTES: 1. Currently specific to the building of Python
# interpreter shared objects, in that the entry
@ -23,7 +30,11 @@
# 3. Uncommenting the "echo" lines gives detailed output
# about the commands executed in the script.
#
# HISTORY: Jul-1-1996 -- Make sure to use /usr/ccs/bin/ld --
# HISTORY: Aug-6-1996 -- Take care of the compiler specific --
# -- args by leaving CC to invoke "ld". --
# Vladimir Marangozov
#
# Jul-1-1996 -- Make sure to use /usr/ccs/bin/ld --
# -- Use makexp_aix for the export list. --
# Vladimir Marangozov (Vladimir.Marangozov@imag.fr)
#
@ -32,19 +43,24 @@
#
# Variables
objfile=$1
shift
CC=$1; shift
objfile=$1; shift
filename=`echo $objfile | sed -e "s:.*/\([^/]*\)$:\1:" -e "s/\..*$//"`
entry=init`echo $filename | sed "s/module.*//"`
ldopts="-e$entry -bE:$filename.exp -bI:python.exp -bM:SRE -T512 -H512 -lc"
ldargs="$objfile $*"
expfile="$filename.exp"
impfile="python.exp"
CCOPT="-Wl,-e$entry -Wl,-bE:$expfile -Wl,-bI:$impfile"
CCOPT="$CCOPT -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -lm"
CCARGS="$objfile $*"
# Export list generation
makexp_aix $filename.exp "$objfile" $objfile
# Perform the link.
#echo "ld $ldopts $ldargs"
/usr/ccs/bin/ld $ldopts $ldargs
#echo $CC $CCOPT $CCARGS
$CC $CCOPT $CCARGS
# Delete the module's export list file.
# Comment this line if you need it.
@ -54,5 +70,3 @@ rm -f $filename.exp
#echo chmod -x `echo $objfile | sed "s/\.o$/.so/"`
chmod -x `echo $objfile | sed "s/\.o$/.so/"`