6868
6969# Attempt to guess machine architecture
7070if os .path .exists ('/usr/lib/libgl_s' ): ARCH = 'sgi'
71+ elif os .path .exists ('/etc/issue' ): ARCH = 'sequent'
7172else : ARCH = 'sun4'
7273
7374# Site parametrizations (change to match your site)
7879BLD = j (PYTHON , 'build.' + ARCH ) # Python build directory
7980#BLD = SRC # Use this if you build in SRC
8081
82+ LIBINST = '/ufs/guido/src/python/irix4/tmp/lib/python/lib' # installed libraries
83+ INCLINST = '/ufs/guido/src/python/irix4/tmp/include/Py' # installed include files
84+
8185# Other packages (change to match your site)
8286DL = j (TOP , 'dl' ) # Top of the dl source tree
8387DL_DLD = j (TOP , 'dl-dld' ) # The dl-dld source directory
8892SUN_X11 = '/usr/local/X11R5/lib/libX11.a'
8993
9094# File names (usually no need to change)
91- LIBP = j (BLD , 'libpython.a' ) # Main Python library
92- CONFIG = j (SRC , 'config.c' ) # Configuration source file
93- FMAIN = j (SRC , 'frozenmain.c' ) # Special main source file
95+ LIBP = [ # Main Python libraries
96+ j (LIBINST , 'libPython.a' ),
97+ j (LIBINST , 'libParser.a' ),
98+ j (LIBINST , 'libObjects.a' ),
99+ j (LIBINST , 'libModules.a' )
100+ ]
101+ CONFIG_IN = j (LIBINST , 'config.c.in' ) # Configuration source file
102+ FMAIN = j (LIBINST , 'frozenmain.c' ) # Special main source file
94103
95104# Libraries needed when linking. First tuple item is built-in module
96105# for which it is needed (or '*' for always), rest are ld arguments.
104113 ('cd' , '-lcdaudio' , '-lds' ), \
105114 ('cl' , '-lcl' ), \
106115 ('imgfile' , '-limage' , '-lgutil' , '-lm' ), \
107- ('mpz' , '/ufs/jh/src/gmp-1.2/libgmp.a' ), \
108- ('md5' , '/ufs/jh/src/md5/md5.o' ), \
116+ ('mpz' , '/ufs/guido/src/gmp/libgmp.a' ), \
109117 ('*' , '-lsun' ), \
110118 ('*' , j (DL , 'libdl.a' ), '-lmld' ), \
111119 ('*' , '-lmpc' ), \
125133 ('*' , '-ltermcap' ), \
126134 ('*' , '-lc' ), \
127135 ]
136+ libdeps_sequent = [ \
137+ ('*' , j (LIBINST , 'libreadline.a' ), '-ltermcap' ), \
138+ ('*' , '-lsocket' ), \
139+ ('*' , '-linet' ), \
140+ ('*' , '-lnsl' ), \
141+ ('*' , '-lm' ), \
142+ ('*' , '-lc' ), \
143+ ]
128144libdeps = eval ('libdeps_' + ARCH )
129145
130146################################
@@ -223,7 +239,8 @@ def process(filename, addmodules):
223239 else :
224240 if not quiet : print 'NOT writing frozen.c ...'
225241 #
226- if not dlmodules :
242+ ## if not dlmodules:
243+ if 0 :
227244 config = CONFIG
228245 if not quiet : print 'Using existing' , config , '...'
229246 else :
@@ -233,41 +250,50 @@ def process(filename, addmodules):
233250 else :
234251 if not quiet :
235252 print 'Writing config.c with dl modules ...'
236- f = open (CONFIG , 'r' )
253+ f = open (CONFIG_IN , 'r' )
237254 g = open (config , 'w' )
238255 m1 = regex .compile ('-- ADDMODULE MARKER 1 --' )
239256 m2 = regex .compile ('-- ADDMODULE MARKER 2 --' )
257+ builtinmodules = []
258+ stdmodules = ('sys' , '__main__' , '__builtin__' ,
259+ 'marshal' )
260+ todomodules = builtinmodules + dlmodules
261+ for mod in dict .keys ():
262+ if dict [mod ] == '<builtin>' and \
263+ mod not in stdmodules :
264+ builtinmodules .append (mod )
240265 while 1 :
241266 line = f .readline ()
242267 if not line : break
243268 g .write (line )
244269 if m1 .search (line ) >= 0 :
245270 if verbose : print 'Marker 1 ...'
246- for mod in dlmodules :
271+ for mod in todomodules :
247272 g .write ('extern void init' + \
248273 mod + '();\n ' )
249274 if m2 .search (line ) >= 0 :
250275 if verbose : print 'Marker 2 ...'
251- for mod in dlmodules :
276+ for mod in todomodules :
252277 g .write ('{"' + mod + \
253278 '", init' + mod + '},\n ' )
254279 g .close ()
255280 #
256281 if not quiet :
257282 if noexec : print 'Generating compilation commands ...'
258283 else : print 'Starting compilation ...'
259- defs = ['-DUSE_FROZEN' , '-DPYTHONPATH=\' "."\' ' ]
260- for mod in dict .keys ():
261- if dict [mod ] == '<builtin>' and mod <> 'sys' :
262- defs .append ('-DUSE_' + string .upper (mod ))
284+ defs = ['-DNO_MAIN' , '-DUSE_FROZEN' , '-DPYTHONPATH=\' "."\' ' ]
263285 #
264- incs = ['-I.' , '-I' + SRC ]
286+ incs = ['-I.' , '-I' + INCLINST ]
265287 if dict .has_key ('stdwin' ):
266288 incs .append ('-I' + j (STDWIN , 'H' ))
267289 #
268290 srcs = [config , FMAIN ]
269291 #
270- libs .append (LIBP )
292+ if type (LIBP ) == type ('' ):
293+ libs .append (LIBP )
294+ else :
295+ for lib in LIBP :
296+ libs .append (lib )
271297 for item in libdeps :
272298 m = item [0 ]
273299 if m == '*' or dict .has_key (m ):
@@ -344,7 +370,7 @@ def writefrozen(filename, dict):
344370 for mod , codestring in codelist :
345371 if verbose :
346372 write ('Writing initializer for %s\n ' % mod )
347- print 'static char M_' + mod + '[' + \
373+ print 'static unsigned char M_' + mod + '[' + \
348374 str (len (codestring )) + '+1] = {'
349375 for i in range (0 , len (codestring ), 16 ):
350376 for c in codestring [i :i + 16 ]:
@@ -353,7 +379,7 @@ def writefrozen(filename, dict):
353379 print '};'
354380 print 'struct frozen {'
355381 print ' char *name;'
356- print ' char *code;'
382+ print ' unsigned char *code;'
357383 print ' int size;'
358384 print '} frozen_modules[] = {'
359385 for mod , codestring in codelist :
0 commit comments