]> Creatis software - creaToolsTools.git/blob - Install/scripts/make.sh
90b000fd31661c0f4c39a235a32b1d223178a4b7
[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  exit 0
158
159 # -------------------------
160 #        start_point =  4 : creaMaracasVisu
161 #-------------------------
162 if [ $start_point -le 4 ]
163 then
164 # the following stupid test is used at debug time; Please don't remove!
165 #if [ true = false ]
166 if [ true = true ]
167 then
168 # creaMaracasVisu
169  sh cmakemod.sh                 $creamaracassource $generationdir $installPrefix $buildType 
170  sh creaMaracasVariables.sh     $creamaracassource $generationdir $docgeneration
171  sh compilemod.sh               $buildType $creamaracassource $generationdir 
172  sh ctestmod.sh                 $creamaracassource $generationdir
173 fi
174 fi
175  creamaracasdll=$generationdir/creatools_bin/creamaracasBin
176  LD_LIBRARY_PATH=$creamaracasdll:$LD_LIBRARY_PATH
177
178
179 # -------------------------
180 #        start_point =  5 : creaEnvironment
181 #-------------------------
182 if [ $start_point -le 5 ]
183 then
184 # the following stupid test is used at debug time; Please don't remove!
185 #if [ true = false ]
186 if [ true = true ]
187 then
188 # creaEnvironment
189  sh cmakemod.sh                 $creaenvironmentsource $generationdir $installPrefix $buildType 
190  sh creaenvironmentVariables.sh $creaenvironmentsource $generationdir $docgeneration
191  sh compilemod.sh $buildType    $creaenvironmentsource $generationdir
192  sh ctestmod.sh                 $creaenvironmentsource $generationdir
193 fi
194 fi
195  creaenvironmentdll=$generationdir/creatools_bin/creaenvironmentBin
196  LD_LIBRARY_PATH=$creaenvironmentdll:$LD_LIBRARY_PATH
197
198
199 # -------------------------
200 #        start_point =  6 : creaBruker
201 #-------------------------
202 if [ $start_point -le 6 ]
203 then
204 # the following stupid test is used at debug time; Please don't remove!
205 #if [ true = false ]
206 if [ true = true ]
207 then
208 # creaBruker
209  sh cmakemod.sh              $creabrukersource $generationdir $installPrefix $buildType 
210  sh creaBrukerVariables.sh       $creabrukersource $generationdir $docgeneration $gdcmVersion
211  sh compilemod.sh $buildType $creabrukersource $generationdir
212  echo generationdir 
213  sh ctestmod.sh              $creabrukersource $generationdir
214 fi
215 fi
216  creabrukerdll=$generationdir/creatools_bin/creabrukerBin
217  LD_LIBRARY_PATH=$creabrukerdll:$LD_LIBRARY_PATH
218
219
220 # -------------------------
221 #        start_point =  7 : creaImageIO
222 #-------------------------
223 if [ $start_point -le 7 ]
224 then
225  # the following stupid test is used at debug time; Please don't remove!
226 #if [ true = false ]
227 if [ true = true ]
228 then
229 # creaImageIO
230  sh cmakemod.sh                 $creaimagesource $generationdir $installPrefix $buildType 
231  sh creaImageIOVariables.sh     $creaimagesource $generationdir $docgeneration $gdcmVersion
232  sh compilemod.sh    $buildType $creaimagesource $generationdir
233  sh ctestmod.sh                 $creaimagesource $generationdir
234 fi
235 fi
236  creaimagedll=$generationdir/creatools_bin/creaimageBin
237  LD_LIBRARY_PATH=$creaimagedll:$LD_LIBRARY_PATH
238
239
240 # -------------------------
241 #        start_point =  8 : creaContour
242 #-------------------------
243 if [ $start_point -le 8 ]
244 then
245 # the following stupid test is used at debug time; Please don't remove!
246 #if [ true = false ]
247 if [ true = true ]
248 then
249 # creaContours
250  sh cmakemod.sh                 $creacontourssource $generationdir $installPrefix $buildType 
251  sh creaContoursVariables.sh    $creacontourssource $generationdir $docgeneration
252  sh compilemod.sh        $buildType $creacontourssource $generationdir
253  sh ctestmod.sh                 $creacontourssource $generationdir
254 fi
255 fi
256 # creacontourdll=$generationdir/creatools_bin/creacontoursBin
257 # LD_LIBRARY_PATH=$creacontoursdll:$LD_LIBRARY_PATH
258
259
260 # -------------------------
261 #        start_point =  9 : creaRigidRegistration
262 #-------------------------
263 if [ $start_point -le 9 ]
264 then
265 # the following stupid test is used at debug time; Please don't remove!
266 #if [ true = false ]
267 if [ true = true ]
268 then
269  sh cmakemod.sh                         $crearigidregistrationssource $generationdir $installPrefix $buildType 
270  sh creaRigidRegistrationVariables.sh   $crearigidregistrationssource $generationdir $docgeneration
271  sh compilemod.sh                        $buildType $crearigidregistrationssource $generationdir
272  sh ctestmod.sh                         $crearigidregistrationssource $generationdir
273 fi
274 fi
275 # crearigidregistrationdll=$generationdir/creatools_bin/crearigidregistrationBin
276 # LD_LIBRARY_PATH=$crearigidregistrationdll:$LD_LIBRARY_PATH
277
278
279 # -------------------------
280 #        start_point =  10 : bbtkGEditor
281 #-------------------------
282 if [ $start_point -le 10 ]
283 then
284 # the following stupid test is used at debug time; Please don't remove!
285 #if [ true = false ]
286 if [ true = true ]
287 then
288 # bbtkGEditor
289  sh cmakemod.sh                 $bbtkgeditorsource $generationdir $installPrefix $buildType 
290  sh bbtkGEditorVariables.sh     $bbtkgeditorsource $generationdir $docgeneration
291  sh compilemod.sh    $buildType $bbtkgeditorsource $generationdir
292  sh ctestmod.sh                 $bbtkgeditorsource $generationdir
293 fi
294 fi
295 # bbtkgeditordll=$generationdir/creatools_bin/bbtkgeditorBin
296 # LD_LIBRARY_PATH=$bbtkgeditordll:$LD_LIBRARY_PATH
297
298
299 # -------------------------
300 #        start_point =  11 : creaTools
301 #-------------------------
302 if [ $start_point -le 11 ]
303 then
304 # the following stupid test is used at debug time; Please don't remove!
305 #if [ true = false ]
306 if [ true = true ]
307 then
308 # creaTools
309  sh cmakemod.sh                    $creatoolssource $generationdir $installPrefix $buildType 
310  sh creaToolsVariables.sh          $creatoolssource $generationdir $docgeneration
311  sh compilemod.sh               $buildType $creatoolssource $generationdir
312 fi
313 fi
314
315
316 # sh ctestmod.sh $creatoolsbinary $generationdir
317 #  creatoolsdll=$generationdir/creatools_bin/creatoolsBin
318 #  LD_LIBRARY_PATH=$creatoolssdll:$LD_LIBRARY_PATH
319
320
321 CREATOOLS_INSTALL_DIR=$installPrefix
322 sudo rm        $CREATOOLS_INSTALL_DIR/share/creatools_base_library_config.sh
323 sudo touch     $CREATOOLS_INSTALL_DIR/share/creatools_base_library_config.sh
324 sudo chmod 666 $CREATOOLS_INSTALL_DIR/share/creatools_base_library_config.sh
325
326 #######################################
327
328 sudo touch     $installPrefix/share/creatools_base_library_config.sh
329 sudo chmod 666 $installPrefix/share/creatools_base_library_config.sh
330
331
332 sudo echo export PATH='$'PATH:$installPrefix/bin                                   >> $installPrefix/share/creatools_base_library_config.sh
333 sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$installPrefix/lib/creatools   >> $installPrefix/share/creatools_base_library_config.sh
334 sudo echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$installPrefix/lib64/creatools >> $installPrefix/share/creatools_base_library_config.sh
335
336 #  modify .bashrc
337 # - remove line 'sh $installPrefix/creatools_install/share/creatools_base_party_libraries_config.sh' if any (with accurate value for ???)
338 sed -i -e '/.*creatools_base_library_config.*/ d' ~/.bashrc
339
340 # - add line 'sh $installPrefix/creatools_install/share/creatools_base_libraries_config.sh' (with accurate value for ???)
341 echo [ -f "$installPrefix/share/creatools_base_library_config.sh" ] &&  source $installPrefix/share/creatools_base_library_config.sh >> ~/.bashrc 
342
343
344 # shutdown /s
345 # exit /b