lol
1{ lib
2, stdenv
3, fetchurl
4, cmake
5, gmp
6, halibut
7, ncurses
8, perl
9}:
10
11stdenv.mkDerivation rec {
12 pname = "spigot";
13 version = "20210527";
14 srcVersion = "20210527.7dd3cfd";
15
16 src = fetchurl {
17 url = "https://www.chiark.greenend.org.uk/~sgtatham/spigot/${pname}-${srcVersion}.tar.gz";
18 hash = "sha256-EBS3lgfLtsyBQ8mzoJPyZhRBJNmkVSeF5XecGgcvqtw=";
19 };
20
21 nativeBuildInputs = [
22 cmake
23 halibut
24 perl
25 ];
26
27 buildInputs = [
28 gmp
29 ncurses
30 ];
31
32 outputs = [ "out" "man" ];
33
34 strictDeps = true;
35
36 doInstallCheck = true;
37 installCheckPhase = ''
38 runHook preInstallCheck
39
40 [ `$out/bin/spigot -b 10 -d 10 e` == "2.7182818284" ] || exit 1
41 [ `$out/bin/spigot -b 10 -d 10 pi` == "3.1415926535" ] || exit 1
42 [ `$out/bin/spigot -b 10 -d 10 sqrt\(2\)` == "1.4142135623" ] || exit 1
43
44 runHook postInstallCheck
45 '';
46
47 meta = with lib; {
48 homepage = "https://www.chiark.greenend.org.uk/~sgtatham/spigot/";
49 description = "A command-line exact real calculator";
50 license = licenses.mit;
51 maintainers = with maintainers; [ AndersonTorres mcbeth ];
52 platforms = platforms.unix;
53 };
54}