@@ -45,7 +45,7 @@ def guess_target():
45
45
system = platform .system ()
46
46
arch = platform .machine ()
47
47
if system == 'Darwin' :
48
- return 'mac'
48
+ return 'mac-universal '
49
49
if system == 'Linux' :
50
50
if re .match ('^(x|i.?)86$' , arch ) is not None :
51
51
return 'linux-x86'
@@ -102,34 +102,49 @@ def validate_target(opts):
102
102
# Action
103
103
################################################################
104
104
105
- def exec_fetch_libraries (build_platform ):
105
+ def exec_fetch_libraries (build_platform , build_arch ):
106
106
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 ]
108
108
else :
109
- args = ["./prebuilt/fetch-libraries.sh" , build_platform ]
109
+ args = ["./prebuilt/fetch-libraries.sh" , build_platform , build_arch ]
110
110
print (' ' .join (args ))
111
111
status = subprocess .call (args )
112
112
if status != 0 :
113
113
sys .exit (status )
114
114
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
+
115
123
def fetch (args ):
116
124
opts = {}
117
125
process_env_options (opts )
118
126
process_arg_options (opts , args )
119
127
120
128
validate_target (opts )
121
129
130
+ host_components = guess_target ().split ('-' )
131
+ target_components = opts ['TARGET' ].split ('-' )
132
+
122
133
# 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 ])
124
137
125
138
# 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 ])
127
142
128
143
print ('Fetching host platform prebuilts (' + host_platform + ')' )
129
- exec_fetch_libraries (host_platform )
144
+ exec_fetch_libraries (host_platform , host_arch )
130
145
131
146
print ('Fetching target platform prebuilts (' + target_platform + ')' )
132
- exec_fetch_libraries (target_platform )
147
+ exec_fetch_libraries (target_platform , target_arch )
133
148
134
149
if __name__ == '__main__' :
135
150
fetch (sys .argv [1 :])
0 commit comments