Skip to content

Commit 6213d05

Browse files
authored
Merge pull request alexcrichton#36 from arrtchiu/patch-1
add aarch64-apple-ios target support
2 parents aff25e7 + ad0e2a1 commit 6213d05

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/lib.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,12 @@ impl Build {
181181
"x86_64-unknown-netbsd" => "BSD-x86_64",
182182
"wasm32-unknown-emscripten" => "gcc",
183183
"wasm32-unknown-unknown" => "gcc",
184+
"aarch64-apple-ios" => "ios64-cross",
184185
_ => panic!("don't know how to configure OpenSSL for {}", target),
185186
};
186187

188+
let mut ios_isysroot: std::option::Option<String> = None;
189+
187190
configure.arg(os);
188191

189192
// If we're not on MSVC we configure cross compilers and cross tools and
@@ -210,12 +213,39 @@ impl Build {
210213

211214
// Make sure we pass extra flags like `-ffunction-sections` and
212215
// other things like ARM codegen flags.
216+
let mut skip_next = false;
217+
let mut is_isysroot = false;
213218
for arg in compiler.args() {
214219
// For whatever reason `-static` on MUSL seems to cause
215220
// issues...
216221
if target.contains("musl") && arg == "-static" {
217222
continue
218223
}
224+
225+
// cargo-lipo specifies this but OpenSSL complains
226+
if target.contains("apple-ios") {
227+
if arg == "-arch" {
228+
skip_next = true;
229+
continue
230+
}
231+
232+
if arg == "-isysroot" {
233+
is_isysroot = true;
234+
continue
235+
}
236+
237+
if is_isysroot {
238+
is_isysroot = false;
239+
ios_isysroot = Some(arg.to_str().unwrap().to_string());
240+
continue
241+
}
242+
}
243+
244+
if skip_next {
245+
skip_next = false;
246+
continue
247+
}
248+
219249
configure.arg(arg);
220250
}
221251

@@ -290,6 +320,13 @@ impl Build {
290320
build.env("MAKEFLAGS", s);
291321
}
292322
}
323+
324+
if let Some(ref isysr) = ios_isysroot {
325+
let components: Vec<&str> = isysr.split("/SDKs/").collect();
326+
build.env("CROSS_TOP", components[0]);
327+
build.env("CROSS_SDK", components[1]);
328+
}
329+
293330
self.run_command(build, "building OpenSSL");
294331

295332
let mut install = self.cmd_make();

0 commit comments

Comments
 (0)