]> Creatis software - creaToolsTools.git/blob - Install_ThirdParty/scripts/install_thirdparty_all.sh
Fix mistyping
[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      echo "MacOS not yet dealt with ..."
89      exit 0
90      ;;
91   *)
92      echo " '$OS' : Unknown (for us...) Operating Sytem "
93      echo " Allowed values are (right now) Fedora, Ubuntu, MacOS "
94      exit 0
95      ;;
96   esac             
97 fi
98
99
100
101 # the following stupid test is used at debug time; Please don't remove!
102 if [ true = true ]
103 then
104   rm -rf $sources/VTK*
105   rm -rf $sources/vtk*
106   rm -rf $sources/InsightToolkit*
107   rm -rf $sources/gdcm*
108   cd $sourcesDir
109   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/vtk-5.6.1.tar.gz
110   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_08_Dic_2009.tar.gz
111   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/InsightToolkit-3.20.0.tar.gz
112   tar -xvzf vtk-5.6.1.tar.gz
113   tar -xvzf gdcm_08_Dic_2009.tar.gz
114   tar -xvzf InsightToolkit-3.20.0.tar.gz
115 fi
116
117
118
119 if [ $buildType = "Debug" ]
120 then
121 debug="ON"
122 else
123 debug="OFF"
124 fi
125
126
127 if [ true = true ]
128 then
129   libname=VTK
130   dirInstall=$binDir/$libname-Bin
131   dirInstallVTK=$dirInstall
132   mkdir $dirInstall
133   cd $dirInstall
134   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
135   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
136   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
137   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
138   make -j 2
139   sudo make install
140   cd ..
141 fi
142
143 if [ true = true ]
144 then
145   libname=gdcm
146   dirInstall=$binDir/$libname-Bin
147   mkdir $dirInstall
148   cd $dirInstall
149   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
150   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
151   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
152   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
153   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
154   make -j 2
155   sudo make install
156   cd ..
157 fi
158
159 if [ true = true ]
160 then
161   libname=InsightToolkit-3.20.0
162   dirInstall=$binDir/$libname-Bin
163   mkdir $dirInstall
164   cd $dirInstall
165   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
166   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
167   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
168   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
169   cmake CMakeCache.txt
170   make -j 2
171   sudo make install
172   cd ..
173 fi
174
175 #deal with create creatools_third_party_libraries_config.sh
176
177 THIRDPARTY_INSTALL_DIR=$installPrefix/thirdparty_install
178 sudo rm $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
179
180 sudo echo export PATH=$PATH:$THIRDPARTY_INSTALL_DIR/bin             >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
181 sudo echo export VTK_DIR=$THIRDPARTY_INSTALL_DIR/lib/vtk-5.6        >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
182 sudo echo export ITK_DIR=$THIRDPARTY_INSTALL_DIR/lib/InsightToolkit >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
183 sudo echo export GDCM_DIR=$THIRDPARTY_INSTALL_DIR/lib/gdcm          >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
184 sudo echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GDCM_DIR         >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
185 sudo echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ITK_DIR          >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
186 sudo echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VTK_DIR          >> $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_library_config.sh
187
188 #  modify .bashrc
189 # - remove line 'sh $installPrefix/thirdparty_install/share/creatools_third_party_libraries_config.sh' if any (with accurate value for ???)
190 sed -i -e 's/.*creatools_third_party_libraries_config.*/  /g' ~/.bashrc
191
192 # - add line 'sh $installPrefix/thirdparty_install/share/creatools_third_party_libraries_config.sh' (with accurate value for ???)
193 echo sh $THIRDPARTY_INSTALL_DIR/share/creatools_third_party_libraries_config.sh >> ~/.bashrc 
194
195
196