Mipsel hack into rpython/translator/platform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rpython.translator.platform.linux import Linux | |
from rpython.translator.platform.posix import _run_subprocess, GnuMakefile | |
from rpython.translator.platform import ExecutionResult, log | |
from os import getenv | |
prefix = "/opt/gcw0-toolchain/usr/bin" | |
class MIPSEL(Linux): | |
name = 'mipsel' | |
shared_only = ('-PIC',) | |
available_librarydirs = [] | |
available_includedirs = [] | |
copied_cache = {} | |
def _invent_new_name(self, basepath, base): | |
pth = basepath.join(base) | |
num = 0 | |
while pth.check(): | |
pth = basepath.join('%s_%d' % (base,num)) | |
num += 1 | |
return pth.ensure(dir=1) | |
def _execute_c_compiler(self, cc, args, outname, cwd=None): | |
#cc = prefix + "/mipsel-gcw0-linux-uclibc-" + cc | |
log.execute(cc + ' ' + ' '.join(args)) | |
returncode, stdout, stderr = _run_subprocess(cc, args) | |
self._handle_error(returncode, stderr, stdout, outname) | |
def execute(self, executable, args=[], env=None): | |
print executable, args, env | |
if env is None: | |
env = {} | |
prefix = "/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot" | |
env['QEMU_SET_ENV'] = "LD_LIBRARY_PATH=" + prefix + "/lib" | |
env['QEMU_LD_PREFIX'] = prefix | |
args.insert(0, str(executable)) | |
executable = 'qemu-mipsel' | |
log.message('executing ' + str(executable) + ' ' + ' '.join(map(str,args))) | |
returncode, stdout, stderr = _run_subprocess(executable, args, env) | |
return ExecutionResult(returncode, stdout, stderr) | |
def include_dirs_for_libffi(self): | |
return self.available_includedirs | |
def library_dirs_for_libffi(self): | |
return self.available_librarydirs | |
def _preprocess_library_dirs(self, library_dirs): | |
return list(library_dirs) + self.available_librarydirs | |
def execute_makefile(self, path_to_makefile, extra_opts=[]): | |
log.execute('mipsel make') | |
if isinstance(path_to_makefile, GnuMakefile): | |
path = path_to_makefile.makefile_dir | |
else: | |
path = path_to_makefile | |
print path | |
returncode, stdout, stderr = _run_subprocess('make', ['-C', str(path)] + extra_opts) | |
self._handle_error(returncode, stdout, stderr, path.join('make')) | |
# log.execute('sb2 %s make %s in %s' % (' '.join(SB2ARGS), " ".join(extra_opts), path)) | |
# returncode, stdout, stderr = _run_subprocess( | |
# 'sb2', SB2ARGS + ['make', '-C', str(path)] + extra_opts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment