Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #60 from ibmruntimes/v6.0.0-proposal-port
Browse files Browse the repository at this point in the history
Add s390/s390x Linux support to Node v6.x (v2)
  • Loading branch information
gibfahn committed May 6, 2016
2 parents ce3e3c5 + 1fa06ce commit 2c33528
Show file tree
Hide file tree
Showing 6,158 changed files with 2,140,943 additions and 32 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 7 additions & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@
['GENERATOR == "ninja" or OS== "mac"', {
'OBJ_DIR': '<(PRODUCT_DIR)/obj',
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
}, {
}],
['GENERATOR != "ninja" and OS!= "mac" and target_arch not in "s390 s390x"', {

'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.a',
}],
['GENERATOR != "ninja" and OS!= "mac" and target_arch in "s390 s390x"', {
'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8z/tools/gyp/libv8_base.a',
}],
['openssl_fips != ""', {
'OPENSSL_PRODUCT': 'libcrypto.a',
}, {
Expand Down
5 changes: 5 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ def configure_node(o):
else:
o['variables']['node_enable_v8_vtunejit'] = 'false'

if target_arch in ('s390', 's390x'):
o['variables']['v8_parent_path'] = 'deps/v8z'
else:
o['variables']['v8_parent_path'] = 'deps/v8'

if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
use_dtrace = not options.without_dtrace
# Don't enable by default on linux and freebsd
Expand Down
4 changes: 4 additions & 0 deletions deps/v8z/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Defines the Google C++ style for automatic reformatting.
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Google
MaxEmptyLinesToKeep: 1
92 changes: 92 additions & 0 deletions deps/v8z/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
*.a
*.exe
*.idb
*.lib
*.log
*.map
*.mk
*.ncb
*.pdb
*.pyc
*.scons*
*.sdf
*.sln
*.so
*.suo
*.user
*.vcproj
*.vcxproj
*.vcxproj.filters
*.xcodeproj
#*#
*~
.#*
.cpplint-cache
.cproject
.d8_history
.gclient_entries
.gdb_history
.landmines
.project
.pydevproject
.settings
.*.sw?
bsuite
compile_commands.json
d8
d8_g
gccauses
gcsuspects
shell
shell_g
/_*
/build/Debug
/build/gyp
/build/ipch
/build/Release
/build/win_toolchain.json
/buildtools
/hydrogen.cfg
/obj
/out
/perf.data
/perf.data.old
/test/benchmarks/data
/test/mozilla/data
/test/promises-aplus/promises-tests
/test/promises-aplus/promises-tests.tar.gz
/test/promises-aplus/sinon
/test/simdjs/data
/test/test262/data
/test/test262/data.tar
/testing/gmock
/testing/gtest
/third_party
/third_party/icu
/third_party/llvm
/third_party/llvm-build
/tools/clang
/tools/gcmole/gcmole-tools
/tools/gcmole/gcmole-tools.tar.gz
/tools/jsfunfuzz/jsfunfuzz
/tools/jsfunfuzz/jsfunfuzz.tar.gz
/tools/luci-go/linux64/isolate
/tools/luci-go/mac64/isolate
/tools/luci-go/win64/isolate.exe
/tools/oom_dump/oom_dump
/tools/oom_dump/oom_dump.o
/tools/swarming_client
/tools/visual_studio/Debug
/tools/visual_studio/Release
/v8.log.ll
/xcodebuild
TAGS
*.Makefile
GTAGS
GRTAGS
GSYMS
GPATH
gtags.files
turbo*.cfg
turbo*.dot
turbo*.json
193 changes: 193 additions & 0 deletions deps/v8z/.ycm_extra_conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# Copyright 2015 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Autocompletion config for YouCompleteMe in V8.
#
# USAGE:
#
# 1. Install YCM [https://github.com/Valloric/YouCompleteMe]
# (Googlers should check out [go/ycm])
#
# 2. Profit
#
#
# Usage notes:
#
# * You must use ninja & clang to build V8.
#
# * You must have run gyp_v8 and built V8 recently.
#
#
# Hacking notes:
#
# * The purpose of this script is to construct an accurate enough command line
# for YCM to pass to clang so it can build and extract the symbols.
#
# * Right now, we only pull the -I and -D flags. That seems to be sufficient
# for everything I've used it for.
#
# * That whole ninja & clang thing? We could support other configs if someone
# were willing to write the correct commands and a parser.
#
# * This has only been tested on gTrusty.


import os
import os.path
import subprocess
import sys


# Flags from YCM's default config.
flags = [
'-DUSE_CLANG_COMPLETER',
'-std=gnu++0x',
'-x',
'c++',
]


def PathExists(*args):
return os.path.exists(os.path.join(*args))


def FindV8SrcFromFilename(filename):
"""Searches for the root of the V8 checkout.
Simply checks parent directories until it finds .gclient and v8/.
Args:
filename: (String) Path to source file being edited.
Returns:
(String) Path of 'v8/', or None if unable to find.
"""
curdir = os.path.normpath(os.path.dirname(filename))
while not (PathExists(curdir, 'v8') and PathExists(curdir, 'v8', 'DEPS')
and (PathExists(curdir, '.gclient')
or PathExists(curdir, 'v8', '.git'))):
nextdir = os.path.normpath(os.path.join(curdir, '..'))
if nextdir == curdir:
return None
curdir = nextdir
return os.path.join(curdir, 'v8')


def GetClangCommandFromNinjaForFilename(v8_root, filename):
"""Returns the command line to build |filename|.
Asks ninja how it would build the source file. If the specified file is a
header, tries to find its companion source file first.
Args:
v8_root: (String) Path to v8/.
filename: (String) Path to source file being edited.
Returns:
(List of Strings) Command line arguments for clang.
"""
if not v8_root:
return []

# Generally, everyone benefits from including V8's root, because all of
# V8's includes are relative to that.
v8_flags = ['-I' + os.path.join(v8_root)]

# Version of Clang used to compile V8 can be newer then version of
# libclang that YCM uses for completion. So it's possible that YCM's libclang
# doesn't know about some used warning options, which causes compilation
# warnings (and errors, because of '-Werror');
v8_flags.append('-Wno-unknown-warning-option')

# Header files can't be built. Instead, try to match a header file to its
# corresponding source file.
if filename.endswith('.h'):
alternates = ['.cc', '.cpp']
for alt_extension in alternates:
alt_name = filename[:-2] + alt_extension
if os.path.exists(alt_name):
filename = alt_name
break
else:
if filename.endswith('-inl.h'):
for alt_extension in alternates:
alt_name = filename[:-6] + alt_extension
if os.path.exists(alt_name):
filename = alt_name
break;
else:
# If this is a standalone -inl.h file with no source, the best we can
# do is try to use the default flags.
return v8_flags
else:
# If this is a standalone .h file with no source, the best we can do is
# try to use the default flags.
return v8_flags

sys.path.append(os.path.join(v8_root, 'tools', 'ninja'))
from ninja_output import GetNinjaOutputDirectory
out_dir = os.path.realpath(GetNinjaOutputDirectory(v8_root))

# Ninja needs the path to the source file relative to the output build
# directory.
rel_filename = os.path.relpath(os.path.realpath(filename), out_dir)

# Ask ninja how it would build our source file.
p = subprocess.Popen(['ninja', '-v', '-C', out_dir, '-t',
'commands', rel_filename + '^'],
stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.returncode:
return v8_flags

# Ninja might execute several commands to build something. We want the last
# clang command.
clang_line = None
for line in reversed(stdout.split('\n')):
if 'clang' in line:
clang_line = line
break
else:
return v8_flags

# Parse flags that are important for YCM's purposes.
for flag in clang_line.split(' '):
if flag.startswith('-I'):
# Relative paths need to be resolved, because they're relative to the
# output dir, not the source.
if flag[2] == '/':
v8_flags.append(flag)
else:
abs_path = os.path.normpath(os.path.join(out_dir, flag[2:]))
v8_flags.append('-I' + abs_path)
elif flag.startswith('-std'):
v8_flags.append(flag)
elif flag.startswith('-') and flag[1] in 'DWFfmO':
if flag == '-Wno-deprecated-register' or flag == '-Wno-header-guard':
# These flags causes libclang (3.3) to crash. Remove it until things
# are fixed.
continue
v8_flags.append(flag)

return v8_flags


def FlagsForFile(filename):
"""This is the main entry point for YCM. Its interface is fixed.
Args:
filename: (String) Path to source file being edited.
Returns:
(Dictionary)
'flags': (List of Strings) Command line flags.
'do_cache': (Boolean) True if the result should be cached.
"""
v8_root = FindV8SrcFromFilename(filename)
v8_flags = GetClangCommandFromNinjaForFilename(v8_root, filename)
final_flags = flags + v8_flags
return {
'flags': final_flags,
'do_cache': True
}
Loading

0 comments on commit 2c33528

Please sign in to comment.