]> Creatis software - creaToolsTools.git/blobdiff - Linux/scripts/ThirdParty-install.sh
#2493 creaToolsTools Feature New Normal - Prepare and Install binary CreaTools...
[creaToolsTools.git] / Linux / scripts / ThirdParty-install.sh
index cd2705255d9c598dab349ca28104ff12c39c1993..a3ffec9c1dce34371e27d6273b4f063a556968ac 100644 (file)
@@ -1,4 +1,29 @@
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+#                        pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+#
+#  This software is governed by the CeCILL-B license under French law and 
+#  abiding by the rules of distribution of free software. You can  use, 
+#  modify and/ or redistribute the software under the terms of the CeCILL-B 
+#  license as circulated by CEA, CNRS and INRIA at the following URL 
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability. 
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------  
+
+
 #!/bin/bash
+
  if [ ! -f $PWD/scripts/CreaTools-configure.sh ]
  then 
    echo
@@ -11,7 +36,7 @@
    echo
    echo
    exit 0
-fi 
+fi
 echo $loginGroupName
 
 source $PWD/scripts/CreaTools-configure.sh
@@ -21,7 +46,7 @@ source $PWD/scripts/CreaTools-configure.sh
    echo --generationdir--
    echo $generationdir
    echo --corenumber--
-   echo $corenumber   
+   echo $corenumber
    echo --docgeneration--
    echo $docgeneration
    echo --installPrefix--
@@ -32,6 +57,8 @@ source $PWD/scripts/CreaTools-configure.sh
    echo $buildType
    echo --gdcmVersion--
    echo $gdcmVersion
+   echo "--ETC_BASHRC--"
+   echo $ETC_BASHRC  
 #   echo --sourcesFrom--
 #   echo $sourcesFrom
 #   echo --scriptDir--
@@ -40,126 +67,65 @@ source $PWD/scripts/CreaTools-configure.sh
 #   echo $start_point
    echo "------"
 
-
 scriptDir=$PWD
 sourcesDir=$generationdir/thirdparty_sources
 binDir=$generationdir/thirdparty_bin
 
 if [ ! -e $generationdir ]
 then
-   mkdir $generationdir
-   chown $loginUserName:$loginGroupName $generationdir
+   mkdir -p $generationdir
+   chown -R $loginUserName  $generationdir
+   chgrp -R $loginGroupName $generationdir
 fi
+
 if [ ! -e $sourcesDir ]
 then
-   mkdir $sourcesDir
+   mkdir -p $sourcesDir
+   #was : (pb on MacOS?)
+   #chown -R $loginUserName:$loginGroupName $sourcesDir
+   chown -R $loginUserName  $sourcesDir
+   chgrp -R $loginGroupName $sourcesDir
 fi
 
 if [ ! -e $binDir ]
 then
-   mkdir $binDir
+   mkdir -p $binDir
+   chown -R $loginUserName  $binDir
+   chgrp -R $loginGroupName $binDir
 fi
 
 
-# the following stupid test is used at debug time; Please don't remove!
-if [ true = true ]
-#if [ true = false ]
-then
-
-  case "$OperatingSystem" in
-  Fedora)
-     yum install cmake -y 
-     yum install cmake-gui -y 
-     yum install doxygen -y
-     yum install graphviz -y
-     yum install texlive -y
-     yum install latex2html -y
-     yum install wxGTK-devel wxBase -y
-     yum install boost-devel -y
-     yum install sqlite-devel -y
-     yum install qt-devel -y
-     yum install mesa-libOSMesa-devel -y
-     ;;
-  Ubuntu)  
-     apt-get --yes install build-essential  # esta linea instala las librerias necesarias para compilar en ubuntu, g++ gcc etc etc etc.
-     apt-get --yes install cmake
-     apt-get --yes install cmake-gui
-     apt-get --yes install cmake-curses-gui
-     apt-get --yes install doxygen
-     apt-get --yes install graphviz
-     apt-get --yes install texlive
-     apt-get --yes install latex2html
-     apt-get --yes install libgtk2.0-dev #GTK
-     apt-get --yes install libwxgtk2.8-dev #Wx GTK
-     apt-get --yes install libwxbase2.8-dev #Wx solito
-     apt-get --yes install libboost-dev  #Boost
-     apt-get --yes install libboost-all-dev #Boost
-     apt-get --yes install libqt4-dev #QT4
-     apt-get --yes install sqlite
-     apt-get --yes install libsqlite0-dev
-     apt-get --yes install libosmesa6-dev #Mesa6
-     apt-get --yes install uuid-dev # uuid para la instalacion de itk
-     apt-get --yes install libxaw7-dev # X11
-     ;;
-  MacOS)
-# QUESTION : is -y  mandatory?
-     port selfupdate
-     port install cmake -y 
-     port install doxygen -y
-     port install graphviz -y
-     port install texlive -y
-     port install latex2html -y
-     port install wxGTK -y
-     port install boost -y
-     port install sqlite3 -y
-     port install qt4-mac -y
-     port install mesa -y
-     ;;
-  *)
-     #echo " '$OperatingSystem' : Unknown (for us...) Operating Sytem "
-    echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
-     exit 0
-     ;;
-  esac             
-fi
-
+# Third Party base stuff is now installed by ThirdParty-install-Base-Stuff.sh   JPR
 
 
 # the following stupid test is used at debug time; Please don't remove!
 #if [ true = false ]
 if [ true = true ]
 then
