Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / igraph / default.nix
blob21396a6bdaf884246230f4b27e014ea2588d65d7
1 { stdenv
2 , lib
3 , fetchFromGitHub
4 , arpack
5 , bison
6 , blas
7 , cmake
8 , flex
9 , fop
10 , glpk
11 , gmp
12 , lapack
13 , libxml2
14 , libxslt
15 , llvmPackages
16 , pkg-config
17 , plfit
18 , python3
19 , sourceHighlight
20 , xmlto
23 assert (blas.isILP64 == lapack.isILP64 &&
24         blas.isILP64 == arpack.isILP64 &&
25         !blas.isILP64);
27 stdenv.mkDerivation (finalAttrs: {
28   pname = "igraph";
29   version = "0.10.7";
31   src = fetchFromGitHub {
32     owner = "igraph";
33     repo = finalAttrs.pname;
34     rev = finalAttrs.version;
35     hash = "sha256-1ge5V9G2jmIWQE5TW7+6cXCV9viFkhcnjpYrLQVLrgg=";
36   };
38   postPatch = ''
39     echo "${finalAttrs.version}" > IGRAPH_VERSION
40   ''
41   # https://github.com/igraph/igraph/issues/2340
42   + lib.optionalString stdenv.isDarwin ''
43     sed -i "/safelocale/d" tests/CMakeLists.txt
44   '';
46   outputs = [ "out" "dev" "doc" ];
48   nativeBuildInputs = [
49     bison
50     cmake
51     flex
52     fop
53     libxml2
54     libxslt
55     pkg-config
56     python3
57     sourceHighlight
58     xmlto
59   ];
61   buildInputs = [
62     arpack
63     blas
64     glpk
65     gmp
66     lapack
67     libxml2
68     plfit
69   ] ++ lib.optionals stdenv.cc.isClang [
70     llvmPackages.openmp
71   ];
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   ];
88   doCheck = true;
90   postInstall = ''
91     mkdir -p "$out/share"
92     cp -r doc "$out/share"
93   '';
95   postFixup = lib.optionalString stdenv.isDarwin ''
96     install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libigraph.dylib
97   '';
99   passthru.tests = {
100     python = python3.pkgs.igraph;
101   };
103   meta = with lib; {
104     description = "C library for complex network analysis and graph theory";
105     homepage = "https://igraph.org/";
106     changelog = "https://github.com/igraph/igraph/blob/${finalAttrs.src.rev}/CHANGELOG.md";
107     license = licenses.gpl2Plus;
108     platforms = platforms.all;
109     maintainers = with maintainers; [ MostAwesomeDude dotlambda ];
110   };