mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-12 15:14:13 +00:00
Merge pull request #196390 from oxalica/pkg/cargo-show-asm
cargo-show-asm: init at 0.1.24
This commit is contained in:
commit
d1fdabc163
50
pkgs/development/tools/rust/cargo-show-asm/default.nix
Normal file
50
pkgs/development/tools/rust/cargo-show-asm/default.nix
Normal file
@ -0,0 +1,50 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, rustPlatform
|
||||
, pkg-config
|
||||
, installShellFiles
|
||||
, openssl
|
||||
, nix-update-script
|
||||
, callPackage
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "cargo-asm";
|
||||
version = "0.1.24";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pacak";
|
||||
repo = "cargo-show-asm";
|
||||
rev = version;
|
||||
hash = "sha256-ahkKUtg5M88qddzEwYxPecDtBofGfPVxKuYKgmsbWYc=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-S7OpHNjiTfQg7aPmHEx6Q/OV5QA9pB29F3MTIeiLAXg=";
|
||||
|
||||
nativeBuildInputs = [ pkg-config installShellFiles ];
|
||||
buildInputs = [ openssl ];
|
||||
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd foobar \
|
||||
--bash <($out/bin/cargo-asm --bpaf-complete-style-bash) \
|
||||
--fish <($out/bin/cargo-asm --bpaf-complete-style-fish) \
|
||||
--zsh <($out/bin/cargo-asm --bpaf-complete-style-zsh )
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script {
|
||||
attrPath = pname;
|
||||
};
|
||||
tests = lib.optionalAttrs stdenv.hostPlatform.isx86_64 {
|
||||
test-basic-x86_64 = callPackage ./test-basic-x86_64.nix { };
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Cargo subcommand showing the assembly, LLVM-IR and MIR generated for Rust code";
|
||||
homepage = "https://github.com/pacak/cargo-show-asm";
|
||||
license = with licenses; [ asl20 mit ];
|
||||
maintainers = with maintainers; [ oxalica ];
|
||||
broken = stdenv.isDarwin; # FIXME: Seems to have issue compiling bundled curl.
|
||||
};
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
{ runCommand, cargo, rustc, cargo-show-asm }:
|
||||
runCommand "test-basic" {
|
||||
nativeBuildInputs = [ cargo rustc cargo-show-asm ];
|
||||
} ''
|
||||
mkdir -p src
|
||||
cat >Cargo.toml <<EOF
|
||||
[package]
|
||||
name = "add"
|
||||
version = "0.0.0"
|
||||
EOF
|
||||
cat >src/lib.rs <<EOF
|
||||
pub fn add(a: u32, b: u32) -> u32 { a + b }
|
||||
EOF
|
||||
|
||||
[[ "$(cargo asm add::add | tee /dev/stderr)" == *"lea eax, "* ]]
|
||||
[[ "$(cargo asm --mir add | tee /dev/stderr)" == *"= Add("* ]]
|
||||
touch $out
|
||||
''
|
@ -14896,6 +14896,9 @@ with pkgs;
|
||||
cargo-semver-checks = callPackage ../development/tools/rust/cargo-semver-checks {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
};
|
||||
|
||||
cargo-show-asm = callPackage ../development/tools/rust/cargo-show-asm { };
|
||||
|
||||
cargo-sort = callPackage ../development/tools/rust/cargo-sort { };
|
||||
cargo-spellcheck = callPackage ../development/tools/rust/cargo-spellcheck {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
|
Loading…
Reference in New Issue
Block a user