[pypy-svn] r55414 - in pypy/branch/build-external/pypy/translator: c c/test tool
afa at codespeak.net
afa at codespeak.net
Fri May 30 03:45:57 CEST 2008
Author: afa
Date: Fri May 30 03:45:55 2008
New Revision: 55414
Modified:
pypy/branch/build-external/pypy/translator/c/gc.py
pypy/branch/build-external/pypy/translator/c/genc.py
pypy/branch/build-external/pypy/translator/c/test/test_boehm.py
pypy/branch/build-external/pypy/translator/tool/cbuild.py
Log:
pypy can not compile the boehm gc from sources.
Modified: pypy/branch/build-external/pypy/translator/c/gc.py
==============================================================================
--- pypy/branch/build-external/pypy/translator/c/gc.py (original)
+++ pypy/branch/build-external/pypy/translator/c/gc.py Fri May 30 03:45:55 2008
@@ -7,6 +7,7 @@
from pypy.rpython.memory.gctransform import \
refcounting, boehm, framework, llvmgcroot, asmgcroot
from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.translator.tool.cbuild import ExternalCompilationInfo, CompilationSet
class BasicGcPolicy(object):
requires_stackless = False
@@ -36,8 +37,8 @@
def struct_after_definition(self, defnode):
return []
- def gc_libraries(self):
- return []
+ def compilation_info(self):
+ return ExternalCompilationInfo()
def pre_pre_gc_code(self): # code that goes before include g_prerequisite.h
gct = self.db.gctransformer
@@ -184,10 +185,55 @@
def rtti_node_factory(self):
return BoehmGcRuntimeTypeInfo_OpaqueNode
- def gc_libraries(self):
- if sys.platform == 'win32':
- return ['gc_pypy']
- return ['gc']
+ def compilation_info(self):
+ from pypy.translator.tool.cbuild import external_dir
+
+ # Get source:
+ # http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc6.8.tar.gz
+ # extract it into the "dist/external" directory
+ gc_home = external_dir.join("gc6.8")
+
+ if gc_home.check(dir=True):
+ from pypy.tool.udir import udir
+ udir.join('gc', 'gc.h').ensure()
+ udir.join('gc', 'gc.h').write('#include "%s/include/gc.h"' % gc_home)
+
+ gc_eci = ExternalCompilationInfo(
+ include_dirs=[gc_home.join('include')],
+ compile_extra=['-DGC_WIN32_THREADS', '-DGC_NOT_DLL'],
+ libraries=['user32'],
+ )
+
+ cs = CompilationSet(gc_eci,
+ files=[gc_home.join(x) for x in
+ ['malloc.c', 'mallocx.c', 'alloc.c',
+ 'allchblk.c', 'new_hblk.c',
+ 'finalize.c', 'reclaim.c',
+ 'headers.c', 'obj_map.c', 'stubborn.c',
+ 'mark.c', 'mark_rts.c', 'blacklst.c',
+ 'misc.c', 'os_dep.c', 'mach_dep.c',
+ 'dyn_load.c',
+ 'win32_threads.c',
+ ]])
+
+ eci = ExternalCompilationInfo(
+ include_dirs=[udir],
+ compile_extra=['-DGC_WIN32_THREADS', '-DGC_NOT_DLL'],
+ extra_objects=cs.compile_objects(),
+ libraries=['user32'],
+ )
+
+ else:
+ if sys.platform == 'win32':
+ libraries = ['gc_pypy'],
+ else:
+ libraries = ['gc']
+
+ eci = ExternalCompilationInfo(
+ libraries=libraries,
+ )
+
+ return eci
def pre_pre_gc_code(self):
for line in BasicGcPolicy.pre_pre_gc_code(self):
@@ -254,7 +300,6 @@
class NoneGcPolicy(BoehmGcPolicy):
- gc_libraries = RefcountingGcPolicy.gc_libraries.im_func
gc_startup_code = RefcountingGcPolicy.gc_startup_code.im_func
Modified: pypy/branch/build-external/pypy/translator/c/genc.py
==============================================================================
--- pypy/branch/build-external/pypy/translator/c/genc.py (original)
+++ pypy/branch/build-external/pypy/translator/c/genc.py Fri May 30 03:45:55 2008
@@ -79,8 +79,7 @@
def collect_compilation_info(self, db):
# we need a concrete gcpolicy to do this
- self.eci = self.eci.merge(ExternalCompilationInfo(
- libraries=db.gcpolicy.gc_libraries()))
+ self.eci = self.eci.merge(db.gcpolicy.compilation_info())
all = []
for node in self.db.globalcontainers():
Modified: pypy/branch/build-external/pypy/translator/c/test/test_boehm.py
==============================================================================
--- pypy/branch/build-external/pypy/translator/c/test/test_boehm.py (original)
+++ pypy/branch/build-external/pypy/translator/c/test/test_boehm.py Fri May 30 03:45:55 2008
@@ -7,7 +7,7 @@
from pypy import conftest
def setup_module(mod):
- if not check_boehm_presence():
+ if not check_boehm_presence(noerr=False):
py.test.skip("Boehm GC not present")
class AbstractGCTestClass(object):
Modified: pypy/branch/build-external/pypy/translator/tool/cbuild.py
==============================================================================
--- pypy/branch/build-external/pypy/translator/tool/cbuild.py (original)
+++ pypy/branch/build-external/pypy/translator/tool/cbuild.py Fri May 30 03:45:55 2008
@@ -293,6 +293,7 @@
try:
objects = compiler.compile(
files,
+ extra_preargs=list(self.eci.compile_extra),
include_dirs=self.eci.include_dirs,
)
objects = [str(py.path.local(o)) for o in objects]
@@ -663,6 +664,7 @@
return str(compiler.outputfilename)
def check_boehm_presence(noerr=True):
+ from pypy.translator.c.gc import BoehmGcPolicy
from pypy.tool.udir import udir
try:
cfile = udir.join('check_boehm.c')
@@ -672,14 +674,12 @@
#include <gc/gc.h>
int main() {
+ GC_malloc(10);
return 0;
}
""")
cfile.close()
- if sys.platform == 'win32':
- eci = ExternalCompilationInfo(libraries=['gc_pypy'])
- else:
- eci = ExternalCompilationInfo(libraries=['gc'])
+ eci = BoehmGcPolicy(db=None).compilation_info()
build_executable([cfname], eci, noerr=noerr)
except CompilationError:
if noerr:
More information about the Pypy-commit
mailing list