updated to modern VTK
[engrid-github.git] / src / scripts / engrid_installer_updater.sh
blobfb6e056d20f14f4244a82e709852849f96c67790
1 #!/usr/bin/env bash
2 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 # + +
4 # + This file is part of enGrid. +
5 # + +
6 # + Copyright 2008-2014 enGits GmbH +
7 # + +
8 # + enGrid is free software: you can redistribute it and/or modify +
9 # + it under the terms of the GNU General Public License as published by +
10 # + the Free Software Foundation, either version 3 of the License, or +
11 # + (at your option) any later version. +
12 # + +
13 # + enGrid is distributed in the hope that it will be useful, +
14 # + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 # + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 # + GNU General Public License for more details. +
17 # + +
18 # + You should have received a copy of the GNU General Public License +
19 # + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 # + +
21 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #for debugging
24 set -eux
26 source "${0%/*}/engrid_installer_updater.cfg"
28 VTKINCDIR=$VTKPREFIX/include/vtk-$VTKVERSION
29 VTKLIBDIR=$VTKPREFIX/lib/vtk-$VTKVERSION
31 CGNSINCDIR=$CGNSPREFIX/include
32 CGNSLIBDIR=$CGNSPREFIX/lib
34 create_bash_engrid()
36 echo "Create bash_engrid"
37 mkdir -p $BINPREFIX
39 echo "#!/usr/bin/env bash" > $BINPREFIX/$ENV_SETUP
40 echo "export VTKINCDIR=$VTKINCDIR" >> $BINPREFIX/$ENV_SETUP
41 echo "export VTKLIBDIR=$VTKLIBDIR" >> $BINPREFIX/$ENV_SETUP
42 echo "export LD_LIBRARY_PATH=$VTKLIBDIR:\$LD_LIBRARY_PATH" >> $BINPREFIX/$ENV_SETUP
44 echo "export CGNSINCDIR=$CGNSINCDIR" >> $BINPREFIX/$ENV_SETUP
45 echo "export CGNSLIBDIR=$CGNSLIBDIR" >> $BINPREFIX/$ENV_SETUP
46 echo "export LD_LIBRARY_PATH=$CGNSLIBDIR:\$LD_LIBRARY_PATH" >> $BINPREFIX/$ENV_SETUP
48 echo "export PATH=$QTPREFIX/bin:\$PATH" >> $BINPREFIX/$ENV_SETUP
49 echo "export QTDIR=$QTPREFIX" >> $BINPREFIX/$ENV_SETUP
50 echo "export LD_LIBRARY_PATH=$QTPREFIX/lib:\$LD_LIBRARY_PATH" >> $BINPREFIX/$ENV_SETUP
52 chmod 755 $BINPREFIX/$ENV_SETUP
55 create_start_engrid()
57 echo "Create start_engrid"
58 mkdir -p $BINPREFIX
60 echo "#!/usr/bin/env bash" > $BINPREFIX/$START_ENGRID
61 echo "source $BINPREFIX/$ENV_SETUP" >> $BINPREFIX/$START_ENGRID
62 echo "$SRCPREFIX/engrid/src/engrid" >> $BINPREFIX/$START_ENGRID
64 chmod 755 $BINPREFIX/$START_ENGRID
67 install_QT()
69 echo "Install QT"
70 if [ $DOWNLOAD_QT = 1 ]; then wget $URL_QT; fi
71 tar -xzvf ./$ARCHIVE_QT
72 cd $(basename $ARCHIVE_QT .tar.gz)
73 mkdir -p $QTPREFIX
74 # echo yes | ./configure --prefix=$QTPREFIX -opensource
75 echo yes | ./configure --prefix=$QTPREFIX -opensource -nomake examples -nomake demos -nomake docs -no-webkit -no-phonon -no-phonon-backend -no-qt3support -no-accessibility -silent
77 make $MAKEOPTIONS_ALL && make install
78 cd -
81 install_VTK()
83 echo "Install VTK"
84 if [ $DOWNLOAD_VTK = 1 ]; then wget $URL_VTK; fi
85 tar -xzvf ./$ARCHIVE_VTK
86 cd ./VTK
87 mkdir -p $VTKPREFIX
88 cmake -DCMAKE_INSTALL_PREFIX:PATH=$VTKPREFIX -DBUILD_SHARED_LIBS:BOOL=ON -DVTK_USE_GUISUPPORT:BOOL=ON -DVTK_USE_QVTK:BOOL=ON -DVTK_USE_QT:BOOL=ON -DDESIRED_QT_VERSION:STRING=4 .
89 chmod 644 Utilities/vtktiff/tif_fax3sm.c
90 make $MAKEOPTIONS_ALL && make install
91 cd -
94 install_CGNS()
96 echo "Install CGNS"
97 if [ $DOWNLOAD_CGNS = 1 ]; then wget $URL_CGNS; fi
98 tar -xzvf ./$ARCHIVE_CGNS
99 cd ./cgnslib_2.5/
100 mkdir -p $CGNSPREFIX
101 mkdir -p $CGNSPREFIX/include
102 mkdir -p $CGNSPREFIX/lib
103 ./configure --prefix=$CGNSPREFIX && make $MAKEOPTIONS_ALL && make install
104 cd -
107 build_engrid()
109 ORIG_WD=$(pwd)
111 mkdir -p $SRCPREFIX
112 cd $SRCPREFIX
114 if [ $DOWNLOAD_ENGRID = 1 ];
115 then
116 wget $URL_ENGRID;
117 tar -xzvf ./$ARCHIVE_ENGRID
118 else
119 git clone $GIT_URL_ENGRID
120 cd $SRCPREFIX/engrid/src
121 if [ $BRANCH != "master" ]; then git checkout -b $BRANCH origin/$BRANCH; fi;
124 cd $SRCPREFIX/engrid/src
126 echo "Build netgen"
128 if [ $DOWNLOAD_NETGEN = 1 ];
129 then
130 cd $SRCPREFIX/engrid/src/netgen_svn
131 wget $URL_NETGEN;
132 tar -xzvf ./$ARCHIVE_NETGEN
133 qmake && make $MAKEOPTIONS_ALL
134 cd $SRCPREFIX/engrid/src
135 else
136 ./scripts/build-nglib.sh
139 echo "Build enGrid"
140 qmake $PROJECT_FILE && make $MAKEOPTIONS_ALL $MAKEOPTIONS_ENGRID
142 cd $ORIG_WD
145 update_netgen()
147 ORIG_WD=$(pwd)
149 cd $SRCPREFIX/engrid/src
150 echo "Update netgen"
152 if [ $DOWNLOAD_NETGEN = 1 ];
153 then
154 cd $SRCPREFIX/engrid/src/netgen_svn
155 wget $URL_NETGEN;
156 tar -xzvf ./$ARCHIVE_NETGEN
157 qmake && make $MAKEOPTIONS_ALL
158 cd $SRCPREFIX/engrid/src
159 else
160 ./scripts/build-nglib.sh
163 cd $ORIG_WD
166 update_engrid()
168 ORIG_WD=$(pwd)
170 cd $SRCPREFIX/engrid/src
171 echo "Update enGrid"
173 if [ $DOWNLOAD_ENGRID = 1 ];
174 then
175 cd $SRCPREFIX
176 wget $URL_ENGRID;
177 tar -xzvf ./$ARCHIVE_ENGRID
178 cd $SRCPREFIX/engrid/src
179 else
180 git pull
183 qmake $PROJECT_FILE && make $MAKEOPTIONS_ALL $MAKEOPTIONS_ENGRID
185 cd $ORIG_WD
188 rebuild_engrid()
190 cd $SRCPREFIX/engrid/src
191 qmake && make distclean && qmake $PROJECT_FILE && make $MAKEOPTIONS_ALL $MAKEOPTIONS_ENGRID
192 cd -
195 ans=$(zenity --height=350 --list --text "Which actions should be executed?" --checklist --column "Run" --column "Actions" \
196 FALSE "create_bash_engrid" \
197 FALSE "install_QT" \
198 FALSE "install_VTK" \
199 FALSE "install_CGNS" \
200 FALSE "build_engrid" \
201 FALSE "update_netgen" \
202 FALSE "update_engrid" \
203 FALSE "rebuild_engrid" \
204 FALSE "create_start_engrid" \
205 --separator=":");
206 echo $ans
208 if ( echo $ans | grep -w "create_bash_engrid" ) then create_bash_engrid; fi
210 set +u
211 source $BINPREFIX/$ENV_SETUP
212 set -u
214 if ( echo $ans | grep -w "install_QT" ) then install_QT; fi;
215 if ( echo $ans | grep -w "install_VTK" ) then install_VTK; fi;
216 if ( echo $ans | grep -w "install_CGNS" ) then install_CGNS; fi;
217 if ( echo $ans | grep -w "build_engrid" ) then build_engrid; fi;
218 if ( echo $ans | grep -w "update_netgen" ) then update_netgen; fi;
219 if ( echo $ans | grep -w "update_engrid" ) then update_engrid; fi;
220 if ( echo $ans | grep -w "rebuild_engrid" ) then rebuild_engrid; fi;
221 if ( echo $ans | grep -w "create_start_engrid" ) then create_start_engrid; fi;
223 echo "SUCCESS"
224 exit 0