Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

protobuf3: support cross compilation

PR #48450

authored by

ryan4729 and committed by
Linus Heckemann
7414ec1f 143884d4

+10 -4
+10 -4
pkgs/development/libraries/protobuf/generic-v3.nix
··· 1 1 { stdenv 2 2 , fetchFromGitHub 3 - , autoreconfHook, zlib, gmock 3 + , autoreconfHook, zlib, gmock, which, buildPackages 4 4 , version, sha256 5 5 , ... 6 6 }: 7 7 8 - stdenv.mkDerivation rec { 8 + let 9 + mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation rec { 9 10 name = "protobuf-${version}"; 10 11 11 12 # make sure you test also -A pythonPackages.protobuf ··· 28 29 --replace 'tmpnam(b)' '"'$TMPDIR'/foo"' 29 30 ''; 30 31 31 - nativeBuildInputs = [ autoreconfHook ]; 32 + nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc buildProtobuf ]; 33 + 32 34 buildInputs = [ zlib ]; 35 + configureFlags = if buildProtobuf == null then [] else [ "--with-protoc=${buildProtobuf}/bin/protoc" ]; 33 36 34 37 enableParallelBuilding = true; 35 38 ··· 54 57 }; 55 58 56 59 passthru.version = version; 57 - } 60 + }; 61 + in mkProtobufDerivation(if (stdenv.buildPlatform != stdenv.hostPlatform) 62 + then (mkProtobufDerivation null buildPackages.stdenv) 63 + else null) stdenv