1 # ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # This software is governed by the CeCILL-B license under French law and
8 # abiding by the rules of distribution of free software. You can use,
9 # modify and/ or redistribute the software under the terms of the CeCILL-B
10 # license as circulated by CEA, CNRS and INRIA at the following URL
11 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
12 # or in the file LICENSE.txt.
14 # As a counterpart to the access to the source code and rights to copy,
15 # modify and redistribute granted by the license, users are provided only
16 # with a limited warranty and the software's author, the holder of the
17 # economic rights, and the successive licensors have only limited
20 # The fact that you are presently reading this means that you have had
21 # knowledge of the CeCILL-B license and that you accept its terms.
22 # ------------------------------------------------------------------------
27 if [ -f scripts/CreaTools-configure.sh ]
29 source scripts/CreaTools-configure.sh
42 echo " Choose what you want to do :"
44 echo " Configure :........................0"
46 if [ $expanded = "YES" ]
48 echo " Install all base stuff :..........1.0"
49 echo " (cmake, doxygen, graphviz, ...)"
50 echo " Get, Compile, Install vtk .......1.1"
51 echo " Get, Compile, Install gdcm :.. . .1.2"
52 echo " Get, Compile, Install itk :.......1.3"
53 echo " Get, Compile, Install Wx (for Mac Users) :…....1.4"
56 echo " Install Third Party Libraries :....1 (as root)"
59 if [ $expanded = "YES" ]
61 echo " Get the 'CreaTools' source files :.2.1 (GIT : as user!)"
62 echo " Compile the CreaTools :..........2.2"
63 # Install creatools as user (no longer as root) // JPR 2/5/2011
64 echo " Install the CreaTools :..........2.3"
66 echo " Get and Install the 'CreaTools':...2"
69 if [ $expanded = "NO" ]
71 echo " Use Expanded menu :................5 "
73 echo " Use compact menu :.................5 "
75 echo " Uninstall the CreaTools :..........6 "
76 echo " Help ..............................7 Help about this menu"
77 echo " Show some Environment Variables ...8"
78 echo " Exit :.............................9"
83 echo "Type in your choice :"
89 # Do it, while we are under user, not under root! # JPR
90 if [ -f $HOME/.bashrc ]
92 export ETC_BASHRC=$HOME/.bashrc
94 if [ -f $HOME/.profile ]
96 export ETC_BASHRC=$HOME/.profile
98 echo "======================== BIG TROUBLE : neither $HOME/.bashrc nor $HOME/.profile file found"
99 echo "======================== You'd better to abort the program and (try to) fix the issue"
100 read a # just to let the user time enough to read the message...
106 #ls -l scripts/CreaTools-configure.sh
107 if [ -f scripts/CreaTools-configure.sh ]
109 while [[ "$suitable" != "YES" && \
110 "$suitable" != "yes" && \
111 "$suitable" != "Y" && \
112 "$suitable" != "y" && \
113 "$suitable" != "NO" && \
114 "$suitable" != "no" ]]
116 echo "'Configure' already done; Content of scripts/CreaTools-configure.sh :"
117 echo "------------------------"
118 more scripts/CreaTools-configure.sh
119 echo "------------------------"
121 # WARNING : $installPrefixThird is taken from CreaTools-configure.sh
122 # If user configured without installing third party library,
123 # last third party library is still in use! JPR
125 if [ ! -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
128 echo "the curently used Third Party libraries are NOT in $installPrefixThird but ... in :"
129 grep "installPrefixThird=" $ETC_BASHRC
130 echo "VTK_DIR : " $VTK_DIR
131 echo "ITK_DIR : " $ITK_DIR
132 echo "GDCM_DIR : " $GDCM_DIR
133 echo "(Have a look at $ETC_BASHRC=, edit it or run again Install Third Party Libraries if you disagree)"
136 echo "Are these values suitable for you : YES/NO? (default is YES)"
138 if [ "$suitable" = "" ]
147 if [[ "$suitable" = "YES" || "$suitable" = "Y" || "$suitable" = "yes" || "$suitable" = "y" ]]
149 source scripts/CreaTools-configure.sh
152 if [[ "$suitable" = "NO" || "$suitable" = "N" || "$suitable" = "no" || "$suitable" = "n" ]]
153 #if [ "$suitable" = "NO" ]
158 while [ "$confirm" != "YES" ]
160 # ///\TODO what about SuSE? Debian? Mandriva? Gentoo?
161 OperatingSystem="XXX"
162 while [[ "$OperatingSystem" != "Fedora" && \
163 "$OperatingSystem" != "Ubuntu" && \
164 "$OperatingSystem" != "MacOS" ]]
166 echo "Operating System : Fedora/Ubuntu/MacOS (default : Fedora)"
168 if [ "$OperatingSystem" = "" ]
170 OperatingSystem="Fedora"
173 echo "you said : [" $OperatingSystem "]"
178 echo "How many cores on your computer 2 (default is 2)"
180 if [ "$corenumber" = "" ]
184 echo "you said : [" $corenumber "]"
189 racine=$HOME/myDefaultCreatoolsGenerationDir
191 echo "Name of the Generation Directory (default is $racine)"
193 if [ "$generationdir" = "" ]
195 generationdir=$racine
197 echo "you said : [" $generationdir "]"
202 installPrefixThird="___"
203 echo "Install Prefix For Third Party Library : '$generationdir/thirdparty_install' / '/usr/local' (default is '$generationdir/thirdparty_install')"
204 read installPrefixThird
205 if [ "$installPrefixThird" = "" ]
207 installPrefixThird="$generationdir/thirdparty_install"
209 echo "you said : [" $installPrefixThird "]"
215 echo "Install Prefix for CreaTools : '$generationdir/creatools_install' / '/usr/local' (default is '$generationdir/creatools_install')"
217 if [ "$installPrefix" = "" ]
219 installPrefix="$generationdir/creatools_install"
221 echo "you said : [" $installPrefix "]"
229 while [[ "$docgeneration" != "ON" && "$docgeneration" != "OFF" ]]
231 echo "Boolean For Doc Generation : ON/OFF (default is OFF)"
233 if [ "$docgeneration" = "" ]
237 echo "you said : [" $docgeneration "]"
248 while [[ "$sourcesFrom" != "GIT" && "$sourcesFrom" != "HTML" ]]
250 echo "Where do you want to get source files from : GIT/HTML ( GIT : for registered CREATIS users only! )"
252 if [ "$sourcesFrom" = "" ]
256 echo "you said : [" $sourcesFrom "]"
263 if [ "$sourcesFrom" = "GIT" ]
265 while [ "$gitUserName" == "" ]
267 echo "GIT User Name ( registered CREATIS user : mandatory!)"
270 echo "you said : [" $gitUserName "]"
272 gitUserName="ForgetThisOne"
281 #while [ "$loginUserName" == "" ]
283 echo "Have a look at the following line to know 'Login User Name'/'Login Group Name'"
285 # echo "Login User Name (mandatory!)"
287 # echo "you said : [" $loginUserName "]"
293 while [ "$loginGroupName" == "" ]
295 echo "Have a look at the following line to know 'Login User Name'/'Login Group Name'"
296 echo "Login Group Name (mandatory!)"
298 echo "you said : [" $loginGroupName "]"
305 while [[ "$buildType" != "Release" && "$buildType" != "Debug" ]]
307 echo "Build type : Release/Debug (default is Release)"
309 if [ "$buildType" = "" ]
313 echo "you said : [" $buildType "]"
320 while [[ "$gdcmVersion" != "GDCM1" && "$gdcmVersion" != "GDCM2" ]]
322 echo "Gdcm version : GDCM1/GDCM2 (default is GDCM1)"
324 if [ "$gdcmVersion" = "" ]
328 echo "you said : [" $gdcmVersion "]"
331 # NOT YET CHECKED ! JPR
333 while [[ "$ITKVersion" != "ITK3" && "$ITKVersion" != "ITK4" ]]
335 echo "ITK version : ITK3/ITK4 (default is ITK3)"
337 if [ "$ITKVersion" = "" ]
341 echo "you said : [" $ITKVersion "]"
349 echo " Operating System : $OperatingSystem"
350 echo " Number of Cores : $corenumber"
351 echo " Name of the Generation Directory : $generationdir"
352 echo " Install Prefix for Third Party Libraries : $installPrefixThird"
353 echo " Install Prefix for CreaTools : $installPrefix"
354 echo " Boolean for Doc Generation : $docgeneration"
355 echo " Where do you want to get source files from : $sourcesFrom"
356 if [ $sourcesFrom = GIT ]
358 echo " GIT User Name : $gitUserName"
360 echo " Login User Name : $loginUserName"
361 echo " Login Group Name : $loginGroupName"
362 echo " Build type : $buildType"
363 echo " Gdcm version : $gdcmVersion"
364 echo " ITK version : $ITKVersion"
368 echo "Do you confirm your choices : YES/NO ? (default is YES)"
370 if [ "$confirm" = "" ]
376 # ==> On genere le fichier CreaTools-configure.sh genere chez l'utilisateur (no choice!)...
379 configureFile="scripts/CreaTools-configure.sh"
381 echo "#!/bin/bash" > $configureFile
382 echo >> $configureFile
383 echo "#File generated by 'menu.sh'" >> $configureFile
384 echo "#DO NOT edit !" >> $configureFile
385 echo "#(except if you *do* know what you do)" >> $configureFile
386 echo >> $configureFile
387 echo "OperatingSystem=$OperatingSystem" >> $configureFile
388 echo "corenumber=$corenumber" >> $configureFile
389 echo "generationdir=$generationdir" >> $configureFile
390 echo "installPrefix=$installPrefix" >> $configureFile
391 echo "installPrefixThird=$installPrefixThird" >> $configureFile
392 echo "docgeneration=$docgeneration" >> $configureFile
393 echo "sourcesFrom=$sourcesFrom" >> $configureFile
394 echo "gitUserName=$gitUserName" >> $configureFile
395 echo "loginUserName=$loginUserName" >> $configureFile
396 echo "loginGroupName=$loginGroupName" >> $configureFile
397 echo "buildType=$buildType" >> $configureFile
398 echo "gdcmVersion=$gdcmVersion" >> $configureFile
399 echo "ITKVersion=$ITKVersion" >> $configureFile
400 echo "ETC_BASHRC=$ETC_BASHRC" >> $configureFile
408 echo "========================== 1 "
409 source scripts/Check-if-root.sh
410 bash scripts/ThirdParty-install-Base-Stuff.sh
411 bash scripts/ThirdParty-install-VTK.sh
412 bash scripts/ThirdParty-install-gdcm.sh
413 bash scripts/ThirdParty-install-ITK.sh
414 bash scripts/ThirdParty-install.sh
415 bash scripts/ThirdParty-install-Finalize.sh
417 if [ "$sourcesFrom" = "GIT" ]
419 echo "----------------------------------------------------------------------"
421 echo "To go on, run again 'bash menu.sh' as '$loginUserName', in a new window"
422 echo "----------------------------------------------------------------------"
424 echo "----------------------------------------------------------------------"
426 echo "To go on, run again 'bash menu.sh' in a new window"
427 echo "----------------------------------------------------------------------"
431 echo "==> You HAVE to leave current window to continue!"
438 echo "========================== 1.0 "
439 source scripts/Check-if-root.sh
440 bash scripts/ThirdParty-install-Base-Stuff.sh
441 bash scripts/ThirdParty-install-Finalize.sh
445 echo "========================== 1.1 "
446 #source scripts/Check-if-root.sh
447 bash scripts/ThirdParty-install-VTK.sh
448 bash scripts/ThirdParty-install-Finalize.sh
452 echo "========================== 1.2 "
453 #source scripts/Check-if-root.sh
454 bash scripts/ThirdParty-install-gdcm.sh
455 bash scripts/ThirdParty-install-Finalize.sh
459 echo "========================== 1.3 "
460 #source scripts/Check-if-root.sh
461 bash scripts/ThirdParty-install-ITK.sh
462 bash scripts/ThirdParty-install-Finalize.sh
465 echo "========================== 1.4 "
466 #source scripts/Check-if-root.sh
467 bash scripts/ThirdParty-install-WX.sh
468 bash scripts/ThirdParty-install-Finalize.sh
474 bash scripts/CreaTools-load.sh
476 source scripts/CreaTools-configure.sh
477 bash scripts/CreaTools-compile.sh
479 bash scripts/CreaTools-install.sh
481 echo "==> You HAVE to leave current window to continue!"
489 echo "========================== 2.1"
490 bash scripts/CreaTools-load.sh
494 echo "========================== 2.2"
495 source scripts/CreaTools-configure.sh
497 bash scripts/CreaTools-compile.sh
499 # To allow (*very* aware) user to patch code, later
500 if [ ! -e $generationdir/creatools_source ]
502 echo "You probabely made a mistake : "
503 echo "Directory $loginUserName $generationdir/creatools_source not found"
504 echo "Make sure you know the mistake"
505 echo "Hit any key to continue"
506 echo "Fix the mistake!"
509 chown -R $loginUserName $generationdir/creatools_source
510 chgrp -R $loginGroupName $generationdir/creatools_source
516 echo "========================= 4"
518 bash scripts/CreaTools-install.sh
522 # echo "You HAVE to leave current window to continue!"
524 # echo "==> Hit any key to close current window"
530 if [ $expanded = "NO" ]
539 echo "========================= 5"
540 bash scripts/CreaTools-uninstall.sh
542 echo "==> Hit any key to go on"
548 echo "==================================="
551 echo "==> Hit any key to go on"
557 echo "==================================="
559 # WARNING : $installPrefixThird is taken from CreaTools-configure.sh
560 # If user configured without installing third party library,
561 # last third party library is still in use! JPR
564 if [ ! -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
568 echo "the curently used Third Party libraries are NOT in $installPrefixThird but in :"
569 grep "installPrefixThird=" $ETC_BASHRC
570 echo "VTK_DIR : " $VTK_DIR
571 echo "ITK_DIR : " $ITK_DIR
572 echo "GDCM_DIR : " $GDCM_DIR
574 echo "installPrefixThird ... " $installPrefixThird
577 if [ -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
579 echo "Third party config file : " $installPrefixThird/share/creatools_third_party_library_config.sh
581 more $installPrefixThird/share/creatools_third_party_library_config.sh
587 if [ -f $installPrefix/share/creatools_base_library_config.sh ]
589 echo "Creatools base library config file : " $installPrefix/share/creatools_base_library_config.sh
591 more $installPrefix/share/creatools_base_library_config.sh
594 echo "installPrefix ... " $installPrefix
597 echo "VTK_DIR : " $VTK_DIR
598 echo "ITK_DIR : " $ITK_DIR
599 echo "GDCM_DIR : " $GDCM_DIR
601 echo "crea_DIR : " $crea_DIR
602 echo "BBTK_DIR : " $BBTK_DIR
603 echo "creaMaracasVisu_DIR : " $creaMaracasVisu_DIR
604 echo "creaEnvironment_DIR : " $creaEnvironment_DIR
605 echo "creaBruker_DIR : " $creaBruker_DIR
606 echo "creaImageIO_DIR : " $creaImageIO_DIR
607 echo "creaContours_DIR : " $creaContours_DIR
608 echo "creaRigidRegistration_DIR :" $creaRigidRegistration_DIR
609 echo "bbtkGEditor_DIR : " $bbtkGEditor_DIR
610 echo "creaTools_DIR : " $creaTools_DIR
611 echo "creaMiniTools_DIR : " $creaMiniTools_DIR
612 echo "Ido_DIR : " $Ido_DIR
613 echo "==================================="
615 echo "Press any key to continue"
625 # Hiden option, usefull at debug time
626 bash scripts/ThirdParty-install_no_compile.sh
633 echo "Your answer must be in {0, 1, 2, 5, 6, 7, 8, 9} (was [ $i ])"
635 echo "Your answer must be in {0, 1, 2.1, 2.2, 2.3, 5, 6, 7, 8, 9} (was [ $i ])"