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