]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-gdcm.sh
curl vs wget
[creaToolsTools.git] / Linux / scripts / ThirdParty-install-gdcm.sh
1 #!/bin/bash
2  if [ ! -f $PWD/scripts/CreaTools-configure.sh ]
3  then 
4    echo
5    echo "..ERROR.."
6    echo "==================================================="
7    echo "REMEMBER !"
8    echo ""
9    echo "YOU NEED TO RUN 'Configure' (0) First !"
10    echo "==================================================="
11    echo
12    echo
13    exit 0
14 fi 
15
16 source $PWD/scripts/CreaTools-configure.sh
17
18    echo "------"
19    echo $PWD/scripts/CreaTools-configure.sh
20    echo --generationdir--
21    echo $generationdir
22    echo --docgeneration--
23    echo $docgeneration
24    echo --installPrefix--
25    echo $installPrefix
26    echo --installPrefixThird--
27    echo $installPrefixThird
28    echo --buildType--
29    echo $buildType
30    echo --gdcmVersion--
31    echo $gdcmVersion
32 #   echo --sourcesFrom--
33 #   echo $sourcesFrom
34 #   echo --scriptDir--
35 #   echo $scriptDir
36 #   echo --start_point--
37 #   echo $start_point
38    echo "------"
39
40
41 scriptDir=$PWD
42 sourcesDir=$generationdir/thirdparty_sources
43 binDir=$generationdir/thirdparty_bin
44
45 if [ ! -e $generationdir ]
46 then
47    mkdir $generationdir
48    chown $loginUserName:$loginGroupName $generationdir
49 fi
50 if [ ! -e $sourcesDir ]
51 then
52    mkdir $sourcesDir
53 fi
54
55 if [ ! -e $binDir ]
56 then
57    mkdir $binDir
58 fi
59
60
61 # the following stupid test is used at debug time; Please don't remove!
62 #if [ true = false ]
63 if [ true = true ]
64 then
65
66   rm -rf $sourcesDir/gdcm*
67
68   rm -rf $binDir/gdcm*
69
70   cd $sourcesDir
71   
72  if [ $OperatingSystem = "MacOS" ]
73  then      
74   curl http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_05_Mai_2011.tar.gz 
75  else  
76   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_05_Mai_2011.tar.gz
77  fi
78  
79   tar -xvzf gdcm_05_Mai_2011.tar.gz
80
81 fi
82
83
84 if [ $buildType = "Debug" ]
85 then
86    debug="ON"
87 else
88    debug="OFF"
89 fi
90
91
92 # the following stupid test is used at debug time; Please don't remove!
93 #if [ true = false ]
94 if [ true = true ]
95 then
96   libname=gdcm
97   dirInstall=$binDir/$libname-Bin
98   export GDCM_DIR=$installPrefixThird/lib/gdcm/
99   mkdir $dirInstall
100   cd $dirInstall
101   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
102   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
103   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
104   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
105   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
106   make -j 2
107   make install
108   cd ..
109 fi
110
111 #if [ true = false ]
112 if [ true = true ]
113 then
114   cd $sourcesDir
115   cp tth $installPrefixThird/bin
116 fi
117
118
119 #deal with create creatools_third_party_libraries_config.sh
120
121 if [ -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
122 then
123    rm $installPrefixThird/share/creatools_third_party_library_config.sh
124 fi
125
126 if [ ! -e $installPrefixThird/share ]
127 then
128    mkdir $installPrefixThird/share
129 fi
130 touch     $installPrefixThird/share/creatools_third_party_library_config.sh
131 chmod 755 $installPrefixThird/share/creatools_third_party_library_config.sh
132
133 echo export PATH='$'PATH:$installPrefixThird/bin           >> $installPrefixThird/share/creatools_third_party_library_config.sh
134 echo export VTK_DIR=$installPrefixThird/lib/vtk-5.6        >> $installPrefixThird/share/creatools_third_party_library_config.sh
135 echo export ITK_DIR=$installPrefixThird/lib/InsightToolkit >> $installPrefixThird/share/creatools_third_party_library_config.sh
136 echo export GDCM_DIR=$installPrefixThird/lib/gdcm          >> $installPrefixThird/share/creatools_third_party_library_config.sh
137 echo export TTH=$installPrefixThird/bin/tth                >> $installPrefixThird/share/creatools_third_party_library_config.sh
138
139 if [ $OperatingSystem = "MacOS" ]
140 then
141 echo export DYLD_LIBRARY_PATH='$'DYLD_LIBRARY_PATH:$GDCM_DIR   >> $installPrefixThird/share/creatools_third_party_library_config.sh
142 echo export DYLD_LIBRARY_PATH='$'DYLD_LIBRARY_PATH:$ITK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
143 echo export DYLD_LIBRARY_PATH='$'DYLD_LIBRARY_PATH:$VTK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
144 else
145 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR   >> $installPrefixThird/share/creatools_third_party_library_config.sh
146 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
147 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
148 fi
149
150 export ETC_BASHRC=$HOME/.bashrc
151
152    sed -i -e '/.*installPrefixThird*/ d' $ETC_BASHRC
153    sed -i -e '/.*creatools_third_party_library_config.*/ d' $ETC_BASHRC
154
155
156 # - add line 'bash $installPrefixThird/share/creatools_third_party_library_config.sh' (with accurate value for ???)
157 echo installPrefixThird=$installPrefixThird >> $ETC_BASHRC
158 echo '[ -f "$installPrefixThird/share/creatools_third_party_library_config.sh" ] &&  source $installPrefixThird/share/creatools_third_party_library_config.sh' >> $ETC_BASHRC