diff --git a/brightray/brightray.gypi b/brightray/brightray.gypi index 7d4b1f42073c..ad18976fd3f3 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': [ @@ -167,9 +174,24 @@ ['exclude', '_win\.(cc|h)$'], ], }], + ['OS=="linux"', { + 'cflags_cc': [ + '-std=gnu++11', + ], + }], ], }, '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': [ 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_; } 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): diff --git a/brightray/script/build b/brightray/script/build index 6463d9d1d90b..8e155d37fa67 100755 --- a/brightray/script/build +++ b/brightray/script/build @@ -7,29 +7,28 @@ 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(): 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__': 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__': diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index 33472d4dfeca..5ffcb396d64d 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 33472d4dfeca556ce68c126cc71cd1e3f830de8a +Subproject commit 5ffcb396d64df97a2d0220101e1e52598a661fc8