Merge pull request #18737 from chris-martin/secp256k1-flags

secp256k1: configure with more feature flags

authored by Alexey Shmalko and committed by GitHub 1c50bdd9 f98b71b2

+30 -13
+30 -13
pkgs/tools/security/secp256k1/default.nix
··· 1 - { stdenv, fetchFromGitHub, autoconf, automake, libtool, ... }: 1 + { stdenv, fetchFromGitHub, autoreconfHook, jdk 2 + 3 + # Enable ECDSA pubkey recovery module 4 + , enableRecovery ? true 5 + 6 + # Enable ECDH shared secret computation (disabled by default because it is 7 + # experimental) 8 + , enableECDH ? false 9 + 10 + # Enable libsecp256k1_jni (disabled by default because it requires a jdk, 11 + # which is a large dependency) 12 + , enableJNI ? false 13 + 14 + }: 15 + 16 + let inherit (stdenv.lib) optionals; in 2 17 3 18 stdenv.mkDerivation rec { 4 19 name = "secp256k1-${version}"; 5 20 6 - # I can't find any version numbers, so we're just using the date 7 - # of the last commit. 8 - version = "2016-05-30"; 21 + # I can't find any version numbers, so we're just using the date of the 22 + # last commit. 23 + version = "2016-11-27"; 9 24 10 25 src = fetchFromGitHub { 11 26 owner = "bitcoin-core"; 12 27 repo = "secp256k1"; 13 - rev = "b3be8521e694eaf45dd29baea035055183c42fe2"; 14 - sha256 = "1pgsy72w87yxbiqn96hnm8alsfx3rj7d9jlzdsypyf6i1rf6w4bq"; 28 + rev = "2928420c1b8e1feee8c20dff4e3cc41a0de2fc22"; 29 + sha256 = "1djsr2vrhh88353czlwb8bwlyabf008w1f7xg0fs3q33rf42w5gm"; 15 30 }; 16 31 17 - buildInputs = [ autoconf automake libtool ]; 32 + buildInputs = optionals enableJNI [ jdk ]; 18 33 19 - configureFlags = [ "--enable-module-recovery" ]; 34 + nativeBuildInputs = [ autoreconfHook ]; 20 35 21 - preConfigure = "./autogen.sh"; 36 + configureFlags = 37 + optionals enableECDH [ "--enable-module-ecdh" "--enable-experimental" ] ++ 38 + optionals enableRecovery [ "--enable-module-recovery" ] ++ 39 + optionals enableJNI [ "--enable-jni" ]; 22 40 23 41 meta = with stdenv.lib; { 24 42 description = "Optimized C library for EC operations on curve secp256k1"; 25 43 longDescription = '' 26 - Optimized C library for EC operations on curve secp256k1. 27 - Part of Bitcoin Core. This library is a work in progress 28 - and is being used to research best practices. Use at your 29 - own risk. 44 + Optimized C library for EC operations on curve secp256k1. Part of 45 + Bitcoin Core. This library is a work in progress and is being used 46 + to research best practices. Use at your own risk. 30 47 ''; 31 48 homepage = https://github.com/bitcoin-core/secp256k1; 32 49 license = with licenses; [ mit ];