neuron: fix on clang 3.8 and above

This is in preparation for upgrading Darwin stdenv to LLVM 4
This commit is contained in:
Dan Peebles 2017-03-21 01:00:18 -04:00
parent 93005b82dc
commit 7ad3fd7ca7
1 changed files with 25 additions and 16 deletions

View File

@ -1,5 +1,5 @@
{ stdenv { stdenv
, fetchurl , fetchurl
, pkgconfig , pkgconfig
, automake , automake
, autoconf , autoconf
@ -7,14 +7,14 @@
, ncurses , ncurses
, readline , readline
, which , which
, python ? null , python ? null
, mpi ? null , mpi ? null
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "neuron-${version}"; name = "neuron-${version}";
version = "7.4"; version = "7.4";
nativeBuildInputs = [ which pkgconfig automake autoconf libtool ]; nativeBuildInputs = [ which pkgconfig automake autoconf libtool ];
buildInputs = [ ncurses readline python mpi ]; buildInputs = [ ncurses readline python mpi ];
@ -25,23 +25,32 @@ stdenv.mkDerivation rec {
patches = (stdenv.lib.optional (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]); patches = (stdenv.lib.optional (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
# With LLVM 3.8 and above, clang (really libc++) gets upset if you attempt to redefine these...
postPatch = stdenv.lib.optionalString stdenv.cc.isClang ''
substituteInPlace src/gnu/neuron_gnu_builtin.h \
--replace 'double abs(double arg);' "" \
--replace 'float abs(float arg);' "" \
--replace 'short abs(short arg);' "" \
--replace 'long abs(long arg);' ""
'';
enableParallelBuilding = true; enableParallelBuilding = true;
## neuron install by default everything under prefix/${host_arch}/* ## neuron install by default everything under prefix/${host_arch}/*
## override this to support nix standard file hierarchy ## override this to support nix standard file hierarchy
## without issues: install everything under prefix/ ## without issues: install everything under prefix/
preConfigure = '' preConfigure = ''
./build.sh ./build.sh
export prefix="''${prefix} --exec-prefix=''${out}" export prefix="''${prefix} --exec-prefix=''${out}"
''; '';
configureFlags = with stdenv.lib; configureFlags = with stdenv.lib;
[ "--without-x" "--with-readline=${readline}" ] [ "--without-x" "--with-readline=${readline}" ]
++ optionals (python != null) [ "--with-nrnpython=${python.interpreter}" ] ++ optionals (python != null) [ "--with-nrnpython=${python.interpreter}" ]
++ (if mpi != null then ["--with-mpi" "--with-paranrn"] ++ (if mpi != null then ["--with-mpi" "--with-paranrn"]
else ["--without-mpi"]); else ["--without-mpi"]);
postInstall = stdenv.lib.optionals (python != null) [ '' postInstall = stdenv.lib.optionals (python != null) [ ''
## standardise python neuron install dir if any ## standardise python neuron install dir if any
if [[ -d $out/lib/python ]]; then if [[ -d $out/lib/python ]]; then
@ -49,22 +58,22 @@ stdenv.mkDerivation rec {
mv ''${out}/lib/python/* ''${out}/${python.sitePackages}/ mv ''${out}/lib/python/* ''${out}/${python.sitePackages}/
fi fi
'']; ''];
propagatedBuildInputs = [ readline ncurses which libtool ]; propagatedBuildInputs = [ readline ncurses which libtool ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Simulation environment for empirically-based simulations of neurons and networks of neurons"; description = "Simulation environment for empirically-based simulations of neurons and networks of neurons";
longDescription = "NEURON is a simulation environment for developing and exercising models of longDescription = "NEURON is a simulation environment for developing and exercising models of
neurons and networks of neurons. It is particularly well-suited to problems where neurons and networks of neurons. It is particularly well-suited to problems where
cable properties of cells play an important role, possibly including extracellular cable properties of cells play an important role, possibly including extracellular
potential close to the membrane), and where cell membrane properties are complex, potential close to the membrane), and where cell membrane properties are complex,
involving many ion-specific channels, ion accumulation, and second messengers"; involving many ion-specific channels, ion accumulation, and second messengers";
license = licenses.bsd3; license = licenses.bsd3;
homepage = http://www.neuron.yale.edu/neuron; homepage = http://www.neuron.yale.edu/neuron;
maintainers = [ maintainers.adev ]; maintainers = [ maintainers.adev ];
platforms = platforms.all; platforms = platforms.all;
}; };
} }