mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Jaap V's changes plus a few of my own -- now it seems to work.
This commit is contained in:
parent
ed3112c1b5
commit
a873fcecdf
1 changed files with 43 additions and 17 deletions
|
@ -68,6 +68,7 @@ j = os.path.join
|
||||||
|
|
||||||
# Attempt to guess machine architecture
|
# Attempt to guess machine architecture
|
||||||
if os.path.exists('/usr/lib/libgl_s'): ARCH = 'sgi'
|
if os.path.exists('/usr/lib/libgl_s'): ARCH = 'sgi'
|
||||||
|
elif os.path.exists('/etc/issue'): ARCH = 'sequent'
|
||||||
else: ARCH = 'sun4'
|
else: ARCH = 'sun4'
|
||||||
|
|
||||||
# Site parametrizations (change to match your site)
|
# Site parametrizations (change to match your site)
|
||||||
|
@ -78,6 +79,9 @@ SRC = j(PYTHON, 'src') # Python source directory
|
||||||
BLD = j(PYTHON, 'build.' + ARCH) # Python build directory
|
BLD = j(PYTHON, 'build.' + ARCH) # Python build directory
|
||||||
#BLD = SRC # Use this if you build in SRC
|
#BLD = SRC # Use this if you build in SRC
|
||||||
|
|
||||||
|
LIBINST = '/ufs/guido/src/python/irix4/tmp/lib/python/lib' # installed libraries
|
||||||
|
INCLINST = '/ufs/guido/src/python/irix4/tmp/include/Py' # installed include files
|
||||||
|
|
||||||
# Other packages (change to match your site)
|
# Other packages (change to match your site)
|
||||||
DL = j(TOP, 'dl') # Top of the dl source tree
|
DL = j(TOP, 'dl') # Top of the dl source tree
|
||||||
DL_DLD = j(TOP, 'dl-dld') # The dl-dld source directory
|
DL_DLD = j(TOP, 'dl-dld') # The dl-dld source directory
|
||||||
|
@ -88,9 +92,14 @@ READLINE = j(TOP, 'readline.' + ARCH) # Top of the GNU Readline source tree
|
||||||
SUN_X11 = '/usr/local/X11R5/lib/libX11.a'
|
SUN_X11 = '/usr/local/X11R5/lib/libX11.a'
|
||||||
|
|
||||||
# File names (usually no need to change)
|
# File names (usually no need to change)
|
||||||
LIBP = j(BLD, 'libpython.a') # Main Python library
|
LIBP = [ # Main Python libraries
|
||||||
CONFIG = j(SRC, 'config.c') # Configuration source file
|
j(LIBINST, 'libPython.a'),
|
||||||
FMAIN = j(SRC, 'frozenmain.c') # Special main source file
|
j(LIBINST, 'libParser.a'),
|
||||||
|
j(LIBINST, 'libObjects.a'),
|
||||||
|
j(LIBINST, 'libModules.a')
|
||||||
|
]
|
||||||
|
CONFIG_IN = j(LIBINST, 'config.c.in') # Configuration source file
|
||||||
|
FMAIN = j(LIBINST, 'frozenmain.c') # Special main source file
|
||||||
|
|
||||||
# Libraries needed when linking. First tuple item is built-in module
|
# Libraries needed when linking. First tuple item is built-in module
|
||||||
# for which it is needed (or '*' for always), rest are ld arguments.
|
# for which it is needed (or '*' for always), rest are ld arguments.
|
||||||
|
@ -104,8 +113,7 @@ libdeps_sgi = [ \
|
||||||
('cd', '-lcdaudio', '-lds'), \
|
('cd', '-lcdaudio', '-lds'), \
|
||||||
('cl', '-lcl'), \
|
('cl', '-lcl'), \
|
||||||
('imgfile', '-limage', '-lgutil', '-lm'), \
|
('imgfile', '-limage', '-lgutil', '-lm'), \
|
||||||
('mpz', '/ufs/jh/src/gmp-1.2/libgmp.a'), \
|
('mpz', '/ufs/guido/src/gmp/libgmp.a'), \
|
||||||
('md5', '/ufs/jh/src/md5/md5.o'), \
|
|
||||||
('*', '-lsun'), \
|
('*', '-lsun'), \
|
||||||
('*', j(DL, 'libdl.a'), '-lmld'), \
|
('*', j(DL, 'libdl.a'), '-lmld'), \
|
||||||
('*', '-lmpc'), \
|
('*', '-lmpc'), \
|
||||||
|
@ -125,6 +133,14 @@ libdeps_sun4 = [ \
|
||||||
('*', '-ltermcap'), \
|
('*', '-ltermcap'), \
|
||||||
('*', '-lc'), \
|
('*', '-lc'), \
|
||||||
]
|
]
|
||||||
|
libdeps_sequent = [ \
|
||||||
|
('*', j(LIBINST, 'libreadline.a'), '-ltermcap'), \
|
||||||
|
('*', '-lsocket'), \
|
||||||
|
('*', '-linet'), \
|
||||||
|
('*', '-lnsl'), \
|
||||||
|
('*', '-lm'), \
|
||||||
|
('*', '-lc'), \
|
||||||
|
]
|
||||||
libdeps = eval('libdeps_' + ARCH)
|
libdeps = eval('libdeps_' + ARCH)
|
||||||
|
|
||||||
################################
|
################################
|
||||||
|
@ -223,7 +239,8 @@ def process(filename, addmodules):
|
||||||
else:
|
else:
|
||||||
if not quiet: print 'NOT writing frozen.c ...'
|
if not quiet: print 'NOT writing frozen.c ...'
|
||||||
#
|
#
|
||||||
if not dlmodules:
|
## if not dlmodules:
|
||||||
|
if 0:
|
||||||
config = CONFIG
|
config = CONFIG
|
||||||
if not quiet: print 'Using existing', config, '...'
|
if not quiet: print 'Using existing', config, '...'
|
||||||
else:
|
else:
|
||||||
|
@ -233,22 +250,30 @@ def process(filename, addmodules):
|
||||||
else:
|
else:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print 'Writing config.c with dl modules ...'
|
print 'Writing config.c with dl modules ...'
|
||||||
f = open(CONFIG, 'r')
|
f = open(CONFIG_IN, 'r')
|
||||||
g = open(config, 'w')
|
g = open(config, 'w')
|
||||||
m1 = regex.compile('-- ADDMODULE MARKER 1 --')
|
m1 = regex.compile('-- ADDMODULE MARKER 1 --')
|
||||||
m2 = regex.compile('-- ADDMODULE MARKER 2 --')
|
m2 = regex.compile('-- ADDMODULE MARKER 2 --')
|
||||||
|
builtinmodules = []
|
||||||
|
stdmodules = ('sys', '__main__', '__builtin__',
|
||||||
|
'marshal')
|
||||||
|
todomodules = builtinmodules + dlmodules
|
||||||
|
for mod in dict.keys():
|
||||||
|
if dict[mod] == '<builtin>' and \
|
||||||
|
mod not in stdmodules:
|
||||||
|
builtinmodules.append(mod)
|
||||||
while 1:
|
while 1:
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
if not line: break
|
if not line: break
|
||||||
g.write(line)
|
g.write(line)
|
||||||
if m1.search(line) >= 0:
|
if m1.search(line) >= 0:
|
||||||
if verbose: print 'Marker 1 ...'
|
if verbose: print 'Marker 1 ...'
|
||||||
for mod in dlmodules:
|
for mod in todomodules:
|
||||||
g.write('extern void init' + \
|
g.write('extern void init' + \
|
||||||
mod + '();\n')
|
mod + '();\n')
|
||||||
if m2.search(line) >= 0:
|
if m2.search(line) >= 0:
|
||||||
if verbose: print 'Marker 2 ...'
|
if verbose: print 'Marker 2 ...'
|
||||||
for mod in dlmodules:
|
for mod in todomodules:
|
||||||
g.write('{"' + mod + \
|
g.write('{"' + mod + \
|
||||||
'", init' + mod + '},\n')
|
'", init' + mod + '},\n')
|
||||||
g.close()
|
g.close()
|
||||||
|
@ -256,18 +281,19 @@ def process(filename, addmodules):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
if noexec: print 'Generating compilation commands ...'
|
if noexec: print 'Generating compilation commands ...'
|
||||||
else: print 'Starting compilation ...'
|
else: print 'Starting compilation ...'
|
||||||
defs = ['-DUSE_FROZEN', '-DPYTHONPATH=\'"."\'']
|
defs = ['-DNO_MAIN', '-DUSE_FROZEN', '-DPYTHONPATH=\'"."\'']
|
||||||
for mod in dict.keys():
|
|
||||||
if dict[mod] == '<builtin>' and mod <> 'sys':
|
|
||||||
defs.append('-DUSE_' + string.upper(mod))
|
|
||||||
#
|
#
|
||||||
incs = ['-I.', '-I' + SRC]
|
incs = ['-I.', '-I' + INCLINST]
|
||||||
if dict.has_key('stdwin'):
|
if dict.has_key('stdwin'):
|
||||||
incs.append('-I' + j(STDWIN, 'H'))
|
incs.append('-I' + j(STDWIN, 'H'))
|
||||||
#
|
#
|
||||||
srcs = [config, FMAIN]
|
srcs = [config, FMAIN]
|
||||||
#
|
#
|
||||||
libs.append(LIBP)
|
if type(LIBP) == type(''):
|
||||||
|
libs.append(LIBP)
|
||||||
|
else:
|
||||||
|
for lib in LIBP:
|
||||||
|
libs.append(lib)
|
||||||
for item in libdeps:
|
for item in libdeps:
|
||||||
m = item[0]
|
m = item[0]
|
||||||
if m == '*' or dict.has_key(m):
|
if m == '*' or dict.has_key(m):
|
||||||
|
@ -344,7 +370,7 @@ def writefrozen(filename, dict):
|
||||||
for mod, codestring in codelist:
|
for mod, codestring in codelist:
|
||||||
if verbose:
|
if verbose:
|
||||||
write('Writing initializer for %s\n'%mod)
|
write('Writing initializer for %s\n'%mod)
|
||||||
print 'static char M_' + mod + '[' + \
|
print 'static unsigned char M_' + mod + '[' + \
|
||||||
str(len(codestring)) + '+1] = {'
|
str(len(codestring)) + '+1] = {'
|
||||||
for i in range(0, len(codestring), 16):
|
for i in range(0, len(codestring), 16):
|
||||||
for c in codestring[i:i+16]:
|
for c in codestring[i:i+16]:
|
||||||
|
@ -353,7 +379,7 @@ def writefrozen(filename, dict):
|
||||||
print '};'
|
print '};'
|
||||||
print 'struct frozen {'
|
print 'struct frozen {'
|
||||||
print ' char *name;'
|
print ' char *name;'
|
||||||
print ' char *code;'
|
print ' unsigned char *code;'
|
||||||
print ' int size;'
|
print ' int size;'
|
||||||
print '} frozen_modules[] = {'
|
print '} frozen_modules[] = {'
|
||||||
for mod, codestring in codelist:
|
for mod, codestring in codelist:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue