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