1{ lib, stdenv
2, fetchFromGitHub
3, cmake
4, gmp
5, flint
6, mpfr
7, libmpc
8, catch
9}:
10
11stdenv.mkDerivation rec {
12 pname = "symengine";
13 version = "0.9.0";
14
15 src = fetchFromGitHub {
16 owner = "symengine";
17 repo = "symengine";
18 rev = "v${version}";
19 sha256 = "sha256-5KpxBusJCuwrfFWHbrRKlH6Ic7YivYqz2m+BCbNfZp0=";
20 };
21
22 postPatch = ''
23 cp ${catch}/include/catch/catch.hpp symengine/utilities/catch/catch.hpp
24 '';
25
26 nativeBuildInputs = [ cmake ];
27
28 buildInputs = [ gmp flint mpfr libmpc ];
29
30 cmakeFlags = [
31 "-DWITH_FLINT=ON"
32 "-DINTEGER_CLASS=flint"
33 "-DWITH_SYMENGINE_THREAD_SAFE=yes"
34 "-DWITH_MPC=yes"
35 "-DBUILD_FOR_DISTRIBUTION=yes"
36 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
37 # error: unrecognized instruction mnemonic, did you mean: bit, cnt, hint, ins, not?
38 "-DBUILD_TESTS=OFF"
39 ];
40
41 doCheck = true;
42
43 checkPhase = ''
44 ctest
45 '';
46
47 meta = with lib; {
48 description = "A fast symbolic manipulation library";
49 homepage = "https://github.com/symengine/symengine";
50 platforms = platforms.unix ++ platforms.windows;
51 license = licenses.bsd3;
52 maintainers = [ maintainers.costrouc ];
53 };
54
55}