Merge pull request #190949 from Artturin/rpcsvcproto-cpp

This commit is contained in:
Artturi 2022-09-13 19:38:43 +03:00 committed by GitHub
commit 9608ace700
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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'
'';