1{ stdenv
2, lib
3, fetchFromGitHub
4, pkg-config
5, gfortran
6, texinfo
7, python2
8, boost
9 # Select SIMD alignment width (in bytes) for vectorization.
10, simdWidth ? 1
11 # Pad arrays to simdWidth by default?
12 # Note: Only useful if simdWidth > 1
13, enablePadding ? false
14 # Activate serialization through Boost.Serialize?
15, enableSerialization ? true
16 # Activate test-suite?
17 # WARNING: Some of the tests require up to 1700MB of memory to compile.
18, doCheck ? true
19}:
20
21let
22 inherit (lib) optional optionals;
23in
24stdenv.mkDerivation rec {
25 pname = "blitz++";
26 version = "1.0.1";
27
28 src = fetchFromGitHub {
29 owner = "blitzpp";
30 repo = "blitz";
31 rev = "1.0.1";
32 sha256 = "0nq84vwvvbq7m0my6h835ijfw53bxdp42qjc6kjhk436888qy9rh";
33 };
34
35 nativeBuildInputs = [ pkg-config python2 texinfo ];
36 buildInputs = [ gfortran texinfo boost ];
37
38 configureFlags =
39 [
40 "--enable-shared"
41 "--disable-static"
42 "--enable-fortran"
43 "--enable-optimize"
44 "--with-pic=yes"
45 "--enable-html-docs"
46 "--disable-doxygen"
47 "--disable-dot"
48 "--disable-latex-docs"
49 "--enable-simd-width=${toString simdWidth}"
50 "--with-boost=${boost.dev}"
51 "--with-boost-libdir=${boost.out}/lib"
52 ] ++ optional enablePadding "--enable-array-length-padding"
53 ++ optional enableSerialization "--enable-serialization"
54 ++ optional stdenv.is64bit "--enable-64bit";
55
56 # skip broken library name detection
57 ax_boost_user_serialization_lib = lib.optionalString stdenv.isDarwin "boost_serialization";
58
59 enableParallelBuilding = true;
60
61 inherit doCheck;
62 checkTarget = "check-testsuite check-examples";
63
64 meta = with lib; {
65 description = "Fast multi-dimensional array library for C++";
66 homepage = "https://sourceforge.net/projects/blitz/";
67 license = licenses.lgpl3;
68 platforms = platforms.unix;
69 maintainers = with maintainers; [ ToxicFrog ];
70 longDescription = ''
71 Blitz++ is a C++ class library for scientific computing which provides
72 performance on par with Fortran 77/90. It uses template techniques to
73 achieve high performance. Blitz++ provides dense arrays and vectors,
74 random number generators, and small vectors (useful for representing
75 multicomponent or vector fields).
76 '';
77 };
78}