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