1{ lib, stdenv, fetchurl, m4, which, yasm, autoreconfHook, fetchpatch, buildPackages }:
2
3stdenv.mkDerivation rec {
4 pname = "mpir";
5 version = "3.0.0";
6
7 depsBuildBuild = [ buildPackages.stdenv.cc ];
8
9 nativeBuildInputs = [ m4 which yasm autoreconfHook ];
10
11 src = fetchurl {
12 url = "https://mpir.org/mpir-${version}.tar.bz2";
13 sha256 = "1fvmhrqdjs925hzr2i8bszm50h00gwsh17p2kn2pi51zrxck9xjj";
14 };
15
16 patches = [
17 # Fixes configure check failures with clang 16 due to implicit definitions of `exit`, which
18 # is an error with newer versions of clang.
19 (fetchpatch {
20 url = "https://github.com/wbhart/mpir/commit/bbc43ca6ae0bec4f64e69c9cd4c967005d6470eb.patch";
21 hash = "sha256-vW+cDK5Hq2hKEyprOJaNbj0bT2FJmMcyZHPE8GUNUWc=";
22 })
23 ];
24
25 configureFlags = [ "--enable-cxx" ]
26 ++ lib.optionals stdenv.isLinux [ "--enable-fat" ];
27
28 meta = {
29 description = "Highly optimised library for bignum arithmetic forked from GMP";
30 license = lib.licenses.lgpl3Plus;
31 maintainers = [lib.maintainers.raskin];
32 platforms = lib.platforms.unix;
33 downloadPage = "https://mpir.org/downloads.html";
34 homepage = "https://mpir.org/";
35 };
36}