mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03:00
avoid building platform for link type dylib and no link
Both of these cases do not tie to a platform. The roc app can be built without considering the platform. It is often the case that the platform is using one of these options because roc cannot build the platform. This allows for more flexibility and avoids wasting time compiling the platform.
This commit is contained in:
parent
6f2e14cf18
commit
1b92a24577
@ -186,7 +186,9 @@ pub fn build_file<'a>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// We don't need to spawn a rebuild thread when using a prebuilt host.
|
// We don't need to spawn a rebuild thread when using a prebuilt host.
|
||||||
let rebuild_thread = if is_prebuilt {
|
let rebuild_thread = if matches!(link_type, LinkType::Dylib | LinkType::None) {
|
||||||
|
None
|
||||||
|
} else if is_prebuilt {
|
||||||
if !preprocessed_host_path.exists() {
|
if !preprocessed_host_path.exists() {
|
||||||
if prebuilt_requested {
|
if prebuilt_requested {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
@ -378,10 +380,11 @@ pub fn build_file<'a>(
|
|||||||
|
|
||||||
std::fs::write(app_o_file, &*roc_app_bytes).unwrap();
|
std::fs::write(app_o_file, &*roc_app_bytes).unwrap();
|
||||||
|
|
||||||
let mut inputs = vec![
|
let mut inputs = vec![app_o_file.to_str().unwrap()];
|
||||||
host_input_path.as_path().to_str().unwrap(),
|
|
||||||
app_o_file.to_str().unwrap(),
|
if !matches!(link_type, LinkType::Dylib | LinkType::None) {
|
||||||
];
|
inputs.push(host_input_path.as_path().to_str().unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
let builtins_host_tempfile = {
|
let builtins_host_tempfile = {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
@ -1248,14 +1248,14 @@ fn link_macos(
|
|||||||
input_paths: &[&str],
|
input_paths: &[&str],
|
||||||
link_type: LinkType,
|
link_type: LinkType,
|
||||||
) -> io::Result<(Child, PathBuf)> {
|
) -> io::Result<(Child, PathBuf)> {
|
||||||
let (link_type_arg, output_path) = match link_type {
|
let (link_type_args, output_path) = match link_type {
|
||||||
LinkType::Executable => ("-execute", output_path),
|
LinkType::Executable => (vec!["-execute"], output_path),
|
||||||
LinkType::Dylib => {
|
LinkType::Dylib => {
|
||||||
let mut output_path = output_path;
|
let mut output_path = output_path;
|
||||||
|
|
||||||
output_path.set_extension("dylib");
|
output_path.set_extension("dylib");
|
||||||
|
|
||||||
("-dylib", output_path)
|
(vec!["-dylib", "-undefined", "dynamic_lookup"], output_path)
|
||||||
}
|
}
|
||||||
LinkType::None => internal_error!("link_macos should not be called with link type of none"),
|
LinkType::None => internal_error!("link_macos should not be called with link type of none"),
|
||||||
};
|
};
|
||||||
@ -1272,13 +1272,13 @@ fn link_macos(
|
|||||||
// The `-l` flags should go after the `.o` arguments
|
// The `-l` flags should go after the `.o` arguments
|
||||||
// Don't allow LD_ env vars to affect this
|
// Don't allow LD_ env vars to affect this
|
||||||
.env_clear()
|
.env_clear()
|
||||||
|
.args(&link_type_args)
|
||||||
.args([
|
.args([
|
||||||
// NOTE: we don't do --gc-sections on macOS because the default
|
// NOTE: we don't do --gc-sections on macOS because the default
|
||||||
// macOS linker doesn't support it, but it's a performance
|
// macOS linker doesn't support it, but it's a performance
|
||||||
// optimization, so if we ever switch to a different linker,
|
// optimization, so if we ever switch to a different linker,
|
||||||
// we'd like to re-enable it on macOS!
|
// we'd like to re-enable it on macOS!
|
||||||
// "--gc-sections",
|
// "--gc-sections",
|
||||||
link_type_arg,
|
|
||||||
"-arch",
|
"-arch",
|
||||||
&arch,
|
&arch,
|
||||||
"-macos_version_min",
|
"-macos_version_min",
|
||||||
|
Loading…
Reference in New Issue
Block a user