Merge pull request #11208 from electron/mips64el

Add support for mips64el
This commit is contained in:
Cheng Zhao 2017-11-24 10:54:19 +09:00 committed by GitHub
commit f8adaed763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 207 additions and 46 deletions

View file

@ -172,6 +172,63 @@ jobs:
else
echo 'Skipping upload distribution because build is not for release'
fi
electron-linux-mips64el:
docker:
- image: electronbuilds/electron:0.0.3
environment:
TARGET_ARCH: mips64el
resource_class: xlarge
steps:
- checkout
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: npm run lint
- run:
name: Build
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Building Electron for release'
script/build.py -c R
else
echo 'Building Electron for debug'
script/build.py -c D
fi
- run:
name: Create distribution
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Creating Electron release distribution'
script/create-dist.py
else
echo 'Skipping create distribution because build is not for release'
fi
- run:
name: Upload distribution
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "1" ]; then
echo 'Uploading Electron release distribution to s3'
script/upload.py --upload_to_s3
else
echo 'Skipping upload distribution because build is not for release'
fi
electron-linux-x64:
docker:

3
.gitignore vendored
View file

@ -32,9 +32,12 @@
/vendor/debian_jessie_arm-sysroot/
/vendor/debian_jessie_arm64-sysroot/
/vendor/debian_jessie_i386-sysroot/
/vendor/debian_jessie_mips64-sysroot/
/vendor/debian_wheezy_amd64-sysroot/
/vendor/debian_wheezy_arm-sysroot/
/vendor/debian_wheezy_i386-sysroot/
/vendor/gcc-4.8.3-d197-n64-loongson/
/vendor/readme-gcc483-loongson.txt
/vendor/download/
/vendor/llvm-build/
/vendor/llvm/

View file

