1{ stdenv, fetchurl, libtool }:
2
3stdenv.mkDerivation rec {
4 name = "libtommath-${version}";
5 version = "1.0.1";
6
7 src = fetchurl {
8 url = "https://github.com/libtom/libtommath/releases/download/v${version}/ltm-${version}.tar.xz";
9 sha256 = "0sbccdwbkfc680id2fi0x067j23biqcjqilwkk7y9339knrjy0s7";
10 };
11
12 nativeBuildInputs = [ libtool ];
13
14 postPatch = ''
15 substituteInPlace makefile.shared --replace "LT:=glibtool" "LT:=libtool"
16 substituteInPlace makefile_include.mk --replace "shell arch" "shell uname -m"
17 '';
18
19 preBuild = ''
20 makeFlagsArray=(PREFIX=$out \
21 INSTALL_GROUP=$(id -g) \
22 INSTALL_USER=$(id -u))
23 '';
24
25 makefile = "makefile.shared";
26
27 enableParallelBuilding = true;
28
29 meta = with stdenv.lib; {
30 homepage = http://www.libtom.net/LibTomMath/;
31 description = "A library for integer-based number-theoretic applications";
32 license = with licenses; [ publicDomain wtfpl ];
33 platforms = platforms.unix;
34 };
35}