@@ -45,7 +45,7 @@ def guess_target():
4545 system = platform .system ()
4646 arch = platform .machine ()
4747 if system == 'Darwin' :
48- return 'mac'
48+ return 'mac-universal '
4949 if system == 'Linux' :
5050 if re .match ('^(x|i.?)86$' , arch ) is not None :
5151 return 'linux-x86'
@@ -102,34 +102,49 @@ def validate_target(opts):
102102# Action
103103################################################################
104104
105- def exec_fetch_libraries (build_platform ):
105+ def exec_fetch_libraries (build_platform , build_arch ):
106106 if platform .system () == 'Windows' :
107- args = [".\util\invoke-unix.bat" , "prebuilt/fetch-libraries.sh" , build_platform ]
107+ args = [".\util\invoke-unix.bat" , "prebuilt/fetch-libraries.sh" , build_platform , build_arch ]
108108 else :
109- args = ["./prebuilt/fetch-libraries.sh" , build_platform ]
109+ args = ["./prebuilt/fetch-libraries.sh" , build_platform , build_arch ]
110110 print (' ' .join (args ))
111111 status = subprocess .call (args )
112112 if status != 0 :
113113 sys .exit (status )
114114
115+ def get_fetch_arch (platform , arch ):
116+ if platform in ['mac' , 'ios' ]:
117+ return "Universal"
118+ elif platform == 'linux' and arch == 'x86' :
119+ return "i386"
120+ else :
121+ return arch
122+
115123def fetch (args ):
116124 opts = {}
117125 process_env_options (opts )
118126 process_arg_options (opts , args )
119127
120128 validate_target (opts )
121129
130+ host_components = guess_target ().split ('-' )
131+ target_components = opts ['TARGET' ].split ('-' )
132+
122133 # Get the host platform to pass to fetch-libraries
123- host_platform = guess_target ().split ('-' )[0 ]
134+ host_platform = host_components [0 ]
135+
136+ host_arch = get_fetch_arch (host_platform , host_components [1 ])
124137
125138 # Get the target platform to pass to fetch-libraries
126- target_platform = opts ['TARGET' ].split ('-' )[0 ]
139+ target_platform = target_components [1 ]
140+
141+ target_arch = get_fetch_arch (target_platform , target_components [0 ])
127142
128143 print ('Fetching host platform prebuilts (' + host_platform + ')' )
129- exec_fetch_libraries (host_platform )
144+ exec_fetch_libraries (host_platform , host_arch )
130145
131146 print ('Fetching target platform prebuilts (' + target_platform + ')' )
132- exec_fetch_libraries (target_platform )
147+ exec_fetch_libraries (target_platform , target_arch )
133148
134149if __name__ == '__main__' :
135150 fetch (sys .argv [1 :])
0 commit comments