[pypy-svn] r54834 - in pypy/dist/pypy: rpython/lltypesystem translator/tool

karlb at codespeak.net karlb at codespeak.net
Sat May 17 16:34:23 CEST 2008


Author: karlb
Date: Sat May 17 16:34:22 2008
New Revision: 54834

Modified:
   pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
   pypy/dist/pypy/translator/tool/cbuild.py
Log:
Added MacOS X framework support to cbuild.CCompiler


Modified: pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py	Sat May 17 16:34:22 2008
@@ -569,7 +569,7 @@
         eci = old_eci.compile_shared_lib()
         _eci_cache[old_eci] = eci
 
-    libraries = list(eci.libraries)
+    libraries = list(eci.libraries + eci.frameworks)
 
     FUNCTYPE = lltype.typeOf(funcptr).TO
     if not libraries:

Modified: pypy/dist/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/dist/pypy/translator/tool/cbuild.py	(original)
+++ pypy/dist/pypy/translator/tool/cbuild.py	Sat May 17 16:34:22 2008
@@ -17,7 +17,7 @@
     _ATTRIBUTES = ['pre_include_lines', 'includes', 'include_dirs',
                    'post_include_lines', 'libraries', 'library_dirs',
                    'separate_module_sources', 'separate_module_files',
-                   'export_symbols']
+                   'export_symbols', 'compile_extra', 'link_extra', 'frameworks']
     _AVOID_DUPLICATES = ['separate_module_files', 'libraries', 'includes',
                          'include_dirs', 'library_dirs', 'separate_module_sources']
 
@@ -30,7 +30,10 @@
                  library_dirs            = [],
                  separate_module_sources = [],
                  separate_module_files   = [],
-                 export_symbols          = []):
+                 export_symbols          = [],
+                 compile_extra           = [],
+                 link_extra              = [],
+                 frameworks              = []):
         """
         pre_include_lines: list of lines that should be put at the top
         of the generated .c files, before any #include.  They shouldn't
@@ -439,11 +442,12 @@
                  compiler_exe=None, profbased=None):
         self.cfilenames = cfilenames
         ext = ''
-        self.compile_extra = []
-        self.link_extra = []
         self.libraries = list(eci.libraries)
         self.include_dirs = list(eci.include_dirs)
         self.library_dirs = list(eci.library_dirs)
+        self.compile_extra = list(eci.compile_extra)
+        self.link_extra = list(eci.link_extra) 
+        self.frameworks = list(eci.frameworks)
         self.compiler_exe = compiler_exe
         self.profbased = profbased
         if not sys.platform in ('win32', 'darwin'): # xxx
@@ -465,6 +469,8 @@
                    os.path.exists(s + 'lib'):
                     self.library_dirs.append(s + 'lib')
             self.compile_extra += ['-O3', '-fomit-frame-pointer']
+            for framework in self.frameworks:
+                self.link_extra += ['-framework', framework]
 
         if outputfilename is None:
             self.outputfilename = py.path.local(cfilenames[0]).new(ext=ext)
@@ -530,6 +536,7 @@
                 objects.append(str(cobjfile))
             finally: 
                 old.chdir() 
+
         compiler.link_executable(objects, str(self.outputfilename),
                                  libraries=self.eci.libraries,
                                  extra_preargs=self.link_extra,



More information about the Pypy-commit mailing list