forked from M-Labs/nac3
fix compilation with nixpkgs 21.05
The environment variable is optional to keep compatibility with other build environments. Closes #131
This commit is contained in:
parent
8c8a5d53b9
commit
2ba4d8935d
|
@ -31,6 +31,7 @@ let
|
|||
];
|
||||
buildPhase = ''
|
||||
export XARGO_RUST_SRC="${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library"
|
||||
export CLANG_EXTRA_INCLUDE_DIR="${pkgs.llvmPackages_9.clang-unwrapped.lib}/lib/clang/9.0.1/include"
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
make TARGET=${target} GWARGS="${if json == null then "-V ${variant}" else json}"
|
||||
'';
|
||||
|
|
|
@ -30,6 +30,7 @@ in
|
|||
];
|
||||
|
||||
XARGO_RUST_SRC = "${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library";
|
||||
CLANG_EXTRA_INCLUDE_DIR = "${pkgs.llvmPackages_9.clang-unwrapped.lib}/lib/clang/9.0.1/include";
|
||||
OPENOCD_ZYNQ = "${zynq-rs}/openocd";
|
||||
SZL = "${zc706-szl}/szl.elf";
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ fn main() {
|
|||
|
||||
mod libc {
|
||||
use std::path::Path;
|
||||
use std::env;
|
||||
|
||||
pub fn compile() {
|
||||
let cfg = &mut cc::Build::new();
|
||||
cfg.no_default_flags(true);
|
||||
|
@ -16,6 +18,9 @@ mod libc {
|
|||
cfg.flag("-ffreestanding");
|
||||
cfg.flag("-fno-PIC");
|
||||
cfg.flag("-isystem../include");
|
||||
if let Ok(extra_include) = env::var("CLANG_EXTRA_INCLUDE_DIR") {
|
||||
cfg.flag(&("-isystem".to_owned() + &extra_include));
|
||||
}
|
||||
cfg.flag("-fno-stack-protector");
|
||||
cfg.flag("--target=armv7-none-eabihf");
|
||||
cfg.flag("-O2");
|
||||
|
|
|
@ -6,6 +6,7 @@ fn main() {
|
|||
|
||||
mod llvm_libunwind {
|
||||
use std::path::Path;
|
||||
use std::env;
|
||||
|
||||
fn setup_options(cfg: &mut cc::Build) {
|
||||
cfg.no_default_flags(true);
|
||||
|
@ -16,6 +17,9 @@ mod llvm_libunwind {
|
|||
cfg.flag("-fno-PIC");
|
||||
cfg.flag("-Isrc");
|
||||
cfg.flag("-isystem../include");
|
||||
if let Ok(extra_include) = env::var("CLANG_EXTRA_INCLUDE_DIR") {
|
||||
cfg.flag(&("-isystem".to_owned() + &extra_include));
|
||||
}
|
||||
cfg.flag("-fno-stack-protector");
|
||||
cfg.flag("--target=armv7-none-eabihf");
|
||||
cfg.flag("-O2");
|
||||
|
|
Loading…
Reference in New Issue