-  rm -rf $sourcesDir/VTK*
-  rm -rf $sourcesDir/vtk*
-  rm -rf $sourcesDir/InsightToolkit*
-  rm -rf $sourcesDir/gdcm*
   rm -rf $sourcesDir/tth*
 
-  rm -rf $binDir/gdcm*
-  rm -rf $binDir/InsightToolkit*
-  rm -rf $binDir/VTK*
   cd $sourcesDir
- if [ $OperatingSystem = "MacOS" ]
- then    
-  curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
-  curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_05_Mai_2011.tar.gz
-  curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
-  curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_Developer_Tools/All_Versions/tth/tth_linux/tth
-
-  tar -xvf VTK-5.6.1.patchCreatis.tar.gz
-  tar -xvf gdcm_05_Mai_2011.tar.gz
-  tar -xvf InsightToolkit-3.20.0.tar.gz
 
-else
-  wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
-  wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_05_Mai_2011.tar.gz
-  wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
-  wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_Developer_Tools/All_Versions/tth/tth_linux/tth
+  if [ $OperatingSystem = "MacOS" ]
+  then
+    # curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
+    # curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_05_Mai_2011.tar.gz
+    # curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
+    curl -O http://www.creatis.insa-lyon.fr/software/public/creatools/crea_Developer_Tools/All_Versions/tth/tth_linux/tth
+    # MacOS, clever enough to understand it *has* to uncompress, doesn't understand tar -z :-(
+    # tar -xvf VTK-5.6.1.patchCreatis.tar.gz
+    # tar -xvf gdcm_05_Mai_2011.tar.gz
+    # tar -xvf InsightToolkit-3.20.0.tar.gz
+  else
+    # wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/VTK-5.6.1.patchCreatis.tar.gz
+    # wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_05_Mai_2011.tar.gz
+    # wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
+    wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_Developer_Tools/All_Versions/tth/tth_linux/tth
   
-  tar -xvzf VTK-5.6.1.patchCreatis.tar.gz
-  tar -xvzf gdcm_05_Mai_2011.tar.gz
-  tar -xvzf InsightToolkit-3.20.0.tar.gz
-fi
+    # tar -xvzf VTK-5.6.1.patchCreatis.tar.gz
+    #tar -xvzf gdcm_05_Mai_2011.tar.gz
+    #tar -xvzf InsightToolkit-3.20.0.tar.gz
+  fi
 
 fi
 
@@ -171,134 +137,11 @@ else
    debug="OFF"
 fi
 
