Index: SConstruct |
diff --git a/SConstruct b/SConstruct |
index 72bad9c75d0bcda3abe6e873d371bdbcf17fa69b..2a06e17c43405a8d37c99f531beb214e292401a3 100755 |
--- a/SConstruct |
+++ b/SConstruct |
@@ -2293,6 +2293,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'), |
Mark Seaborn
2012/09/08 02:43:14
Nit: fix indentation to line up with previous line
petarj
2012/09/11 16:58:13
Done.
|
+ 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', 'crypto', 'z'], |
Mark Seaborn
2012/09/08 02:43:14
I'm pretty sure you don't need libcrypto -- I remo
petarj
2012/09/11 16:58:13
Done.
|
+ CCFLAGS=['-EL', '-Wl,-EL', '-march=mips32r2']) |
+ |
def MakeLinuxEnv(): |
linux_env = MakeUnixLikeEnv().Clone( |
BUILD_TYPE = '${OPTIMIZATION_LEVEL}-linux', |
@@ -2331,8 +2362,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()) |
@@ -2349,7 +2379,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. |