From 9f1a3a4b0ff90869c41efcb72ba1610dd05d10d1 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Sat, 5 Sep 2015 01:35:13 -0700 Subject: [PATCH] pond: Fix x86_64 optimizations to be correctly applied to only x86_64 --- pkgs/development/libraries/dclxvi/default.nix | 2 +- pkgs/top-level/go-packages.nix | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/dclxvi/default.nix b/pkgs/development/libraries/dclxvi/default.nix index 1b8528dd08bb..6207f3d20382 100644 --- a/pkgs/development/libraries/dclxvi/default.nix +++ b/pkgs/development/libraries/dclxvi/default.nix @@ -22,6 +22,6 @@ stdenv.mkDerivation { homepage = "https://github.com/agl/dclxvi"; description = "Naehrig, Niederhagen and Schwabe's pairings code, massaged into a shared library"; maintainers = with maintainers; [ wkennington ]; - platforms = platforms.all; + platforms = platforms.x86_64; }; } diff --git a/pkgs/top-level/go-packages.nix b/pkgs/top-level/go-packages.nix index 3cdf30300567..6a83cc46701d 100644 --- a/pkgs/top-level/go-packages.nix +++ b/pkgs/top-level/go-packages.nix @@ -2090,15 +2090,21 @@ let doCheck = false; # bad import path in tests }; - pond = buildFromGitHub { + pond = let isx86_64 = stdenv.lib.any (n: n == stdenv.system) stdenv.lib.platforms.x86_64; in buildFromGitHub { rev = "bce6e0dc61803c23699c749e29a83f81da3c41b2"; owner = "agl"; repo = "pond"; sha256 = "1dmgbg4ak3jkbgmxh0lr4hga1nl623mh7pvsgby1rxl4ivbzwkh4"; - buildInputs = [ net crypto protobuf ed25519 pkgs.trousers pkgs.dclxvi ]; + buildInputs = [ net crypto protobuf ed25519 pkgs.trousers ] + ++ stdenv.lib.optional isx86_64 pkgs.dclxvi; buildFlags = "-tags nogui"; - excludedPackages = "appengine"; + excludedPackages = "\\(appengine\\|bn256cgo\\)"; + postPatch = stdenv.lib.optionalString isx86_64 '' + grep -r 'bn256' | awk -F: '{print $1}' | xargs sed -i \ + -e "s,golang.org/x/crypto/bn256,github.com/agl/pond/bn256cgo,g" \ + -e "s,bn256\.,bn256cgo.,g" + ''; }; pongo2 = buildFromGitHub {