Use mips64el toolchain

This commit is contained in:
Cheng Zhao 2017-11-21 20:42:20 +09:00
parent a83b8e751b
commit b2fdfa2710
2 changed files with 37 additions and 5 deletions

View file

@ -5,12 +5,13 @@ import os
import subprocess
import sys
from lib.config import get_target_arch
from lib.config import MIPS64EL_GCC, get_target_arch
from lib.util import electron_gyp, import_vs_env
CONFIGURATIONS = ['Release', 'Debug']
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
LIBCC_SOURCE_ROOT = os.path.join(SOURCE_ROOT, 'vendor', 'libchromiumcontent')
LIBCC_DIST_MAIN = os.path.join(LIBCC_SOURCE_ROOT, 'dist', 'main')
GCLIENT_DONE = os.path.join(SOURCE_ROOT, '.gclient_done')
@ -40,9 +41,10 @@ def main():
get_target_arch()])
subprocess.check_call([ninja, '-C', LIBCC_DIST_MAIN])
env = build_env()
for config in args.configuration:
build_path = os.path.join('out', config[0])
ret = subprocess.call([ninja, '-C', build_path, args.target])
ret = subprocess.call([ninja, '-C', build_path, args.target], env=env)
if ret != 0:
sys.exit(ret)
@ -68,5 +70,20 @@ def parse_args():
return parser.parse_args()
def build_env():
env = os.environ.copy()
if get_target_arch() == "mips64el":
gcc_dir = os.path.join(VENDOR_DIR, MIPS64EL_GCC)
ldlib_dirs = [
gcc_dir + '/usr/x86_64-unknown-linux-gnu/mips64el-redhat-linux/lib',
gcc_dir + '/usr/lib64',
gcc_dir + '/usr/mips64el-redhat-linux/lib64',
gcc_dir + '/usr/mips64el-redhat-linux/sysroot/lib64',
gcc_dir + '/usr/mips64el-redhat-linux/sysroot/usr/lib64',
]
env['LD_LIBRARY_PATH'] = os.pathsep.join(ldlib_dirs)
env['PATH'] = os.pathsep.join([gcc_dir + '/usr/bin', env['PATH']])
return env
if __name__ == '__main__':
sys.exit(main())

View file

@ -5,6 +5,9 @@
# Set this to true when building with Clang.
'clang%': 1,
# Path to mips64el toolchain.
'make_mips64_dir%': 'vendor/gcc-4.8.3-d197-n64-loongson/usr',
'variables': {
# The minimum macOS SDK version to use.
'mac_sdk_min%': '10.10',
@ -30,8 +33,8 @@
'use_lto_o2%': 0,
'conditions': [
# Do not use Clang on Windows.
['OS=="win"', {
# Do not use Clang on Windows or when building for mips64el.
['OS=="win" or target_arch=="mips64el"', {
'clang%': 0,
}], # OS=="win"
@ -61,6 +64,9 @@
['target_arch=="x64"', {
'sysroot%': '<(source_root)/vendor/debian_jessie_amd64-sysroot',
}],
['target_arch=="mips64el"', {
'sysroot%': '<(source_root)/vendor/debian_jessie_mips64-sysroot',
}],
],
},
# Copy conditionally-set variables out one scope.
@ -130,6 +136,15 @@
},
}], # clang==1
['target_arch=="mips64el"', {
'make_global_settings': [
['CC', '<(make_mips64_dir)/bin/mips64el-redhat-linux-gcc'],
['CXX', '<(make_mips64_dir)/bin/mips64el-redhat-linux-g++'],
['CC.host', '$(CC)'],
['CXX.host', '$(CXX)'],
],
}],
# Specify the SDKROOT.
['OS=="mac"', {
'target_defaults': {
@ -140,7 +155,7 @@
}],
# Setup sysroot environment.
['OS=="linux" and target_arch in ["arm", "ia32", "x64", "arm64"]', {
['OS=="linux" and target_arch in ["arm", "ia32", "x64", "arm64", "mips64el"]', {
'target_defaults': {
'target_conditions': [
['_toolset=="target"', {