#!/usr/bin/bash

# -----------------------------------------------------------------------------
# omniORB
omniORB_SRC="https://downloads.sourceforge.net/project/omniorb/omniORB/omniORB-4.2.1/omniORB-4.2.1-2.tar.bz2"
omniORB_DIR=$(pwd)/omniORB-4.2.1/install
# diet
diet_SRC="https://shared.hadriencroubois.com/teaching/2016-M1-SystDist/diet.tar.xz"
diet_DIR=$(pwd)/diet/install
# -----------------------------------------------------------------------------

# Dowload omniorb 4.2.1
wget -O omniORB-4.2.1-2.tar.bz2 ${omniORB_SRC} &&
# Install omniorb 4.2.1
tar -xvf omniORB-4.2.1-2.tar.bz2 &&
cd omniORB-4.2.1/ &&
./configure --prefix=${omniORB_DIR} &&
make &&
make install &&
cd .. &&

#Download DIET
wget -O diet.tar.xz ${diet_SRC} &&
# Install DIET
tar -xvf diet.tar.xz &&
mkdir diet/build &&
cd diet/build &&
cmake ..                                        \
	-DCMAKE_INSTALL_PREFIX=${diet_DIR}            \
	-DOMNIORB4_DIR=${omniORB_DIR}                 \
	-DOMNIORB4_INCLUDE_DIR=${omniORB_DIR}/include \
	-DDIET_BUILD_EXAMPLES=ON &&
make &&
make install &&
echo "SUCCESS !"