linux: Improve building flags for Release build

This commit is contained in:
Cheng Zhao 2015-04-09 09:58:07 +08:00
parent 2ef9e85f5e
commit 62d845f09e
2 changed files with 60 additions and 25 deletions

View file

@ -93,6 +93,7 @@
'common/main_delegate_mac.mm',
],
'conditions': [
# Link with libraries of libchromiumcontent.
['OS=="linux" and libchromiumcontent_component==0', {
# On Linux we have to use "--whole-archive" to force executable
# to include all symbols, otherwise we will have plenty of
@ -110,30 +111,43 @@
},
}],
['OS=="linux"', {
'cflags_cc': [
'-Wno-deprecated-register',
'-fno-rtti',
],
'variables': {
'system_libraries': 'gtk+-2.0 libnotify dbus-1 x11 xrandr xext gconf-2.0',
},
'link_settings': {
'ldflags': [
'<!@(pkg-config --libs-only-L --libs-only-other gtk+-2.0 libnotify dbus-1 x11 xrandr xext gconf-2.0)',
'<!@(pkg-config --libs-only-L --libs-only-other <(system_libraries))',
],
'libraries': [
'-lpthread',
'<!@(pkg-config --libs-only-l gtk+-2.0 libnotify dbus-1 x11 xrandr xext gconf-2.0)',
'<!@(pkg-config --libs-only-l <(system_libraries))',
],
},
'cflags': [
'<!@(pkg-config --cflags <(system_libraries))',
# Needed by using libgtk2ui:
'-Wno-deprecated-register',
],
'direct_dependent_settings': {
'cflags': [
'<!@(pkg-config --cflags <(system_libraries))',
'-Wno-deprecated-register',
],
},
'conditions': [
['libchromiumcontent_component', {
'link_settings': {
'libraries': [
# libgtk2ui is always linked statically.
'<(libchromiumcontent_dir)/libgtk2ui.a',
],
},
}, {
'link_settings': {
'libraries': [
# libboringssl is always linked dynamically.
'<(libchromiumcontent_dir)/libboringssl.so',
# Following libraries are required by libchromiumcontent:
'-lasound',
'-lcap',
'-lcups',

View file

@ -110,9 +110,27 @@
'USE_X11',
],
}],
['OS=="linux"', {
'cflags_cc': [
'-D__STRICT_ANSI__',
'-std=gnu++11',
'-fno-rtti',
],
}], # OS=="linux"
],
}, # Common_Base
'Debug_Base': {
'defines': [
# Use this instead of "NDEBUG" to determine whether we are in
# Debug build, because "NDEBUG" is already used by Chromium.
'DEBUG',
# Require when using libchromiumcontent.
'COMPONENT_BUILD',
'GURL_DLL',
'SKIA_DLL',
'USING_V8_SHARED',
'WEBKIT_DLL',
],
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '2', # /MD (nondebug DLL)
@ -181,6 +199,27 @@
],
},
},
'conditions': [
['OS=="linux"', {
'cflags': [
'-O2',
# Don't emit the GCC version ident directives, they just end up
# in the .comment section taking up binary size.
'-fno-ident',
# Put data and code in their own sections, so that unused symbols
# can be removed at link time with --gc-sections.
'-fdata-sections',
'-ffunction-sections',
],
'ldflags': [
# Specifically tell the linker to perform optimizations.
# See http://lwn.net/Articles/192624/ .
'-Wl,-O1',
'-Wl,--as-needed',
'-Wl,--gc-sections',
],
}], # OS=="linux"
],
}, # Release_Base
'conditions': [
['libchromiumcontent_component', {
@ -241,14 +280,7 @@
['exclude', '_win\.(cc|h)$'],
],
}],
['OS=="linux"', {
'cflags_cc': [
'-D__STRICT_ANSI__',
'-std=gnu++11',
'-fno-rtti',
'<!@(pkg-config --cflags gtk+-2.0)',
],
}, {
['OS!="linux"', {
'sources/': [
['exclude', '/linux/'],
['exclude', '_linux\.(cc|h)$'],
@ -257,17 +289,6 @@
],
},
'conditions': [
['libchromiumcontent_component', {
'target_defaults': {
'defines': [
'COMPONENT_BUILD',
'GURL_DLL',
'SKIA_DLL',
'USING_V8_SHARED',
'WEBKIT_DLL',
],
},
}],
['OS=="win"', {
'target_defaults': {
'include_dirs': [