62
62
63
63
def GetFlavor (params ):
64
64
"""Returns |params.flavor| if it's set, the system's default flavor else."""
65
- return params .get ('flavor' , 'mac' if sys .platform == 'darwin' else 'linux' )
65
+ flavors = {
66
+ 'darwin' : 'mac' ,
67
+ 'sunos5' : 'solaris' ,
68
+ 'freebsd7' : 'freebsd' ,
69
+ 'freebsd8' : 'freebsd' ,
70
+ }
71
+ flavor = flavors .get (sys .platform , 'linux' )
72
+ return params .get ('flavor' , flavor )
66
73
67
74
68
75
def CalculateVariables (default_variables , params ):
@@ -71,7 +78,8 @@ def CalculateVariables(default_variables, params):
71
78
default_variables ['LINKER_SUPPORTS_ICF' ] = \
72
79
gyp .system_test .TestLinkerSupportsICF (cc_command = cc_target )
73
80
74
- if GetFlavor (params ) == 'mac' :
81
+ flavor = GetFlavor (params )
82
+ if flavor == 'mac' :
75
83
default_variables .setdefault ('OS' , 'mac' )
76
84
default_variables .setdefault ('SHARED_LIB_SUFFIX' , '.dylib' )
77
85
default_variables .setdefault ('SHARED_LIB_DIR' ,
@@ -94,7 +102,10 @@ def CalculateVariables(default_variables, params):
94
102
global COMPILABLE_EXTENSIONS
95
103
COMPILABLE_EXTENSIONS .update ({'.m' : 'objc' , '.mm' : 'objcxx' })
96
104
else :
97
- default_variables .setdefault ('OS' , 'linux' )
105
+ operating_system = flavor
106
+ if flavor == 'android' :
107
+ operating_system = 'linux' # Keep this legacy behavior for now.
108
+ default_variables .setdefault ('OS' , operating_system )
98
109
default_variables .setdefault ('SHARED_LIB_SUFFIX' , '.so' )
99
110
default_variables .setdefault ('SHARED_LIB_DIR' ,'$(builddir)/lib.$(TOOLSET)' )
100
111
default_variables .setdefault ('LIB_DIR' , '$(obj).$(TOOLSET)' )
@@ -349,7 +360,7 @@ def ensure_directory_exists(path):
349
360
350
361
quiet_cmd_cxx = CXX($(TOOLSET)) $@
351
362
cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
352
- %(mac_commands )s
363
+ %(extra_commands )s
353
364
quiet_cmd_touch = TOUCH $@
354
365
cmd_touch = touch $@
355
366
@@ -480,6 +491,14 @@ def ensure_directory_exists(path):
480
491
cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)
481
492
"""
482
493
494
+ SHARED_HEADER_SUN_COMMANDS = """
495
+ # gyp-sun-tool is written next to the root Makefile by gyp.
496
+ # Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
497
+ # already.
498
+ quiet_cmd_sun_tool = SUNTOOL $(4) $<
499
+ cmd_sun_tool = ./gyp-sun-tool $(4) $< "$@"
500
+ """
501
+
483
502
484
503
def WriteRootHeaderSuffixRules (writer ):
485
504
extensions = sorted (COMPILABLE_EXTENSIONS .keys (), key = str .lower )
@@ -2407,11 +2426,13 @@ def StripProductDir(s):
2407
2426
env ['UNLOCALIZED_RESOURCES_FOLDER_PATH' ] = \
2408
2427
self .xcode_settings .GetBundleResourceFolder ()
2409
2428
env ['INFOPLIST_PATH' ] = self .xcode_settings .GetBundlePlistPath ()
2429
+ env ['WRAPPER_NAME' ] = self .xcode_settings .GetWrapperName ()
2410
2430
2411
2431
# TODO(thakis): Remove this.
2412
2432
env ['EXECUTABLE_PATH' ] = QuoteSpaces (env ['EXECUTABLE_PATH' ])
2413
2433
env ['CONTENTS_FOLDER_PATH' ] = QuoteSpaces (env ['CONTENTS_FOLDER_PATH' ])
2414
2434
env ['INFOPLIST_PATH' ] = QuoteSpaces (env ['INFOPLIST_PATH' ])
2435
+ env ['WRAPPER_NAME' ] = QuoteSpaces (env ['WRAPPER_NAME' ])
2415
2436
2416
2437
return env
2417
2438
@@ -2576,17 +2597,32 @@ def RunSystemTests(flavor):
2576
2597
'LINK_flags' : link_flags }
2577
2598
2578
2599
2579
- def CopyMacTool (out_path ):
2580
- """Finds mac_tool.gyp in the gyp directory and copies it to |out_path|."""
2600
+ def CopyTool (flavor , out_path ):
2601
+ """Finds (mac|sun)_tool.gyp in the gyp directory and copies it
2602
+ to |out_path|."""
2603
+ prefix = { 'solaris' : 'sun' , 'mac' : 'mac' }.get (flavor , None )
2604
+ if not prefix :
2605
+ return
2606
+
2607
+ tool_path = os .path .join (out_path , 'gyp-%s-tool' % prefix )
2608
+ if os .path .exists (tool_path ):
2609
+ os .remove (tool_path )
2610
+
2611
+ # Slurp input file.
2581
2612
source_path = os .path .join (
2582
- os .path .dirname (os .path .abspath (__file__ )), '..' , 'mac_tool .py' )
2613
+ os .path .dirname (os .path .abspath (__file__ )), '..' , '%s_tool .py' % prefix )
2583
2614
source_file = open (source_path )
2584
2615
source = source_file .readlines ()
2585
2616
source_file .close ()
2586
- mactool_file = open (out_path , 'w' )
2587
- mactool_file .write (
2617
+
2618
+ # Add header and write it out.
2619
+ tool_file = open (tool_path , 'w' )
2620
+ tool_file .write (
2588
2621
'' .join ([source [0 ], '# Generated by gyp. Do not edit.\n ' ] + source [1 :]))
2589
- mactool_file .close ()
2622
+ tool_file .close ()
2623
+
2624
+ # Make file executable.
2625
+ os .chmod (tool_path , 0755 )
2590
2626
2591
2627
2592
2628
def GenerateOutput (target_list , target_dicts , data , params ):
@@ -2641,7 +2677,7 @@ def CalculateMakefilePath(build_file, base_name):
2641
2677
'flock' : flock_command ,
2642
2678
'flock_index' : 1 ,
2643
2679
'link_commands' : LINK_COMMANDS_LINUX ,
2644
- 'mac_commands ' : '' ,
2680
+ 'extra_commands ' : '' ,
2645
2681
'srcdir' : srcdir ,
2646
2682
}
2647
2683
if flavor == 'mac' :
@@ -2650,12 +2686,22 @@ def CalculateMakefilePath(build_file, base_name):
2650
2686
'flock' : flock_command ,
2651
2687
'flock_index' : 2 ,
2652
2688
'link_commands' : LINK_COMMANDS_MAC ,
2653
- 'mac_commands ' : SHARED_HEADER_MAC_COMMANDS ,
2689
+ 'extra_commands ' : SHARED_HEADER_MAC_COMMANDS ,
2654
2690
})
2655
- if flavor == 'android' :
2691
+ elif flavor == 'android' :
2656
2692
header_params .update ({
2657
2693
'link_commands' : LINK_COMMANDS_ANDROID ,
2658
2694
})
2695
+ elif flavor == 'solaris' :
2696
+ header_params .update ({
2697
+ 'flock' : './gyp-sun-tool flock' ,
2698
+ 'flock_index' : 2 ,
2699
+ 'extra_commands' : SHARED_HEADER_SUN_COMMANDS ,
2700
+ })
2701
+ elif flavor == 'freebsd' :
2702
+ header_params .update ({
2703
+ 'flock' : 'lockf' ,
2704
+ })
2659
2705
header_params .update (RunSystemTests (flavor ))
2660
2706
2661
2707
build_file , _ , _ = gyp .common .ParseQualifiedTarget (target_list [0 ])
@@ -2693,13 +2739,8 @@ def CalculateMakefilePath(build_file, base_name):
2693
2739
WriteRootHeaderSuffixRules (root_makefile )
2694
2740
2695
2741
# Put mac_tool next to the root Makefile.
2696
- if flavor == 'mac' :
2697
- mactool_path = os .path .join (os .path .dirname (makefile_path ), 'gyp-mac-tool' )
2698
- if os .path .exists (mactool_path ):
2699
- os .remove (mactool_path )
2700
- CopyMacTool (mactool_path )
2701
- # Make file executable.
2702
- os .chmod (mactool_path , 0755 )
2742
+ dest_path = os .path .dirname (makefile_path )
2743
+ CopyTool (flavor , dest_path )
2703
2744
2704
2745
# Find the list of targets that derive from the gyp file(s) being built.
2705
2746
needed_targets = set ()
0 commit comments