forked from M-Labs/artiq-zynq
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
93e26087ee
commit
298085b62d
@ -31,6 +31,7 @@ let
|
|||||||
];
|
];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
export XARGO_RUST_SRC="${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library"
|
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)
|
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||||
make TARGET=${target} VARIANT=${variant}
|
make TARGET=${target} VARIANT=${variant}
|
||||||
'';
|
'';
|
||||||
|
@ -30,6 +30,7 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
XARGO_RUST_SRC = "${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library";
|
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";
|
OPENOCD_ZYNQ = "${zynq-rs}/openocd";
|
||||||
SZL = "${zc706-szl}/szl.elf";
|
SZL = "${zc706-szl}/szl.elf";
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ fn main() {
|
|||||||
|
|
||||||
mod libc {
|
mod libc {
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
pub fn compile() {
|
pub fn compile() {
|
||||||
let cfg = &mut cc::Build::new();
|
let cfg = &mut cc::Build::new();
|
||||||
cfg.no_default_flags(true);
|
cfg.no_default_flags(true);
|
||||||
@ -16,6 +18,9 @@ mod libc {
|
|||||||
cfg.flag("-ffreestanding");
|
cfg.flag("-ffreestanding");
|
||||||
cfg.flag("-fno-PIC");
|
cfg.flag("-fno-PIC");
|
||||||
cfg.flag("-isystem../include");
|
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("-fno-stack-protector");
|
||||||
cfg.flag("--target=armv7-none-eabihf");
|
cfg.flag("--target=armv7-none-eabihf");
|
||||||
cfg.flag("-O2");
|
cfg.flag("-O2");
|
||||||
|
@ -6,6 +6,7 @@ fn main() {
|
|||||||
|
|
||||||
mod llvm_libunwind {
|
mod llvm_libunwind {
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
fn setup_options(cfg: &mut cc::Build) {
|
fn setup_options(cfg: &mut cc::Build) {
|
||||||
cfg.no_default_flags(true);
|
cfg.no_default_flags(true);
|
||||||
@ -16,6 +17,9 @@ mod llvm_libunwind {
|
|||||||
cfg.flag("-fno-PIC");
|
cfg.flag("-fno-PIC");
|
||||||
cfg.flag("-Isrc");
|
cfg.flag("-Isrc");
|
||||||
cfg.flag("-isystem../include");
|
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("-fno-stack-protector");
|
||||||
cfg.flag("--target=armv7-none-eabihf");
|
cfg.flag("--target=armv7-none-eabihf");
|
||||||
cfg.flag("-O2");
|
cfg.flag("-O2");
|
||||||
|
Loading…
Reference in New Issue
Block a user