uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs
|
||||
index 3beddf54..0f859b8d 100644
|
||||
--- a/src/dist/component/package.rs
|
||||
+++ b/src/dist/component/package.rs
|
||||
@@ -113,6 +113,7 @@ impl Package for DirectoryPackage {
|
||||
} else {
|
||||
builder.move_file(path.clone(), &src_path)?
|
||||
}
|
||||
+ nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path)
|
||||
}
|
||||
"dir" => {
|
||||
if self.copy {
|
||||
@@ -135,6 +136,29 @@ impl Package for DirectoryPackage {
|
||||
}
|
||||
}
|
||||
|
||||
+fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) {
|
||||
+ let (is_bin, is_lib) = if let Some(p) = src_path.parent() {
|
||||
+ (p.ends_with("bin"), p.ends_with("lib"))
|
||||
+ } else {
|
||||
+ (false, false)
|
||||
+ };
|
||||
+
|
||||
+ if is_bin {
|
||||
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
||||
+ .arg("--set-interpreter")
|
||||
+ .arg("@dynamicLinker@")
|
||||
+ .arg(dest_path)
|
||||
+ .output();
|
||||
+ }
|
||||
+ else if is_lib {
|
||||
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
||||
+ .arg("--set-rpath")
|
||||
+ .arg("@libPath@")
|
||||
+ .arg(dest_path)
|
||||
+ .output();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
#[derive(Debug)]
|
||||
pub struct TarPackage<'a>(DirectoryPackage, temp::Dir<'a>);
|
||||
|
||||
94
pkgs/development/tools/rust/rustup/default.nix
Normal file
94
pkgs/development/tools/rust/rustup/default.nix
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, runCommand
|
||||
, patchelf
|
||||
, fetchFromGitHub
|
||||
, rustPlatform
|
||||
, makeWrapper
|
||||
, pkg-config
|
||||
, curl
|
||||
, zlib
|
||||
, Security
|
||||
, CoreServices
|
||||
, libiconv
|
||||
, xz
|
||||
}:
|
||||
|
||||
let
|
||||
libPath = lib.makeLibraryPath [
|
||||
zlib # libz.so.1
|
||||
];
|
||||
in
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "rustup";
|
||||
version = "1.24.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rust-lang";
|
||||
repo = "rustup";
|
||||
rev = version;
|
||||
sha256 = "sha256-JpOOFwlTgwwBCrXOGYskFTgS6RZ7mHQJGT0jnHavxvI=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-hAfGpKaWD94IxFFpnW9XwQp4P9clUX6mmekwodCK0Ag=";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper pkg-config ];
|
||||
|
||||
buildInputs = [
|
||||
curl
|
||||
zlib
|
||||
] ++ lib.optionals stdenv.isDarwin [ CoreServices Security libiconv xz ];
|
||||
|
||||
buildFeatures = [ "no-self-update" ];
|
||||
|
||||
checkFeatures = [ ];
|
||||
|
||||
patches = lib.optionals stdenv.isLinux [
|
||||
(runCommand "0001-dynamically-patchelf-binaries.patch" { CC = stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } ''
|
||||
export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
|
||||
substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
|
||||
--subst-var patchelf \
|
||||
--subst-var dynamicLinker \
|
||||
--subst-var libPath
|
||||
'')
|
||||
];
|
||||
|
||||
doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;
|
||||
|
||||
postInstall = ''
|
||||
pushd $out/bin
|
||||
mv rustup-init rustup
|
||||
binlinks=(
|
||||
cargo rustc rustdoc rust-gdb rust-lldb rls rustfmt cargo-fmt
|
||||
cargo-clippy clippy-driver cargo-miri
|
||||
)
|
||||
for link in ''${binlinks[@]}; do
|
||||
ln -s rustup $link
|
||||
done
|
||||
popd
|
||||
|
||||
wrapProgram $out/bin/rustup --prefix "LD_LIBRARY_PATH" : "${libPath}"
|
||||
|
||||
# tries to create .rustup
|
||||
export HOME=$(mktemp -d)
|
||||
mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}
|
||||
|
||||
# generate completion scripts for rustup
|
||||
$out/bin/rustup completions bash rustup > "$out/share/bash-completion/completions/rustup"
|
||||
$out/bin/rustup completions fish rustup > "$out/share/fish/vendor_completions.d/rustup.fish"
|
||||
$out/bin/rustup completions zsh rustup > "$out/share/zsh/site-functions/_rustup"
|
||||
|
||||
# generate completion scripts for cargo
|
||||
# Note: fish completion script is not supported.
|
||||
$out/bin/rustup completions bash cargo > "$out/share/bash-completion/completions/cargo"
|
||||
$out/bin/rustup completions zsh cargo > "$out/share/zsh/site-functions/_cargo"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "The Rust toolchain installer";
|
||||
homepage = "https://www.rustup.rs/";
|
||||
license = with licenses; [ asl20 /* or */ mit ];
|
||||
maintainers = [ maintainers.mic92 ];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue