about summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2018-10-15 14:30:38 +0200
committerGitHub <noreply@github.com>2018-10-15 14:30:38 +0200
commitdc6abb3db8eb1d2718cad94211a20f2a0c9f9865 (patch)
treea1f6465fd74f403b19c4bb23b12813d5331d525b /pkgs/development/libraries
parent455e0ed88527d69a9c4a52e1238d35ec61556257 (diff)
parent65a81afcf5ef9bc96c21089b370bece300849977 (diff)
downloadnixlib-dc6abb3db8eb1d2718cad94211a20f2a0c9f9865.tar
nixlib-dc6abb3db8eb1d2718cad94211a20f2a0c9f9865.tar.gz
nixlib-dc6abb3db8eb1d2718cad94211a20f2a0c9f9865.tar.bz2
nixlib-dc6abb3db8eb1d2718cad94211a20f2a0c9f9865.tar.lz
nixlib-dc6abb3db8eb1d2718cad94211a20f2a0c9f9865.tar.xz
nixlib-dc6abb3db8eb1d2718cad94211a20f2a0c9f9865.tar.zst
nixlib-dc6abb3db8eb1d2718cad94211a20f2a0c9f9865.zip
Merge pull request #48450 from ryan4729/proto3-cross
protobuf3: support cross compilation
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/protobuf/generic-v3.nix14
1 files changed, 10 insertions, 4 deletions
diff --git a/pkgs/development/libraries/protobuf/generic-v3.nix b/pkgs/development/libraries/protobuf/generic-v3.nix
index 79e4c387cdf5..883dff56f2ee 100644
--- a/pkgs/development/libraries/protobuf/generic-v3.nix
+++ b/pkgs/development/libraries/protobuf/generic-v3.nix
@@ -1,11 +1,12 @@
 { stdenv
 , fetchFromGitHub
-, autoreconfHook, zlib, gmock
+, autoreconfHook, zlib, gmock, which, buildPackages
 , version, sha256
 , ...
 }:
 
-stdenv.mkDerivation rec {
+let
+mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation rec {
   name = "protobuf-${version}";
 
   # make sure you test also -A pythonPackages.protobuf
@@ -28,8 +29,10 @@ stdenv.mkDerivation rec {
       --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
   '';
 
-  nativeBuildInputs = [ autoreconfHook ];
+  nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc buildProtobuf ];
+
   buildInputs = [ zlib ];
+  configureFlags = if buildProtobuf == null then [] else [ "--with-protoc=${buildProtobuf}/bin/protoc" ];
 
   enableParallelBuilding = true;
 
@@ -54,4 +57,7 @@ stdenv.mkDerivation rec {
   };
 
   passthru.version = version;
-}
+};
+in mkProtobufDerivation(if (stdenv.buildPlatform != stdenv.hostPlatform)
+                        then (mkProtobufDerivation null buildPackages.stdenv)
+                        else null) stdenv