about summary refs log tree commit diff
path: root/pkgs/tools/misc/rpcsvc-proto
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-09-12 00:02:17 +0300
committerArtturin <Artturin@artturin.com>2022-09-13 18:22:58 +0300
commit9fa0e55f243d337d6fd7d27191ebbc564c2f34cc (patch)
tree639146b886bfb78ee72ce208795eea32c443e922 /pkgs/tools/misc/rpcsvc-proto
parent2c286b47f53378bab0c6c18db8762391e971adfc (diff)
rpcsvc-proto: pull patch to follow RPCGEN_CPP env var and replace fallback cpp
setting RPCGEN_CPP is to fix the build of host != build rpcsvc-proto
because buildPackages.rpcsvc-proto is used

to fix usage in cross-compilation
Diffstat (limited to 'pkgs/tools/misc/rpcsvc-proto')
-rw-r--r--pkgs/tools/misc/rpcsvc-proto/default.nix21
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/tools/misc/rpcsvc-proto/default.nix b/pkgs/tools/misc/rpcsvc-proto/default.nix
index 4b56dec9d5211..3e8f62ff89540 100644
--- a/pkgs/tools/misc/rpcsvc-proto/default.nix
+++ b/pkgs/tools/misc/rpcsvc-proto/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, autoreconfHook, buildPackages }:
+{ stdenv, lib, fetchFromGitHub, autoreconfHook, buildPackages, fetchpatch, targetPackages }:
 
 stdenv.mkDerivation rec {
   pname = "rpcsvc-proto";
@@ -11,12 +11,27 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-DXRLEpOanWcxCSTC8OxEw5SWKpgFz7oTPukzfnPrAOk=";
   };
 
+  patches = [
+    # https://github.com/thkukuk/rpcsvc-proto/pull/14
+    (fetchpatch {
+      name = "follow-RPCGEN_CPP-env-var";
+      url = "https://github.com/thkukuk/rpcsvc-proto/commit/e772270774ff45172709e39f744cab875a816667.diff";
+      sha256 = "sha256-KrUD6YwdyxW9S99h4TB21ahnAOgQmQr2tYz++MIbk1Y=";
+    })
+  ];
+
   outputs = [ "out" "man" ];
 
-  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ autoreconfHook ];
 
-  postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+  RPCGEN_CPP = "${stdenv.cc.targetPrefix}cpp";
+
+  postPatch = ''
+    # replace fallback cpp with the target prefixed cpp
+    substituteInPlace rpcgen/rpc_main.c \
+      --replace 'CPP = "cpp"' \
+                'CPP = "${targetPackages.stdenv.cc.targetPrefix}cpp"'
+  '' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)  ''
     substituteInPlace rpcsvc/Makefile.am \
       --replace '$(top_builddir)/rpcgen/rpcgen' '${buildPackages.rpcsvc-proto}/bin/rpcgen'
   '';