rubyPackages.rbtrace: fix riscv64-linux build (#565242)

This commit is contained in:
Gaétan Lepage
2026-09-29 19:58:06 +00:00
committed by GitHub
2 changed files with 65 additions and 37 deletions

View File

@@ -23,6 +23,9 @@
rustc,
rustPlatform,
# gitlab-glaz
buildPackages,
# gpgme
pkg-config,
@@ -67,46 +70,57 @@ let
buildFlags = [ "--enable-system-libraries" ];
};
gitlab-glaz = attrs: {
cargoDeps = rustPlatform.fetchCargoVendor {
src = stdenv.mkDerivation {
inherit (buildRubyGem { inherit (attrs) gemName version source; })
name
src
unpackPhase
nativeBuildInputs
;
dontBuilt = true;
installPhase = ''
cp -R ext/glaz $out
cp Cargo.lock $out
'';
gitlab-glaz =
attrs:
{
cargoDeps = rustPlatform.fetchCargoVendor {
src = stdenv.mkDerivation {
inherit (buildRubyGem { inherit (attrs) gemName version source; })
name
src
unpackPhase
nativeBuildInputs
;
dontBuilt = true;
installPhase = ''
cp -R ext/glaz $out
cp Cargo.lock $out
'';
};
hash = "sha256-5fGoW6TpkIQ8OIXjt2fLGzG9xhZ2TT+v2zLH1ecItII=";
};
hash = "sha256-5fGoW6TpkIQ8OIXjt2fLGzG9xhZ2TT+v2zLH1ecItII=";
dontBuild = false;
nativeBuildInputs = [
cargo
rustc
rustPlatform.cargoSetupHook
rustPlatform.bindgenHook
];
disallowedReferences = [
rustc.unwrapped
];
preInstall = ''
export CARGO_HOME="$PWD/../.cargo/"
'';
postInstall = ''
find $out -type f -name .rustc_info.json -delete
'';
}
// lib.optionalAttrs stdenv.hostPlatform.isRiscV64 {
# protoc-bin-vendored ships no riscv64 protoc
postPatch = ''
substituteInPlace $cargoDepsCopy/source-*/glaz-proto-*/build.rs \
--replace-fail 'protoc_bin_vendored::protoc_bin_path()?' \
'std::path::PathBuf::from(std::env::var("PROTOC")?)'
'';
PROTOC = lib.getExe' buildPackages.protobuf "protoc";
};
dontBuild = false;
nativeBuildInputs = [
cargo
rustc
rustPlatform.cargoSetupHook
rustPlatform.bindgenHook
];
disallowedReferences = [
rustc.unwrapped
];
preInstall = ''
export CARGO_HOME="$PWD/../.cargo/"
'';
postInstall = ''
find $out -type f -name .rustc_info.json -delete
'';
};
gitlab-glfm-markdown = attrs: {
cargoDeps = rustPlatform.fetchCargoVendor {
src = stdenv.mkDerivation {

View File

@@ -1045,6 +1045,20 @@ in
buildFlags = [ "--with-ssh" ];
};
rbtrace =
attrs:
# unpack the vendored msgpack so the gnu-config hook can refresh its old config.{guess,sub}
lib.optionalAttrs (stdenv.hostPlatform.isRiscV64 || stdenv.hostPlatform.isLoongArch64) {
dontBuild = false;
postPatch = ''
tar -xzf ext/src/msgpack-1.1.0.tar.gz -C ext/src
'';
preConfigure = ''
tar -czf ext/src/msgpack-1.1.0.tar.gz -C ext/src msgpack-1.1.0
rm -r ext/src/msgpack-1.1.0
'';
};
sassc = attrs: {
nativeBuildInputs = [ rake ];
dontBuild = false;