nixpkgs/pkgs/by-name/ig/igraph/package.nix
Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d5c88a98d674f637d092807cfc12253.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e4587d75882aebc21a04bee960418f8ce9
2025-04-08 02:57:25 -04:00

121 lines
2.3 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
arpack,
bison,
blas,
cmake,
flex,
fop,
glpk,
gmp,
lapack,
libxml2,
libxslt,
llvmPackages,
pkg-config,
plfit,
python3,
sourceHighlight,
xmlto,
}:
assert (blas.isILP64 == lapack.isILP64 && blas.isILP64 == arpack.isILP64 && !blas.isILP64);
stdenv.mkDerivation (finalAttrs: {
pname = "igraph";
version = "0.10.15";
src = fetchFromGitHub {
owner = "igraph";
repo = "igraph";
rev = finalAttrs.version;
hash = "sha256-TSAVRLeOWh3IQ9X0Zr4CQS+h1vTeUZnzMp/IYujGMn0=";
};
postPatch = ''
echo "${finalAttrs.version}" > IGRAPH_VERSION
'';
outputs = [
"out"
"dev"
"doc"
];
nativeBuildInputs = [
bison
cmake
flex
fop
libxml2
libxslt
pkg-config
python3
sourceHighlight
xmlto
];
buildInputs =
[
arpack
blas
glpk
gmp
lapack
libxml2
plfit
]
++ lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
];
cmakeFlags = [
"-DIGRAPH_USE_INTERNAL_BLAS=OFF"
"-DIGRAPH_USE_INTERNAL_LAPACK=OFF"
"-DIGRAPH_USE_INTERNAL_ARPACK=OFF"
"-DIGRAPH_USE_INTERNAL_GLPK=OFF"
"-DIGRAPH_USE_INTERNAL_GMP=OFF"
"-DIGRAPH_USE_INTERNAL_PLFIT=OFF"
"-DIGRAPH_GLPK_SUPPORT=ON"
"-DIGRAPH_GRAPHML_SUPPORT=ON"
"-DIGRAPH_OPENMP_SUPPORT=ON"
"-DIGRAPH_ENABLE_LTO=AUTO"
"-DIGRAPH_ENABLE_TLS=ON"
"-DBUILD_SHARED_LIBS=ON"
];
doCheck = true;
postInstall = ''
mkdir -p "$out/share"
cp -r doc "$out/share"
'';
postFixup =
''
substituteInPlace $dev/lib/cmake/igraph/igraph-targets.cmake \
--replace-fail "_IMPORT_PREFIX \"$out\"" "_IMPORT_PREFIX \"$dev\""
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libigraph.dylib
'';
passthru.tests = {
python = python3.pkgs.igraph;
};
meta = with lib; {
description = "C library for complex network analysis and graph theory";
homepage = "https://igraph.org/";
changelog = "https://github.com/igraph/igraph/blob/${finalAttrs.src.rev}/CHANGELOG.md";
license = licenses.gpl2Plus;
platforms = platforms.all;
maintainers = with maintainers; [
MostAwesomeDude
dotlambda
];
};
})