#!/bin/bash
# Install BICO on standard Debian system
# Install dependencies, compile and install to /usr/local
# all necessary binaries, headers and libraries
# to execute bico and kmeans++
# Note: to create BICO-conform input files, csv2wsv from
# the environment bundle is needed. BICO accepts the files
# with ending wsv.b

# start in BICO bundle main directory

# Step 0: install dependencies
sudo apt-get install build-essential premake4 gfortran g++ libboost-all-dev libblas-dev liblapack-dev libeigen3-dev libeigen3-doc

# Step 1: Compile BICO, CluE library and header files
cd bico
premake4 gmake
cd build
make
cd ..

# Step 2 (optional): Install BICO, CluE library and header files globally
sudo cp ./bin/BICO_Experiments /usr/local/bin/bico
sudo chmod o+x /usr/local/bin/bico
sudo cp ./bin/libCluE.a /usr/local/lib/libCluE.a
sudo chmod o+r /usr/local/lib/libCluE.a
sudo mkdir /usr/local/include/CluE
sudo cp -r src/* /usr/local/include/CluE
sudo find /usr/local/include/CluE/ -type f -exec chmod 664 {} + -o -type d -exec chmod 775 {} +
cd ..
