[pypy-svn] r18696 - pypy/dist/pypy/translator/tool

sanxiyn at codespeak.net sanxiyn at codespeak.net
Mon Oct 17 09:13:18 CEST 2005


Author: sanxiyn
Date: Mon Oct 17 09:13:15 2005
New Revision: 18696

Modified:
   pypy/dist/pypy/translator/tool/cbuild.py
Log:
Patch from Jerub to compile on Mac OS X with Fink.


Modified: pypy/dist/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/dist/pypy/translator/tool/cbuild.py	(original)
+++ pypy/dist/pypy/translator/tool/cbuild.py	Mon Oct 17 09:13:15 2005
@@ -255,19 +255,28 @@
     return spawn_and_log
 
 def build_executable(cfilenames, outputfilename=None, include_dirs=None,
-                     libraries=[]):
+                     libraries=[], library_dirs=None):
     from distutils.ccompiler import new_compiler 
     ext = ''
     extra_preargs = None
-    if sys.platform != 'win32': 
+    if not include_dirs:
+        include_dirs = []
+    if not library_dirs:
+        library_dirs = []
+    if not sys.platform in ('win32', 'darwin'): 
         libraries.append('m')
         libraries.append('pthread')
         extra_preargs = ['-O2', '-pthread']   # XXX 2 x hackish
+    if sys.platform == 'darwin':
+        include_dirs.append('/sw/include')
     if outputfilename is None:
         outputfilename = py.path.local(cfilenames[0]).new(ext=ext)
     else: 
         outputfilename = py.path.local(outputfilename) 
 
+    if sys.platform == 'darwin':
+        library_dirs=['/sw/lib']
+
     compiler = new_compiler()
     compiler.spawn = log_spawned_cmd(compiler.spawn)
     objects = []
@@ -286,7 +295,8 @@
             old.chdir() 
     compiler.link_executable(objects, str(outputfilename),
                              libraries=libraries,
-                             extra_preargs=extra_preargs)
+                             extra_preargs=extra_preargs,
+                            library_dirs=library_dirs)
     return str(outputfilename)
 
 def check_boehm_presence():



More information about the Pypy-commit mailing list