-
-# the following stupid test is used at debug time; Please don't remove!
-#if [ true = false ]
-if [ true = true ]
-then
-  libname=VTK
-  dirInstall=$binDir/$libname-Bin
-  dirInstallVTK=$dirInstall
-  export VTK_DIR=$installPrefixThird/lib/vtk-5.6/
-  mkdir $dirInstall
-  cd $dirInstall
-  cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
-  ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
-  cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
-  cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D VTK_USE_QT:BOOL=ON CMakeCache.txt
-  make -j $corenumber
-  make install
-  cd ..
-fi
-
-
-# the following stupid test is used at debug time; Please don't remove!
-#if [ true = false ]
-if [ true = true ]
-then
-  libname=gdcm
-  dirInstall=$binDir/$libname-Bin
-  export GDCM_DIR=$installPrefixThird/lib/gdcm/
-  mkdir $dirInstall
-  cd $dirInstall
-  cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
-  ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
-  cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
-  cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
-  cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
-  make -j 2
-  make install
-  cd ..
-fi
-
-# the following stupid test is used at debug time; Please don't remove!
-#if [ true = false ]
-if [ true = true ]
-then
-  libname=InsightToolkit-3.20.0
-  dirInstall=$binDir/$libname-Bin
-  export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
-  mkdir $dirInstall
-  cd $dirInstall
-  cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
-  ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
-  cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
-  cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D ITK_USE_REVIEW:BOOL=ON CMakeCache.txt
-  #uncomment following line if you want to use the bleeding edge of GDCM2!
-  #cmake -D ITK_USE_SYSTEM_GDCM:BOOL=ON CMakeCache.txt
-  cmake CMakeCache.txt
-  make -j 2
-  make install
-  cd ..
-fi
-
 #if [ true = false ]
 if [ true = true ]
 then
   cd $sourcesDir
- # cp tth $installPrefixThird/bin
+ # pourquoi ne copie-t-on plus? JPR
+ mkdir -p $installPrefixThird/bin
+ cp tth $installPrefixThird/bin
 fi
-
-
-#deal with create creatools_third_party_libraries_config.sh
-
-if [ -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
-then
-   rm $installPrefixThird/share/creatools_third_party_library_config.sh
-fi
-
-if [ ! -e $installPrefixThird/share ]
-then
-   mkdir $installPrefixThird/share
-fi
-touch     $installPrefixThird/share/creatools_third_party_library_config.sh
-chmod 755 $installPrefixThird/share/creatools_third_party_library_config.sh
-
-echo export PATH='$'PATH:$installPrefixThird/bin           >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export VTK_DIR=$installPrefixThird/lib/vtk-5.6        >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export ITK_DIR=$installPrefixThird/lib/InsightToolkit >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export GDCM_DIR=$installPrefixThird/lib/gdcm          >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export TTH=$installPrefixThird/bin/tth                >> $installPrefixThird/share/creatools_third_party_library_config.sh
-if [ $OperatingSystem = "MacOS" ]
-then
-echo export DYLD_LIBRARY_PATH='$'DYLD_LIBRARY_PATH:$GDCM_DIR   >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export DYLD_LIBRARY_PATH='$'DYLD_LIBRARY_PATH:$ITK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export DYLD_LIBRARY_PATH='$'DYLD_LIBRARY_PATH:$VTK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
-else
-echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR   >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
-echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
-fi
-
-#  modify .bashrc
-# - remove line 'bash $installPrefixThird/share/creatools_third_party_library_config.sh' if any (with accurate value for ???)
-
-# Install creatools as user (no longer as root) // JPR 2/5/2011
-#if [ ! -f /etc/bashrc ]
-#then
-#    export ETC_BASHRC="/etc/bash.bashrc"
-#else
-#    export ETC_BASHRC="/etc/bashrc"
-#fi
-
-   case "$OperatingSystem" in
-   Fedora)
-     export ETC_BASHRC=$HOME/.bashrc
-     ;;
-   Ubuntu)
-     export ETC_BASHRC=$HOME/.bashrc
-     ;;
-   MacOS)      
-     export ETC_BASHRC=$HOME/.profile 
-     ;;
-   esac
-
-
-   sed -i -e '/.*installPrefixThird*/ d' $ETC_BASHRC
-   sed -i -e '/.*creatools_third_party_library_config.*/ d' $ETC_BASHRC
-
-
-# - add line 'bash $installPrefixThird/share/creatools_third_party_library_config.sh' (with accurate value for ???)
-echo installPrefixThird=$installPrefixThird >> $ETC_BASHRC
-echo '[ -f "$installPrefixThird/share/creatools_third_party_library_config.sh" ] &&  source $installPrefixThird/share/creatools_third_party_library_config.sh' >> $ETC_BASHRC