Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, libtool }:
2
3stdenv.mkDerivation rec {
4 pname = "libtommath";
5 version = "1.2.0";
6
7 src = fetchurl {
8 url = "https://github.com/libtom/libtommath/releases/download/v${version}/ltm-${version}.tar.xz";
9 sha256 = "1c8q1qy88cjhdjlk3g24mra94h34c1ldvkjz0n2988c0yvn5xixp";
10 };
11
12 nativeBuildInputs = [ libtool ];
13
14 postPatch = ''
15 substituteInPlace makefile.shared --replace glibtool 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 env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) "-DTARGET_OS_IPHONE=0";
28
29 enableParallelBuilding = true;
30
31 meta = with lib; {
32 homepage = "https://www.libtom.net/LibTomMath/";
33 description = "A library for integer-based number-theoretic applications";
34 license = with licenses; [ publicDomain wtfpl ];
35 platforms = platforms.unix;
36 };
37}