]> khamidou — GitHub mirrors - electron.git/commitdiff
Also build with static_library version of libchromiumcontent
authorCheng Zhao <zcbenz@gmail.com>
Thu, 2 Apr 2015 15:03:23 +0000 (23:03 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 2 Apr 2015 15:03:23 +0000 (23:03 +0800)
atom.gyp
common.gypi
script/build.py
script/update.py
vendor/brightray

index af0692dd95f80c54357c51f8bf6c8f28398ea06f..76daadfcb62250a2ed8bae89ee71d3db4f2521fc 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
        # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
       'filename_rules.gypi',
     ],
-    'configurations': {
-      'Debug': {
-        'defines': [ 'DEBUG' ],
-        'cflags': [ '-g', '-O0' ],
-      },
-    },
+    'conditions': [
+      ['libchromiumcontent_component', {
+        'configurations': {
+          'Debug': {
+            'defines': [ 'DEBUG' ],
+            'cflags': [ '-g', '-O0' ],
+          },
+        },
+      }],
+    ],
   },
   'targets': [
     {
             {
               'destination': '<(PRODUCT_DIR)',
               'files': [
-                '<(libchromiumcontent_library_dir)/chromiumcontent.dll',
-                '<(libchromiumcontent_library_dir)/ffmpegsumo.dll',
-                '<(libchromiumcontent_library_dir)/libEGL.dll',
-                '<(libchromiumcontent_library_dir)/libGLESv2.dll',
-                '<(libchromiumcontent_resources_dir)/icudtl.dat',
-                '<(libchromiumcontent_resources_dir)/content_resources_200_percent.pak',
-                '<(libchromiumcontent_resources_dir)/content_shell.pak',
-                '<(libchromiumcontent_resources_dir)/ui_resources_200_percent.pak',
-                '<(libchromiumcontent_resources_dir)/natives_blob.bin',
-                '<(libchromiumcontent_resources_dir)/snapshot_blob.bin',
+                '<(libchromiumcontent_dir)/chromiumcontent.dll',
+                '<(libchromiumcontent_dir)/ffmpegsumo.dll',
+                '<(libchromiumcontent_dir)/libEGL.dll',
+                '<(libchromiumcontent_dir)/libGLESv2.dll',
+                '<(libchromiumcontent_dir)/icudtl.dat',
+                '<(libchromiumcontent_dir)/content_resources_200_percent.pak',
+                '<(libchromiumcontent_dir)/content_shell.pak',
+                '<(libchromiumcontent_dir)/ui_resources_200_percent.pak',
+                '<(libchromiumcontent_dir)/natives_blob.bin',
+                '<(libchromiumcontent_dir)/snapshot_blob.bin',
                 'external_binaries/d3dcompiler_47.dll',
                 'external_binaries/msvcp120.dll',
                 'external_binaries/msvcr120.dll',
             {
               'destination': '<(PRODUCT_DIR)',
               'files': [
-                '<(libchromiumcontent_library_dir)/libchromiumcontent.so',
-                '<(libchromiumcontent_library_dir)/libffmpegsumo.so',
-                '<(libchromiumcontent_resources_dir)/icudtl.dat',
-                '<(libchromiumcontent_resources_dir)/content_shell.pak',
-                '<(libchromiumcontent_resources_dir)/natives_blob.bin',
-                '<(libchromiumcontent_resources_dir)/snapshot_blob.bin',
+                '<(libchromiumcontent_dir)/libchromiumcontent.so',
+                '<(libchromiumcontent_dir)/libffmpegsumo.so',
+                '<(libchromiumcontent_dir)/icudtl.dat',
+                '<(libchromiumcontent_dir)/content_shell.pak',
+                '<(libchromiumcontent_dir)/natives_blob.bin',
+                '<(libchromiumcontent_dir)/snapshot_blob.bin',
               ],
             },
             {
                 '--build-dir=<(PRODUCT_DIR)',
                 '--binary=<(PRODUCT_DIR)/<(product_name).app/Contents/MacOS/<(product_name)',
                 '--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-                '--libchromiumcontent-dir=<(libchromiumcontent_library_dir)',
+                '--libchromiumcontent-dir=<(libchromiumcontent_dir)',
                 '--clear',
                 '--jobs=16',
               ],
                 '--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
                 '--jobs=16',
                 '<(PRODUCT_DIR)',
-                '<(libchromiumcontent_library_dir)',
+                '<(libchromiumcontent_dir)',
               ],
             },
           ],
                 '--build-dir=<(PRODUCT_DIR)',
                 '--binary=<(PRODUCT_DIR)/<(project_name)',
                 '--symbols-dir=<(PRODUCT_DIR)/Atom-Shell.breakpad.syms',
-                '--libchromiumcontent-dir=<(libchromiumcontent_library_dir)',
+                '--libchromiumcontent-dir=<(libchromiumcontent_dir)',
                 '--clear',
                 '--jobs=16',
               ],
             ],
           },
           'inputs': [
-            '<(libchromiumcontent_library_dir)/<(chromedriver_binary)',
+            '<(libchromiumcontent_dir)/<(chromedriver_binary)',
           ],
           'outputs': [
             '<(PRODUCT_DIR)/<(chromedriver_binary)',
           'include_dirs': [
             '.',
             'vendor',
-            '<(libchromiumcontent_include_dir)',
+            '<(libchromiumcontent_src_dir)',
           ],
           'defines': [
             'PRODUCT_NAME="<(product_name)"',
           'mac_bundle': 1,
           'mac_bundle_resources': [
             'atom/common/resources/mac/MainMenu.xib',
-            '<(libchromiumcontent_resources_dir)/content_shell.pak',
-            '<(libchromiumcontent_resources_dir)/icudtl.dat',
-            '<(libchromiumcontent_resources_dir)/natives_blob.bin',
-            '<(libchromiumcontent_resources_dir)/snapshot_blob.bin',
+            '<(libchromiumcontent_dir)/content_shell.pak',
+            '<(libchromiumcontent_dir)/icudtl.dat',
+            '<(libchromiumcontent_dir)/natives_blob.bin',
+            '<(libchromiumcontent_dir)/snapshot_blob.bin',
           ],
           'xcode_settings': {
             'INFOPLIST_FILE': 'atom/common/resources/mac/Info.plist',
               'destination': '<(PRODUCT_DIR)/<(product_name) Framework.framework/Versions/A/Libraries',
               'files': [
                 '<@(libchromiumcontent_shared_libraries)',
-                '<(libchromiumcontent_library_dir)/ffmpegsumo.so',
+                '<(libchromiumcontent_dir)/ffmpegsumo.so',
                 '<(PRODUCT_DIR)/libnode.dylib',
               ],
             },
               'action_name': 'Create node.lib',
               'inputs': [
                 '<(PRODUCT_DIR)/node.dll.lib',
-                '<(libchromiumcontent_library_dir)/chromiumcontent.dll.lib',
+                '<(libchromiumcontent_dir)/chromiumcontent.dll.lib',
               ],
               'outputs': [
                 '<(PRODUCT_DIR)/node.lib',
index 7aaa4aa35f8dea31fd35583e6ca0701b30ef2bd9..28633effd54b0808986c2b291ab0846c0feec8a9 100644 (file)
         ],
       }],
       ['_target_name=="node"', {
-        'conditions': [
-          ['OS=="linux"', {
-            'libraries': [
-              '<(libchromiumcontent_library_dir)/libv8.so',
-            ],
-          }],
-          ['OS=="win"', {
-            'libraries': [
-              '<(libchromiumcontent_library_dir)/v8.dll.lib',
-            ],
-          }],
-          ['OS=="mac"', {
-            'libraries': [
-              '<(libchromiumcontent_library_dir)/libv8.dylib',
-            ],
-          }],
-        ],
+        'variables': {
+          'conditions': [
+            ['OS=="linux" and libchromiumcontent_component==1', {
+              'v8_libs': ['<(libchromiumcontent_dir)/libv8.so']
+            }],
+            ['OS=="mac" and libchromiumcontent_component==1', {
+              'v8_libs': ['<(libchromiumcontent_dir)/libv8.dylib']
+            }],
+            ['OS=="win" and libchromiumcontent_component==1', {
+              'v8_libs': ['<(libchromiumcontent_dir)/v8.dll.lib']
+            }],
+            ['OS in ["linux", "mac"] and libchromiumcontent_component==0', {
+              'v8_libs': [
+                '<(libchromiumcontent_dir)/libv8_base.a',
+                '<(libchromiumcontent_dir)/libv8_external_snapshot.a',
+                '<(libchromiumcontent_dir)/libv8_libbase.a',
+                '<(libchromiumcontent_dir)/libv8_libplatform.a',
+                '<(libchromiumcontent_dir)/libicudata.a',
+                '<(libchromiumcontent_dir)/libicui18n.a',
+                '<(libchromiumcontent_dir)/libicuuc.a',
+              ],
+            }],
+            ['OS=="win" and libchromiumcontent_component==0', {
+              'v8_libs': [
+                '<(libchromiumcontent_dir)/v8_base.lib',
+                '<(libchromiumcontent_dir)/v8_external_snapshot.lib',
+                '<(libchromiumcontent_dir)/v8_libbase.lib',
+                '<(libchromiumcontent_dir)/v8_libplatform.lib',
+                '<(libchromiumcontent_dir)/icudata.lib',
+                '<(libchromiumcontent_dir)/icui18n.lib',
+                '<(libchromiumcontent_dir)/icuuc.lib',
+              ],
+            }],
+          ],
+        },
+        'libraries': ['<@(v8_libs)']
       }],
       ['_target_name=="libuv"', {
         'conditions': [
index 1dd60deffe17210f4f6b6e5137c6142ce5f1e303..52d4cc5fd80c790a0affdffb865ac5b45e21f6eb 100755 (executable)
@@ -19,7 +19,7 @@ def main():
 
   args = parse_args()
   for config in args.configuration:
-    build_path = os.path.join('out', config)
+    build_path = os.path.join('out', 'Real' + config)
     ret = subprocess.call([ninja, '-C', build_path, args.target])
     if ret != 0:
       sys.exit(ret)
index 2fe52e7f3a6145e569fd7599be01be4a35b34f75..67a0c2b5002d22b9648224032a71ccfc619a41b1 100755 (executable)
@@ -14,7 +14,7 @@ def main():
   os.chdir(SOURCE_ROOT)
 
   update_external_binaries()
-  update_gyp()
+  return update_gyp()
 
 
 def update_external_binaries():
@@ -23,27 +23,37 @@ def update_external_binaries():
 
 
 def update_gyp():
-  gyp = os.path.join('vendor', 'brightray', 'vendor', 'gyp', 'gyp_main.py')
-  python = sys.executable
-  arch = DIST_ARCH
+  target_arch = DIST_ARCH
   if sys.platform == 'darwin':
     # Only have 64bit build on OS X.
-    arch = 'x64'
+    target_arch = 'x64'
   elif sys.platform in ['cygwin', 'win32']:
     # Only have 32bit build on Windows.
-    arch = 'ia32'
-    if sys.platform == 'cygwin':
-      # Force using win32 python on cygwin.
-      python = os.path.join('vendor', 'python_26', 'python.exe')
-
-  ret = subprocess.call([python, gyp,
-                         '-f', 'ninja', '--depth', '.', 'atom.gyp',
-                         '-Icommon.gypi',
-                         '-Dlinux_clang=0',  # Disable brightray's clang setting
-                         '-Dtarget_arch={0}'.format(arch),
-                         '-Dlibrary=static_library'])
-  if ret != 0:
-    sys.exit(ret)
+    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.
+  # In order to work around this, we decided to generate the configuration
+  # 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.
+  return (run_gyp(target_arch, 0) or run_gyp(target_arch, 1))
+
+
+def run_gyp(target_arch, component):
+  python = sys.executable
+  if sys.platform == 'cygwin':
+    # Force using win32 python on cygwin.
+    python = os.path.join('vendor', 'python_26', 'python.exe')
+  gyp = os.path.join('vendor', 'brightray', 'vendor', 'gyp', 'gyp_main.py')
+  return subprocess.call([python, gyp,
+                          '-f', 'ninja', '--depth', '.', 'atom.gyp',
+                          '-Icommon.gypi',
+                          '-Dlibchromiumcontent_component={0}'.format(component),
+                          '-Dlinux_clang=0',  # FIXME remove me.
+                          '-Dtarget_arch={0}'.format(target_arch),
+                          '-Dlibrary=static_library'])
 
 
 if __name__ == '__main__':
index a430d8f653602fd108094398b2ef79dc7126c819..09c73a0e615807fe238f74b697e60696d6451bd1 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a430d8f653602fd108094398b2ef79dc7126c819
+Subproject commit 09c73a0e615807fe238f74b697e60696d6451bd1