From 070e7171587b7cf3a0ae90bd696416e99b1d2c33 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 --- vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/libchromiumcontent b/vendor/libchromiumcontent index 33472d4dfeca5..be713176cce15 160000 --- a/vendor/libchromiumcontent +++ b/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 33472d4dfeca556ce68c126cc71cd1e3f830de8a +Subproject commit be713176cce155601c7ec79f4129f4c7fceae495 From c34580b99c61fe2b399d286ed96fda37fc3594f9 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 --- script/bootstrap | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index 57e28b339978f..0325f49b0c3bb 100755 --- a/script/bootstrap +++ b/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 a196a28ef73cdb348dd0bd189e1d31e6e094f6f7 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 --- script/cibuild | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/script/cibuild b/script/cibuild index 2ca4394f31c7d..318331ffb3b1d 100755 --- a/script/cibuild +++ b/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 1d01ca8bf8c0c8ce2f319895c732fa8a4ccbc5b0 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 --- vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/libchromiumcontent b/vendor/libchromiumcontent index be713176cce15..5ffcb396d64df 160000 --- a/vendor/libchromiumcontent +++ b/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit be713176cce155601c7ec79f4129f4c7fceae495 +Subproject commit 5ffcb396d64df97a2d0220101e1e52598a661fc8 From 88adb2282bc38d1ff1d12a0734325c5886a81035 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 --- script/build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/script/build b/script/build index 6463d9d1d90b7..b308e1837871d 100755 --- a/script/build +++ b/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 f77389cad989f4f406f7cb2b64902e05946b6a0b 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 --- script/build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script/build b/script/build index b308e1837871d..8e155d37fa67b 100755 --- a/script/build +++ b/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 152aed0db9243107caa25abe53aad7968cbd41f4 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.gypi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/brightray.gypi b/brightray.gypi index 7d4b1f42073c1..a8cb1ea556dd6 100644 --- a/brightray.gypi +++ b/brightray.gypi @@ -73,6 +73,13 @@ ], }, }, + 'conditions': [ + ['OS not in ["mac", "win"]', { + 'defines': [ + 'USE_X11', + ], + }], + ], }, 'Debug': { 'inherit_from': [ From e83e7ef10d284eeb9624b8a4a19bb9d463e04095 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.gypi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/brightray.gypi b/brightray.gypi index a8cb1ea556dd6..0fe893d80ee47 100644 --- a/brightray.gypi +++ b/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 5cdc6778512ac974ea849a3bc0d0588051d51746 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.gypi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/brightray.gypi b/brightray.gypi index 0fe893d80ee47..ad18976fd3f3a 100644 --- a/brightray.gypi +++ b/brightray.gypi @@ -174,6 +174,11 @@ ['exclude', '_win\.(cc|h)$'], ], }], + ['OS=="linux"', { + 'cflags_cc': [ + '-std=gnu++11', + ], + }], ], }, 'conditions': [ From 2ba3fcdfb9baf349aeb74df457ed6e8484975c60 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. --- browser/browser_context.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/browser/browser_context.cc b/browser/browser_context.cc index 494f08f64035d..31c00b8d6aa01 100644 --- a/browser/browser_context.cc +++ b/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_; }