Skip to content

Instantly share code, notes, and snippets.

@berndhahnebach
Last active October 13, 2018 12:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berndhahnebach/7d39889916cb36ea7e6ed6c0d758f9f6 to your computer and use it in GitHub Desktop.
Save berndhahnebach/7d39889916cb36ea7e6ed6c0d758f9f6 to your computer and use it in GitHub Desktop.
compile XC (https://github.com/xcfem) on Debian Stretch
#!/bin/bash
# Released under GPL v2.0
# bernd@bimstatik.org
# tested on Debian Stretch
# username on my Stretch vagrant box = vagrant
# cd ~ # use if start on a local computer or inside a virtual machine
cd /home/vagrant # use with a vagrant box, because cd ~ returns home of root = /root
cd Documents
#sudo rm -rf build_xc
mkdir build_xc
cd build_xc
base_dir=`pwd`
##########################################################
# update system
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
##########################################################
# install packages apt-get
packages_build="\
git \
cmake \
g++ \
gfortran \
libboost-all-dev"
sudo apt-get install -y $packages_build
packages_lib="\
libarpack2-dev \
libarpack++2-dev \
libcgal-dev \
libdb-dev \
libf2c2-dev \
libglib2.0-dev \
libgmp3-dev \
libgtk2.0-dev \
libgtkgl2.0-dev \
libgtkglextmm-x11-1.2-dev \
libgtkmm-2.4-dev \
libgts-bin \
libgts-dev \
liblapack-dev \
libmpfr-dev \
libmysql++-dev \
libplot-dev \
libsqlite3-dev \
libsuperlu-dev \
libsuitesparse-dev \
libvtk6-dev \
libx11-dev \
libmetis-dev"
sudo apt-get install -y $packages_lib
packages_dev="\
cimg-dev \
petsc-dev \
tcl-dev"
sudo apt-get install -y $packages_dev
packages_python="\
python-vtk6 \
python-scipy \
python-sympy \
python-matplotlib \
python-pandas \
python-sklearn \
python-pip"
sudo apt-get install -y $packages_python
packages_div="\
gnuplot \
bc"
# bc is needed by xc_utils verification tests
sudo apt-get install -y $packages_div
##########################################################
# install packages apt-get from non-free
# add nonfree to sources.list
sudo apt-get update
cat /etc/apt/sources.list | sed 's/main/main non-free/' > /tmp/sources.list
# TODO we may have multiple non-free in our sources.list after a few runs of the scipt ...
sudo cp /tmp/sources.list /etc/apt/sources.list
sudo apt-get update
# install nonfree packages
packages_nonfree="\
libparmetis-dev"
sudo apt-get install -y $packages_nonfree
##########################################################
# install packages pip (pip has to be installed, see Python packages)
sudo -H pip install mayavi
##########################################################
# clean system
sudo apt-get clean
##########################################################
# clone xc_basic, xc_utils, XC
cd $base_dir
git clone https://github.com/xcfem/xc_basic/ xc_basic
git clone https://github.com/xcfem/xc_utils/ xc_utils
git clone https://github.com/xcfem/xc/ xc
##########################################################
# build xc_basic
cd $base_dir
mkdir build-xc_basic
cd build-xc_basic
cmake ../xc_basic/src
make -j 2
sudo make install
## source needed as include dir for xc_utils, includes are not installed into /usr/local/include
## in xc_utils sqlite will only be found if build of xc_basic will not be removed
## or add find_packages sqlite to xc_utils, see a commit on a branch in my repo of xc_utils
##########################################################
# build xc_utils
cd $base_dir
mkdir build-xc_utils
cd build-xc_utils
cmake ../xc_utils/src
make -j 2
sudo make install
cd $base_dir/xc_utils/python_modules
sudo sh local_install.sh
##########################################################
# build XC
cd $base_dir
mkdir build-xc
cd build-xc
cmake ../xc/src
make -j 2
sudo make install
cd $base_dir/xc/python_modules
sudo sh local_install.sh
##########################################################
# run unit tests
cd $base_dir/xc_utils/verif
sh run_verif.sh
cd $base_dir/xc/verif
sh run_verif.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment