]> Creatis software - creaToolsTools.git/blob - Install_ThirdParty/scripts/install_thirdparty_all.sh
86709106da3b19ac54c4050a678be4abc067ba57
[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
48 mkdir $generationdir
49 mkdir $sourcesDir
50 mkdir $binDir
51
52
53
54
55
56 # the following stupid test is used at debug time; Please don't remove!
57 if [ true = true ]
58 then
59
60   case "$OS" in
61   Fedora)
62      sudo yum install cmake -y 
63      sudo yum install cmake-gui -y 
64      sudo yum install doxygen -y
65      sudo yum install graphviz -y
66      sudo yum install texlive -y
67      sudo yum install latex2html -y
68      sudo yum install wxGTK-devel wxBase -y
69      sudo yum install boost-devel -y
70      sudo yum install sqlite-devel -y
71      sudo yum install qt-devel -y
72      sudo yum install mesa-libOSMesa-devel -y
73      ;;
74   Ubuntu)  
75      sudo apt-get --yes install build-essential  # esta linea instala las librerias necesarias para compilar en ubuntu, g++ gcc etc etc etc.
76      sudo apt-get --yes install cmake
77      sudo apt-get --yes install cmake-gui
78      sudo apt-get --yes install cmake-curses-gui
79      sudo apt-get --yes install doxygen
80      sudo apt-get --yes install graphviz
81      sudo apt-get --yes install texlive
82      sudo apt-get --yes install latex2html
83      sudo apt-get --yes install libgtk2.0-dev #GTK
84      sudo apt-get --yes install libwxgtk2.8-dev #Wx GTK
85      sudo apt-get --yes install libwxbase2.8-dev #Wx solito
86      sudo apt-get --yes install libboost-dev  #Boost
87      sudo apt-get --yes install libboost-all-dev #Boost
88      sudo apt-get --yes install libqt4-dev #QT4
89      sudo apt-get --yes install sqlite
90      sudo apt-get --yes install libosmesa6-dev #Mesa6
91      sudo apt-get --yes install uuid-dev # uuid para la instalacion de itk
92      sudo apt-get --yes install libxaw7-dev # X11
93      ;;
94   MacOS)
95 # QUESTION : is -y  mandatory?
96
97      sudo port install cmake -y 
98      sudo port install cmake-gui -y 
99      sudo port install doxygen -y
100      sudo port install graphviz -y
101      sudo port install texlive -y
102      sudo port install latex2html -y
103      sudo port install wxGTK-devel wxBase -y
104      sudo port install boost-devel -y
105      sudo port install sqlite-devel -y
106      sudo port install qt-devel -y
107      sudo port install mesa-libOSMesa-devel -y
108      ;;
109   *)
110      #echo " '$OS' : Unknown (for us...) Operating Sytem "
111      echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
112      exit 0
113      ;;
114   esac             
115 fi
116
117
118
119 # the following stupid test is used at debug time; Please don't remove!
120 if [ true = true ]
121 then
122   rm -rf $sources/VTK*
123   rm -rf $sources/vtk*
124   rm -rf $sources/InsightToolkit*
125   rm -rf $sources/gdcm*
126   cd $sourcesDir
127   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/vtk-5.6.1.tar.gz
128   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_08_Dic_2009.tar.gz
129   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
130   tar -xvzf vtk-5.6.1.tar.gz
131   tar -xvzf gdcm_08_Dic_2009.tar.gz
132   tar -xvzf InsightToolkit-3.20.0.tar.gz
133 fi
134
135
136
137 if [ $buildType = "Debug" ]
138 then
139 debug="ON"
140 else
141 debug="OFF"
142 fi
143
144
145 if [ true = true ]
146 then
147   libname=VTK
148   dirInstall=$binDir/$libname-Bin
149   dirInstallVTK=$dirInstall
150   mkdir $dirInstall
151   cd $dirInstall
152   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
153   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
154   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
155   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
156   make -j 2
157   sudo make install
158   cd ..
159 fi
160
161 if [ true = true ]
162 then
163   libname=gdcm
164   dirInstall=$binDir/$libname-Bin
165   mkdir $dirInstall
166   cd $dirInstall
167   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
168   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
169   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
170   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
171   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
172   make -j 2
173   sudo make install
174   cd ..
175 fi
176
177 if [ true = true ]
178 then
179   libname=InsightToolkit-3.20.0
180   dirInstall=$binDir/$libname-Bin
181   mkdir $dirInstall
182   cd $dirInstall
183   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
184   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
185   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
186   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
187   cmake CMakeCache.txt
188   make -j 2
189   sudo make install
190   cd ..
191 fi
192
193 #deal with create creatools_third_party_libraries_config.sh
194
195 THIRDPARTY_INSTALL_DIR=$installPrefix/thirdparty_install
196 sudo rm        $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
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 's/.*creatools_third_party_libraries_config.*/  /g' ~/.bashrc
211
212 # - add line 'sh $installPrefix/thirdparty_install/share/creatools_third_party_libraries_config.sh' (with accurate value for ???)
213 echo sh $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_libraries_config.sh >> ~/.bashrc 
214
215
216