Skip to content

Instantly share code, notes, and snippets.

@vogdb
Last active August 19, 2019 08:50
Show Gist options
  • Save vogdb/e76f2d346865371a6287e7085afd2e25 to your computer and use it in GitHub Desktop.
Save vogdb/e76f2d346865371a6287e7085afd2e25 to your computer and use it in GitHub Desktop.
#!/bin/sh
echo "IMPORTANT! INSTALL_DIR arg must be an absolute path!"
set -e
SRC_DIR=$1
INSTALL_DIR=$2
if [ ! -e ${INSTALL_DIR}/.install_finished ]
then
echo 'Neuron was not fully installed in previous build, installing ...'
mkdir -p ${SRC_DIR}
cd ${SRC_DIR}
echo "Downloading IV ..."
rm -rf iv
git clone --depth 1 https://github.com/neuronsimulator/iv.git >download.log 2>&1
cd iv
echo "Preparing IV ..."
./build.sh >prepare.log 2>&1
echo "Configuring IV ..."
./configure --prefix=${INSTALL_DIR}/iv >configure.log 2>&1
echo "Building IV ..."
make -j4 >make.log 2>&1
echo "Installing IV ..."
make -j4 install >install.log 2>&1
cd ..
echo "Downloading NEURON ..."
rm -rf nrn
git clone --depth 1 https://github.com/neuronsimulator/nrn.git >download.log 2>&1
cd nrn
echo "Preparing NEURON ..."
./build.sh >prepare.log 2>&1
echo "Configuring NEURON ..."
./configure --prefix=${INSTALL_DIR}/nrn --with-iv=${INSTALL_DIR}/iv --with-nrnpython=python --disable-rx3d >configure.log 2>&1
echo "Building NEURON ..."
make -j4 >make.log 2>&1
echo "Installing NEURON ..."
make -j4 install >install.log 2>&1
export PATH="${INSTALL_DIR}/nrn/x86_64/bin":${PATH}
export PYTHONPATH="${INSTALL_DIR}/nrn/lib/python":${PYTHONPATH}
cd src/nrnpython
python setup.py install
cd ../../
echo "Testing NEURON import ...."
python -c 'import neuron' >testimport.log 2>&1
touch -f ${INSTALL_DIR}/.install_finished
echo "NEURON successfully installed"
else
echo 'Neuron was successfully installed in previous build, not rebuilding'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment