Index: SConstruct |
diff --git a/SConstruct b/SConstruct |
index faca3da3ae369a7c46b03a31e255dbf4b52c75e8..74f943eb710097a7aee66a07244126e8c2d8894c 100755 |
--- a/SConstruct |
+++ b/SConstruct |
@@ -2259,6 +2259,40 @@ 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: |
+ TC_DIR = os.path.join(os.getcwd(), 'toolchain', 'linux_mips-trusted', |
Mark Seaborn
2012/09/20 02:40:42
Nit: use lower-case 'TC_DIR'
petarj
2012/09/20 15:33:00
Done.
|
+ 'mips-release', 'bin') |
+ if not which(os.path.join(TC_DIR,'mips-linux-gnu-gcc')): |
Mark Seaborn
2012/09/20 02:40:42
Nit: add space after comma. Same below.
petarj
2012/09/20 15:33:00
Done.
|
+ print ("\nERRROR: MIPS trusted TC is not installed - try running:\n" |
+ "tools/trusted_cross_toolchains/trusted-toolchain-creator" |
+ ".mipsel.squeeze.sh trusted_sdk") |
+ sys.exit(-1) |
+ env.Replace(CC=os.path.join(TC_DIR,'mips-linux-gnu-gcc'), |
+ CXX=os.path.join(TC_DIR,'mips-linux-gnu-g++'), |
+ LD=os.path.join(TC_DIR,'mips-linux-gnu-ld'), |
+ EMULATOR=os.path.join(jail, |
+ 'run_under_qemu_mips32'), |
+ ASFLAGS=[], |
+ LIBPATH=['${LIB_DIR}', |
+ jail + '/mips-release/mips-linux-gnu/libc/el/usr/lib'], |
+ LINKFLAGS=['-EL', '-T', |
+ os.path.join(jail,'ld_script_mips_trusted')] |
+ ) |
+ |
+ 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 +2331,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 +2348,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. |