forked from adobe/brackets-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appshell.gyp
executable file
·563 lines (562 loc) · 17.9 KB
/
appshell.gyp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
{
'variables': {
'pkg-config': 'pkg-config',
'target_arch%': 'environment',
'chromium_code': 1,
'framework_name': 'Chromium Embedded Framework',
'linux_use_gold_binary': 0,
'linux_use_gold_flags': 0,
'conditions': [
[ 'OS=="mac"', {
# Don't use clang with CEF binary releases due to Chromium tree structure dependency.
'clang': 0,
}],
[ 'OS=="win"', {
'multi_threaded_dll%': 0,
}],
]
},
'includes': [
# Bring in the configuration vars
'appshell_config.gypi',
# Bring in the source file lists for appshell.
'appshell_paths.gypi',
],
'target_defaults':
{
'xcode_settings':
{
'SDKROOT': '',
'CLANG_CXX_LANGUAGE_STANDARD' : 'c++0x',
'COMBINE_HIDPI_IMAGES': 'YES',
'ARCHS': "$(ARCHS_STANDARD_64_BIT)",
'FRAMEWORK_SEARCH_PATHS': [
'$(inherited)',
'$(CONFIGURATION)'
]
},
},
'targets': [
{
'target_name': '<(appname)',
'type': 'executable',
'mac_bundle': 1,
'msvs_guid': '6617FED9-C5D4-4907-BF55-A90062A6683F',
'dependencies': [
'libcef_dll_wrapper',
],
'defines': [
'USING_CEF_SHARED',
],
'include_dirs': [
'.',
],
'sources': [
'<@(includes_common)',
'<@(includes_wrapper)',
],
'mac_bundle_resources': [
'<@(appshell_bundle_resources_mac)',
],
'mac_bundle_resources!': [
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)
# that automatically sets the correct INFOPLIST_FILE setting and adds
# the file to a source group.
'appshell/mac/Info.plist',
],
'xcode_settings': {
'INFOPLIST_FILE': 'appshell/mac/Info.plist',
# Necessary to avoid an "install_name_tool: changing install names or
# rpaths can't be redone" error.
'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'],
# Target build path.
'SYMROOT': 'xcodebuild',
'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
},
'conditions': [
['OS=="win"', {
'configurations': {
'Common_Base': {
'msvs_configuration_attributes': {
'OutputDirectory': '$(ConfigurationName)',
},
},
},
'variables': {
'win_exe_compatibility_manifest': 'compatibility.manifest',
'xparams': "/efy",
},
'actions': [
{
'action_name': 'copy_resources',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_resources.stamp',
],
'action': [
'xcopy <(xparams)',
'Resources\*',
'$(OutDir)',
],
},
],
'msvs_settings': {
'VCLinkerTool': {
# Set /SUBSYSTEM:WINDOWS.
'SubSystem': '2',
},
'VCManifestTool': {
'AdditionalManifestFiles': [
'appshell.exe.manifest',
],
},
},
'link_settings': {
'libraries': [
'-lcomctl32.lib',
'-lshlwapi.lib',
'-lrpcrt4.lib',
'-lopengl32.lib',
'-lglu32.lib',
'-luser32.lib',
'-lcomdlg32.lib',
'-lshell32.lib',
'-lole32.lib',
'-lgdi32.lib',
'-l$(ConfigurationName)/libcef.lib',
],
},
'library_dirs': [
# Needed to find cef_sandbox.lib using #pragma comment(lib, ...).
'$(ConfigurationName)',
],
'sources': [
'<@(includes_win)',
'<@(appshell_sources_win)',
],
'copies': [
{
# Copy node executable to the output directory
'destination': '<(PRODUCT_DIR)',
'files': ['deps/node/node.exe'],
},
{
# Copy node server files to the output directory
# The '/' at the end of the 'files' directory is very important and magically
# causes 'xcopy' to get used instead of 'copy' for recursive copies.
# This seems to be an undocumented feature of gyp.
'destination': '<(PRODUCT_DIR)',
'files': ['appshell/node-core/'],
},
{
# Copy resources
'destination': '<(PRODUCT_DIR)',
'files': ['Resources/cef.pak', 'Resources/devtools_resources.pak'],
},
{
# Copy locales
'destination': '<(PRODUCT_DIR)',
'files': ['Resources/locales/'],
},
{
# Copy windows command line script
'destination': '<(PRODUCT_DIR)command',
'files': ['scripts/brackets.bat', 'scripts/brackets'],
}
],
}],
[ 'OS=="win" and multi_threaded_dll', {
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 3,
'WarnAsError': 'false',
},
},
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 2,
'WarnAsError': 'false',
},
},
}
}
}],
[ 'OS=="mac"', {
'product_name': '<(appname)',
'dependencies': [
'appshell_helper_app',
],
'copies': [
{
# Add libraries and helper app.
'destination': '<(PRODUCT_DIR)/<(appname).app/Contents/Frameworks',
'files': [
'<(PRODUCT_DIR)/<(appname) Helper.app',
],
},
],
'postbuilds': [
{
'postbuild_name': 'Add framework',
'action': [
'cp',
'-Rf',
'${CONFIGURATION}/<(framework_name).framework',
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/'
],
},
{
'postbuild_name': 'Fix Framework Link',
'action': [
'install_name_tool',
'-change',
'@executable_path/<(framework_name)',
'@executable_path/../Frameworks/<(framework_name).framework/<(framework_name)',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
{
# Copy the entire "node-core" directory into the same location as the "www"
# directory will end up. Note that the ".." in the path is necessary because
# the EXECUTABLE_FOLDER_PATH macro resolves to multiple levels of folders.
'postbuild_name': 'Copy node core resources',
'action': [
'rsync',
'-a',
'./appshell/node-core/',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/../node-core/',
],
},
{
'postbuild_name': 'Copy node executable',
'action': [
'cp',
'./deps/node/bin/Brackets-node',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/Brackets-node',
],
},
{
# This postbuid step is responsible for creating the following
# helpers:
#
# <(appname) Helper EH.app and <(appname) Helper NP.app are created
# from <(appname) Helper.app.
#
# The EH helper is marked for an executable heap. The NP helper
# is marked for no PIE (ASLR).
'postbuild_name': 'Make More Helpers',
'action': [
'tools/make_more_helpers.sh',
'Frameworks',
'<(appname)',
],
},
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/ScriptingBridge.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
],
},
'sources': [
'<@(includes_mac)',
'<@(appshell_sources_mac)',
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'actions': [
{
'action_name': 'appshell_extensions_js',
'inputs': [
'appshell/appshell_extensions.js',
],
'outputs': [
'appshell_extensions_js.o',
],
'action': [
'objcopy',
'--input',
'binary',
'--output',
'<(output_bfd)',
'--binary-architecture',
'i386',
'<@(_inputs)',
'<@(_outputs)',
],
'message': 'compiling js resource'
}
],
'cflags': [
'<!@(<(pkg-config) --cflags gtk+-2.0 gthread-2.0)',
'<(march)',
],
'include_dirs': [
'.',
],
'default_configuration': 'Release',
'configurations': {
'Release': {},
'Debug': {},
},
'copies': [
{
'destination': '<(PRODUCT_DIR)/files',
'files': [
'<@(appshell_bundle_resources_linux)',
],
},
{
'destination': '<(PRODUCT_DIR)/',
'files': [
'Resources/cef.pak',
'Resources/cef_100_percent.pak',
'Resources/cef_200_percent.pak',
'Resources/cef_extensions.pak',
'Resources/devtools_resources.pak',
'Resources/icudtl.dat',
'Resources/locales/',
'$(BUILDTYPE)/chrome-sandbox',
'$(BUILDTYPE)/libcef.so',
'$(BUILDTYPE)/natives_blob.bin',
'$(BUILDTYPE)/snapshot_blob.bin',
],
},
{
# Copy node executable to the output directory
'destination': '<(PRODUCT_DIR)',
'files': ['deps/node/bin/Brackets-node'],
},
{
# Copy node server files to the output directory
# The '/' at the end of the 'files' directory is very important and magically
# causes 'xcopy' to get used instead of 'copy' for recursive copies.
# This seems to be an undocumented feature of gyp.
'destination': '<(PRODUCT_DIR)',
'files': ['appshell/node-core/'],
},
],
'dependencies': [
'gtk',
],
'link_settings': {
'ldflags': [
'-Wl,-rpath,\$$ORIGIN/lib',
'<(march)'
],
'libraries': [
"$(BUILDTYPE)/libcef.so",
"-lX11",
'appshell_extensions_js.o',
],
},
'sources': [
'<@(includes_linux)',
'<@(appshell_sources_linux)',
],
}],
],
},
{
'target_name': 'libcef_dll_wrapper',
'type': 'static_library',
'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9',
'defines': [
'USING_CEF_SHARED',
],
'configurations': {
'Common_Base': {
'msvs_configuration_attributes': {
'OutputDirectory': '$(ConfigurationName)',
},
},
},
'include_dirs': [
'.',
],
'sources': [
'<@(includes_common)',
'<@(includes_capi)',
'<@(includes_wrapper)',
'<@(libcef_dll_wrapper_sources_common)',
],
'xcode_settings': {
# Target build path.
'SYMROOT': 'xcodebuild',
'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
},
'conditions': [
['OS=="linux"', {
'cflags': [
'<(march)',
],
'default_configuration': 'Release',
'configurations': {
'Release': {},
'Debug': {},
},
}],
[ 'OS=="win" and multi_threaded_dll', {
'configurations': {
'Common_Base': {
'msvs_configuration_attributes': {
'OutputDirectory': '$(ConfigurationName)',
},
},
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 3,
'WarnAsError': 'false',
},
},
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 2,
'WarnAsError': 'false',
},
},
}
}
}],
],
},
],
'conditions': [
['OS=="mac"', {
'targets': [
{
'target_name': 'appshell_helper_app',
'type': 'executable',
'variables': { 'enable_wexit_time_destructors': 1, },
'product_name': '<(appname) Helper',
'mac_bundle': 1,
'dependencies': [
'libcef_dll_wrapper',
],
'defines': [
'USING_CEF_SHARED',
],
'include_dirs': [
'.',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/ScriptingBridge.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
],
},
'sources': [
'<@(appshell_sources_mac_helper)',
],
# TODO(mark): Come up with a fancier way to do this. It should only
# be necessary to list helper-Info.plist once, not the three times it
# is listed here.
'mac_bundle_resources!': [
'appshell/mac/helper-Info.plist',
],
# TODO(mark): For now, don't put any resources into this app. Its
# resources directory will be a symbolic link to the browser app's
# resources directory.
'mac_bundle_resources/': [
['exclude', '.*'],
],
'xcode_settings': {
'INFOPLIST_FILE': 'appshell/mac/helper-Info.plist',
# Necessary to avoid an "install_name_tool: changing install names or
# rpaths can't be redone" error.
'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'],
'SYMROOT': 'xcodebuild',
'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'FRAMEWORK_SEARCH_PATHS': [
'$(inherited)',
'$(CONFIGURATION)'
]
},
'postbuilds': [
{
# The framework defines its load-time path
# (DYLIB_INSTALL_NAME_BASE) relative to the main executable
# (chrome). A different relative path needs to be used in
# appshell_helper_app.
'postbuild_name': 'Fix Framework Link',
'action': [
'install_name_tool',
'-change',
'@executable_path/<(framework_name)',
'@executable_path/../../../../Frameworks/<(framework_name).framework/<(framework_name)',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
],
}, # target appshell_helper_app
],
}], # OS=="mac"
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'targets': [
{
'target_name': 'gtk',
'type': 'none',
'variables': {
# gtk requires gmodule, but it does not list it as a dependency
# in some misconfigured systems.
'gtk_packages': 'gmodule-2.0 gtk+-2.0 gthread-2.0 gtk+-unix-print-2.0',
},
'direct_dependent_settings': {
'cflags': [
'$(shell <(pkg-config) --cflags <(gtk_packages))',
],
},
'link_settings': {
'ldflags': [
'$(shell <(pkg-config) --libs-only-L --libs-only-other <(gtk_packages))',
],
'libraries': [
'$(shell <(pkg-config) --libs-only-l <(gtk_packages))',
],
},
},
],
}], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
['target_arch=="ia32"', {
'variables': {
'output_bfd': 'elf32-i386',
'march': '-m32',
},
}],
['target_arch=="x64"', {
'variables': {
'output_bfd': 'elf64-x86-64',
'march': '-m64',
},
}],
['target_arch=="environment"', {
'variables': {
'output_bfd': '<!(uname -m | sed "s/x86_64/elf64-x86-64/;s/i.86/elf32-i386/")',
'march': ' ',
},
}],
],
}