From 9fa0e55f243d337d6fd7d27191ebbc564c2f34cc Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 12 Sep 2022 00:02:17 +0300 Subject: [PATCH] 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 --- pkgs/tools/misc/rpcsvc-proto/default.nix | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/misc/rpcsvc-proto/default.nix b/pkgs/tools/misc/rpcsvc-proto/default.nix index 4b56dec9d521..3e8f62ff8954 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' '';