diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 18:18:34 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 18:18:34 +0000 |
commit | 79e2336c1782fff5147a447495a20729007935c2 (patch) | |
tree | 08e8d6c59381ed89bab615ef9618fd0f5db7186f | |
parent | 45316d6f9cd510bd1b4604c38713272b2c8a7c9e (diff) | |
download | chromium_src-79e2336c1782fff5147a447495a20729007935c2.zip chromium_src-79e2336c1782fff5147a447495a20729007935c2.tar.gz chromium_src-79e2336c1782fff5147a447495a20729007935c2.tar.bz2 |
The gyp files don't have a way to refer to POSIX-like OS's as a group, so I defined os_posix, toolkit_gtk, and use_x11 in common.gypi to handle them. I used something similar when porting Chromium 10 and 11 to OpenBSD and Solaris, plus a version of this patch has been tested on FreeBSD.
Chromium has also been built on other BSDs, so rather than adding each Unix to every gyp file individually every time another port is added, these broad defines can be used instead and modified with specific logic only where necessary.
I included a few modified gyp files so the usage can be seen. I also added sunos5 to some grd/html files and set the default host_arch on i86pc solaris to ia32.
BUG=0
TEST={}
Patch by ruben <chromium@hybridsource.org>.
Review URL: http://codereview.chromium.org/6965007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85154 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/app.gyp | 4 | ||||
-rw-r--r-- | app/app_base.gypi | 6 | ||||
-rw-r--r-- | app/resources/app_resources.grd | 8 | ||||
-rw-r--r-- | base/allocator/allocator.gyp | 2 | ||||
-rw-r--r-- | base/base.gyp | 10 | ||||
-rw-r--r-- | base/base.gypi | 14 | ||||
-rw-r--r-- | build/all.gyp | 8 | ||||
-rw-r--r-- | build/common.gypi | 57 | ||||
-rw-r--r-- | build/features_override.gypi | 2 | ||||
-rw-r--r-- | build/linux/system.gyp | 4 | ||||
-rw-r--r-- | build/temp_gyp/googleurl.gyp | 2 | ||||
-rw-r--r-- | chrome/browser/resources/options/personal_options.html | 2 |
12 files changed, 72 insertions, 47 deletions
diff --git a/app/app.gyp b/app/app.gyp index b7b9aaa..955a6d6 100644 --- a/app/app.gyp +++ b/app/app.gyp @@ -57,7 +57,7 @@ '..', ], 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + ['toolkit_uses_gtk==1', { 'sources': [ '../ui/base/dragdrop/gtk_dnd_util_unittest.cc', ], @@ -73,7 +73,7 @@ '../ui/base/view_prop_unittest.cc', ], }], - ['OS =="linux" or OS =="freebsd"', { + ['os_posix==1 and OS!="mac"', { 'conditions': [ ['linux_use_tcmalloc==1', { 'dependencies': [ diff --git a/app/app_base.gypi b/app/app_base.gypi index 873cbb0..82c3962 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -31,7 +31,7 @@ 'app_paths.cc', ], 'conditions': [ - ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', { + ['toolkit_uses_gtk!=1', { 'sources!': [ '../ui/base/dragdrop/gtk_dnd_util.cc', '../ui/base/dragdrop/gtk_dnd_util.h', @@ -221,7 +221,7 @@ 'win/shell.h', ], 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + ['toolkit_uses_gtk==1', { 'dependencies': [ # font_gtk.cc uses fontconfig. # TODO(evanm): I think this is wrong; it should just use GTK. @@ -273,7 +273,7 @@ ['exclude', '^win/*'], ], }], - ['OS=="linux"', { + ['use_x11==1', { 'sources!': [ '../ui/base/keycodes/keyboard_code_conversion_mac.mm', '../ui/base/keycodes/keyboard_code_conversion_mac.h', diff --git a/app/resources/app_resources.grd b/app/resources/app_resources.grd index 751dfbf..6bd2388 100644 --- a/app/resources/app_resources.grd +++ b/app/resources/app_resources.grd @@ -18,7 +18,7 @@ <include name="IDR_CLOSE_H" file="close_h.png" type="BINDATA" /> <include name="IDR_CLOSE_P" file="close_p.png" type="BINDATA" /> </if> - <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1)"> + <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1 or os == 'sunos5')"> <include name="IDR_CLOSE" file="linux_close.png" type="BINDATA" /> <include name="IDR_CLOSE_H" file="linux_close_h.png" type="BINDATA" /> <include name="IDR_CLOSE_P" file="linux_close_p.png" type="BINDATA" /> @@ -42,7 +42,7 @@ <include name="IDR_MAXIMIZE_H" file="maximize_h.png" type="BINDATA" /> <include name="IDR_MAXIMIZE_P" file="maximize_p.png" type="BINDATA" /> </if> - <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1)"> + <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1 or os == 'sunos5')"> <include name="IDR_MAXIMIZE" file="linux_maximize.png" type="BINDATA" /> <include name="IDR_MAXIMIZE_H" file="linux_maximize_h.png" type="BINDATA" /> <include name="IDR_MAXIMIZE_P" file="linux_maximize_p.png" type="BINDATA" /> @@ -54,7 +54,7 @@ <include name="IDR_MINIMIZE_H" file="minimize_h.png" type="BINDATA" /> <include name="IDR_MINIMIZE_P" file="minimize_p.png" type="BINDATA" /> </if> - <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1)"> + <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1 or os == 'sunos5')"> <include name="IDR_MINIMIZE" file="linux_minimize.png" type="BINDATA" /> <include name="IDR_MINIMIZE_H" file="linux_minimize_h.png" type="BINDATA" /> <include name="IDR_MINIMIZE_P" file="linux_minimize_p.png" type="BINDATA" /> @@ -64,7 +64,7 @@ <include name="IDR_RESTORE_H" file="restore_h.png" type="BINDATA" /> <include name="IDR_RESTORE_P" file="restore_p.png" type="BINDATA" /> </if> - <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1)"> + <if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1 or os == 'sunos5')"> <include name="IDR_RESTORE" file="linux_restore.png" type="BINDATA" /> <include name="IDR_RESTORE_H" file="linux_restore_h.png" type="BINDATA" /> <include name="IDR_RESTORE_P" file="linux_restore_p.png" type="BINDATA" /> diff --git a/base/allocator/allocator.gyp b/base/allocator/allocator.gyp index 065cbf4..1e96171 100644 --- a/base/allocator/allocator.gyp +++ b/base/allocator/allocator.gyp @@ -309,7 +309,7 @@ '<(tcmalloc_dir)/src/debugallocation.cc', ], }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + ['OS=="linux" or OS=="freebsd" or OS=="solaris"', { 'sources!': [ '<(tcmalloc_dir)/src/system-alloc.h', '<(tcmalloc_dir)/src/windows/port.cc', diff --git a/base/base.gyp b/base/base.gyp index 6953ede..0e3c72d 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -20,7 +20,7 @@ '../third_party/icu/icu.gyp:icuuc', ], 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + ['toolkit_uses_gtk==1', { 'dependencies': [ # i18n/rtl.cc uses gtk '../build/linux/system.gyp:gtk', @@ -233,7 +233,7 @@ '../testing/gtest.gyp:gtest', ], 'conditions': [ - ['OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', { + ['toolkit_uses_gtk==1', { 'sources!': [ 'file_version_info_unittest.cc', ], @@ -260,7 +260,7 @@ '../build/linux/system.gyp:nss', '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck', ], - }, { # OS != "linux" and OS != "freebsd" and OS != "openbsd" and OS != "solaris" + }, { # toolkit_uses_gtk!=1 'sources!': [ 'message_pump_glib_unittest.cc', ] @@ -303,7 +303,7 @@ 'base', ], 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + ['toolkit_uses_gtk==1', { 'dependencies': [ # test_suite initializes GTK. '../build/linux/system.gyp:gtk', @@ -348,7 +348,7 @@ ], }, 'conditions': [ - ['OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', { + ['toolkit_uses_gtk==1', { 'dependencies': [ # Needed to handle the #include chain: # base/test/perf_test_suite.h diff --git a/base/base.gypi b/base/base.gypi index 578e50d..56da313 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -354,7 +354,7 @@ '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework/Frameworks', ], 'conditions': [ - [ 'OS != "linux" and OS != "freebsd" and OS != "openbsd" and OS != "solaris"', { + [ 'toolkit_uses_gtk==0', { 'sources/': [ ['exclude', '^nix/'], ], @@ -406,12 +406,12 @@ 'string16.cc', ], },], - ['OS=="freebsd" or OS=="openbsd"', { + ['os_posix==1 and OS!="linux" and OS!="mac"', { 'sources!': [ - 'base/files/file_path_watcher_linux.cc', + 'files/file_path_watcher_linux.cc', ], 'sources': [ - 'base/files/file_path_watcher_stub.cc', + 'files/file_path_watcher_stub.cc', ], }], ], @@ -442,7 +442,7 @@ ], }, 'conditions': [ - [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', { + [ 'toolkit_uses_gtk==1', { 'conditions': [ [ 'chromeos==1', { 'sources/': [ ['include', '_chromeos\\.cc$'] ] @@ -477,7 +477,7 @@ '../build/linux/system.gyp:gtk', '../build/linux/system.gyp:x11', ], - }, { # OS != "linux" and OS != "freebsd" and OS != "openbsd" and OS != "solaris" + }, { # toolkit_uses_gtk!=1 'sources/': [ ['exclude', '/xdg_user_dirs/'], ['exclude', '_nss\.cc$'], @@ -627,7 +627,7 @@ }, ], }], - [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', { + [ 'os_posix==1 and OS!="mac"', { 'targets': [ { 'target_name': 'symbolize', diff --git a/build/all.gyp b/build/all.gyp index 8da3952..0842e9f 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -60,7 +60,7 @@ '../v8/tools/gyp/v8.gyp:*', ], }], - ['OS=="mac" or OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + ['OS=="mac" or OS=="linux"', { 'dependencies': [ '../third_party/yasm/yasm.gyp:*#host', ], @@ -89,7 +89,7 @@ }], ], }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + ['toolkit_uses_gtk==1', { 'dependencies': [ '../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*', '../tools/xdisplaycheck/xdisplaycheck.gyp:*', @@ -285,11 +285,11 @@ '../chrome/chrome.gyp:chromedriver', ], 'conditions': [ - ['OS=="mac" or OS=="win" or (OS=="linux" and target_arch==python_arch)', { + ['OS=="mac" or OS=="win" or (os_posix==1 and target_arch==python_arch)', { 'dependencies': [ '../chrome/chrome.gyp:pyautolib', ], - }], # 'OS=="mac" or OS=="win" or (OS=="linux" and target_arch==python_arch)' + }], ], }, # target_name: chromium_builder_qa ], diff --git a/build/common.gypi b/build/common.gypi index 112d5294..eadb47a 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -38,14 +38,16 @@ # Compute the architecture that we're building on. 'conditions': [ - [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { - # This handles the Linux platforms we generally deal with. Anything - # else gets passed through, which probably won't work very well; such - # hosts should pass an explicit target_arch to gyp. + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + # This handles the Unix platforms for which there is some support. + # Anything else gets passed through, which probably won't work very + # well; such hosts should pass an explicit target_arch to gyp. 'host_arch%': - '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")', - }, { # OS!="linux" + '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/")', + 'os_nix%': 1, + }, { # OS=="win" or OS=="mac" 'host_arch%': 'ia32', + 'os_nix%': 0, }], # Set default value of toolkit_views on for Windows, Chrome OS @@ -64,6 +66,7 @@ 'host_arch%': '<(host_arch)', 'library%': '<(library)', 'toolkit_views%': '<(toolkit_views)', + 'os_nix%': '<(os_nix)', # Override branding to select the desired branding flavor. 'branding%': 'Chromium', @@ -143,6 +146,22 @@ 'disable_pie%': 0, 'conditions': [ + # A flag for POSIX platforms + ['os_nix==1 or OS=="mac"', { + 'os_posix%': 1, + }, { + 'os_posix%': 0, + }], + + # Flags to use Gtk and X11 on non-Mac POSIX platforms + ['os_nix==1', { + 'toolkit_uses_gtk%': 1, + 'use_x11%': 1, + }, { + 'toolkit_uses_gtk%': 0, + 'use_x11%': 0, + }], + # A flag to enable or disable our compile-time dependency # on gnome-keyring. If that dependency is disabled, no gnome-keyring # support will be available. This option is useful @@ -188,6 +207,9 @@ 'target_arch%': '<(target_arch)', 'host_arch%': '<(host_arch)', 'toolkit_views%': '<(toolkit_views)', + 'os_posix%': '<(os_posix)', + 'toolkit_uses_gtk%': '<(toolkit_uses_gtk)', + 'use_x11%': '<(use_x11)', 'use_gnome_keyring%': '<(use_gnome_keyring)', 'linux_fpic%': '<(linux_fpic)', 'enable_flapper_hacks%': '<(enable_flapper_hacks)', @@ -409,7 +431,7 @@ 'icu_src_dir': '../third_party/icu', 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + ['os_posix==1 and OS!="mac"', { # This will set gcc_version to XY if you are running gcc X.Y.*. # This is used to tweak build flags for gcc 4.4. 'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)', @@ -425,7 +447,7 @@ 'linux_dump_symbols%': 1, }], ], - }], # OS=="linux" or OS=="freebsd" or OS=="openbsd" + }], # os_posix==1 and OS!="mac" ['OS=="mac"', { 'conditions': [ @@ -487,7 +509,7 @@ ], }], - ['OS=="mac" or (OS=="linux" and chromeos==0 and target_arch!="arm")', { + ['os_posix==1 and chromeos==0 and target_arch!="arm"', { 'use_cups%': 1, }, { 'use_cups%': 0, @@ -736,7 +758,7 @@ 'target_conditions': [ ['chromium_code==0', { 'conditions': [ - [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + [ 'os_posix==1 and OS!="mac"', { # We don't want to get warnings from third-party code, # so remove any existing warning-enabling flags like -Wall. 'cflags!': [ @@ -792,7 +814,7 @@ ['exclude', '(^|/)(cocoa|mac)/'], ['exclude', '\\.mm?$' ] ], }], - ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', { + ['toolkit_uses_gtk!=1', { 'sources/': [ ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.(h|cc)$'], ['exclude', '(^|/)gtk/'], @@ -1027,16 +1049,19 @@ }, }, 'conditions': [ - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + ['os_posix==1 and OS!="mac"', { 'target_defaults': { # Enable -Werror by default, but put it in a variable so it can # be disabled in ~/.gyp/include.gypi on the valgrind builders. 'variables': { # Use -fno-strict-aliasing, see http://crbug.com/32204 'no_strict_aliasing%': 1, - 'conditions': [['OS=="linux"', {'werror%': '-Werror',}], - ['OS=="freebsd"', {'werror%': '',}], - ['OS=="openbsd"', {'werror%': '',}], + 'conditions': [ + ['OS=="linux"', { + 'werror%': '-Werror', + }, { # turn off -Werror on other Unices + 'werror%': '', + }], ], }, 'cflags': [ @@ -1634,7 +1659,7 @@ }, }, }], - ['disable_nacl==1 or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { + ['disable_nacl==1', { 'target_defaults': { 'defines': [ 'DISABLE_NACL', diff --git a/build/features_override.gypi b/build/features_override.gypi index 622afb3..a03e0b8 100644 --- a/build/features_override.gypi +++ b/build/features_override.gypi @@ -88,7 +88,7 @@ 'enable_svg%': '<(enable_svg)', 'enable_touch_events%': '<(enable_touch_events)', 'conditions': [ - ['(OS=="win" or OS=="linux" or OS=="mac") and use_accelerated_compositing==1', { + ['use_accelerated_compositing==1', { 'feature_defines': [ 'WTF_USE_ACCELERATED_COMPOSITING=1', 'ENABLE_3D_RENDERING=1', diff --git a/build/linux/system.gyp b/build/linux/system.gyp index 30a3430..528cda6 100644 --- a/build/linux/system.gyp +++ b/build/linux/system.gyp @@ -13,13 +13,13 @@ 'pkg-config': 'pkg-config' }, }], - [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + [ 'os_posix==1 and OS!="mac"', { 'variables': { # We use our own copy of libssl3, although we still need to link against # the rest of NSS. 'use_system_ssl%': 0, }, - }, { # OS!="linux" + }, { 'variables': { 'use_system_ssl%': 1, }, diff --git a/build/temp_gyp/googleurl.gyp b/build/temp_gyp/googleurl.gyp index 8e87a70..b59d994 100644 --- a/build/temp_gyp/googleurl.gyp +++ b/build/temp_gyp/googleurl.gyp @@ -86,7 +86,7 @@ '../../base/test/run_all_unittests.cc', ], 'conditions': [ - ['OS=="linux" or OS=="freebsd"', { + ['os_posix==1 and OS!="mac"', { 'conditions': [ ['linux_use_tcmalloc==1', { 'dependencies': [ diff --git a/chrome/browser/resources/options/personal_options.html b/chrome/browser/resources/options/personal_options.html index 7f77e47..1a316c4 100644 --- a/chrome/browser/resources/options/personal_options.html +++ b/chrome/browser/resources/options/personal_options.html @@ -103,7 +103,7 @@ </div> </section> </if> -<if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1)"> +<if expr="not pp_ifdef('toolkit_views') and (os == 'linux2' or os.find('bsd') != -1 or os == 'sunos5')"> <section> <h3 i18n-content="appearance"></h3> <div> |