-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for downloading libgccjit.so file to prevent requiring to…
… build it yourself
- Loading branch information
1 parent
e936289
commit 6332003
Showing
8 changed files
with
132 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! Retrieves information related to GCC backend. | ||
use crate::builder::Cargo; | ||
|
||
/// This retrieves the gccjit sha we use. | ||
pub(crate) fn detect_gccjit_sha() -> String { | ||
// FIXME: This is absolutely ugly. Please find another way to do that. | ||
let content = | ||
include_str!("../../../../ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh"); | ||
if let Some(commit) = content | ||
.lines() | ||
.filter_map(|line| line.strip_prefix("GIT_COMMIT=\"")) | ||
.filter_map(|commit| commit.strip_suffix("\"")) | ||
.next() | ||
{ | ||
if !commit.is_empty() { | ||
return commit.to_string(); | ||
} | ||
} | ||
|
||
eprintln!("error: could not find commit hash for downloading libgccjit"); | ||
panic!(); | ||
} | ||
|
||
pub fn set_gccjit_library_path(config: &crate::Config, cargo: &mut Cargo) { | ||
if config.gcc_download_gccjit { | ||
let libgccjit_path = config.libgccjit_folder(&detect_gccjit_sha()); | ||
let mut library_path = std::env::var("LD_LIBRARY_PATH").unwrap_or_default(); | ||
if !library_path.is_empty() { | ||
library_path.push(':'); | ||
} | ||
library_path.push_str(&libgccjit_path.display().to_string()); | ||
cargo.env("LD_LIBRARY_PATH", &library_path); | ||
cargo.env("LIBRARY_PATH", library_path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters