Index: SConstruct |
diff --git a/SConstruct b/SConstruct |
index faca3da3ae369a7c46b03a31e255dbf4b52c75e8..7a9d7aeeb06d8a3fee592d17785a73b116816c47 100755 |
--- a/SConstruct |
+++ b/SConstruct |
@@ -2259,6 +2259,37 @@ def SetupLinuxEnvArm(env): |
# get_plugin_dirname.cc has a dependency on dladdr |
env.Append(LIBS=['dl']) |
+def SetupLinuxEnvMips(env): |
+ jail = '${SCONSTRUCT_DIR}/toolchain/linux_mips-trusted' |
+ if env.Bit('built_elsewhere'): |
+ def FakeInstall(dest, source, env): |
+ print 'Not installing', dest |
+ # Replace build commands with no-ops |
+ env.Replace(CC='true', CXX='true', LD='true', |
+ AR='true', RANLIB='true', INSTALL=FakeInstall) |
+ # Allow emulation on x86 hosts for testing built_elsewhere flag |
+ if not platform.machine().startswith('mips'): |
+ env.Replace(EMULATOR=jail + '/run_under_qemu_mips32') |
+ else: |
+ sys.path.append('tools/trusted_cross_toolchains') |
+ from setup_mips32_trusted_toolchain import mips32_env |
+ sys.path.pop() |
+ # Allow env vars to override these settings, for what it's worth. |
+ mips32_env = mips32_env.copy() |
+ mips32_env.update(os.environ) |
+ env.Replace(CC=mips32_env.get('MIPS32_CC', 'NO-MIPSEL-CC-SPECIFIED'), |
+ CXX=mips32_env.get('MIPS32_CXX', 'NO-MIPSEL-CXX-SPECIFIED'), |
+ LD=mips32_env.get('MIPS32_LD', 'NO-MIPSEL-LD-SPECIFIED'), |
+ EMULATOR=mips32_env.get('MIPS32_EMU', ''), |
+ ASFLAGS=[], |
+ LIBPATH=['${LIB_DIR}', |
+ mips32_env.get('MIPS32_LIB_DIR', '').split()], |
+ LINKFLAGS=mips32_env.get('MIPS32_LINKFLAGS', ''), |
+ ) |
+ |
+ env.Append(LIBS=['rt', 'dl', 'pthread'], |
+ CCFLAGS=['-EL', '-Wl,-EL', '-march=mips32r2']) |
+ |
def MakeLinuxEnv(): |
linux_env = MakeUnixLikeEnv().Clone( |
BUILD_TYPE = '${OPTIMIZATION_LEVEL}-linux', |
@@ -2297,8 +2328,7 @@ def MakeLinuxEnv(): |
elif linux_env.Bit('build_arm'): |
SetupLinuxEnvArm(linux_env) |
elif linux_env.Bit('build_mips32'): |
- # TODO(petarj): Add support for MIPS. |
- pass |
+ SetupLinuxEnvMips(linux_env) |
else: |
Banner('Strange platform: %s' % GetPlatform()) |
@@ -2315,7 +2345,7 @@ def MakeLinuxEnv(): |
) |
# The ARM toolchain has a linker that doesn't handle the code its |
# compiler generates under -fPIE. |
- if linux_env.Bit('build_arm'): |
+ if linux_env.Bit('build_arm') or linux_env.Bit('build_mips32'): |
linux_env.Prepend(CCFLAGS=['-fPIC']) |
# TODO(mcgrathr): Temporarily punt _FORTIFY_SOURCE for ARM because |
# it causes a libc dependency newer than the old bots have installed. |