]> Creatis software - creaToolsTools.git/blob - Install/scripts/make-install.sh
General upgrade
[creaToolsTools.git] / Install / scripts / make-install.sh
1 #!/bin/sh
2
3 if [ $# = 0 ]
4 then
5
6 echo "Run it as 'root':"
7 echo "Use it as :"
8 echo "sh make-install.sh <nameOfTheGenerationDirectory> <BooleanForDocGeneration> <userNameForCVS> <installPrefix> <buildType> <GDCM Version>"
9 echo "with 'installPrefix' : /usr/local or <directory where you want to generate>/creatools_install"
10 echo "with 'GDCM Version' : GDCM1 / GDCM2"
11 echo " "
12 echo "ex : sh make-install.sh /tmp/gendir OFF jpr /tmp/gendir/creatools_install Debug GDCM2"
13 exit 0
14 fi
15
16 echo $#
17 echo "----------"
18 echo $0
19 echo $1
20 echo $2
21 echo $3
22 echo $4
23 echo $5
24 echo $6
25 echo "----------"
26
27 if [ $# != 6 ]
28 then 
29 echo "sh make-install.sh <nameOfTheGenerationDirectory> <BooleanForDocGeneration> <userNameForCVS> <installPrefix> <buildType> <GDCM Version>"
30 echo "with 'installPrefix' : /usr/local or <directory where you want to generate>/creatools_install"
31 echo " "
32 echo "ex : sh make-install.sh /tmp/gendir OFF jpr /tmp/gendir/creatools_install Debug GDCM2"
33 exit 0
34 fi
35
36 # @echo off
37
38 #allow user to choose the generation dir
39 #allow user to choose to generate the doc or not
40
41 generationdir=$1
42 docGeneration=$2
43 cvsUserName=$3
44 installPrefix=$4
45 buildType=$5
46 gdcmVersion=$6
47
48 scriptDir=$PWD
49 echo scriptDir
50 echo $scriptDir
51
52
53 # /// \TODO check if directories exist.
54 # /// \ exit 0 if they don't (message: run install.sh first!")
55 #mkdir $generationdir
56 #mkdir $generationdir/creatools_source
57 #mkdir $generationdir/creatools_bin
58
59  creasource=crea
60  bbtksource=bbtk
61  creamaracassource=creaMaracasVisu
62  creaenvironmentsource=creaEnvironment
63  creabrukersource=creaBruker
64  creaimagesource=creaImageIO
65  creacontourssource=creaContours
66  crearigidregistrationssource=creaRigidRegistration
67  bbtkgeditorsource=bbtkGEditor
68  creatoolssource=creaTools
69  
70 cd $generationdir
71
72 # start_point : used at debug time : start point of the script
73 # ex : if everything is OK, but bbtkGEditor, 
74 # cvs upate bbtkGEditor manually,and use :
75 # start_point=10
76 # in order not to cvs co everything, nor recompile everything.
77
78 start_point=0
79
80 # --------------------------------
81 #         start_point = 1 : remove everything hat was installed before
82 #---------------------------------
83 if [ $start_point -le 1 ]
84 then
85 # the following stupid test is used at debug time; Please don't remove!
86 #if [ true = false ]
87 if [ true = true ]
88 then
89
90   rm -rf creatools_install/lib/creatools
91   rm -rf creatools_install/lib64/creatools
92   rm -rf creatools_install/bin/bb*
93   rm -rf creatools_install/bin/crea*
94   rm -rf creatools_install/include/bb*
95   rm -rf creatools_install/include/crea*
96   rm -rf creatools_install/share/bb*
97   rm -rf creatools_install/share/crea*
98
99 #this is for the old versions EED
100   rm -rf creatools_install/lib/crea*
101   rm -rf creatools_install/lib/libbb*
102   rm -rf creatools_install/lib/libcrea*
103   rm -rf creatools_install/lib64/crea*
104   rm -rf creatools_install/lib64/libbb*
105   rm -rf creatools_install/lib64/libcrea*
106 fi
107 fi
108
109
110 cd $scriptDir
111
112
113 # -------------------------
114 #        start_point =  2 : CREA
115 #-------------------------
116 if [ $start_point -le 2 ]
117 then
118 # CREA
119 # the following stupid test is used at debug time; Please don't remove!
120 #if [ true = false ]
121 if [ true = true ]
122 then
123  sh installmod.sh       $buildType   $creasource $generationdir  
124
125 fi
126 fi
127  creadll=$generationdir/creatools_bin/creaBin
128  LD_LIBRARY_PATH=$creadll:LD_LIBRARY_$PATH
129  
130
131
132 # -------------------------
133 #        start_point =  3 : BBTK
134 #-------------------------
135 if [ $start_point -le 3 ]
136 then
137 # the following stupid test is used at debug time; Please don't remove!
138 #if [ true = false ]
139 if [ true = true ]
140 then
141 # BBTK
142  sh installmod.sh       $buildType $bbtksource $generationdir 
143 fi
144 fi
145  bbtkdll=$generationdir/creatools_bin/bbtkBin
146  LD_LIBRARY_PATH=$bbtkdll:$LD_LIBRARY_PATH
147
148
149 # -------------------------
150 #        start_point =  4 : creaMaracasVisu
151 #-------------------------
152 if [ $start_point -le 4 ]
153 then
154 # the following stupid test is used at debug time; Please don't remove!
155 #if [ true = false ]
156 if [ true = true ]
157 then
158 # creaMaracasVisu
159  sh installmod.sh               $buildType $creamaracassource $generationdir 
160 fi
161 fi
162  creamaracasdll=$generationdir/creatools_bin/creamaracasBin
163  LD_LIBRARY_PATH=$creamaracasdll:$LD_LIBRARY_PATH
164
165
166 # -------------------------
167 #        start_point =  5 : creaEnvironment
168 #-------------------------
169 if [ $start_point -le 5 ]
170 then
171 # the following stupid test is used at debug time; Please don't remove!
172 #if [ true = false ]
173 if [ true = true ]
174 then
175 # creaEnvironment
176  sh installmod.sh $buildType    $creaenvironmentsource $generationdir
177 fi
178 fi
179  creaenvironmentdll=$generationdir/creatools_bin/creaenvironmentBin
180  LD_LIBRARY_PATH=$creaenvironmentdll:$LD_LIBRARY_PATH
181
182
183 # -------------------------
184 #        start_point =  6 : creaBruker
185 #-------------------------
186 if [ $start_point -le 6 ]
187 then
188 # the following stupid test is used at debug time; Please don't remove!
189 #if [ true = false ]
190 if [ true = true ]
191 then
192 # creaBruker
193  sh installmod.sh $buildType    $creabrukersource  $generationdir
194  echo generationdir 
195 fi
196 fi
197  creabrukerdll=$generationdir/creatools_bin/creabrukerBin
198  LD_LIBRARY_PATH=$creabrukerdll:$LD_LIBRARY_PATH
199
200
201 # -------------------------
202 #        start_point =  7 : creaImageIO
203 #-------------------------
204 if [ $start_point -le 7 ]
205 then
206  # the following stupid test is used at debug time; Please don't remove!
207 #if [ true = false ]
208 if [ true = true ]
209 then
210 # creaImageIO
211  sh installmod.sh               $buildType $creaimagesource $generationdir
212 fi
213 fi
214  creaimagedll=$generationdir/creatools_bin/creaimageBin
215  LD_LIBRARY_PATH=$creaimagedll:$LD_LIBRARY_PATH
216
217
218 # -------------------------
219 #        start_point =  8 : creaContour
220 #-------------------------
221 if [ $start_point -le 8 ]
222 then
223 # the following stupid test is used at debug time; Please don't remove!
224 #if [ true = false ]
225 if [ true = true ]
226 then
227 # creaContours
228  sh installmod.sh               $buildType $creacontourssource $generationdir
229 fi
230 fi
231 # creacontourdll=$generationdir/creatools_bin/creacontoursBin
232 # LD_LIBRARY_PATH=$creacontoursdll:$LD_LIBRARY_PATH
233
234
235 # -------------------------
236 #        start_point =  9 : creaRigidRegistration
237 #-------------------------
238 if [ $start_point -le 9 ]
239 then
240 # the following stupid test is used at debug time; Please don't remove!
241 #if [ true = false ]
242 if [ true = true ]
243 then
244  sh installmod.sh                       $buildType $crearigidregistrationssource $generationdir
245 fi
246 fi
247 # crearigidregistrationdll=$generationdir/creatools_bin/crearigidregistrationBin
248 # LD_LIBRARY_PATH=$crearigidregistrationdll:$LD_LIBRARY_PATH
249
250
251 # -------------------------
252 #        start_point =  10 : bbtkGEditor
253 #-------------------------
254 if [ $start_point -le 10 ]
255 then
256 # the following stupid test is used at debug time; Please don't remove!
257 #if [ true = false ]
258 if [ true = true ]
259 then
260 # bbtkGEditor
261  sh installmod.sh               $buildType $bbtkgeditorsource $generationdir
262 fi
263 fi
264 # bbtkgeditordll=$generationdir/creatools_bin/bbtkgeditorBin
265 # LD_LIBRARY_PATH=$bbtkgeditordll:$LD_LIBRARY_PATH
266
267
268 # -------------------------
269 #        start_point =  11 : creaTools
270 #-------------------------
271 if [ $start_point -le 11 ]
272 then
273 # the following stupid test is used at debug time; Please don't remove!
274 #if [ true = false ]
275 if [ true = true ]
276 then
277 # creaTools
278  sh installmod.sh                  $buildType $creatoolssource $generationdir
279 fi
280 fi
281
282
283 #  creatoolsdll=$generationdir/creatools_bin/creatoolsBin
284 #  LD_LIBRARY_PATH=$creatoolssdll:$LD_LIBRARY_PATH
285
286
287 CREATOOLS_INSTALL_DIR=$installPrefix
288 rm        $CREATOOLS_INSTALL_DIR/share/creatools_base_library_config.sh
289 touch     $CREATOOLS_INSTALL_DIR/share/creatools_base_library_config.sh
290 chmod 666 $CREATOOLS_INSTALL_DIR/share/creatools_base_library_config.sh
291
292 #######################################
293
294 touch     $installPrefix/share/creatools_base_library_config.sh
295 chmod 666 $installPrefix/share/creatools_base_library_config.sh
296
297
298 echo export PATH='$'PATH:$installPrefix/bin                                   >> $installPrefix/share/creatools_base_library_config.sh
299 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$installPrefix/lib/creatools   >> $installPrefix/share/creatools_base_library_config.sh
300 echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$installPrefix/lib64/creatools >> $installPrefix/share/creatools_base_library_config.sh
301
302 #  modify .bashrc
303 # - remove line 'sh $installPrefix/creatools_install/share/creatools_base_party_libraries_config.sh' if any (with accurate value for ???)
304 sed -i -e '/.*creatools_base_library_config.*/ d' ~/.bashrc
305
306 # - add line 'sh $installPrefix/creatools_install/share/creatools_base_libraries_config.sh' (with accurate value for ???)
307 echo source $installPrefix/share/creatools_base_library_config.sh >> ~/.bashrc 
308
309
310 # shutdown /s
311 # exit /b