Skip to content

Commit

Permalink
neuron: fix on clang 3.8 and above
Browse files Browse the repository at this point in the history
This is in preparation for upgrading Darwin stdenv to LLVM 4
  • Loading branch information
copumpkin committed Mar 21, 2017
1 parent 93005b8 commit 7ad3fd7
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions pkgs/applications/science/biology/neuron/default.nix
@@ -1,20 +1,20 @@
{ stdenv
, fetchurl
{ stdenv
, fetchurl
, pkgconfig
, automake
, autoconf
, libtool
, ncurses
, readline
, which
, python ? null
, python ? null
, mpi ? null
}:

stdenv.mkDerivation rec {
name = "neuron-${version}";
version = "7.4";

nativeBuildInputs = [ which pkgconfig automake autoconf libtool ];
buildInputs = [ ncurses readline python mpi ];

Expand All @@ -25,46 +25,55 @@ stdenv.mkDerivation rec {

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;

## 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/
preConfigure = ''
./build.sh
export prefix="''${prefix} --exec-prefix=''${out}"
export prefix="''${prefix} --exec-prefix=''${out}"
'';

configureFlags = with stdenv.lib;
[ "--without-x" "--with-readline=${readline}" ]
++ 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"]);


postInstall = stdenv.lib.optionals (python != null) [ ''
## standardise python neuron install dir if any
if [[ -d $out/lib/python ]]; then
mkdir -p ''${out}/${python.sitePackages}
mv ''${out}/lib/python/* ''${out}/${python.sitePackages}/
fi
''];
propagatedBuildInputs = [ readline ncurses which libtool ];

propagatedBuildInputs = [ readline ncurses which libtool ];

meta = with stdenv.lib; {
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
neurons and networks of neurons. It is particularly well-suited to problems where
cable properties of cells play an important role, possibly including extracellular
potential close to the membrane), and where cell membrane properties are complex,
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
cable properties of cells play an important role, possibly including extracellular
potential close to the membrane), and where cell membrane properties are complex,
involving many ion-specific channels, ion accumulation, and second messengers";

license = licenses.bsd3;
homepage = http://www.neuron.yale.edu/neuron;
maintainers = [ maintainers.adev ];
platforms = platforms.all;
};
};
}

1 comment on commit 7ad3fd7

@copumpkin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.