nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 pkg-config,
8 gfortran,
9 texinfo,
10 python3,
11 boost,
12 # Select SIMD alignment width (in bytes) for vectorization.
13 simdWidth ? 1,
14 # Pad arrays to simdWidth by default?
15 # Note: Only useful if simdWidth > 1
16 enablePadding ? false,
17 # Activate serialization through Boost.Serialize?
18 enableSerialization ? true,
19 # Activate test-suite?
20 # WARNING: Some of the tests require up to 1700MB of memory to compile.
21 doCheck ? true,
22}:
23
24let
25 inherit (lib) optional optionals;
26in
27stdenv.mkDerivation rec {
28 pname = "blitz++";
29 version = "1.0.2";
30
31 src = fetchFromGitHub {
32 owner = "blitzpp";
33 repo = "blitz";
34 rev = version;
35 hash = "sha256-wZDg+4lCd9iHvxuQQE/qs58NorkxZ0+mf+8PKQ57CDE=";
36 };
37
38 patches = [
39 # https://github.com/blitzpp/blitz/pull/180
40 (fetchpatch {
41 name = "use-cmake-install-full-dir.patch";
42 url = "https://github.com/blitzpp/blitz/commit/020f1d768c7fa3265cec244dc28f3dc8572719c5.patch";
43 hash = "sha256-8hYFNyWrejjIWPN/HzIOphD4Aq6Soe0FFUBmwV4tpWQ=";
44 })
45 ];
46
47 nativeBuildInputs = [
48 cmake
49 pkg-config
50 python3
51 texinfo
52 ];
53
54 buildInputs = [
55 gfortran
56 texinfo
57 boost
58 ];
59
60 cmakeFlags =
61 optional enablePadding "-DARRAY_LENGTH_PADDING=ON"
62 ++ optional enableSerialization "-DENABLE_SERIALISATION=ON"
63 ++ optional stdenv.hostPlatform.is64bit "-DBZ_FULLY64BIT=ON";
64 # FIXME ++ optional doCheck "-DBUILD_TESTING=ON";
65
66 # skip broken library name detection
67 ax_boost_user_serialization_lib = lib.optionalString stdenv.hostPlatform.isDarwin "boost_serialization";
68
69 enableParallelBuilding = true;
70
71 inherit doCheck;
72
73 meta = with lib; {
74 description = "Fast multi-dimensional array library for C++";
75 homepage = "https://sourceforge.net/projects/blitz/";
76 license = with licenses; [
77 artistic2 # or
78 bsd3 # or
79 lgpl3Plus
80 ];
81 platforms = platforms.unix;
82 maintainers = with maintainers; [ ToxicFrog ];
83 longDescription = ''
84 Blitz++ is a C++ class library for scientific computing which provides
85 performance on par with Fortran 77/90. It uses template techniques to
86 achieve high performance. Blitz++ provides dense arrays and vectors,
87 random number generators, and small vectors (useful for representing
88 multicomponent or vector fields).
89 '';
90 };
91}