#!/bin/sh
-if [ $# = 0 ]
-then
- echo "Use it as :"
- echo "sh install_thirdparty_fedora.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType>"
- echo " "
- echo "ex : sh install_thirdparty_fedora.sh /tmp/gendir /home/jpr/myInstallDirectory Debug"
- exit 0
-fi
+#if [ $# = 0 ]
+#then
+# echo "Use it as :"
+# echo "sh install_thirdparty_all.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType> <OperatingSystem>"
+# echo "with 'OperatingSystem' in {Fedora, Ubuntu, MacOS}"
+# echo "with 'installPrefix' : /usr/local or <directory where you want to install>/thirdparty_install
+# echo " "
+# echo "ex : sh install_thirdparty_all.sh /tmp/gendir /tmp/gendir/thirdparty_install Debug Ubuntu"
+# exit 0
+#fi
echo $#
echo "----------"
echo $1
echo $2
echo $3
+echo $4
echo "----------"
-if [ $# != 3 ]
+
+
+if [ $# = 0 || $# != 4 ]
then
echo "Use it as :"
- echo "sh install_thirdparty_fedora.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType>"
+ echo "sh install_thirdparty_all.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType> <OperatingSystem>"
+ echo "with 'OperatingSystem' in {Fedora, Ubuntu, MacOS}"
+ echo "with 'installPrefix' : /usr/local or <directory where you want to install> "
echo " "
- echo "ex : sh install_thirdparty_fedora.sh /tmp/gendir /home/jpr/myInstallDirectory Debug"
+ echo "ex : sh install_thirdparty_all.sh /tmp/gendir /tmp/gendir/thirdparty_install Debug Ubuntu"
exit 0
fi
-
+echo $OS
+echo 'ididid'
generationdir=$1
installPrefix=$2
buildType=$3
+OS=$4
scriptDir=$PWD
sourcesDir=$generationdir/thirdparty_sources
binDir=$generationdir/thirdparty_bin
+
mkdir $generationdir
mkdir $sourcesDir
mkdir $binDir
+sudo rm $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
+
+
+
+
# the following stupid test is used at debug time; Please don't remove!
-if [ true = false ]
+if [ true = true ]
then
- sudo yum install cmake -y
- sudo yum install cmake-gui -y
- sudo yum install doxygen -y
- sudo yum install graphviz -y
- sudo yum install texlive -y
- sudo yum install latex2html -y
- sudo yum install wxGTK-devel wxBase -y
- sudo yum install boost-devel -y
- sudo yum install sqlite-devel -y
- sudo yum install qt-devel -y
- sudo yum install mesa-libOSMesa-devel -y
+
+ case "$OS" in
+ Fedora)
+ sudo yum install cmake -y
+ sudo yum install cmake-gui -y
+ sudo yum install doxygen -y
+ sudo yum install graphviz -y
+ sudo yum install texlive -y
+ sudo yum install latex2html -y
+ sudo yum install wxGTK-devel wxBase -y
+ sudo yum install boost-devel -y
+ sudo yum install sqlite-devel -y
+ sudo yum install qt-devel -y
+ sudo yum install mesa-libOSMesa-devel -y
+ ;;
+ Ubuntu)
+ sudo apt-get --yes install build-essential # esta linea instala las librerias necesarias para compilar en ubuntu, g++ gcc etc etc etc.
+ sudo apt-get --yes install cmake
+ sudo apt-get --yes install cmake-gui
+ sudo apt-get --yes install cmake-curses-gui
+ sudo apt-get --yes install doxygen
+ sudo apt-get --yes install graphviz
+ sudo apt-get --yes install texlive
+ sudo apt-get --yes install latex2html
+ sudo apt-get --yes install libgtk2.0-dev #GTK
+ sudo apt-get --yes install libwxgtk2.8-dev #Wx GTK
+ sudo apt-get --yes install libwxbase2.8-dev #Wx solito
+ sudo apt-get --yes install libboost-dev #Boost
+ sudo apt-get --yes install libboost-all-dev #Boost
+ sudo apt-get --yes install libqt4-dev #QT4
+ sudo apt-get --yes install sqlite
+ sudo apt-get --yes install libsqlite0-dev
+ sudo apt-get --yes install libosmesa6-dev #Mesa6
+ sudo apt-get --yes install uuid-dev # uuid para la instalacion de itk
+ sudo apt-get --yes install libxaw7-dev # X11
+ ;;
+ MacOS)
+# QUESTION : is -y mandatory?
+
+ sudo port install cmake -y
+ sudo port install cmake-gui -y
+ sudo port install doxygen -y
+ sudo port install graphviz -y
+ sudo port install texlive -y
+ sudo port install latex2html -y
+ sudo port install wxGTK-devel wxBase -y
+ sudo port install boost-devel -y
+ sudo port install sqlite-devel -y
+ sudo port install qt-devel -y
+ sudo port install mesa-libOSMesa-devel -y
+ ;;
+ *)
+ #echo " '$OS' : Unknown (for us...) Operating Sytem "
+ echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
+ exit 0
+ ;;
+ esac
fi
# the following stupid test is used at debug time; Please don't remove!
-if [ true = false ]
+if [ true = true ]
then
rm -rf $sources/VTK*
rm -rf $sources/vtk*
rm -rf $sources/InsightToolkit*
rm -rf $sources/gdcm*
- cd $sources
+ cd $sourcesDir
wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/vtk-5.6.1.tar.gz
wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_08_Dic_2009.tar.gz
wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
cd ..
fi
+#deal with create creatools_third_party_libraries_config.sh
+
+sudo touch $installPrefix/share/creatools_third_party_library_config.sh
+sudo chmod 666 $installPrefix/share/creatools_third_party_library_config.sh
+
+sudo echo export PATH='$'PATH:$THIRDPARTY_INSTALL_DIR/bin >> $installPrefix/share/creatools_third_party_library_config.sh
+sudo echo export VTK_DIR=$THIRDPARTY_INSTALL_DIR/lib/vtk-5.6 >> $installPrefix/share/creatools_third_party_library_config.sh
+sudo echo export ITK_DIR=$THIRDPARTY_INSTALL_DIR/lib/InsightToolkit >> $installPrefix/share/creatools_third_party_library_config.sh
+sudo echo export GDCM_DIR=$THIRDPARTY_INSTALL_DIR/lib/gdcm >> $installPrefix/share/creatools_third_party_library_config.sh
+sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR >> $installPrefix/share/creatools_third_party_library_config.sh
+sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR >> $installPrefix/share/creatools_third_party_library_config.sh
+sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR >> $installPrefix/share/creatools_third_party_library_config.sh
+
+# modify .bashrc
+# - remove line 'sh $installPrefix/share/creatools_third_party_library_config.sh' if any (with accurate value for ???)
+sed -i -e '/.*creatools_third_party_library_config.*/ d' ~/.bashrc
+
+# - add line 'sh $installPrefix/share/creatools_third_party_library_config.sh' (with accurate value for ???)
+echo source $installPrefix/share/creatools_third_party_library_config.sh >> ~/.bashrc
+
+