lol
1{ lib
2, stdenv
3, fetchFromGitLab
4, fetchpatch
5, cmake
6, installShellFiles
7, bison
8, boost
9, flex
10, gmp
11, libxml2
12, mpfi
13, mpfr
14, scalp
15, sollya
16, wcpg
17}:
18
19stdenv.mkDerivation rec {
20 pname = "flopoco";
21 version = "4.1.3";
22
23 src = fetchFromGitLab {
24 owner = pname;
25 repo = pname;
26 # flopoco-4.1.3 is not tagged on GitLab
27 rev = "67598298207c9f3261c35679c8a5966480c4343c";
28 sha256 = "sha256-0jRjg4/qciqBcjsi6BTbKO4VJkcoEzpC98wFkUOIGbI=";
29 };
30
31 patches = [
32 (fetchpatch {
33 name = "fix-clang-error-sin-cos.patch";
34 url = "https://gitlab.com/flopoco/flopoco/-/commit/de3aa60ad19333952c176c2a2e51f12653ca736b.patch";
35 postFetch = ''
36 substituteInPlace $out \
37 --replace 'FixSinCosCORDIC.hpp' 'CordicSinCos.hpp'
38 '';
39 sha256 = "sha256-BlamA/MZuuqqvGYto+jPeQPop6gwva0y394Odw8pdwg=";
40 })
41 (fetchpatch {
42 name = "fix-clang-error-atan2.patch";
43 url = "https://gitlab.com/flopoco/flopoco/-/commit/a3ffe2436c1b59ee0809b3772b74f2d43c6edb99.patch";
44 sha256 = "sha256-dSYcufLHDL0p1V1ghmy6X6xse5f6mjUqckaVqLZnTaA=";
45 })
46 ];
47
48 postPatch = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
49 sed -i "s/-pg//g" {,src/Apps/TaMaDi/}CMakeLists.txt
50 '';
51
52 strictDeps = true;
53
54 nativeBuildInputs = [
55 bison
56 cmake
57 installShellFiles
58 ];
59
60 buildInputs = [
61 boost
62 flex
63 gmp
64 libxml2
65 mpfi
66 mpfr
67 scalp
68 sollya
69 wcpg
70 ];
71
72 postBuild = ''
73 ./flopoco BuildAutocomplete
74 '';
75
76 installPhase = ''
77 runHook preInstall
78
79 install -Dm755 flopoco $out/bin/flopoco
80 cp bin* fp* ieee* longacc* $out/bin/
81 installShellCompletion --bash flopoco_autocomplete
82
83 runHook postInstall
84 '';
85
86 meta = with lib; {
87 description = "The FloPoCo arithmetic core generator";
88 homepage = "https://flopoco.org/";
89 license = licenses.unfree;
90 platforms = platforms.unix;
91 maintainers = with maintainers; [ wegank ];
92 };
93}