Commit 2c3e8b6a authored by Ben Noordhuis's avatar Ben Noordhuis
Browse files

build: rework -fvisibility=hidden detection

Make the gcc_version macro conform with what node.js and v8 use. Important
because node.js's common.gypi is going to export it soon.
parent a1157cef
v1.x v1.41.0 v1.40.0 v1.39.0 v1.38.1 v1.38.0 v1.37.0 v1.36.0 v1.35.0 v1.34.2 v1.34.1 v1.34.0 v1.33.1 v1.33.0 v1.32.0 v1.31.0 v1.30.1 v1.30.0 v1.29.1 v1.29.0 v1.28.0 v1.27.0 v1.26.0 v1.25.0 v1.24.1 v1.24.0 v1.23.2 v1.23.1 v1.23.0 v1.22.0 v1.21.0 v1.20.3 v1.20.2 v1.20.1 v1.20.0 v1.19.2 v1.19.1 v1.19.0 v1.18.0 v1.17.0 v1.16.1 v1.16.0 v1.15.0 v1.14.1 v1.14.0 v1.13.1 v1.13.0 v1.12.0 v1.11.0 v1.10.2 v1.10.1 v1.10.0 v1.9.1 v1.9.0 v1.8.0 v1.7.5 v1.7.4 v1.7.3 v1.7.2 v1.7.1 v1.7.0 v1.6.1 v1.6.0 v1.5.0 v1.4.2 v1.4.1 v1.4.0 v1.3.0 v1.2.1 v1.2.0 v1.1.0 v1.0.2 v1.0.1 v1.0.0 v1.0.0-rc2 v1.0.0-rc1 v0.11.29 v0.11.28 v0.11.27 v0.11.26 v0.11.25 v0.11.24 v0.11.23 v0.11.22 v0.11.21 v0.11.20 v0.11.19 v0.11.18 v0.11.17 v0.11.16 v0.11.15 v0.11.14 v0.11.13 v0.11.12 v0.11.11 v0.11.10 v0.11.9 v0.11.8 v0.11.7 v0.11.6 v0.11.5 v0.11.4 v0.11.3 v0.11.2 v0.11.1 v0.10.37 v0.10.36 v0.10.35 v0.10.34 v0.10.33 v0.10.32 v0.10.31 v0.10.30 v0.10.29 v0.10.28 v0.10.27 v0.10.26 v0.10.25 v0.10.24 v0.10.23 v0.10.22 v0.10.21 v0.10.20 v0.10.19 v0.10.18 v0.10.17 v0.10.16 v0.10.15 v0.10.14 v0.10.13 v0.10.12 v0.10.11 v0.10.10 v0.10.9 v0.10.8 v0.10.7 v0.10.6 v0.10.5 v0.10.4 v0.10.3 v0.10.2 node-v0.11.0 node-v0.10.1 node-v0.10.0 node-v0.9.12 node-v0.9.11 node-v0.9.10 node-v0.9.9 node-v0.9.8 node-v0.9.7 node-v0.9.6 node-v0.9.5 node-v0.9.4 node-v0.9.3 node-v0.9.2 node-v0.9.1 node-v0.8.22 node-v0.8.21 node-v0.8.20 node-v0.8.19 node-v0.8.18 node-v0.8.17 node-v0.8.16 node-v0.8.15 node-v0.8.14 node-v0.8.13 node-v0.8.12 node-v0.8.11 node-v0.8.10 node-v0.8.9 node-v0.8.8 node-v0.8.7
No related merge requests found
Showing with 19 additions and 31 deletions
+19 -31
#!/usr/bin/env python
import os
import re
import subprocess
import sys
def DoMain(*args):
cc = os.environ.get('CC', 'gcc')
stdin, stderr = os.pipe()
subprocess.call([cc, '-v'], stderr=stderr)
output = os.read(stdin, 4096)
match = re.search("\ngcc version (\d+\.\d+\.\d+)", output)
if match:
print(match.group(1))
if __name__ == '__main__':
DoMain(*sys.argv)
......@@ -6,6 +6,8 @@
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
'component%': 'static_library', # NB. these names match with what V8 expects
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
'gcc_version%': 'unknown',
'clang%': 0,
},
'target_defaults': {
......@@ -117,9 +119,6 @@
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'variables': {
'gcc_version%': '<!(python build/gcc_version.py)>)',
},
'cflags': [ '-Wall' ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'conditions': [
......@@ -137,7 +136,7 @@
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
}],
[ 'visibility=="hidden" and gcc_version >= "4.0.0"', {
[ 'visibility=="hidden" and (clang==1 or gcc_version >= 40)', {
'cflags': [ '-fvisibility=hidden' ],
}],
],
......
#!/usr/bin/env python
import glob
import os
import shlex
import subprocess
import sys
CC = os.environ.get('CC', 'cc')
script_dir = os.path.dirname(__file__)
uv_root = os.path.normpath(script_dir)
output_dir = os.path.join(os.path.abspath(uv_root), 'out')
sys.path.insert(0, os.path.join(uv_root, 'build', 'gyp', 'pylib'))
try:
......@@ -14,9 +17,14 @@ except ImportError:
print('You need to install gyp in build/gyp first. See the README.')
sys.exit(42)
# Directory within which we want all generated files (including Makefiles)
# to be written.
output_dir = os.path.join(os.path.abspath(uv_root), 'out')
def compiler_version():
proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE)
is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
version = tuple(map(int, proc.communicate()[0].split('.')))
return (version, is_clang)
def run_gyp(args):
rc = gyp.main(args)
......@@ -24,6 +32,7 @@ def run_gyp(args):
print 'Error running GYP'
sys.exit(rc)
if __name__ == '__main__':
args = sys.argv[1:]
......@@ -49,12 +58,12 @@ if __name__ == '__main__':
# There's a bug with windows which doesn't allow this feature.
if sys.platform != 'win32':
# Tell gyp to write the Makefiles into output_dir
args.extend(['--generator-output', output_dir])
# Tell make to write its output into the same dir
args.extend(['-Goutput_dir=' + output_dir])
# Create Makefiles, not XCode projects
args.extend('-f make'.split())
(major, minor), is_clang = compiler_version()
args.append('-Dgcc_version=%d' % (10 * major + minor))
args.append('-Dclang=%d' % int(is_clang))
args.append('-Dtarget_arch=ia32')
args.append('-Dcomponent=static_library')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment