From a61fa01c5df9d739c410e2be54e81cbc54926873 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 31 Jul 2013 16:27:00 -0700 Subject: [PATCH 01/10] Update libchromiumcontent to get basic Linux support * vendor/libchromiumcontent 33472d4...be71317 (4): > Merge pull request #24 from brightray/linux > Fix gyp syntax > Fix Release linker error on Linux > Make sure we always apply patches in alphabetical order --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index 33472d4dfeca..be713176cce1 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 33472d4dfeca556ce68c126cc71cd1e3f830de8a +Subproject commit be713176cce155601c7ec79f4129f4c7fceae495 From 684180153893af2077adeda399e1a82facecd910 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 6 Aug 2013 16:36:58 -0400 Subject: [PATCH 02/10] Spew less when script/bootstrap fails --- brightray/script/bootstrap | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/brightray/script/bootstrap b/brightray/script/bootstrap index 57e28b339978..0325f49b0c3b 100755 --- a/brightray/script/bootstrap +++ b/brightray/script/bootstrap @@ -14,8 +14,8 @@ DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download') def main(): args = parse_args() - update_submodules() - download_libchromiumcontent(args.url) + return (update_submodules() or + download_libchromiumcontent(args.url)) def parse_args(): @@ -27,17 +27,17 @@ def parse_args(): def update_submodules(): - subprocess.check_call(['git', 'submodule', 'sync', '--quiet']) - subprocess.check_call(['git', 'submodule', 'update', '--init', - '--recursive']) + return (subprocess.call(['git', 'submodule', 'sync', '--quiet']) or + subprocess.call(['git', 'submodule', 'update', '--init', + '--recursive'])) def download_libchromiumcontent(url): mkdir_p(DOWNLOAD_DIR) download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script', 'download') - subprocess.check_call([sys.executable, download, '-f', url, - os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')]) + return subprocess.call([sys.executable, download, '-f', url, + os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')]) def mkdir_p(path): From af20c555194573f55d5b910009daf03679c68aec Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 6 Aug 2013 16:41:58 -0400 Subject: [PATCH 03/10] Spew less when script/cibuild fails --- brightray/script/cibuild | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/brightray/script/cibuild b/brightray/script/cibuild index 2ca4394f31c7..318331ffb3b1 100755 --- a/brightray/script/cibuild +++ b/brightray/script/cibuild @@ -16,8 +16,9 @@ def main(): return 'Error: Can\'t find {0}'.format(S3_CREDENTIALS_FILE) copy_to_environment(S3_CREDENTIALS_FILE) - run_script('bootstrap', 'https://{0}.s3.amazonaws.com/libchromiumcontent'.format(os.environ['JANKY_ARTIFACTS_S3_BUCKET'])) - run_script('build') + url = 'https://{0}.s3.amazonaws.com/libchromiumcontent'.format(os.environ['JANKY_ARTIFACTS_S3_BUCKET']) + return (run_script('bootstrap', url) or + run_script('build')) def copy_to_environment(credentials_file): @@ -32,7 +33,7 @@ def run_script(script, *args): script = os.path.join('script', script) sys.stderr.write('+ {0}\n'.format(script)) sys.stderr.flush() - subprocess.check_call([sys.executable, script] + list(args)) + return subprocess.call([sys.executable, script] + list(args)) if __name__ == '__main__': From efad174995b092932152b2222d80c88890501c1a Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 6 Aug 2013 16:43:21 -0400 Subject: [PATCH 04/10] Update libchromiumcontent to get better Linux support * vendor/libchromiumcontent be71317...5ffcb39 (2): > Delete commented-out code in script/download > Teach script/download about Linux --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index be713176cce1..5ffcb396d64d 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit be713176cce155601c7ec79f4129f4c7fceae495 +Subproject commit 5ffcb396d64df97a2d0220101e1e52598a661fc8 From b596adc23770f676c1b3ffbf566491e556a881f2 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 6 Aug 2013 16:49:59 -0400 Subject: [PATCH 05/10] Start teaching script/build about Linux --- brightray/script/build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/brightray/script/build b/brightray/script/build index 6463d9d1d90b..b308e1837871 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -7,9 +7,8 @@ import sys SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) GYP = { - 'darwin': 'gyp', - 'win32': 'gyp.bat', -}[sys.platform] + 'win32': 'gyp.bat', +}.get(sys.platform, 'gyp') def main(): From 3076781c8a0d9ad5efb2b497e5a1911bb8645c74 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 6 Aug 2013 17:25:07 -0400 Subject: [PATCH 06/10] Build using make on Linux --- brightray/script/build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/brightray/script/build b/brightray/script/build index b308e1837871..8e155d37fa67 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -13,22 +13,22 @@ GYP = { def main(): os.chdir(SOURCE_ROOT) - run_gyp() - build() + return (run_gyp() or build()) def run_gyp(): - subprocess.check_call([GYP, '--depth', '.', 'brightray.gyp']) + return subprocess.call([GYP, '--depth', '.', 'brightray.gyp']) def build(): if sys.platform == 'darwin': - subprocess.check_call(['xcodebuild']) - return + return subprocess.call(['xcodebuild']) + if sys.platform == 'linux2': + return subprocess.call(['make']) assert sys.platform == 'win32', sys.platform msbuild = os.path.join(os.environ['windir'], 'Microsoft.NET', 'Framework', 'v4.0.30319', 'MSBuild.exe') - subprocess.check_call([msbuild, 'brightray.sln']) + return subprocess.call([msbuild, 'brightray.sln']) if __name__ == '__main__': From d27a984378d5242d50f8501e55d027061b9d1055 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Tue, 6 Aug 2013 17:29:08 -0400 Subject: [PATCH 07/10] Define USE_X11 on Linux --- brightray/brightray.gypi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index 7d4b1f42073c..a8cb1ea556dd 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -73,6 +73,13 @@ ], }, }, + 'conditions': [ + ['OS not in ["mac", "win"]', { + 'defines': [ + 'USE_X11', + ], + }], + ], }, 'Debug': { 'inherit_from': [ From 7f3afbaf3d41efecf063fdb0477bd90645aba43f Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 14 Aug 2013 07:14:25 -0400 Subject: [PATCH 08/10] Force building with Clang on Linux to get C++11 support --- brightray/brightray.gypi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index a8cb1ea556dd..0fe893d80ee4 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -177,6 +177,16 @@ ], }, 'conditions': [ + ['OS=="linux"', { + 'make_global_settings': [ + ['CC', '/usr/bin/clang'], + ['CXX', '/usr/bin/clang++'], + ['LINK', '$(CXX)'], + ['CC.host', '$(CC)'], + ['CXX.host', '$(CXX)'], + ['LINK.host', '$(LINK)'], + ], + }], ['OS=="win"', { 'target_defaults': { 'include_dirs': [ From 22ea2073df6dd3434c90de126cadd159e6638bec Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 14 Aug 2013 07:58:36 -0400 Subject: [PATCH 09/10] Compile as C++11 on Linux --- brightray/brightray.gypi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index 0fe893d80ee4..ad18976fd3f3 100644 --- a/brightray/brightray.gypi +++ b/brightray/brightray.gypi @@ -174,6 +174,11 @@ ['exclude', '_win\.(cc|h)$'], ], }], + ['OS=="linux"', { + 'cflags_cc': [ + '-std=gnu++11', + ], + }], ], }, 'conditions': [ From 9638e3956f7e48596f5e9acdd15189e3647aa11c Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 14 Aug 2013 08:08:59 -0400 Subject: [PATCH 10/10] Don't use base::DIR_APP_DATA on Linux It doesn't exist. Instead, match content_shell by putting application-specific data in $XDG_CONFIG_HOME or ~/.config. --- brightray/browser/browser_context.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 494f08f64035..31c00b8d6aa0 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -9,6 +9,7 @@ #include "browser/network_delegate.h" #include "common/application_info.h" +#include "base/environment.h" #include "base/files/file_path.h" #include "base/path_service.h" #include "base/prefs/json_pref_store.h" @@ -20,6 +21,10 @@ #include "content/public/browser/storage_partition.h" #include "url_request_context_getter.h" +#if defined(OS_LINUX) +#include "base/nix/xdg_util.h" +#endif + namespace brightray { class BrowserContext::ResourceContext : public content::ResourceContext { @@ -83,7 +88,15 @@ base::FilePath BrowserContext::GetPath() { return path_; base::FilePath path; +#if defined(OS_LINUX) + scoped_ptr env(base::Environment::Create()); + path = base::nix::GetXDGDirectory(env.get(), + base::nix::kXdgConfigHomeEnvVar, + base::nix::kDotConfigDir); +#else CHECK(PathService::Get(base::DIR_APP_DATA, &path)); +#endif + path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName())); return path_; }