summaryrefslogtreecommitdiffstats
path: root/Modules/defmakexp_aix
blob: 23895d2d3737ac7ae620a7fd814a88fb2f0705a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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"