[pypy-svn] r72598 - pypy/trunk/pypy/translator/platform

benjamin at codespeak.net benjamin at codespeak.net
Mon Mar 22 23:17:38 CET 2010


Author: benjamin
Date: Mon Mar 22 23:17:37 2010
New Revision: 72598

Modified:
   pypy/trunk/pypy/translator/platform/linux.py
   pypy/trunk/pypy/translator/platform/posix.py
Log:
(ronny, benjamin) use pkg-config to find libffi on linux

Modified: pypy/trunk/pypy/translator/platform/linux.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/linux.py	(original)
+++ pypy/trunk/pypy/translator/platform/linux.py	Mon Mar 22 23:17:37 2010
@@ -19,10 +19,12 @@
         return ['-shared'] + args
 
     def include_dirs_for_libffi(self):
-        return ['/usr/include/libffi']
+        return self._pkg_config("libffi", "--cflags-only-I",
+                                ['/usr/include/libffi'])
 
     def library_dirs_for_libffi(self):
-        return ['/usr/lib/libffi']
+        return self._pkg_config("libffi", "--libs-only-L",
+                                ['/usr/lib/libffi'])
 
     def library_dirs_for_libffi_a(self):
         # places where we need to look for libffi.a

Modified: pypy/trunk/pypy/translator/platform/posix.py
==============================================================================
--- pypy/trunk/pypy/translator/platform/posix.py	(original)
+++ pypy/trunk/pypy/translator/platform/posix.py	Mon Mar 22 23:17:37 2010
@@ -47,6 +47,13 @@
         # hook for maemo
         return include_dirs
 
+    def _pkg_config(self, lib, opt, default):
+        ret, out, err = _run_subprocess("pkg-config", [lib, opt])
+        if ret:
+            return default
+        # strip compiler flags
+        return [entry[2:] for entry in out.split()]
+
     def gen_makefile(self, cfiles, eci, exe_name=None, path=None):
         cfiles = [py.path.local(f) for f in cfiles]
         cfiles += [py.path.local(f) for f in eci.separate_module_files]



More information about the Pypy-commit mailing list