]> Creatis software - creaToolsTools.git/blob - Linux/scripts/ThirdParty-install-gdcm.sh
Allow quick gdcm compile+install
[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   wget http://www.creatis.insa-lyon.fr/software/public/creatools/crea_ThirdParty_Libraries/source/gdcm_08_Dic_2009.tar.gz
72
73
74   tar -xvzf gdcm_08_Dic_2009.tar.gz
75
76 fi
77
78
79 if [ $buildType = "Debug" ]
80 then
81    debug="ON"
82 else
83    debug="OFF"
84 fi
85
86
87 # the following stupid test is used at debug time; Please don't remove!
88 #if [ true = false ]
89 if [ true = true ]
90 then
91   libname=gdcm
92   dirInstall=$binDir/$libname-Bin
93   export GDCM_DIR=$installPrefixThird/lib/gdcm/
94   mkdir $dirInstall
95   cd $dirInstall
96   cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
97   ##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
98   cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
99   cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
100   cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
101   make -j 2
102   make install
103   cd ..
104 fi
105
106 #if [ true = false ]
107 if [ true = true ]
108 then
109   cd $sourcesDir
110   cp tth $installPrefixThird/bin
111 fi
112
113
114 #deal with create creatools_third_party_libraries_config.sh
115
116 if [ -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
117 then
118    rm $installPrefixThird/share/creatools_third_party_library_config.sh
119 fi
120
121 if [ ! -e $installPrefixThird/share ]
122 then
123    mkdir $installPrefixThird/share
124 fi
125 touch     $installPrefixThird/share/creatools_third_party_library_config.sh
126 chmod 755 $installPrefixThird/share/creatools_third_party_library_config.sh
127
128 echo export PATH='$'PATH:$installPrefixThird/bin           >> $installPrefixThird/share/creatools_third_party_library_config.sh
129 echo export VTK_DIR=$installPrefixThird/lib/vtk-5.6        >> $installPrefixThird/share/creatools_third_party_library_config.sh
130 echo export ITK_DIR=$installPrefixThird/lib/InsightToolkit >> $installPrefixThird/share/creatools_third_party_library_config.sh
131 echo export GDCM_DIR=$installPrefixThird/lib/gdcm          >> $installPrefixThird/share/creatools_third_party_library_config.sh
132 echo export TTH=$installPrefixThird/bin/tth                >> $installPrefixThird/share/creatools_third_party_library_config.sh
133 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR   >> $installPrefixThird/share/creatools_third_party_library_config.sh
134 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
135 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR    >> $installPrefixThird/share/creatools_third_party_library_config.sh
136
137 export ETC_BASHRC=$HOME/.bashrc
138
139    sed -i -e '/.*installPrefixThird*/ d' $ETC_BASHRC
140    sed -i -e '/.*creatools_third_party_library_config.*/ d' $ETC_BASHRC
141
142
143 # - add line 'bash $installPrefixThird/share/creatools_third_party_library_config.sh' (with accurate value for ???)
144 echo installPrefixThird=$installPrefixThird >> $ETC_BASHRC
145 echo '[ -f "$installPrefixThird/share/creatools_third_party_library_config.sh" ] &&  source $installPrefixThird/share/creatools_third_party_library_config.sh' >> $ETC_BASHRC