Merge pull request #7239 from darkdh/6873
[platform/framework/web/crosswalk-tizen.git] / electron.gyp
1 {
2   'variables': {
3     'project_name%': 'electron',
4     'product_name%': 'Electron',
5     'company_name%': 'GitHub, Inc',
6     'company_abbr%': 'github',
7     'version%': '1.4.0',
8   },
9   'includes': [
10     'filenames.gypi',
11     'vendor/native_mate/native_mate_files.gypi',
12   ],
13   'target_defaults': {
14     'defines': [
15       'ATOM_PRODUCT_NAME="<(product_name)"',
16       'ATOM_PROJECT_NAME="<(project_name)"',
17     ],
18     'conditions': [
19       ['OS=="mac"', {
20         'mac_framework_dirs': [
21           '<(source_root)/external_binaries',
22         ],
23       }],
24     ],
25   },
26   'targets': [
27     {
28       'target_name': '<(project_name)',
29       'type': 'executable',
30       'dependencies': [
31         'js2asar',
32         'app2asar',
33         '<(project_name)_lib',
34       ],
35       'sources': [
36         '<@(app_sources)',
37       ],
38       'include_dirs': [
39         '.',
40       ],
41       'conditions': [
42         ['OS=="mac"', {
43           'product_name': '<(product_name)',
44           'mac_bundle': 1,
45           'dependencies!': [
46             '<(project_name)_lib',
47           ],
48           'dependencies': [
49             '<(project_name)_framework',
50             '<(project_name)_helper',
51           ],
52           'xcode_settings': {
53             'ATOM_BUNDLE_ID': 'com.<(company_abbr).<(project_name)',
54             'INFOPLIST_FILE': 'atom/browser/resources/mac/Info.plist',
55             'LD_RUNPATH_SEARCH_PATHS': [
56               '@executable_path/../Frameworks',
57             ],
58           },
59           'mac_bundle_resources': [
60             '<@(bundle_sources)',
61           ],
62           'copies': [
63             {
64               'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Frameworks',
65               'files': [
66                 '<(PRODUCT_DIR)/<(product_name) Helper.app',
67                 '<(PRODUCT_DIR)/<(product_name) Framework.framework',
68               ],
69             },
70           ],
71           'postbuilds': [
72             {
73               # This postbuid step is responsible for creating the following
74               # helpers:
75               #
76               # <(product_name) EH.app and <(product_name) NP.app are created
77               # from <(product_name).app.
78               #
79               # The EH helper is marked for an executable heap. The NP helper
80               # is marked for no PIE (ASLR).
81               'postbuild_name': 'Make More Helpers',
82               'action': [
83                 'vendor/brightray/tools/mac/make_more_helpers.sh',
84                 'Frameworks',
85                 '<(product_name)',
86               ],
87             },
88               # The application doesn't have real localizations, it just has
89               # empty .lproj directories, which is enough to convince Cocoa
90               # that Electron supports those languages.
91             {
92               'postbuild_name': 'Make Empty Localizations',
93               'variables': {
94                 'apply_locales_cmd': ['python', 'tools/mac/apply_locales.py'],
95                 'locale_dirs': [
96                   '>!@(<(apply_locales_cmd) -d ZZLOCALE.lproj <(locales))',
97                 ],
98               },
99               'action': [
100                 'tools/mac/make_locale_dirs.sh',
101                 '<@(locale_dirs)',
102               ],
103             },
104           ],
105           'conditions': [
106             ['mas_build==0', {
107               'copies': [
108                 {
109                   'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Frameworks',
110                   'files': [
111                     'external_binaries/Squirrel.framework',
112                     'external_binaries/ReactiveCocoa.framework',
113                     'external_binaries/Mantle.framework',
114                   ],
115                 },
116               ],
117             }],
118           ],
119         }],  # OS!="mac"
120         ['OS=="win"', {
121           'include_dirs': [
122             '<(libchromiumcontent_dir)/gen/ui/resources',
123           ],
124           'msvs_settings': {
125             'VCManifestTool': {
126               'EmbedManifest': 'true',
127               'AdditionalManifestFiles': 'atom/browser/resources/win/atom.manifest',
128             }
129           },
130           'copies': [
131             {
132               'variables': {
133                 'conditions': [
134                   ['libchromiumcontent_component', {
135                     'copied_libraries': [
136                       '<@(libchromiumcontent_shared_libraries)',
137                       '<@(libchromiumcontent_shared_v8_libraries)',
138                     ],
139                   }, {
140                     'copied_libraries': [
141                       '<(libchromiumcontent_dir)/ffmpeg.dll',
142                     ],
143                   }],
144                 ],
145               },
146               'destination': '<(PRODUCT_DIR)',
147               'files': [
148                 '<@(copied_libraries)',
149                 '<(libchromiumcontent_dir)/locales',
150                 '<(libchromiumcontent_dir)/libEGL.dll',
151                 '<(libchromiumcontent_dir)/libGLESv2.dll',
152                 '<(libchromiumcontent_dir)/icudtl.dat',
153                 '<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
154                 '<(libchromiumcontent_dir)/content_resources_200_percent.pak',
155                 '<(libchromiumcontent_dir)/content_shell.pak',
156                 '<(libchromiumcontent_dir)/ui_resources_200_percent.pak',
157                 '<(libchromiumcontent_dir)/views_resources_200_percent.pak',
158                 '<(libchromiumcontent_dir)/natives_blob.bin',
159                 '<(libchromiumcontent_dir)/snapshot_blob.bin',
160                 'external_binaries/d3dcompiler_47.dll',
161                 'external_binaries/xinput1_3.dll',
162               ],
163             },
164           ],
165         }, {
166           'dependencies': [
167             'vendor/breakpad/breakpad.gyp:dump_syms#host',
168           ],
169         }],  # OS=="win"
170         ['OS=="linux"', {
171           'copies': [
172             {
173               'variables': {
174                 'conditions': [
175                   ['libchromiumcontent_component', {
176                     'copied_libraries': [
177                       '<(PRODUCT_DIR)/lib/libnode.so',
178                       '<@(libchromiumcontent_shared_libraries)',
179                       '<@(libchromiumcontent_shared_v8_libraries)',
180                     ],
181                   }, {
182                     'copied_libraries': [
183                       '<(PRODUCT_DIR)/lib/libnode.so',
184                       '<(libchromiumcontent_dir)/libffmpeg.so',
185                     ],
186                   }],
187                 ],
188               },
189               'destination': '<(PRODUCT_DIR)',
190               'files': [
191                 '<@(copied_libraries)',
192                 '<(libchromiumcontent_dir)/locales',
193                 '<(libchromiumcontent_dir)/icudtl.dat',
194                 '<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
195                 '<(libchromiumcontent_dir)/content_resources_200_percent.pak',
196                 '<(libchromiumcontent_dir)/content_shell.pak',
197                 '<(libchromiumcontent_dir)/ui_resources_200_percent.pak',
198                 '<(libchromiumcontent_dir)/views_resources_200_percent.pak',
199                 '<(libchromiumcontent_dir)/natives_blob.bin',
200                 '<(libchromiumcontent_dir)/snapshot_blob.bin',
201               ],
202             },
203           ],
204         }],  # OS=="linux"
205       ],
206     },  # target <(project_name)
207     {
208       'target_name': '<(project_name)_lib',
209       'type': 'static_library',
210       'dependencies': [
211         'atom_js2c',
212         'vendor/brightray/brightray.gyp:brightray',
213         'vendor/node/node.gyp:node',
214       ],
215       'defines': [
216         # We need to access internal implementations of Node.
217         'NODE_WANT_INTERNALS=1',
218         'NODE_SHARED_MODE',
219         # This is defined in skia/skia_common.gypi.
220         'SK_SUPPORT_LEGACY_GETTOPDEVICE',
221         # Disable warnings for g_settings_list_schemas.
222         'GLIB_DISABLE_DEPRECATION_WARNINGS',
223         # Defined in Chromium but not exposed in its gyp file.
224         'V8_USE_EXTERNAL_STARTUP_DATA',
225         'ENABLE_PLUGINS',
226         'ENABLE_PEPPER_CDMS',
227         'USE_PROPRIETARY_CODECS',
228       ],
229       'sources': [
230         '<@(lib_sources)',
231       ],
232       'include_dirs': [
233         '.',
234         'chromium_src',
235         'vendor/brightray',
236         'vendor/native_mate',
237         # Include atom_natives.h.
238         '<(SHARED_INTERMEDIATE_DIR)',
239         # Include directories for uv and node.
240         'vendor/node/src',
241         'vendor/node/deps/http_parser',
242         'vendor/node/deps/uv/include',
243         # The `node.h` is using `#include"v8.h"`.
244         '<(libchromiumcontent_src_dir)/v8/include',
245         # The `node.h` is using `#include"ares.h"`.
246         'vendor/node/deps/cares/include',
247         # The `third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h` is using `platform/PlatformExport.h`.
248         '<(libchromiumcontent_src_dir)/third_party/WebKit/Source',
249         # The 'third_party/libyuv/include/libyuv/scale_argb.h' is using 'libyuv/basic_types.h'.
250         '<(libchromiumcontent_src_dir)/third_party/libyuv/include',
251         # The 'third_party/webrtc/modules/desktop_capture/desktop_frame.h' is using 'webrtc/base/scoped_ptr.h'.
252         '<(libchromiumcontent_src_dir)/third_party/',
253         '<(libchromiumcontent_src_dir)/components/cdm',
254         '<(libchromiumcontent_src_dir)/third_party/widevine',
255       ],
256       'direct_dependent_settings': {
257         'include_dirs': [
258           '.',
259         ],
260       },
261       'export_dependent_settings': [
262         'vendor/brightray/brightray.gyp:brightray',
263       ],
264       'conditions': [
265         ['libchromiumcontent_component', {
266           'link_settings': {
267             'libraries': [ '<@(libchromiumcontent_v8_libraries)' ],
268           },
269         }],
270         ['OS=="win"', {
271           'sources': [
272             '<@(lib_sources_win)',
273           ],
274           'link_settings': {
275             'libraries': [
276               '-limm32.lib',
277               '-loleacc.lib',
278               '-lcomctl32.lib',
279               '-lcomdlg32.lib',
280               '-lwininet.lib',
281               '-lwinmm.lib',
282               '-lcrypt32.lib',
283             ],
284           },
285           'dependencies': [
286             # Node is built as static_library on Windows, so we also need to
287             # include its dependencies here.
288             'vendor/node/deps/cares/cares.gyp:cares',
289             'vendor/node/deps/http_parser/http_parser.gyp:http_parser',
290             'vendor/node/deps/uv/uv.gyp:libuv',
291             'vendor/node/deps/zlib/zlib.gyp:zlib',
292             # Build with breakpad support.
293             'vendor/breakpad/breakpad.gyp:breakpad_handler',
294             'vendor/breakpad/breakpad.gyp:breakpad_sender',
295           ],
296         }],  # OS=="win"
297         ['OS=="mac" and mas_build==0', {
298           'dependencies': [
299             'vendor/crashpad/client/client.gyp:crashpad_client',
300             'vendor/crashpad/handler/handler.gyp:crashpad_handler',
301           ],
302           'link_settings': {
303             # Do not link with QTKit for mas build.
304             'libraries': [
305               '$(SDKROOT)/System/Library/Frameworks/QTKit.framework',
306             ],
307           },
308           'xcode_settings': {
309             # ReactiveCocoa which is used by Squirrel requires using __weak.
310             'CLANG_ENABLE_OBJC_WEAK': 'YES',
311           },
312         }],  # OS=="mac" and mas_build==0
313         ['OS=="mac" and mas_build==1', {
314           'defines': [
315             'MAS_BUILD',
316           ],
317           'sources!': [
318             'atom/browser/auto_updater_mac.mm',
319             'atom/common/crash_reporter/crash_reporter_mac.h',
320             'atom/common/crash_reporter/crash_reporter_mac.mm',
321           ],
322         }],  # OS=="mac" and mas_build==1
323         ['OS=="linux"', {
324           'sources': [
325             '<@(lib_sources_nss)',
326           ],
327           'link_settings': {
328             'ldflags': [
329               # Make binary search for libraries under current directory, so we
330               # don't have to manually set $LD_LIBRARY_PATH:
331               # http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable
332               '-rpath \$$ORIGIN',
333               # Make native module dynamic loading work.
334               '-rdynamic',
335             ],
336           },
337           # Required settings of using breakpad.
338           'cflags_cc': [
339             '-Wno-empty-body',
340             '-Wno-reserved-user-defined-literal',
341           ],
342           'include_dirs': [
343             'vendor/breakpad/src',
344           ],
345           'dependencies': [
346             'vendor/breakpad/breakpad.gyp:breakpad_client',
347           ],
348         }],  # OS=="linux"
349       ],
350     },  # target <(product_name)_lib
351     {
352       'target_name': 'js2asar',
353       'type': 'none',
354       'actions': [
355         {
356           'action_name': 'js2asar',
357           'variables': {
358             'conditions': [
359               ['OS=="mac"', {
360                 'resources_path': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources',
361               },{
362                 'resources_path': '<(PRODUCT_DIR)/resources',
363               }],
364             ],
365           },
366           'inputs': [
367             '<@(js_sources)',
368           ],
369           'outputs': [
370             '<(resources_path)/electron.asar',
371           ],
372           'action': [
373             'python',
374             'tools/js2asar.py',
375             '<@(_outputs)',
376             'lib',
377             '<@(_inputs)',
378           ],
379         }
380       ],
381     },  # target js2asar
382     {
383       'target_name': 'app2asar',
384       'type': 'none',
385       'actions': [
386         {
387           'action_name': 'app2asar',
388           'variables': {
389             'conditions': [
390               ['OS=="mac"', {
391                 'resources_path': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources',
392               },{
393                 'resources_path': '<(PRODUCT_DIR)/resources',
394               }],
395             ],
396           },
397           'inputs': [
398             '<@(default_app_sources)',
399           ],
400           'outputs': [
401             '<(resources_path)/default_app.asar',
402           ],
403           'action': [
404             'python',
405             'tools/js2asar.py',
406             '<@(_outputs)',
407             'default_app',
408             '<@(_inputs)',
409           ],
410         }
411       ],
412     },  # target app2asar
413     {
414       'target_name': 'atom_js2c',
415       'type': 'none',
416       'actions': [
417         {
418           'action_name': 'atom_js2c',
419           'inputs': [
420             '<@(js2c_sources)',
421           ],
422           'outputs': [
423             '<(SHARED_INTERMEDIATE_DIR)/atom_natives.h',
424           ],
425           'action': [
426             'python',
427             'tools/js2c.py',
428             '<@(_outputs)',
429             '<@(_inputs)',
430           ],
431         }
432       ],
433     },  # target atom_js2c
434   ],
435   'conditions': [
436     ['OS=="mac"', {
437       'targets': [
438         {
439           'target_name': '<(project_name)_framework',
440           'product_name': '<(product_name) Framework',
441           'type': 'shared_library',
442           'dependencies': [
443             '<(project_name)_lib',
444           ],
445           'sources': [
446             '<@(framework_sources)',
447           ],
448           'include_dirs': [
449             '.',
450             'vendor',
451             '<(libchromiumcontent_src_dir)',
452           ],
453           'export_dependent_settings': [
454             '<(project_name)_lib',
455           ],
456           'link_settings': {
457             'libraries': [
458               '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
459               '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
460             ],
461           },
462           'mac_bundle': 1,
463           'mac_bundle_resources': [
464             'atom/common/resources/mac/MainMenu.xib',
465             '<(libchromiumcontent_dir)/content_shell.pak',
466             '<(libchromiumcontent_dir)/icudtl.dat',
467             '<(libchromiumcontent_dir)/natives_blob.bin',
468             '<(libchromiumcontent_dir)/snapshot_blob.bin',
469           ],
470           'xcode_settings': {
471             'ATOM_BUNDLE_ID': 'com.<(company_abbr).<(project_name).framework',
472             'INFOPLIST_FILE': 'atom/common/resources/mac/Info.plist',
473             'LD_DYLIB_INSTALL_NAME': '@rpath/<(product_name) Framework.framework/<(product_name) Framework',
474             'LD_RUNPATH_SEARCH_PATHS': [
475               '@loader_path/Libraries',
476             ],
477             'OTHER_LDFLAGS': [
478               '-ObjC',
479             ],
480           },
481           'copies': [
482             {
483               'variables': {
484                 'conditions': [
485                   ['libchromiumcontent_component', {
486                     'copied_libraries': [
487                       '<(PRODUCT_DIR)/libnode.dylib',
488                       '<@(libchromiumcontent_shared_libraries)',
489                       '<@(libchromiumcontent_shared_v8_libraries)',
490                     ],
491                   }, {
492                     'copied_libraries': [
493                       '<(PRODUCT_DIR)/libnode.dylib',
494                       '<(libchromiumcontent_dir)/libffmpeg.dylib',
495                     ],
496                   }],
497                 ],
498               },
499               'destination': '<(PRODUCT_DIR)/<(product_name) Framework.framework/Versions/A/Libraries',
500               'files': [
501                 '<@(copied_libraries)',
502               ],
503             },
504           ],
505           'postbuilds': [
506             {
507               'postbuild_name': 'Fix path of libnode',
508               'action': [
509                 'install_name_tool',
510                 '-change',
511                 '/usr/local/lib/libnode.dylib',
512                 '@rpath/libnode.dylib',
513                 '${BUILT_PRODUCTS_DIR}/<(product_name) Framework.framework/Versions/A/<(product_name) Framework',
514               ],
515             },
516             {
517               'postbuild_name': 'Fix path of ffmpeg',
518               'action': [
519                 'install_name_tool',
520                 '-change',
521                 '/usr/local/lib/libffmpeg.dylib',
522                 '@rpath/libffmpeg.dylib',
523                 '${BUILT_PRODUCTS_DIR}/<(product_name) Framework.framework/Versions/A/<(product_name) Framework',
524               ],
525             },
526             {
527               'postbuild_name': 'Add symlinks for framework subdirectories',
528               'action': [
529                 'tools/mac/create-framework-subdir-symlinks.sh',
530                 '<(product_name) Framework',
531                 'Libraries',
532               ],
533             },
534             {
535               'postbuild_name': 'Copy locales',
536               'action': [
537                 'tools/mac/copy-locales.py',
538                 '-d',
539                 '<(libchromiumcontent_dir)/locales',
540                 '${BUILT_PRODUCTS_DIR}/<(product_name) Framework.framework/Resources',
541                 '<@(locales)',
542               ],
543             },
544           ],
545           'conditions': [
546             ['mas_build==0', {
547               'link_settings': {
548                 'libraries': [
549                   'external_binaries/Squirrel.framework',
550                   'external_binaries/ReactiveCocoa.framework',
551                   'external_binaries/Mantle.framework',
552                 ],
553               },
554               'copies': [
555                 {
556                   'destination': '<(PRODUCT_DIR)/<(product_name) Framework.framework/Versions/A/Resources',
557                   'files': [
558                     '<(PRODUCT_DIR)/crashpad_handler',
559                   ],
560                 },
561               ],
562             }],
563           ],
564         },  # target framework
565         {
566           'target_name': '<(project_name)_helper',
567           'product_name': '<(product_name) Helper',
568           'type': 'executable',
569           'dependencies': [
570             '<(project_name)_framework',
571           ],
572           'sources': [
573             '<@(app_sources)',
574           ],
575           'include_dirs': [
576             '.',
577           ],
578           'mac_bundle': 1,
579           'xcode_settings': {
580             'ATOM_BUNDLE_ID': 'com.<(company_abbr).<(project_name).helper',
581             'INFOPLIST_FILE': 'atom/renderer/resources/mac/Info.plist',
582             'LD_RUNPATH_SEARCH_PATHS': [
583               '@executable_path/../../..',
584             ],
585           },
586         },  # target helper
587       ],
588     }],  # OS!="mac"
589   ],
590 }