feature angle defaults to 20deg now
[engrid.git] / src / scripts / engrid_installer_updater.sh
blobc8fe2cb200240f13313e342289fc421521799a0c
1 #!/usr/bin/env bash
2 #
3 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 # + +
5 # + This file is part of enGrid. +
6 # + +
7 # + Copyright 2008-2013 enGits GmbH +
8 # + +
9 # + enGrid is free software: you can redistribute it and/or modify +
10 # + it under the terms of the GNU General Public License as published by +
11 # + the Free Software Foundation, either version 3 of the License, or +
12 # + (at your option) any later version. +
13 # + +
14 # + enGrid is distributed in the hope that it will be useful, +
15 # + but WITHOUT ANY WARRANTY; without even the implied warranty of +
16 # + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
17 # + GNU General Public License for more details. +
18 # + +
19 # + You should have received a copy of the GNU General Public License +
20 # + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 # + +
22 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 #for debugging
26 set -eux
28 source "${0%/*}/engrid_installer_updater.cfg"
30 VTKINCDIR=$VTKPREFIX/include/vtk-$VTKVERSION
31 VTKLIBDIR=$VTKPREFIX/lib/vtk-$VTKVERSION
33 CGNSINCDIR=$CGNSPREFIX/include
34 CGNSLIBDIR=$CGNSPREFIX/lib
36 create_bash_engrid()
38 echo "Create bash_engrid"
39 mkdir -p $BINPREFIX
41 echo "#!/usr/bin/env bash" > $BINPREFIX/$ENV_SETUP
42 echo "export VTKINCDIR=$VTKINCDIR" >> $BINPREFIX/$ENV_SETUP
43 echo "export VTKLIBDIR=$VTKLIBDIR" >> $BINPREFIX/$ENV_SETUP
44 echo "export LD_LIBRARY_PATH=$VTKLIBDIR:\$LD_LIBRARY_PATH" >> $BINPREFIX/$ENV_SETUP
46 echo "export CGNSINCDIR=$CGNSINCDIR" >> $BINPREFIX/$ENV_SETUP
47 echo "export CGNSLIBDIR=$CGNSLIBDIR" >> $BINPREFIX/$ENV_SETUP
48 echo "export LD_LIBRARY_PATH=$CGNSLIBDIR:\$LD_LIBRARY_PATH" >> $BINPREFIX/$ENV_SETUP
50 echo "export PATH=$QTPREFIX/bin:\$PATH" >> $BINPREFIX/$ENV_SETUP
51 echo "export QTDIR=$QTPREFIX" >> $BINPREFIX/$ENV_SETUP
52 echo "export LD_LIBRARY_PATH=$QTPREFIX/lib:\$LD_LIBRARY_PATH" >> $BINPREFIX/$ENV_SETUP
54 chmod 755 $BINPREFIX/$ENV_SETUP
57 create_start_engrid()
59 echo "Create start_engrid"
60 mkdir -p $BINPREFIX
62 echo "#!/usr/bin/env bash" > $BINPREFIX/$START_ENGRID
63 echo "source $BINPREFIX/$ENV_SETUP" >> $BINPREFIX/$START_ENGRID
64 echo "$SRCPREFIX/engrid/src/engrid" >> $BINPREFIX/$START_ENGRID
66 chmod 755 $BINPREFIX/$START_ENGRID
69 install_QT()
71 echo "Install QT"
72 if [ $DOWNLOAD_QT = 1 ]; then wget $URL_QT; fi
73 tar -xzvf ./$ARCHIVE_QT
74 cd $(basename $ARCHIVE_QT .tar.gz)
75 mkdir -p $QTPREFIX
76 # echo yes | ./configure --prefix=$QTPREFIX -opensource
77 echo yes | ./configure --prefix=$QTPREFIX -opensource -nomake examples -nomake demos -nomake docs -no-webkit -no-phonon -no-phonon-backend -no-qt3support -no-accessibility -silent
79 make $MAKEOPTIONS_ALL && make install
80 cd -
83 install_VTK()
85 echo "Install VTK"
86 if [ $DOWNLOAD_VTK = 1 ]; then wget $URL_VTK; fi
87 tar -xzvf ./$ARCHIVE_VTK
88 cd ./VTK
89 mkdir -p $VTKPREFIX
90 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 .
91 chmod 644 Utilities/vtktiff/tif_fax3sm.c
92 make $MAKEOPTIONS_ALL && make install
93 cd -
96 install_CGNS()
98 echo "Install CGNS"
99 if [ $DOWNLOAD_CGNS = 1 ]; then wget $URL_CGNS; fi
100 tar -xzvf ./$ARCHIVE_CGNS
101 cd ./cgnslib_2.5/
102 mkdir -p $CGNSPREFIX
103 mkdir -p $CGNSPREFIX/include
104 mkdir -p $CGNSPREFIX/lib
105 ./configure --prefix=$CGNSPREFIX && make $MAKEOPTIONS_ALL && make install
106 cd -
109 build_engrid()
111 ORIG_WD=$(pwd)
113 mkdir -p $SRCPREFIX
114 cd $SRCPREFIX
116 if [ $DOWNLOAD_ENGRID = 1 ];
117 then
118 wget $URL_ENGRID;
119 tar -xzvf ./$ARCHIVE_ENGRID
120 else
121 git clone $GIT_URL_ENGRID
122 cd $SRCPREFIX/engrid/src
123 if [ $BRANCH != "master" ]; then git checkout -b $BRANCH origin/$BRANCH; fi;
126 cd $SRCPREFIX/engrid/src
128 echo "Build netgen"
130 if [ $DOWNLOAD_NETGEN = 1 ];
131 then
132 cd $SRCPREFIX/engrid/src/netgen_svn
133 wget $URL_NETGEN;
134 tar -xzvf ./$ARCHIVE_NETGEN
135 qmake && make $MAKEOPTIONS_ALL
136 cd $SRCPREFIX/engrid/src
137 else
138 ./scripts/build-nglib.sh
141 echo "Build enGrid"
142 qmake $PROJECT_FILE && make $MAKEOPTIONS_ALL $MAKEOPTIONS_ENGRID
144 cd $ORIG_WD
147 update_netgen()
149 ORIG_WD=$(pwd)
151 cd $SRCPREFIX/engrid/src
152 echo "Update netgen"
154 if [ $DOWNLOAD_NETGEN = 1 ];
155 then
156 cd $SRCPREFIX/engrid/src/netgen_svn
157 wget $URL_NETGEN;
158 tar -xzvf ./$ARCHIVE_NETGEN
159 qmake && make $MAKEOPTIONS_ALL
160 cd $SRCPREFIX/engrid/src
161 else
162 ./scripts/build-nglib.sh
165 cd $ORIG_WD
168 update_engrid()
170 ORIG_WD=$(pwd)
172 cd $SRCPREFIX/engrid/src
173 echo "Update enGrid"
175 if [ $DOWNLOAD_ENGRID = 1 ];
176 then
177 cd $SRCPREFIX
178 wget $URL_ENGRID;
179 tar -xzvf ./$ARCHIVE_ENGRID
180 cd $SRCPREFIX/engrid/src
181 else
182 git pull
185 qmake $PROJECT_FILE && make $MAKEOPTIONS_ALL $MAKEOPTIONS_ENGRID
187 cd $ORIG_WD
190 rebuild_engrid()
192 cd $SRCPREFIX/engrid/src
193 qmake && make distclean && qmake $PROJECT_FILE && make $MAKEOPTIONS_ALL $MAKEOPTIONS_ENGRID
194 cd -
197 ans=$(zenity --height=350 --list --text "Which actions should be executed?" --checklist --column "Run" --column "Actions" \
198 FALSE "create_bash_engrid" \
199 FALSE "install_QT" \
200 FALSE "install_VTK" \
201 FALSE "install_CGNS" \
202 FALSE "build_engrid" \
203 FALSE "update_netgen" \
204 FALSE "update_engrid" \
205 FALSE "rebuild_engrid" \
206 FALSE "create_start_engrid" \
207 --separator=":");
208 echo $ans
210 if ( echo $ans | grep -w "create_bash_engrid" ) then create_bash_engrid; fi
212 set +u
213 source $BINPREFIX/$ENV_SETUP
214 set -u
216 if ( echo $ans | grep -w "install_QT" ) then install_QT; fi;
217 if ( echo $ans | grep -w "install_VTK" ) then install_VTK; fi;
218 if ( echo $ans | grep -w "install_CGNS" ) then install_CGNS; fi;
219 if ( echo $ans | grep -w "build_engrid" ) then build_engrid; fi;
220 if ( echo $ans | grep -w "update_netgen" ) then update_netgen; fi;
221 if ( echo $ans | grep -w "update_engrid" ) then update_engrid; fi;
222 if ( echo $ans | grep -w "rebuild_engrid" ) then rebuild_engrid; fi;
223 if ( echo $ans | grep -w "create_start_engrid" ) then create_start_engrid; fi;
225 echo "SUCCESS"
226 exit 0