Merge pull request #26 from brightray/linux
Get a basic Linux build working
This commit is contained in:
commit
3df85640a6
6 changed files with 55 additions and 20 deletions
|
@ -73,6 +73,13 @@
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'conditions': [
|
||||||
|
['OS not in ["mac", "win"]', {
|
||||||
|
'defines': [
|
||||||
|
'USE_X11',
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
],
|
||||||
},
|
},
|
||||||
'Debug': {
|
'Debug': {
|
||||||
'inherit_from': [
|
'inherit_from': [
|
||||||
|
@ -167,9 +174,24 @@
|
||||||
['exclude', '_win\.(cc|h)$'],
|
['exclude', '_win\.(cc|h)$'],
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
|
['OS=="linux"', {
|
||||||
|
'cflags_cc': [
|
||||||
|
'-std=gnu++11',
|
||||||
|
],
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'conditions': [
|
'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"', {
|
['OS=="win"', {
|
||||||
'target_defaults': {
|
'target_defaults': {
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "browser/network_delegate.h"
|
#include "browser/network_delegate.h"
|
||||||
#include "common/application_info.h"
|
#include "common/application_info.h"
|
||||||
|
|
||||||
|
#include "base/environment.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/prefs/json_pref_store.h"
|
#include "base/prefs/json_pref_store.h"
|
||||||
|
@ -20,6 +21,10 @@
|
||||||
#include "content/public/browser/storage_partition.h"
|
#include "content/public/browser/storage_partition.h"
|
||||||
#include "url_request_context_getter.h"
|
#include "url_request_context_getter.h"
|
||||||
|
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
#include "base/nix/xdg_util.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
class BrowserContext::ResourceContext : public content::ResourceContext {
|
class BrowserContext::ResourceContext : public content::ResourceContext {
|
||||||
|
@ -83,7 +88,15 @@ base::FilePath BrowserContext::GetPath() {
|
||||||
return path_;
|
return path_;
|
||||||
|
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
scoped_ptr<base::Environment> 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));
|
CHECK(PathService::Get(base::DIR_APP_DATA, &path));
|
||||||
|
#endif
|
||||||
|
|
||||||
path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
|
path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
|
||||||
return path_;
|
return path_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ DOWNLOAD_DIR = os.path.join(VENDOR_DIR, 'download')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
update_submodules()
|
return (update_submodules() or
|
||||||
download_libchromiumcontent(args.url)
|
download_libchromiumcontent(args.url))
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
|
@ -27,16 +27,16 @@ def parse_args():
|
||||||
|
|
||||||
|
|
||||||
def update_submodules():
|
def update_submodules():
|
||||||
subprocess.check_call(['git', 'submodule', 'sync', '--quiet'])
|
return (subprocess.call(['git', 'submodule', 'sync', '--quiet']) or
|
||||||
subprocess.check_call(['git', 'submodule', 'update', '--init',
|
subprocess.call(['git', 'submodule', 'update', '--init',
|
||||||
'--recursive'])
|
'--recursive']))
|
||||||
|
|
||||||
|
|
||||||
def download_libchromiumcontent(url):
|
def download_libchromiumcontent(url):
|
||||||
mkdir_p(DOWNLOAD_DIR)
|
mkdir_p(DOWNLOAD_DIR)
|
||||||
download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
|
download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
|
||||||
'download')
|
'download')
|
||||||
subprocess.check_call([sys.executable, download, '-f', url,
|
return subprocess.call([sys.executable, download, '-f', url,
|
||||||
os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')])
|
os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,29 +7,28 @@ import sys
|
||||||
|
|
||||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||||
GYP = {
|
GYP = {
|
||||||
'darwin': 'gyp',
|
|
||||||
'win32': 'gyp.bat',
|
'win32': 'gyp.bat',
|
||||||
}[sys.platform]
|
}.get(sys.platform, 'gyp')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
os.chdir(SOURCE_ROOT)
|
os.chdir(SOURCE_ROOT)
|
||||||
run_gyp()
|
return (run_gyp() or build())
|
||||||
build()
|
|
||||||
|
|
||||||
|
|
||||||
def run_gyp():
|
def run_gyp():
|
||||||
subprocess.check_call([GYP, '--depth', '.', 'brightray.gyp'])
|
return subprocess.call([GYP, '--depth', '.', 'brightray.gyp'])
|
||||||
|
|
||||||
|
|
||||||
def build():
|
def build():
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
subprocess.check_call(['xcodebuild'])
|
return subprocess.call(['xcodebuild'])
|
||||||
return
|
if sys.platform == 'linux2':
|
||||||
|
return subprocess.call(['make'])
|
||||||
|
|
||||||
assert sys.platform == 'win32', sys.platform
|
assert sys.platform == 'win32', sys.platform
|
||||||
msbuild = os.path.join(os.environ['windir'], 'Microsoft.NET', 'Framework', 'v4.0.30319', 'MSBuild.exe')
|
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__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -16,8 +16,9 @@ def main():
|
||||||
return 'Error: Can\'t find {0}'.format(S3_CREDENTIALS_FILE)
|
return 'Error: Can\'t find {0}'.format(S3_CREDENTIALS_FILE)
|
||||||
copy_to_environment(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']))
|
url = 'https://{0}.s3.amazonaws.com/libchromiumcontent'.format(os.environ['JANKY_ARTIFACTS_S3_BUCKET'])
|
||||||
run_script('build')
|
return (run_script('bootstrap', url) or
|
||||||
|
run_script('build'))
|
||||||
|
|
||||||
|
|
||||||
def copy_to_environment(credentials_file):
|
def copy_to_environment(credentials_file):
|
||||||
|
@ -32,7 +33,7 @@ def run_script(script, *args):
|
||||||
script = os.path.join('script', script)
|
script = os.path.join('script', script)
|
||||||
sys.stderr.write('+ {0}\n'.format(script))
|
sys.stderr.write('+ {0}\n'.format(script))
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
subprocess.check_call([sys.executable, script] + list(args))
|
return subprocess.call([sys.executable, script] + list(args))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 33472d4dfeca556ce68c126cc71cd1e3f830de8a
|
Subproject commit 5ffcb396d64df97a2d0220101e1e52598a661fc8
|
Loading…
Add table
Add a link
Reference in a new issue