nixpkgs/pkgs/development/libraries/science/math/arpack/default.nix
Anders Kaseorg 3cd8ce3bce treewide: Fix unsafe concatenation of $LD_LIBRARY_PATH
Naive concatenation of $LD_LIBRARY_PATH can result in an empty
colon-delimited segment; this tells glibc to load libraries from the
current directory, which is definitely wrong, and may be a security
vulnerability if the current directory is untrusted.  (See #67234, for
example.)  Fix this throughout the tree.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-01-15 09:47:03 +01:00

58 lines
1.3 KiB
Nix

{ stdenv, fetchFromGitHub, cmake
, gfortran, openblas, eigen }:
with stdenv.lib;
let
version = "3.7.0";
in
stdenv.mkDerivation {
pname = "arpack";
inherit version;
src = fetchFromGitHub {
owner = "opencollab";
repo = "arpack-ng";
rev = version;
sha256 = "1x7a1dj3dg43nlpvjlh8jzzbadjyr3mbias6f0256qkmgdyk4izr";
};
nativeBuildInputs = [ cmake ];
buildInputs = [ gfortran openblas eigen ];
doCheck = true;
BLAS_LIBS = "-L${openblas}/lib -lopenblas";
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DINTERFACE64=${optionalString openblas.blas64 "1"}"
];
preCheck = if stdenv.isDarwin then ''
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}`pwd`/lib
'' else ''
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}`pwd`/lib
'' + ''
# Prevent tests from using all cores
export OMP_NUM_THREADS=2
'';
postInstall = ''
mkdir -p $out/lib/pkgconfig
cp arpack.pc $out/lib/pkgconfig/
'';
meta = {
homepage = https://github.com/opencollab/arpack-ng;
description = ''
A collection of Fortran77 subroutines to solve large scale eigenvalue
problems.
'';
license = stdenv.lib.licenses.bsd3;
maintainers = [ stdenv.lib.maintainers.ttuegel ];
platforms = stdenv.lib.platforms.unix;
};
}