]> Creatis software - creaToolsTools.git/blob - Install_ThirdParty/scripts/install_thirdparty_all.sh
*** empty log message ***
[creaToolsTools.git] / Install_ThirdParty / scripts / install_thirdparty_all.sh
1
2 #!/bin/sh
3
4 #if [ $# = 0 ]
5 #then
6 #  echo "Use it as :"
7 #  echo "sh install_thirdparty_all.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType> <OperatingSystem>"
8 #  echo "with 'OperatingSystem' in {Fedora, Ubuntu, MacOS}" 
9 #  echo "with 'installPrefix' : /usr/local or <directory where you want to install>/thirdparty_install
10 #  echo " "
11 #  echo "ex : sh install_thirdparty_all.sh /tmp/gendir  /tmp/gendir/thirdparty_install Debug Ubuntu"
12 #  exit 0
13 #fi
14
15 echo $#
16 echo "----------"
17 echo $0
18 echo $1
19 echo $2
20 echo $3
21 echo $4
22 echo "----------"
23
24
25
26 if [ $# = 0 || $# != 4 ]
27 then 
28   echo "Use it as :"
29   echo "sh install_thirdparty_all.sh <nameOfTheGenerationDirectory> <installPrefix> <buildType> <OperatingSystem>"
30   echo "with 'OperatingSystem' in {Fedora, Ubuntu, MacOS}"
31   echo "with 'installPrefix' : /usr/local or <directory where you want to install> " 
32   echo " "
33   echo "ex : sh install_thirdparty_all.sh /tmp/gendir /tmp/gendir/thirdparty_install Debug Ubuntu"
34   exit 0
35 fi
36
37 echo $OS 
38 echo 'ididid'
39 generationdir=$1
40 installPrefix=$2
41 buildType=$3
42 OS=$4
43
44 scriptDir=$PWD
45 sourcesDir=$generationdir/thirdparty_sources
46 binDir=$generationdir/thirdparty_bin
47 THIRDPARTY_INSTALL_DIR=$installPrefix/thirdparty_install
48
49 mkdir $generationdir
50 mkdir $sourcesDir
51 mkdir $binDir
52
53 sudo rm        $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
54
55
56
57
58 # the following stupid test is used at debug time; Please don't remove!
59 if [ true = true ]
60 then
61
62   case "$OS" in
63   Fedora)
64      sudo yum install cmake -y 
65      sudo yum install cmake-gui -y 
66      sudo yum install doxygen -y
67      sudo yum install graphviz -y
68      sudo yum install texlive -y
69      sudo yum install latex2html -y
70      sudo yum install wxGTK-devel wxBase -y
71      sudo yum install boost-devel -y
72      sudo yum install sqlite-devel -y
73      sudo yum install qt-devel -y
74      sudo yum install mesa-libOSMesa-devel -y
75      ;;
76   Ubuntu)  
77      sudo apt-get --yes install build-essential  # esta linea instala las librerias necesarias para compilar en ubuntu, g++ gcc etc etc etc.
78      sudo apt-get --yes install cmake
79      sudo apt-get --yes install cmake-gui
80      sudo apt-get --yes install cmake-curses-gui
81      sudo apt-get --yes install doxygen
82      sudo apt-get --yes install graphviz
83      sudo apt-get --yes install texlive
84      sudo apt-get --yes install latex2html
85      sudo apt-get --yes install libgtk2.0-dev #GTK
86      sudo apt-get --yes install libwxgtk2.8-dev #Wx GTK
87      sudo apt-get --yes install libwxbase2.8-dev #Wx solito
88      sudo apt-get --yes install libboost-dev  #Boost
89      sudo apt-get --yes install libboost-all-dev #Boost
90      sudo apt-get --yes install libqt4-dev #QT4
91      sudo apt-get --yes install sqlite
92      sudo apt-get --yes install libosmesa6-dev #Mesa6
93      sudo apt-get --yes install uuid-dev # uuid para la instalacion de itk
94      sudo apt-get --yes install libxaw7-dev # X11
95      ;;
96   MacOS)
97 # QUESTION : is -y  mandatory?
98
99      sudo port install cmake -y 
100      sudo port install cmake-gui -y 
101      sudo port install doxygen -y
102      sudo port install graphviz -y
103      sudo port install texlive -y
104      sudo port install latex2html -y
105      sudo port install wxGTK-devel wxBase -y
106      sudo port install boost-devel -y
107      sudo port install sqlite-devel -y
108      sudo port install qt-devel -y
109      sudo port install mesa-libOSMesa-devel -y
110      ;;
111   *)
112      #echo " '$OS' : Unknown (for us...) Operating Sytem "
113      echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
114      exit 0
115      ;;
116   esac             
117 fi
118
119
120
121 # the following stupid test is used at debug time; Please don't remove!
122 if [ true = true ]
123 then
124   rm -rf $sources/VTK*
125   rm -rf $sources/vtk*
126   rm -rf $sources/InsightToolkit*
127   rm -rf $sources/gdcm*
128   cd $sourcesDir
129   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/vtk-5.6.1.tar.gz
130   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_08_Dic_2009.tar.gz
131   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
132   tar -xvzf vtk-5.6.1.tar.gz
133   tar -xvzf gdcm_08_Dic_2009.tar.gz
134   tar -xvzf InsightToolkit-3.20.0.tar.gz
135 fi
136
137
138
139 if [ $buildType = "Debug" ]
140 then
141 debug="ON"
142 else
143 debug="OFF"
144 fi
145
146
147 if [ true = true ]
148 then
149   libname=VTK
150   dirInstall=$binDir/$libname-Bin
151   dirInstallVTK=$dirInstall
152   mkdir $dirInstall
153   cd $dirInstall
154   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
155   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
156   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
157   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
158   make -j 2
159   sudo make install
160   cd ..
161 fi
162
163 if [ true = true ]
164 then
165   libname=gdcm
166   dirInstall=$binDir/$libname-Bin
167   mkdir $dirInstall
168   cd $dirInstall
169   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
170   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
171   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
172   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
173   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
174   make -j 2
175   sudo make install
176   cd ..
177 fi
178
179 if [ true = true ]
180 then
181   libname=InsightToolkit-3.20.0
182   dirInstall=$binDir/$libname-Bin
183   mkdir $dirInstall
184   cd $dirInstall
185   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
186   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
187   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
188   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
189   cmake CMakeCache.txt
190   make -j 2
191   sudo make install
192   cd ..
193 fi
194
195 #deal with create creatools_third_party_libraries_config.sh
196
197 sudo touch     $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
198 sudo chmod 666 $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
199
200 sudo echo export PATH='$'PATH:$THIRDPARTY_INSTALL_DIR/bin             >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
201 sudo echo export VTK_DIR=$THIRDPARTY_INSTALL_DIR/lib/vtk-5.6          >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
202 sudo echo export ITK_DIR=$THIRDPARTY_INSTALL_DIR/lib/InsightToolkit   >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
203 sudo echo export GDCM_DIR=$THIRDPARTY_INSTALL_DIR/lib/gdcm            >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
204 sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR         >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
205 sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR          >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
206 sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR          >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
207
208 #  modify .bashrc
209 # - remove line 'sh $installPrefix/thirdparty_install/share/creatools_third_party_libraries_config.sh' if any (with accurate value for ???)
210 sed -i -e '/.*creatools_third_party_library_config.*/ d' ~/.bashrc
211
212 # - add line 'sh $installPrefix/thirdparty_install/share/creatools_third_party_libraries_config.sh' (with accurate value for ???)
213 echo source $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh >> ~/.bashrc 
214
215
216