[pypy-svn] r16228 - in pypy/dist/pypy/translator: c c/src tool

arigo at codespeak.net arigo at codespeak.net
Mon Aug 22 19:50:31 CEST 2005


Author: arigo
Date: Mon Aug 22 19:50:29 2005
New Revision: 16228

Modified:
   pypy/dist/pypy/translator/c/genc.py
   pypy/dist/pypy/translator/c/src/g_prerequisite.h
   pypy/dist/pypy/translator/c/src/standalone.h
   pypy/dist/pypy/translator/tool/cbuild.py
Log:
(rxe, arigo) Broke test_standalone.  Fix...


Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py	(original)
+++ pypy/dist/pypy/translator/c/genc.py	Mon Aug 22 19:50:29 2005
@@ -173,6 +173,7 @@
     defines['PYPY_STANDALONE'] = entrypointname
     for key, value in defines.items():
         print >> f, '#define %s %s' % (key, value)
+    print >> f, '#include "src/g_prerequisite.h"'
 
     preimplementationlines = list(
         pre_include_code_lines(database, database.translator.rtyper))

Modified: pypy/dist/pypy/translator/c/src/g_prerequisite.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/g_prerequisite.h	(original)
+++ pypy/dist/pypy/translator/c/src/g_prerequisite.h	Mon Aug 22 19:50:29 2005
@@ -2,7 +2,13 @@
 /**************************************************************/
 /***  this is included before any code produced by genc.py  ***/
 
+/* XXX for now we always include Python.h even to produce stand-alone
+ * executables (which are *not* linked against CPython then),
+ * to get the convenient macro definitions
+ */
+#define Py_BUILD_CORE  /* for Windows: avoid pulling libs in */
 #include "Python.h"
 
+
 #include "thread.h"   /* needs to be included early to define the
                          struct RPyOpaque_ThreadLock */

Modified: pypy/dist/pypy/translator/c/src/standalone.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/standalone.h	(original)
+++ pypy/dist/pypy/translator/c/src/standalone.h	Mon Aug 22 19:50:29 2005
@@ -1,9 +1,3 @@
-/* XXX for now we always include Python.h even to produce stand-alone
- * executables (which are *not* linked against CPython then),
- * to get the convenient macro definitions
- */
-#define Py_BUILD_CORE  /* for Windows: avoid pulling libs in */
-#include "Python.h"
 
 #include <stdlib.h>
 #include <limits.h>

Modified: pypy/dist/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/dist/pypy/translator/tool/cbuild.py	(original)
+++ pypy/dist/pypy/translator/tool/cbuild.py	Mon Aug 22 19:50:29 2005
@@ -230,8 +230,11 @@
                      libraries=[]):
     from distutils.ccompiler import new_compiler 
     ext = ''
+    extra_preargs = None
     if sys.platform != 'win32': 
         libraries.append('m')
+        libraries.append('pthread')
+        extra_preargs = ['-pthread']   # XXX make this more general
     if outputfilename is None:
         outputfilename = py.path.local(cfilenames[0]).new(ext=ext)
     else: 
@@ -244,7 +247,8 @@
         old = cfile.dirpath().chdir() 
         try: 
             res = compiler.compile([cfile.basename], 
-                                   include_dirs=include_dirs)
+                                   include_dirs=include_dirs,
+                                   extra_preargs=extra_preargs)
             assert len(res) == 1
             cobjfile = py.path.local(res[0]) 
             assert cobjfile.check()
@@ -252,6 +256,7 @@
         finally: 
             old.chdir() 
     compiler.link_executable(objects, str(outputfilename),
-                             libraries=libraries)
+                             libraries=libraries,
+                             extra_preargs=extra_preargs)
     return str(outputfilename)
 



More information about the Pypy-commit mailing list