Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 arpack,
6 bison,
7 blas,
8 cmake,
9 flex,
10 fop,
11 glpk,
12 gmp,
13 lapack,
14 libxml2,
15 libxslt,
16 llvmPackages,
17 pkg-config,
18 plfit,
19 python3,
20 sourceHighlight,
21 xmlto,
22}:
23
24assert (blas.isILP64 == lapack.isILP64 && blas.isILP64 == arpack.isILP64 && !blas.isILP64);
25
26stdenv.mkDerivation (finalAttrs: {
27 pname = "igraph";
28 version = "0.10.16";
29
30 src = fetchFromGitHub {
31 owner = "igraph";
32 repo = "igraph";
33 rev = finalAttrs.version;
34 hash = "sha256-Qs2WXAiAQhQ077KEtkapr8ckw6Jlbxj6qwyiplsEaLY=";
35 };
36
37 postPatch = ''
38 echo "${finalAttrs.version}" > IGRAPH_VERSION
39 '';
40
41 outputs = [
42 "out"
43 "dev"
44 "doc"
45 ];
46
47 nativeBuildInputs = [
48 bison
49 cmake
50 flex
51 fop
52 libxml2
53 libxslt
54 pkg-config
55 python3
56 sourceHighlight
57 xmlto
58 ];
59
60 buildInputs = [
61 arpack
62 blas
63 glpk
64 gmp
65 lapack
66 libxml2
67 plfit
68 ]
69 ++ lib.optionals stdenv.cc.isClang [
70 llvmPackages.openmp
71 ];
72
73 cmakeFlags = [
74 "-DIGRAPH_USE_INTERNAL_BLAS=OFF"
75 "-DIGRAPH_USE_INTERNAL_LAPACK=OFF"
76 "-DIGRAPH_USE_INTERNAL_ARPACK=OFF"
77 "-DIGRAPH_USE_INTERNAL_GLPK=OFF"
78 "-DIGRAPH_USE_INTERNAL_GMP=OFF"
79 "-DIGRAPH_USE_INTERNAL_PLFIT=OFF"
80 "-DIGRAPH_GLPK_SUPPORT=ON"
81 "-DIGRAPH_GRAPHML_SUPPORT=ON"
82 "-DIGRAPH_OPENMP_SUPPORT=ON"
83 "-DIGRAPH_ENABLE_LTO=AUTO"
84 "-DIGRAPH_ENABLE_TLS=ON"
85 "-DBUILD_SHARED_LIBS=ON"
86 ];
87
88 doCheck = true;
89
90 postInstall = ''
91 mkdir -p "$out/share"
92 cp -r doc "$out/share"
93 '';
94
95 postFixup = ''
96 substituteInPlace $dev/lib/cmake/igraph/igraph-targets.cmake \
97 --replace-fail "_IMPORT_PREFIX \"$out\"" "_IMPORT_PREFIX \"$dev\""
98 ''
99 + lib.optionalString stdenv.hostPlatform.isDarwin ''
100 install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libigraph.dylib
101 '';
102
103 passthru.tests = {
104 python = python3.pkgs.igraph;
105 };
106
107 meta = with lib; {
108 description = "C library for complex network analysis and graph theory";
109 homepage = "https://igraph.org/";
110 changelog = "https://github.com/igraph/igraph/blob/${finalAttrs.src.rev}/CHANGELOG.md";
111 license = licenses.gpl2Plus;
112 platforms = platforms.all;
113 maintainers = with maintainers; [
114 MostAwesomeDude
115 dotlambda
116 ];
117 };
118})