]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Build with the arch chosen by user
authorCheng Zhao <zcbenz@gmail.com>
Sat, 11 Apr 2015 09:58:19 +0000 (17:58 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Sat, 11 Apr 2015 10:07:22 +0000 (18:07 +0800)
script/create-dist.py
script/lib/config.py
script/update.py
script/upload.py
vendor/brightray

index 4d1ae544c1b33deeede4839783d3a6c3ec3b95b6..a7ceb99f6ee83ba620b21d3f0c07859270aaedf6 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import stat
 
 from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
-                       DIST_ARCH
+                       get_target_arch
 from lib.util import scoped_cwd, rm_rf, get_atom_shell_version, make_zip, \
                      execute, get_chromedriver_version
 
@@ -155,7 +155,7 @@ def create_symbols():
 
 def create_dist_zip():
   dist_name = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
-                                                  PLATFORM, DIST_ARCH)
+                                                  PLATFORM, get_target_arch())
   zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
 
   with scoped_cwd(DIST_DIR):
@@ -168,7 +168,7 @@ def create_dist_zip():
 
 def create_chromedriver_zip():
   dist_name = 'chromedriver-{0}-{1}-{2}.zip'.format(get_chromedriver_version(),
-                                                    PLATFORM, DIST_ARCH)
+                                                    PLATFORM, get_target_arch())
   zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
 
   with scoped_cwd(DIST_DIR):
@@ -183,7 +183,7 @@ def create_chromedriver_zip():
 def create_symbols_zip():
   dist_name = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION,
                                                           PLATFORM,
-                                                          DIST_ARCH)
+                                                          get_target_arch())
   zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
 
   with scoped_cwd(DIST_DIR):
index 2c2a7eda41aa8d321e1bae4c1ad493bcf4c75c14..250c362206b7f988a2ec068479e427d5cd9adc51 100644 (file)
@@ -1,22 +1,13 @@
 #!/usr/bin/env python
 
+import os
 import platform
 import sys
 
+
 BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
 LIBCHROMIUMCONTENT_COMMIT = 'f1ad1412461ba3345a27cfe935ffc872dba0ac5b'
 
-ARCH = {
-    'cygwin': '32bit',
-    'darwin': '64bit',
-    'linux2': platform.architecture()[0],
-    'win32': '32bit',
-}[sys.platform]
-DIST_ARCH = {
-    '32bit': 'ia32',
-    '64bit': 'x64',
-}[ARCH]
-
 PLATFORM = {
   'cygwin': 'win32',
   'darwin': 'darwin',
@@ -26,10 +17,35 @@ PLATFORM = {
 
 verbose_mode = False
 
+
+def get_target_arch():
+  # Always build 64bit on OS X.
+  if PLATFORM == 'darwin':
+    return 'x64'
+  # Only build for host's arch on Linux.
+  elif PLATFORM == 'linux':
+    if platform.architecture()[0] == '32bit':
+      return 'ia32'
+    else:
+      return 'x64'
+  # On Windows it depends on user.
+  elif PLATFORM == 'win32':
+    target_arch_path = os.path.join(__file__, '..', '..', '..', 'vendor',
+                                    'brightray', 'vendor', 'download',
+                                    'libchromiumcontent', '.target_arch')
+    with open(os.path.normpath(target_arch_path)) as f:
+      target_arch = f.read().strip()
+    return target_arch
+  # Maybe we will support other platforms in future.
+  else:
+    return 'x64'
+
+
 def enable_verbose_mode():
   print 'Running in verbose mode'
   global verbose_mode
   verbose_mode = True
 
+
 def is_verbose_mode():
   return verbose_mode
index ba3380d67c3ece3ec4fc6f87637d37891377d9af..aaa07526c05feaac0197e05eb5d705cf8cdd6030 100755 (executable)
@@ -4,7 +4,7 @@ import os
 import subprocess
 import sys
 
-from lib.config import DIST_ARCH
+from lib.config import get_target_arch
 
 
 SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
@@ -23,14 +23,6 @@ def update_external_binaries():
 
 
 def update_gyp():
-  target_arch = DIST_ARCH
-  if sys.platform == 'darwin':
-    # Only have 64bit build on OS X.
-    target_arch = 'x64'
-  elif sys.platform in ['cygwin', 'win32']:
-    # Only have 32bit build on Windows.
-    target_arch = 'ia32'
-
   # Since gyp doesn't support specify link_settings for each configuration,
   # we are not able to link to different libraries in  "Debug" and "Release"
   # configurations.
@@ -38,6 +30,7 @@ def update_gyp():
   # for twice, one is to generate "Debug" config, the other one to generate
   # the "Release" config. And the settings are controlled by the variable
   # "libchromiumcontent_component" which is defined before running gyp.
+  target_arch = get_target_arch()
   return (run_gyp(target_arch, 0) or run_gyp(target_arch, 1))
 
 
index 0c2b2ba6a32bc62be8b0db13301205449151e71f..81fd28f58e087932a4a59499b642ab3a2cc8c555 100755 (executable)
@@ -7,7 +7,7 @@ import subprocess
 import sys
 import tempfile
 
-from lib.config import DIST_ARCH, PLATFORM
+from lib.config import PLATFORM, get_target_arch
 from lib.util import execute, get_atom_shell_version, parse_version, \
                      get_chromedriver_version, scoped_cwd
 from lib.github import GitHub
@@ -22,13 +22,13 @@ OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
 DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
 DIST_NAME = 'atom-shell-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
                                                 PLATFORM,
-                                                DIST_ARCH)
+                                                get_target_arch())
 SYMBOLS_NAME = 'atom-shell-{0}-{1}-{2}-symbols.zip'.format(ATOM_SHELL_VERSION,
                                                            PLATFORM,
-                                                           DIST_ARCH)
+                                                           get_target_arch())
 CHROMEDRIVER_NAME = 'chromedriver-{0}-{1}-{2}.zip'.format(CHROMEDRIVER_VERSION,
                                                           PLATFORM,
-                                                          DIST_ARCH)
+                                                          get_target_arch())
 
 
 def main():
index f44a3834690c010a1841cde92ca5e4798b1c9d2f..33367e86d33f2ba8bf3d9dc796b469e6d5855e20 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f44a3834690c010a1841cde92ca5e4798b1c9d2f
+Subproject commit 33367e86d33f2ba8bf3d9dc796b469e6d5855e20