@ -114,7 +114,7 @@ void BrowserView::SetBackgroundColor(const std::string& color_name) {
view_->SetBackgroundColor(ParseHexColor(color_name));
}
v8::Local<v8::Value> BrowserView::WebContents() {
v8::Local<v8::Value> BrowserView::GetWebContents() {
if (web_contents_.IsEmpty()) {
return v8::Null(isolate());
}
@ -131,7 +131,7 @@ void BrowserView::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setAutoResize", &BrowserView::SetAutoResize)
.SetMethod("setBounds", &BrowserView::SetBounds)
.SetMethod("setBackgroundColor", &BrowserView::SetBackgroundColor)
.SetProperty("webContents", &BrowserView::WebContents)
.SetProperty("webContents", &BrowserView::GetWebContents)
.SetProperty("id", &BrowserView::ID);
}

View file

@ -56,7 +56,7 @@ class BrowserView : public mate::TrackableObject<BrowserView> {
void SetBounds(const gfx::Rect& bounds);
void SetBackgroundColor(const std::string& color_name);
v8::Local<v8::Value> WebContents();
v8::Local<v8::Value> GetWebContents();
v8::Global<v8::Value> web_contents_;
class WebContents* api_web_contents_;

View file

@ -1,7 +1,12 @@
{
'variables': {
# The libraries brightray will be compiled to.
'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gconf-2.0 gmodule-2.0 nss'
'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gconf-2.0 gmodule-2.0 nss',
'conditions': [
['target_arch=="mips64el"', {
'linux_system_libraries': '<(linux_system_libraries) libpulse',
}],
],
},
'includes': [
'filenames.gypi',
@ -69,21 +74,29 @@
},
'cflags': [
'<!@(<(pkg-config) --cflags <(linux_system_libraries))',
# Needed by using libgtkui:
'-Wno-deprecated-register',
'-Wno-sentinel',
],
'cflags_cc': [
'-Wno-reserved-user-defined-literal',
],
'direct_dependent_settings': {
'cflags': [
'<!@(<(pkg-config) --cflags <(linux_system_libraries))',
'-Wno-deprecated-register',
'-Wno-sentinel',
],
},
'conditions': [
['clang==1', {
'cflags_cc': [
'-Wno-reserved-user-defined-literal',
],
'cflags': [
# Needed by using libgtkui:
'-Wno-deprecated-register',
'-Wno-sentinel',
],
'direct_dependent_settings': {
'cflags': [
'-Wno-deprecated-register',
'-Wno-sentinel',
],
},
}],
['libchromiumcontent_component', {
'link_settings': {
'libraries': [

View file

@ -348,7 +348,7 @@
],
},
}],
['OS=="linux"', {
['OS=="linux" and clang==1', {
'cflags': [
'-Wno-inconsistent-missing-override',
'-Wno-undefined-var-template', # https://crbug.com/604888

View file

@ -109,22 +109,27 @@
'conditions': [
['OS=="linux"', {
'cflags': [
'-Wno-parentheses-equality',
'-Wno-unused-function',
'-Wno-sometimes-uninitialized',
'-Wno-pointer-sign',
'-Wno-string-plus-int',
'-Wno-unused-variable',
'-Wno-unused-value',
'-Wno-deprecated-declarations',
'-Wno-return-type',
'-Wno-shift-negative-value',
'-Wno-format',
'-Wno-varargs', # https://git.io/v6Olj
# Required when building as shared library.
'-fPIC',
],
}],
['OS=="linux" and clang==1', {
'cflags': [
'-Wno-pointer-sign',
'-Wno-parentheses-equality',
'-Wno-sometimes-uninitialized',
'-Wno-string-plus-int',
'-Wno-shift-negative-value',
'-Wno-reserved-user-defined-literal',
],
}],
],
}],
['_target_name=="node"', {

View file

@ -350,7 +350,7 @@
# Make binary search for libraries under current directory, so we
# don't have to manually set $LD_LIBRARY_PATH:
# http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable
'-rpath \$$ORIGIN',
'-Wl,-rpath=\$$ORIGIN',
# Make native module dynamic loading work.
'-rdynamic',
],
@ -358,7 +358,6 @@
# Required settings of using breakpad.
'cflags_cc': [
'-Wno-empty-body',
'-Wno-reserved-user-defined-literal',
],
'include_dirs': [
'vendor/breakpad/src',
@ -367,6 +366,12 @@
'vendor/breakpad/breakpad.gyp:breakpad_client',
],
}], # OS=="linux"
['OS=="linux" and clang==1', {
# Required settings of using breakpad.
'cflags_cc': [
'-Wno-reserved-user-defined-literal',
],
}], # OS=="linux" and clang==1
],
}, # target <(product_name)_lib
{

View file

@ -7,10 +7,11 @@ import re
import subprocess
import sys
from lib.config import BASE_URL, PLATFORM, enable_verbose_mode, \
from lib.config import BASE_URL, PLATFORM, MIPS64EL_SYSROOT_URL, \
MIPS64EL_GCC, MIPS64EL_GCC_URL, enable_verbose_mode, \
is_verbose_mode, get_target_arch
from lib.util import execute, execute_stdout, get_electron_version, \
scoped_cwd, update_node_modules
scoped_cwd, download, update_node_modules
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
@ -18,7 +19,6 @@ VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download')
PYTHON_26_URL = 'https://chromium.googlesource.com/chromium/deps/python_26'
def main():
os.chdir(SOURCE_ROOT)
@ -37,6 +37,9 @@ def main():
libcc_shared_library_path = args.libcc_shared_library_path
libcc_static_library_path = args.libcc_static_library_path
if args.target_arch == 'mips64el':
download_mips64el_toolchain()
# Redirect to use local libchromiumcontent build.
if args.build_release_libcc or args.build_debug_libcc:
build_libchromiumcontent(args.verbose, args.target_arch, defines,
@ -57,7 +60,7 @@ def main():
libcc_source_path, libcc_shared_library_path,
libcc_static_library_path)
if PLATFORM == 'linux':
if PLATFORM == 'linux' and args.target_arch != 'mips64el':
download_sysroot(args.target_arch)
create_chrome_version_h()
@ -144,8 +147,8 @@ def setup_libchromiumcontent(is_dev, target_arch, url,
libcc_shared_library_path,
libcc_static_library_path):
target_dir = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')
download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
'download')
script = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
'download')
args = ['-f', '-c', get_libchromiumcontent_commit(), '--target_arch',
target_arch, url, target_dir]
if (libcc_source_path != None and
@ -158,9 +161,9 @@ def setup_libchromiumcontent(is_dev, target_arch, url,
else:
mkdir_p(DOWNLOAD_DIR)
if is_dev:
subprocess.check_call([sys.executable, download] + args)
subprocess.check_call([sys.executable, script] + args)
else:
subprocess.check_call([sys.executable, download, '-s'] + args)
subprocess.check_call([sys.executable, script, '-s'] + args)
def update_win32_python():
@ -198,6 +201,24 @@ def download_sysroot(target_arch):
'--arch', target_arch],
cwd=VENDOR_DIR)
def download_mips64el_toolchain():
# Download sysroot image.
if not os.path.exists(os.path.join(VENDOR_DIR,
'debian_jessie_mips64-sysroot')):
tar_name = 'debian_jessie_mips64-sysroot.tar.bz2'
download(tar_name, MIPS64EL_SYSROOT_URL,
os.path.join(SOURCE_ROOT, tar_name))
subprocess.call(['tar', '-jxf', tar_name, '-C', VENDOR_DIR])
os.remove(tar_name)
# Download toolchain.
if not os.path.exists(os.path.join(VENDOR_DIR, MIPS64EL_GCC)):
tar_name = MIPS64EL_GCC + '.tar.gz'
download(tar_name, MIPS64EL_GCC_URL, os.path.join(SOURCE_ROOT, tar_name))
subprocess.check_call(['tar', '-xf', tar_name, '-C', VENDOR_DIR])
os.remove(tar_name)
def create_chrome_version_h():
version_file = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'VERSION')
target_file = os.path.join(SOURCE_ROOT, 'atom', 'common', 'chrome_version.h')

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, build_env
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)

View file

@ -4,10 +4,11 @@ const buildAppVeyorURL = 'https://windows-ci.electronjs.org/api/builds'
const jenkinsServer = 'https://mac-ci.electronjs.org'
const circleCIJobs = [
'electron-linux-arm',
'electron-linux-arm64',
'electron-linux-ia32',
'electron-linux-x64',
'electron-linux-arm'
'electron-linux-mips64el',
'electron-linux-x64'
]
const jenkinsJobs = [

View file

@ -12,7 +12,7 @@ if sys.platform == "win32":
import _winreg
from lib.config import BASE_URL, PLATFORM, enable_verbose_mode, \
get_target_arch, get_zip_name
get_target_arch, get_zip_name, build_env
from lib.util import scoped_cwd, rm_rf, get_electron_version, make_zip, \
execute, electron_gyp
@ -210,13 +210,15 @@ def strip_binaries():
def strip_binary(binary_path):
if get_target_arch() == 'arm':
strip = 'arm-linux-gnueabihf-strip'
elif get_target_arch() == 'arm64':
strip = 'aarch64-linux-gnu-strip'
else:
strip = 'strip'
execute([strip, binary_path])
if get_target_arch() == 'arm':
strip = 'arm-linux-gnueabihf-strip'
elif get_target_arch() == 'arm64':
strip = 'aarch64-linux-gnu-strip'
elif get_target_arch() == 'mips64el':
strip = 'mips64el-redhat-linux-strip'
else:
strip = 'strip'
execute([strip, binary_path], env=build_env())
def create_version():
@ -226,6 +228,9 @@ def create_version():
def create_symbols():
if get_target_arch() == 'mips64el':
return
destination = os.path.join(DIST_DIR, '{0}.breakpad.syms'.format(PROJECT_NAME))
dump_symbols = os.path.join(SOURCE_ROOT, 'script', 'dump-symbols.py')
execute([sys.executable, dump_symbols, destination])
@ -286,6 +291,9 @@ def create_ffmpeg_zip():
def create_symbols_zip():
if get_target_arch() == 'mips64el':
return
dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'symbols')
zip_file = os.path.join(DIST_DIR, dist_name)
licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

View file

@ -5,6 +5,11 @@ import os
import platform
import sys
# URL to the mips64el sysroot image.
MIPS64EL_SYSROOT_URL = 'https://github.com/electron/debian-sysroot-image-creator/releases/download/v0.5.0/debian_jessie_mips64-sysroot.tar.bz2'
# URL to the mips64el toolchain.
MIPS64EL_GCC = 'gcc-4.8.3-d197-n64-loongson'
MIPS64EL_GCC_URL = 'http://ftp.loongnix.org/toolchain/gcc/release/' + MIPS64EL_GCC + '.tar.gz'
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
@ -79,3 +84,21 @@ def get_zip_name(name, version, suffix=''):
if suffix:
zip_name += '-' + suffix
return zip_name + '.zip'
def build_env():
env = os.environ.copy()
if get_target_arch() == "mips64el":
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
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

View file

@ -100,6 +100,7 @@ function assetsForVersion (version) {
`electron-${version}-linux-armv7l.zip`,
`electron-${version}-linux-ia32-symbols.zip`,
`electron-${version}-linux-ia32.zip`,
`electron-${version}-linux-mips64el.zip`,
`electron-${version}-linux-x64-symbols.zip`,
`electron-${version}-linux-x64.zip`,
`electron-${version}-mas-x64-dsym.zip`,
@ -118,6 +119,7 @@ function assetsForVersion (version) {
`ffmpeg-${version}-linux-arm64.zip`,
`ffmpeg-${version}-linux-armv7l.zip`,
`ffmpeg-${version}-linux-ia32.zip`,
`ffmpeg-${version}-linux-mips64el.zip`,
`ffmpeg-${version}-linux-x64.zip`,
`ffmpeg-${version}-mas-x64.zip`,
`ffmpeg-${version}-win32-ia32.zip`,

View file

@ -66,8 +66,9 @@ def main():
# Upload Electron with GitHub Releases API.
upload_electron(github, release, os.path.join(DIST_DIR, DIST_NAME),
args.upload_to_s3)
upload_electron(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME),
args.upload_to_s3)
if get_target_arch() != 'mips64el':
upload_electron(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME),
args.upload_to_s3)
if PLATFORM == 'darwin':
upload_electron(github, release, os.path.join(DIST_DIR,
'electron-api.json'), args.upload_to_s3)

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,20 @@
},
}], # 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)'],
],
'target_defaults': {
'cflags_cc': [
'-std=c++11',
],
},
}],
# Specify the SDKROOT.
['OS=="mac"', {
'target_defaults': {
@ -140,7 +160,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"', {

@ -1 +1 @@
Subproject commit b0c0a9e10bfac39d6da64a9e66e3509731d6fa69
Subproject commit eb1db5393cd8bf2f931c5ef3ab7c55948bd57d60