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