Ubuntu环境全自动配置FastCAE运行环境脚本
在工作中发现好多同学对FastCAE在Linux环境下的配置不熟悉,特定将整个过程写成脚本,对FastCAE及其依赖库进行了全自动编译安装。脚本是在Ubuntu18.04.6环境下测试的。需要在redhat系列环境使用的只需要把其中的apt命令改成yum,并把后面的包名改成对应的名字即可。如果有任何问题可以加QQ群671925863交流。
脚本代码及相关源码包可以在百度网盘下载。
链接: https://pan.baidu.com/s/1h_gbOlLXmYslrmnnuX9LJQ?pwd=dxyf 提取码: dxyf
1 #/bin/bash 2 # 3 # 本脚本所使用的压缩包可以在百度网盘下载:链接:https://pan.baidu.com/s/1h_gbOlLXmYslrmnnuX9LJQ 提取码:dxyf 4 # 脚本的最新版本下载地址:https://gitee.com/chanyuantiandao/install-script-for-fastcae 5 # 6 echo -e "\033[36m/************************************************\n \033[0m" 7 echo -e "\033[36m*** Automatic installation script for FastCAE ***\n \033[0m" 8 echo -e "\033[36m*** FastCAE Version: 2.5.0+(20220219) ***\n \033[0m" 9 echo -e "\033[36m*** http://www.fastcae.com/ ***\n \033[0m" 10 echo -e "\033[36m************************************************/ \033[0m" 11 12 usage () 13 { 14 cat <<EOF 15 Usage: 16 $0 [-p FastCAEPath] [-v VTKVersion] 17 Description: 18 -p FastCAEPath path to store the FastCAE source code 19 -v VTKVersion version of vtk to use, only can be 6(OpenGL version >= 2.2) or 9(OpenGL version >= 3.2) 20 21 --help print this message 22 EOF 23 exit 1 24 } 25 26 27 if [ $# -ge 1 ]; then 28 if [ $1 = "--help" ]; then 29 usage 30 fi 31 fi 32 33 34 versionLessThan () 35 { 36 test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; 37 } 38 39 40 type glxinfo > /dev/null 2>&1 || sudo apt install mesa-utils -y; 41 42 if [ $? -ne 0 ]; then 43 echo "Failed to install command 'glxinfo', may be has no connection with internet!" 44 exit 1 45 fi 46 47 OPENGL=$(glxinfo | grep "OpenGL version"); 48 49 OPENGLVERSION=${OPENGL:23:3}; 50 51 ISVTK6="NO"; 52 53 SUCCESS=0 54 FAIL=1 55 WORKDIR=$(pwd) 56 TEMPDIR=${WORKDIR}/temp 57 PACKAGEDIR=${WORKDIR}/package 58 59 FASTCAESOURCEINSTALLDIR=${WORKDIR}/FastCAE 60 61 62 63 while getopts ":pv:" OPTNAME 64 do 65 case "${OPTNAME}" in 66 "v") 67 if [ ${OPTARG} -eq 6 ]; then 68 ISVTK6="YES" 69 elif [ ${OPTARG} -eq 9 ]; then 70 ISVTK6="NO" 71 else 72 echo "Invalid parameter value for -v" 73 exit 1 74 fi 75 ;; 76 "p") 77 if [ -d ${OPTARG} ]; then 78 FASTCAESOURCEINSTALLDIR=${OPTARG} 79 else 80 echo "Invalid parameter value for -p" 81 exit 1 82 fi 83 ;; 84 "?") 85 echo "UnKnown Option ${OPTARG}" 86 exit 1 87 ;; 88 ":") 89 echo "No argument value for option ${OPTARG}" 90 exit 1 91 ;; 92 "*") 93 echo "UnKnow error while processing options" 94 exit 1 95 ;; 96 esac 97 done 98 99 if versionLessThan ${OPENGLVERSION} 2.2; then 100 echo "OpenGL version is too low to install FastCAE, version 2.2+ is required!"; 101 exit 1; 102 elif versionLessThan ${OPENGLVERSION} 3.2; then 103 read -p "OpenGL version is not enough to 3.2, FastCAE will be installed which is builded with vtk-6.1.0, continue?[y/n]: " ISCONTINUE 104 if [ ${ISCONTINUE} != "y" ] && [ ${ISCONTINUE} != "Y" ]; then 105 exit 0; 106 fi 107 ISVTK6="YES"; 108 unset ISCONTINUE; 109 else 110 echo "OpenGL version: " $OPENGLVERSION; 111 fi 112 unset OPENGL 113 unset OPENGLVERSION 114 115 read -p "Run this script will take 2 hours, continue?[y/n]: " ISCONTINUE 116 117 if [ ${ISCONTINUE} != "y" ] && [ ${ISCONTINUE} != "Y" ]; then 118 exit 119 fi 120 121 if [ ! -w $(pwd) ]; then 122 echo -e "\033[31mHave no write right to current dirctory, please run as root! \033[0m" 123 exit 124 fi 125 126 if [ "FASTCAE${VARPWD}" = "FASTCAE" ]; then 127 read -p "Input password for running 'sudo ...' command: " VARPWD 128 fi 129 130 if [ ${FASTCAESOURCEINSTALLDIR} = ${WORKDIR}/FastCAE ]; then 131 read -p "This script will install FastCAE source to ${WORKDIR}/FastCAE, input [y] accept the location or input a new location: " FASTCAEINPUT 132 if [ ${FASTCAEINPUT} != "y" ] && [ ${FASTCAEINPUT} != "Y" ]; then 133 mkdir -p ${FASTCAEINPUT} 134 while [[ $? -ne 0 ]]; do 135 read -p "Please input a valid path: " FASTCAEINPUT 136 mkdir -p ${FASTCAEINPUT} 137 done 138 fi 139 140 if [ -d ${FASTCAEINPUT} ]; then 141 FASTCAESOURCEINSTALLDIR=${FASTCAEINPUT} 142 fi 143 fi 144 145 146 output=`echo -e "\033[36mSet work dir to $WORKDIR \033[0m"` 147 echo $output 148 149 testColor () 150 { 151 echo "\033[30m==30== \033[0m" 152 echo "\033[31m==31== \033[0m" 153 echo "\033[32m==32== \033[0m" 154 echo "\033[33m==33== \033[0m" 155 echo "\033[34m==34== \033[0m" 156 echo "\033[35m==35== \033[0m" 157 echo "\033[36m==36== \033[0m" 158 echo "\033[37m==37== \033[0m" 159 echo "\033[38m==38== \033[0m" 160 echo "\033[39m==39== \033[0m" 161 } 162 163 commandExist () 164 { 165 type $1 > /dev/null 2>&1 || return 1; 166 } 167 168 installLibressl280 () 169 { 170 if ! -f /opt/ssllib/bin/openssl; then 171 tar -zxvf ${PACKAGEDIR}/libressl-2.8.0.tar.gz -C ${TEMPDIR} 172 cd ${TEMPDIR}/libressl-2.8.0 173 ./configure --prefix=/opt/ssllib 174 make 175 if [ $? -ne 0 ]; then 176 return ${FAIL} 177 fi 178 echo ${VARPWD} | sudo make install 179 if [ $? -eq 0 ]; then 180 echo ${VARPWD} | sudo mv /usr/bin/openssl /usr/bin/openssl.bak 181 echo ${VARPWD} | sudo mv /usr/include/openssl /usr/include/openssl.bak 182 echo ${VARPWD} | sudo ln -s /opt/ssllib/bin/openssl /usr/bin/openssl 183 echo ${VARPWD} | sudo ln -s /opt/ssllib/include/openssl /usr/include/openssl 184 185 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/libressl-2.8.0/ 186 return ${SUCCESS} 187 else 188 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/libressl-2.8.0/ 189 return ${FAIL} 190 fi 191 else 192 return ${SUCCESS} 193 fi 194 } 195 installPython () 196 { 197 if [ ! -f /opt/python-3.7.0/bin/python3 ]; then 198 199 if ! installLibressl280; then 200 return ${FAIL} 201 fi 202 203 if ! installTclTk; then 204 return ${FAIL} 205 fi 206 cd ${WORKDIR} 207 echo ${VARPWD} | sudo -S apt-get install zlib1g -y 208 if [ $? -ne 0 ]; then 209 return ${FAIL} 210 fi 211 echo ${VARPWD} | sudo -S apt-get install build-essential python-dev python-setuptools python3-pip libreadline-dev libdb-dev -y 212 if [ $? -ne 0 ]; then 213 return ${FAIL} 214 fi 215 echo ${VARPWD} | sudo -S apt-get install libpcap-dev libexpat1-dev libbz2-dev libncurses5-dev xz-utils liblzma-dev libncursesw5-dev -y 216 if [ $? -ne 0 ]; then 217 return ${FAIL} 218 fi 219 echo ${VARPWD} | sudo -S apt-get install libgdbm-dev libc6-dev libsqlite3-dev libffi-dev -y 220 if [ $? -ne 0 ]; then 221 return ${FAIL} 222 fi 223 echo -e "\033[32mBegin install python3.7.0... \033[0m" 224 225 tar -zxvf ${PACKAGEDIR}/Python-3.7.0.tgz -C ${TEMPDIR} 226 cd ${TEMPDIR}/Python-3.7.0/ 227 ./configure --enable-optimizations --prefix=/opt/python-3.7.0 --with-ssl --enable-shared CFLAGS=-fPIC 228 export CPPFLAGS=" -Wno-error=coverage-mismatch" 229 make 230 echo ${VARPWD} | sudo -S make install 231 if [ $? -eq 0 ]; then 232 echo -e "\033[32mPython-3.7.0 has been installed into /opt/python-3.7.0 successfully! \033[0m" 233 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/Python-3.7.0/ 234 return ${SUCCESS} 235 else 236 echo -e "\033[31mFailed to install Python-3.7.0! \033[0m" 237 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/Python-3.7.0/ 238 return ${FAIL} 239 fi 240 241 else 242 echo -e "\036[36mPython-3.7.0 has been installed! \033[0m" 243 return ${SUCCESS} 244 fi 245 } 246 247 installQt5142 () 248 { 249 if [ ! -f /opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake ]; then 250 echo -e "\033[31mQt5.14.2 will be install next step, the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! \033[0m" 251 chmod +x ${PACKAGEDIR}/qt-opensource-linux-x64-5.14.2.run 252 ${PACKAGEDIR}/qt-opensource-linux-x64-5.14.2.run 253 fi 254 255 if [ ! -f /opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake ]; then 256 echo -e "\033[31mQt5.14.2 need to be installed frist! the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! The reasons may be as follows: \033[0m" 257 echo -e "\033[31m\t(1) The installation directory is not set to /opt/Qt5.14.2/ \033[0m" 258 echo -e "\033[31m\t(2) The component 'Desktop gcc 64-bit' is not checked! \033[0m" 259 echo -e "The installation medium is located at ${WORKDIR}/package/qt-opensource-linux-x64-5.14.2.run" 260 return ${FAIL} 261 else 262 return ${SUCCESS} 263 fi 264 } 265 266 installQt542 () 267 { 268 if [ ! -f /opt/Qt5.4.2/5.4/gcc_64/bin/qmake ]; then 269 echo -e "\033[31mQt5.4.2 will be install next step, the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! \033[0m" 270 chmod +x ${PACKAGEDIR}/qt-opensource-linux-x64-5.4.2.run 271 ${PACKAGEDIR}/qt-opensource-linux-x64-5.4.2.run 272 fi 273 274 if [ ! -f /opt/Qt5.4.2/5.4/gcc_64/bin/qmake ]; then 275 echo -e "\033[31mQt5.4.2 need to be installed frist! the component 'Desktop gcc 64-bit' and 'Qt WebEngine' are necessary! The reasons may be as follows: \033[0m" 276 echo -e "\033[31m\t(1) The installation directory is not set to /opt/Qt5.4.2/ \033[0m" 277 echo -e "\033[31m\t(2) The component 'Desktop gcc 64-bit' is not checked! \033[0m" 278 echo -e "The installation medium is located at ${WORKDIR}/package/qt-opensource-linux-x64-5.4.2.run" 279 return ${FAIL} 280 else 281 return ${SUCCESS} 282 fi 283 } 284 285 installCmake3213 () 286 { 287 if [ ! -f /opt/cmake-3.21/bin/cmake ]; then 288 chmod +x ${PACKAGEDIR}/cmake-3.21.3-linux-x86_64.sh 289 echo ${VARPWD} | sudo -S mkdir -p /opt/cmake-3.21/ 290 echo ${VARPWD} | sudo -S ${PACKAGEDIR}/cmake-3.21.3-linux-x86_64.sh --prefix=/opt/cmake-3.21 --skip-license 291 if [ $? -eq 0 ]; then 292 return ${SUCCESS} 293 else 294 return ${FAIL} 295 fi 296 else 297 return ${SUCCESS} 298 fi 299 } 300 301 installCmake2812 () 302 { 303 if [ ! -f /opt/cmake-2.8/bin/cmake ]; then 304 tar -zxvf ${PACKAGEDIR}/cmake-2.8.12.2.tar.gz -C ${TEMPDIR} 305 cd ${TEMPDIR}/cmake-2.8.12.2/ 306 echo ${VARPWD} | sudo -S mkdir -p /opt/cmake-2.8/ 307 ./configure --no-qt-gui --prefix=/opt/cmake-2.8/ 308 make 309 echo ${VARPWD} | sudo make install 310 if [ $? -eq 0 ]; then 311 return ${SUCCESS} 312 else 313 return ${FAIL} 314 fi 315 else 316 return ${SUCCESS} 317 fi 318 } 319 320 installQwt () 321 { 322 if [ ! -f ${TEMPDIR}/qwtpolar-1.1.1/bin/lib/libqwtpolar.so ]; then 323 echo -e "\033[32mBegin install qwt6.1.6... \033[0m" 324 mkdir -p ${TEMPDIR}/qwt-6.1.6/source/ 325 mkdir -p ${TEMPDIR}/qwt-6.1.6/bin/ 326 tar -jxvf ${PACKAGEDIR}/qwt-6.1.6.tar.bz2 -C ${TEMPDIR}/qwt-6.1.6/source/ 327 cd ${TEMPDIR}/qwt-6.1.6/source/ 328 329 # default install path: /usr/local/qwt-6.1.6 330 # replace it to: ${TEMPDIR}/qwt-6.1.6 331 sed -i "s@/usr/local/qwt-\$\$QWT_VERSION@${TEMPDIR}/qwt-\$\$QWT_VERSION/bin@" ${TEMPDIR}/qwt-6.1.6/source/qwt-6.1.6/qwtconfig.pri 332 cd ${TEMPDIR}/qwt-6.1.6/source/qwt-6.1.6/ 333 ${QMAKE} qwt.pro 334 make 335 make install 336 if [ $? -eq 0 ]; then 337 echo -e "\033[32mFinish install qwt6.1.6! \033[0m" 338 echo -e "\033[32mBegin install qwtpolar-1.1.1... \033[0m" 339 mkdir -p ${TEMPDIR}/qwtpolar-1.1.1/source/ 340 mkdir -p ${TEMPDIR}/qwtpolar-1.1.1/bin/ 341 tar -jxvf ${PACKAGEDIR}/qwtpolar-1.1.1.tar.bz2 -C ${TEMPDIR}/qwtpolar-1.1.1/source/ 342 cd ${TEMPDIR}/qwtpolar-1.1.1/source/qwtpolar-1.1.1/ 343 344 #installpath:/usr/local/qwtpolar-1.1.1 345 # replace it to: ${TEMPDIR}/qwtpolar-1.1.1 346 sed -i "s@/usr/local/qwtpolar-\$\$QWT_POLAR_VERSION@${TEMPDIR}/qwtpolar-\$\$QWT_POLAR_VERSION/bin@" ${TEMPDIR}/qwtpolar-1.1.1/source/qwtpolar-1.1.1/qwtpolarconfig.pri 347 echo "INCLUDEPATH += ${TEMPDIR}/qwt-6.1.6/bin/include/" >> qwtpolarconfig.pri 348 echo "LIBS += -L${TEMPDIR}/qwt-6.1.6/bin/lib -lqwt" >> qwtpolarconfig.pri 349 350 ${QMAKE} qwtpolar.pro 351 make 352 make install 353 if [ $? -eq 0 ]; then 354 echo -e "\033[32mFinish install qwtpolar-1.1.1! \033[0m" 355 return ${SUCCESS} 356 else 357 echo -e "\033[31mFailed to install qwtpolar-1.1.1! \033[0m" 358 return ${FAIL} 359 fi 360 361 else 362 echo -e "\033[31mFailed to install qwt6.1.6! \033[0m" 363 return ${FAIL} 364 fi 365 else 366 return ${SUCCESS} 367 fi 368 } 369 370 installQuazip () 371 { 372 if [ ! -f ${TEMPDIR}/quazip-0.7.3/bin/lib/libquazip.so ]; then 373 echo -e "\033[32mBegin install quazip-0.7.3... \033[0m" 374 mkdir -p ${TEMPDIR}/quazip-0.7.3/source 375 mkdir -p ${TEMPDIR}/quazip-0.7.3/bin 376 tar -zxvf ${WORKDIR}/package/quazip-0.7.3.tar.gz -C ${TEMPDIR}/quazip-0.7.3/source 377 cd ${TEMPDIR}/quazip-0.7.3/source/quazip-0.7.3/ 378 ${QMAKE} PREFIX=${TEMPDIR}/quazip-0.7.3/bin 379 380 make 381 make install 382 if [ $? -eq 0 ]; then 383 echo -e "\033[32mFinish install quazip-0.7.3! \033[0m" 384 return ${SUCCESS} 385 else 386 echo -e "\033[31mFailed to install quazip-0.7.3! \033[0m" 387 return ${FAIL} 388 fi 389 else 390 return ${SUCCESS} 391 fi 392 393 } 394 395 installVtk901 () 396 { 397 if [ ! -f ${TEMPDIR}/vtk-9.0.1/install/lib/libvtkRenderingCore-9.0.so ]; then 398 echo -e "\033[32mBegin install vtk-9.0.1... \033[0m" 399 mkdir -p ${TEMPDIR}/vtk-9.0.1/source/ 400 mkdir -p ${TEMPDIR}/vtk-9.0.1/build/ 401 mkdir -p ${TEMPDIR}/vtk-9.0.1/install/ 402 tar -zxvf ${PACKAGEDIR}/VTK-9.0.1.tar.gz -C ${TEMPDIR}/vtk-9.0.1/source 403 cd ${TEMPDIR}/vtk-9.0.1/build/ 404 ${CMAKE} -DVTK_PYTHON_VERSION=3 -DVTK_GROUP_ENABLE_Qt=YES -DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES -DVTK_MODULE_ENABLE_VTK_GUISupportQtSQL=YES -DVTK_MODULE_ENABLE_VTK_RenderingQt=YES -DVTK_MODULE_ENABLE_VTK_ViewsQt=YES -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/vtk-9.0.1/install -DQt5_DIR=/opt/Qt5.14.2/5.14.2/gcc_64/lib/cmake/Qt5 -S ${TEMPDIR}/vtk-9.0.1/source/VTK-9.0.1 -B ${TEMPDIR}/vtk-9.0.1/build 405 cd ${TEMPDIR}/vtk-9.0.1/build 406 make 407 make install 408 if [ $? -eq 0 ]; then 409 echo -e "\033[32mFinish install vtk-9.0.1! \033[0m" 410 return ${SUCCESS} 411 else 412 echo -e "\033[31mFailed to install vtk-9.0.1! \033[0m" 413 return ${FAIL} 414 fi 415 else 416 return ${SUCCESS} 417 fi 418 } 419 420 installVtk610 () 421 { 422 if [ ! -f ${TEMPDIR}/vtk-9.0.1/install/lib/libvtkRenderingCore-9.0.so ]; then 423 echo -e "\033[32mBegin install vtk-6.1.0... \033[0m" 424 mkdir -p ${TEMPDIR}/vtk-6.1.0/source/ 425 mkdir -p ${TEMPDIR}/vtk-6.1.0/build/ 426 mkdir -p ${TEMPDIR}/vtk-6.1.0/install/ 427 tar -zxvf ${PACKAGEDIR}/VTK-6.1.0.tar.gz -C ${TEMPDIR}/vtk-6.1.0/source 428 tar -zxvf ${PACKAGEDIR}/VTKData-6.1.0.tar.gz -C ${TEMPDIR}/vtk-6.1.0/source 429 cd ${TEMPDIR}/vtk-6.1.0/build/ 430 sed -i 's/if(${_gcc_version} VERSION_GREATER 4.2.0 AND BUILD_SHARED_LIBS/if(_gcc_version VERSION_GREATER "4.2.0" AND BUILD_SHARED_LIBS/' ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/CMake/vtkCompilerExtras.cmake 431 sed -i 's/if(${_gcc_version} VERSION_LESS "4.2")/if(_gcc_version VERSION_LESS "4.2")/' ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/CMake/GenerateExportHeader.cmake 432 #${CMAKE} -D VTK_PYTHON_VERSION:STRING=3 -D VTK_GROUP_ENABLE_Qt:BOOL=YES -D CMAKE_CONFIGURATION_TYPES:STRING=Release -D VTK_MODULE_ENABLE_VTK_GUISupportQt:BOOL=YES -D VTK_MODULE_ENABLE_VTK_RenderingQt:BOOL=YES -D VTK_MODULE_ENABLE_VTK_ViewsQt:BOOL=YES -D CMAKE_INSTALL_PREFIX:STRING=${TEMPDIR}/vtk-6.1.0/install -D Qt5_DIR:STRING=/opt/Qt5.4.2/5.4/gcc_64/lib/cmake/Qt5 ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/ 433 434 ${CMAKE} -D VTK_Group_Qt:BOOL=YES -D VTK_QT_VERSION:STRING=5 -D CMAKE_INSTALL_PREFIX:STRING=${TEMPDIR}/vtk-6.1.0/install -D CMAKE_PREFIX_PATH:STRING=/opt/Qt5.4.2/5.4/gcc_64 -D CMAKE_CONFIGURATION_TYPES:STRING=Release -DCMAKE_C_FLAGS=-DGLX_GLXEXT_LEGACY -DCMAKE_CXX_FLAGS=-DGLX_GLXEXT_LEGACY -Wno-dev ${TEMPDIR}/vtk-6.1.0/source/VTK-6.1.0/ 435 make 436 make install 437 if [ $? -eq 0 ]; then 438 echo -e "\033[32mFinish install vtk-6.1.0! \033[0m" 439 return ${SUCCESS} 440 else 441 echo -e "\033[31mFailed to install vtk-6.1.0! \033[0m" 442 return ${FAIL} 443 fi 444 else 445 return ${SUCCESS} 446 fi 447 } 448 449 installTclTk () 450 { 451 if ! commandExist tclsh; then 452 if ! commandExist tclsh8.6; then 453 echo -e "\033[32mBegin install tcl/tk... \033[0m" 454 mkdir -p ${TEMPDIR}/tcltk/ 455 unzip ${PACKAGEDIR}/tcl8611-src.zip -d ${TEMPDIR}/tcltk/ 456 unzip ${PACKAGEDIR}/tk86111-src.zip -d ${TEMPDIR}/tcltk/ 457 cd ${TEMPDIR}/tcltk/tcl8.6.11/unix/ 458 ./configure --enable-gcc --enable-shared --enable-threads --enable-64bit 459 make 460 echo ${VARPWD} | sudo -S make install 461 if [ $? -eq 0 ]; then 462 cd ${TEMPDIR}/tcltk/tk8.6.11/unix/ 463 ./configure --enable-gcc --enable-shared --enable-threads --enable-64bit 464 make 465 echo ${VARPWD} | sudo -S make install 466 if [ $? -eq 0 ]; then 467 echo -e "\033[32mFinish install tcl/tk! \033[0m" 468 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/tcltk/ 469 return ${SUCCESS} 470 else 471 echo -e "\033[31mFailed to install tk! \033[0m" 472 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/tcltk/ 473 return ${FAIL} 474 fi 475 else 476 echo -e "\033[31mFailed to install tcl! \033[0m" 477 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/tcltk/ 478 return ${FAIL} 479 fi 480 else 481 echo ${VARPWD} | sudo ln -s $(which tclsh8.6) /usr/bin/tclsh 482 return ${SUCCESS} 483 fi 484 else 485 return ${SUCCESS} 486 fi 487 } 488 489 installFreeImage () 490 { 491 if [ ! -f /usr/lib/libfreeimage.so ]; then 492 echo -e "\033[32mBegin install FreeImage... \033[0m" 493 unzip ${PACKAGEDIR}/FreeImage3180.zip -d ${TEMPDIR} 494 cd ${TEMPDIR}/FreeImage/ 495 make 496 echo ${VARPWD} | sudo -S make install 497 if [ $? -eq 0 ]; then 498 echo -e "\033[32mFinish install FreeImage! \033[0m" 499 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/FreeImage/ 500 return ${SUCCESS} 501 else 502 echo -e "\033[31mFailed to install FreeImage! \033[0m" 503 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/FreeImage/ 504 return ${FAIL} 505 fi 506 507 else 508 return ${SUCCESS} 509 fi 510 } 511 512 installFreeType () 513 { 514 if [ ! -f /usr/local/lib/libfreetype.so ]; then 515 echo -e "\033[32mBegin install FreeType... \033[0m" 516 tar -zxvf ${PACKAGEDIR}/freetype-2.11.1.tar.gz -C ${TEMPDIR} 517 cd ${TEMPDIR}/freetype-2.11.1/ 518 ./configure 519 if [ $? -eq 0 ]; then 520 make 521 echo ${VARPWD} | sudo -S make install 522 if [ $? -eq 0 ]; then 523 echo -e "\033[32mFinish install FreeType! \033[0m" 524 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/freetype-2.11.1/ 525 return ${SUCCESS} 526 else 527 echo -e "\033[31mFailed to install FreeType! \033[0m" 528 echo ${VARPWD} | sudo rm -rf ${TEMPDIR}/freetype-2.11.1/ 529 return ${FAIL} 530 fi 531 else 532 echo -e "\033[31mFailed to install FreeType! \033[0m" 533 return ${FAIL} 534 fi 535 else 536 return ${SUCCESS} 537 fi 538 } 539 540 installOpenCascade () 541 { 542 if [ ! -f ${TEMPDIR}/occ-7.5.0/install/lib/libTKIVtk.so ]; then 543 echo -e "\033[32mBegin install occ-7.5.0... \033[0m" 544 cd ${WORKDIR} 545 echo ${VARPWD} | sudo -S apt install libxi-dev -y 546 mkdir -p ${TEMPDIR}/occ-7.5.0/source/ 547 mkdir -p ${TEMPDIR}/occ-7.5.0/build/ 548 mkdir -p ${TEMPDIR}/occ-7.5.0/install/ 549 tar -zxvf ${PACKAGEDIR}/opencascade-7.5.0.tgz -C ${TEMPDIR}/occ-7.5.0/source/ 550 cd ${TEMPDIR}/occ-7.5.0/build/ 551 552 if [ ${ISVTK6} = "YES" ]; then 553 ${CMAKE} -DUSE_FREEIMAGE=TRUE -DUSE_VTK=TRUE -D3RDPARTY_VTK_DIR=${FASTCAESOURCEINSTALLDIR}/VTK -D3RDPARTY_VTK_INCLUDE_DIR=${FASTCAESOURCEINSTALLDIR}/VTK/include/vtk-6.1 -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/occ-7.5.0/install/ -S ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0 -B ${TEMPDIR}/occ-7.5.0/build/ 554 else 555 ${CMAKE} -DUSE_FREEIMAGE=TRUE -DUSE_VTK=TRUE -D3RDPARTY_VTK_DIR=${FASTCAESOURCEINSTALLDIR}/VTK -D3RDPARTY_VTK_INCLUDE_DIR=${FASTCAESOURCEINSTALLDIR}/VTK/include/vtk-9.0 -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/occ-7.5.0/install/ -S ${TEMPDIR}/occ-7.5.0/source/opencascade-7.5.0 -B ${TEMPDIR}/occ-7.5.0/build/ 556 sed -i 's/all: src\/TKIVtkDraw\/all/#all: src\/TKIVtkDraw\/all/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2 557 sed -i 's/preinstall: src\/TKIVtkDraw\/preinstall/#preinstall: src\/TKIVtkDraw\/preinstall/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2 558 sed -i 's/clean: src\/TKIVtkDraw\/clean/#clean: src\/TKIVtkDraw\/clean/' ${TEMPDIR}/occ-7.5.0/build/CMakeFiles/Makefile2 559 sed -i "s@include(\"${TEMPDIR}/occ-7.5.0/build/src/TKIVtkDraw/cmake_install.cmake\")@#include(\"${TEMPDIR}/occ-7.5.0/build/src/TKIVtkDraw/cmake_install.cmake\")@" ${TEMPDIR}/occ-7.5.0/build/cmake_install.cmake 560 fi 561 make 562 make install 563 if [ $? -eq 0 ]; then 564 echo -e "\033[32mFinish install occ-7.5.0! \033[0m" 565 return ${SUCCESS} 566 else 567 echo -e "\033[31mFailed install occ-7.5.0! \033[0m" 568 return ${FAIL} 569 fi 570 else 571 return ${SUCCESS} 572 fi 573 } 574 575 installHdf5_bak () 576 { 577 mkdir -p ${TEMPDIR}/hdf5-1.12.1/source/ 578 mkdir -p ${TEMPDIR}/hdf5-1.12.1/bin/ 579 tar -zxvf ${PACKAGEDIR}/hdf5-1.12.1.tar.gz -C ${TEMPDIR}/hdf5-1.12.1/source/ 580 cd ${TEMPDIR}/hdf5-1.12.1/source/hdf5-1.12.1/ 581 ./configure --prefix=${TEMPDIR}/hdf5-1.12.1/bin 582 make 583 make install 584 if [ $? -eq 0 ]; then 585 echo -e "\033[32mFinish install hdf5-1.12.1! \033[0m" 586 return ${SUCCESS} 587 else 588 echo -e "\033[31mFailed to install hdf5-1.12.1! \033[0m" 589 return ${FAIL} 590 fi 591 } 592 593 installHdf5BySource () 594 { 595 mkdir -p ${TEMPDIR}/hdf5-1.12.1/source/ 596 mkdir -p ${TEMPDIR}/hdf5-1.12.1/build/ 597 mkdir -p ${TEMPDIR}/hdf5-1.12.1/install/ 598 cd ${TEMPDIR}/hdf5-1.12.1/build/ 599 echo -e '#include <float.h>\n#include <stdio.h>\n#define CHECK_FLOAT128 _SIZEOF___FLOAT128\n#if CHECK_FLOAT128!=0\n#if _HAVE_QUADMATH_H!=0\n#include <quadmath.h>\n#endif\n#ifdef FLT128_DIG\n#define C_FLT128_DIG FLT128_DIG\n#else\n#define C_FLT128_DIG 0\n#endif\n#else\n#define C_FLT128_DIG 0\n#endif\n#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n#define C_LDBL_DIG DECIMAL_DIG\n#else\n#define C_LDBL_DIG LDBL_DIG\n#endif\nint main() {\nFILE *pFile =fopen("pac_Cconftest.out","w");\nfprintf(pFile, "%d;%d;", C_LDBL_DIG, C_FLT128_DIG);\nreturn 0;\n}' > _pac_test.c 600 gcc -o _pac_test _pac_test.c 601 ./_pac_test 602 tar -zxvf ${PACKAGEDIR}/hdf5-1.12.1.tar.gz -C ${TEMPDIR}/hdf5-1.12.1/source/ 603 cd ${TEMPDIR}/hdf5-1.12.1/build/ 604 ${CMAKE} -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log -S ${TEMPDIR}/hdf5-1.12.1/source/ -B ${TEMPDIR}/hdf5-1.12.1/build/ -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/hdf5-1.12.1/install/ 605 make 606 make install 607 if [ $? -eq 0 ]; then 608 echo -e "\033[32mFinish install hdf5-1.12.1! \033[0m" 609 return ${SUCCESS} 610 else 611 echo -e "\033[31mFailed to install hdf5-1.12.1! \033[0m" 612 return ${FAIL} 613 fi 614 } 615 616 installHdf5ByBin () 617 { 618 mkdir -p ${TEMPDIR}/hdf5-1.12.1/ 619 ${PACKAGEDIR}/HDF5-1.12.1-Linux.sh --prefix=${TEMPDIR}/hdf5-1.12.1/ --skip-license 620 if [ $? -ne 0 ]; then 621 exit ${FAIL} 622 else 623 return ${SUCCESS} 624 fi 625 } 626 627 installHdf5ByCmake () 628 { 629 if [ ! -f ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/lib/libhdf5.so ]; then 630 tar -zxvf ${PACKAGEDIR}/CMake-hdf5-1.12.1.tar.gz -C ${TEMPDIR} 631 mv ${TEMPDIR}/CMake-hdf5-1.12.1 ${TEMPDIR}/hdf5-1.12.1 632 cd ${TEMPDIR}/hdf5-1.12.1/ 633 sed -i "s@execute_process (COMMAND cpack -C \${CTEST_CONFIGURATION_TYPE} -V@execute_process (COMMAND /opt/cmake-3.21/bin/cpack -C \${CTEST_CONFIGURATION_TYPE} -V@" ${TEMPDIR}/hdf5-1.12.1/CTestScript.cmake 634 /opt/cmake-3.21/bin/ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log 635 if [ $? -ne 0 ]; then 636 return ${FAIL} 637 fi 638 if [ ! -f ${TEMPDIR}/hdf5-1.12.1/HDF5-1.12.1-Linux.sh ]; then 639 return ${FAIL} 640 fi 641 642 chmod +x ${TEMPDIR}/hdf5-1.12.1/HDF5-1.12.1-Linux.sh 643 ${TEMPDIR}/hdf5-1.12.1/HDF5-1.12.1-Linux.sh --prefix=${TEMPDIR}/hdf5-1.12.1/ --skip-license 644 if [ $? -eq 0 ]; then 645 return ${SUCCESS} 646 else 647 return ${FAIL} 648 fi 649 else 650 return ${SUCCESS} 651 fi 652 } 653 installGlibc () 654 { 655 if [ ! -f /usr/local/glibc-2.29/lib/libc-2.29.so ]; then 656 tar -zxvf ${PACKAGEDIR}/glibc-2.29.tar.gz -C ${TEMPDIR} 657 cd ${TEMPDIR}/glibc-2.29 658 mkdir build && cd build 659 echo ${VARPWD} | sudo -S apt-get install gawk bison -y 660 ${TEMPDIR}/glibc-2.29/configure --prefix=/usr/local/glibc-2.29 661 662 make 663 echo ${VARPWD} | sudo -S make install 664 if [ $? -eq 0 ]; then 665 echo ${VARPWD} | sudo -S cp /usr/local/glibc-2.29/lib/libc-2.29.so /lib64/libc-2.29.so 666 #mv /lib64/libc.so.6 /lib64/libc.so.6.bak 667 #LD_PRELOAD=/lib64/libc-2.27.so 668 echo ${VARPWD} | sudo -S ln -s /lib64/libc-2.29.so /lib64/libc.so.6 669 return $? 670 else 671 return ${FAIL} 672 fi 673 else 674 return ${SUCCESS} 675 fi 676 } 677 installCgns () 678 { 679 if [ ! -f ${TEMPDIR}/cgns-4.2.0/install/include/cgnslib.h ]; then 680 # hdf5最低要求3.12版本的cmake 681 if ! installCmake3213; then 682 exit ${FAIL} 683 fi 684 if ! installHdf5ByCmake; then 685 exit ${FAIL} 686 fi 687 #if ! installGlibc; then 688 # exit ${FAIL} 689 #fi 690 mkdir -p ${TEMPDIR}/cgns-4.2.0/source/ 691 mkdir -p ${TEMPDIR}/cgns-4.2.0/build/ 692 mkdir -p ${TEMPDIR}/cgns-4.2.0/install/ 693 tar -zxvf ${PACKAGEDIR}/CGNS-4.2.0.tar.gz -C ${TEMPDIR}/cgns-4.2.0/source/ 694 cd ${TEMPDIR}/cgns-4.2.0/build/ 695 ${CMAKE} -DCGNS_BUILD_CGNSTOOLS=TRUE -DCGNS_ENABLE_HDF5=TRUE -DHDF5_DIR=${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/share/cmake/hdf5 -DOpenGL_GL_PREFERENCE=LEGACY -DCMAKE_INSTALL_PREFIX=${TEMPDIR}/cgns-4.2.0/install/ -S ${TEMPDIR}/cgns-4.2.0/source/CGNS-4.2.0/ -B ${TEMPDIR}/cgns-4.2.0/build/ 696 697 make 698 make install 699 if [ $? -eq 0 ]; then 700 echo -e "\033[32mFinish install CGNS-4.2.0! \033[0m" 701 return ${SUCCESS} 702 else 703 echo -e "\033[31mFailed to install CGNS-4.2.0! \033[0m" 704 return ${FAIL} 705 fi 706 fi 707 } 708 709 compileFastCAE () 710 { 711 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/python/ 712 cd ${FASTCAESOURCEINSTALLDIR}/build/python/ 713 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/python/python.pro 714 make ver=release 715 if [ $? -ne 0 ]; then 716 echo -e "\033[31mFailed to compile module python! \033[0m" 717 return ${FAIL} 718 fi 719 720 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/settings/ 721 cd ${FASTCAESOURCEINSTALLDIR}/build/settings/ 722 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/settings/setting.pro 723 make ver=release 724 if [ $? -ne 0 ]; then 725 echo -e "\033[31mFailed to compile module setting! \033[0m" 726 return ${FAIL} 727 fi 728 729 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SARibbonBar/ 730 cd ${FASTCAESOURCEINSTALLDIR}/build/SARibbonBar/ 731 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SARibbonBar/SARibbonBar.pro 732 make ver=release 733 if [ $? -ne 0 ]; then 734 echo -e "\033[31mFailed to compile module SARibbonBar! \033[0m" 735 return ${FAIL} 736 fi 737 738 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/DataProperty/ 739 cd ${FASTCAESOURCEINSTALLDIR}/build/DataProperty/ 740 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/DataProperty/DataProperty.pro 741 make ver=release 742 if [ $? -ne 0 ]; then 743 echo -e "\033[31mFailed to compile module DataProperty! \033[0m" 744 return ${FAIL} 745 fi 746 747 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/meshData/ 748 cd ${FASTCAESOURCEINSTALLDIR}/build/meshData/ 749 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/meshData/meshData.pro 750 make ver=release 751 if [ $? -ne 0 ]; then 752 echo -e "\033[31mFailed to compile module meshData! \033[0m" 753 return ${FAIL} 754 fi 755 756 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SelfDefObject/ 757 cd ${FASTCAESOURCEINSTALLDIR}/build/SelfDefObject/ 758 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SelfDefObject/SelfDefObject.pro 759 make ver=release 760 if [ $? -ne 0 ]; then 761 echo -e "\033[31mFailed to compile module SelfDefObject! \033[0m" 762 return ${FAIL} 763 fi 764 765 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/Material/ 766 cd ${FASTCAESOURCEINSTALLDIR}/build/Material/ 767 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/Material/Material.pro 768 make ver=release 769 if [ $? -ne 0 ]; then 770 echo -e "\033[31mFailed to compile module Material! \033[0m" 771 return ${FAIL} 772 fi 773 774 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/BCBase/ 775 cd ${FASTCAESOURCEINSTALLDIR}/build/BCBase/ 776 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/BCBase/BCBase.pro 777 make ver=release 778 if [ $? -ne 0 ]; then 779 echo -e "\033[31mFailed to compile module BCBase! \033[0m" 780 return ${FAIL} 781 fi 782 783 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SolutionDataIO/ 784 cd ${FASTCAESOURCEINSTALLDIR}/build/SolutionDataIO/ 785 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SolutionDataIO/SolutionDataIO.pro 786 make ver=release 787 if [ $? -ne 0 ]; then 788 echo -e "\033[31mFailed to compile module SolutionDataIO! \033[0m" 789 return ${FAIL} 790 fi 791 792 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ConfigOptions/ 793 cd ${FASTCAESOURCEINSTALLDIR}/build/ConfigOptions/ 794 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ConfigOptions/ConfigOptions.pro 795 make ver=release 796 if [ $? -ne 0 ]; then 797 echo -e "\033[31mFailed to compile module ConfigOptions! \033[0m" 798 return ${FAIL} 799 fi 800 801 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ParaClassFactory/ 802 cd ${FASTCAESOURCEINSTALLDIR}/build/ParaClassFactory/ 803 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ParaClassFactory/ParaClassFactory.pro 804 make ver=release 805 if [ $? -ne 0 ]; then 806 echo -e "\033[31mFailed to compile module ParaClassFactory! \033[0m" 807 return ${FAIL} 808 fi 809 810 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/HeuDataSrcIO/ 811 cd ${FASTCAESOURCEINSTALLDIR}/build/HeuDataSrcIO/ 812 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/HeuDataSrcIO/HeuDataSrcIO.pro 813 make ver=release 814 if [ $? -ne 0 ]; then 815 echo -e "\033[31mFailed to compile module HeuDataSrcIO! \033[0m" 816 return ${FAIL} 817 fi 818 819 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/geometry/ 820 cd ${FASTCAESOURCEINSTALLDIR}/build/geometry/ 821 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/geometry/geometry.pro 822 make ver=release 823 if [ $? -ne 0 ]; then 824 echo -e "\033[31mFailed to compile module geometry! \033[0m" 825 return ${FAIL} 826 fi 827 828 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ModelData/ 829 cd ${FASTCAESOURCEINSTALLDIR}/build/ModelData/ 830 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ModelData/modelData.pro 831 make ver=release 832 if [ $? -ne 0 ]; then 833 echo -e "\033[31mFailed to compile module modelData! \033[0m" 834 return ${FAIL} 835 fi 836 837 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/CurveAnalyse/ 838 cd ${FASTCAESOURCEINSTALLDIR}/build/CurveAnalyse/ 839 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/CurveAnalyse/CurveAnalyse.pro 840 make ver=release 841 if [ $? -ne 0 ]; then 842 echo -e "\033[31mFailed to compile module CurveAnalyse! \033[0m" 843 return ${FAIL} 844 fi 845 846 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/moduleBase/ 847 cd ${FASTCAESOURCEINSTALLDIR}/build/moduleBase/ 848 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/moduleBase/moduleBase.pro 849 make ver=release 850 if [ $? -ne 0 ]; then 851 echo -e "\033[31mFailed to compile module moduleBase! \033[0m" 852 return ${FAIL} 853 fi 854 855 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GraphicsAnalyse/ 856 cd ${FASTCAESOURCEINSTALLDIR}/build/GraphicsAnalyse/ 857 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GraphicsAnalyse/GraphicsAnalyse.pro 858 make ver=release 859 if [ $? -ne 0 ]; then 860 echo -e "\033[31mFailed to compile module GraphicsAnalyse! \033[0m" 861 return ${FAIL} 862 fi 863 864 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PostWidgets/ 865 cd ${FASTCAESOURCEINSTALLDIR}/build/PostWidgets/ 866 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PostWidgets/PostWidgets.pro 867 make ver=release 868 if [ $? -ne 0 ]; then 869 echo -e "\033[31mFailed to compile module PostWidgets! \033[0m" 870 return ${FAIL} 871 fi 872 873 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GeometryDataExchange/ 874 cd ${FASTCAESOURCEINSTALLDIR}/build/GeometryDataExchange/ 875 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GeometryDataExchange/GeometryDataExchange.pro 876 make ver=release 877 if [ $? -ne 0 ]; then 878 echo -e "\033[31mFailed to compile module GeometryDataExchange! \033[0m" 879 return ${FAIL} 880 fi 881 882 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/IO/ 883 cd ${FASTCAESOURCEINSTALLDIR}/build/IO/ 884 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/IO/IO.pro 885 make ver=release 886 if [ $? -ne 0 ]; then 887 echo -e "\033[31mFailed to compile module IO! \033[0m" 888 return ${FAIL} 889 fi 890 891 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ProjectTree/ 892 cd ${FASTCAESOURCEINSTALLDIR}/build/ProjectTree/ 893 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ProjectTree/projectTree.pro 894 make ver=release 895 if [ $? -ne 0 ]; then 896 echo -e "\033[31mFailed to compile module projectTree! \033[0m" 897 return ${FAIL} 898 fi 899 900 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GeometryCommand/ 901 cd ${FASTCAESOURCEINSTALLDIR}/build/GeometryCommand/ 902 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GeometryCommand/geometryCommand.pro 903 make ver=release 904 if [ $? -ne 0 ]; then 905 echo -e "\033[31mFailed to compile module geometryCommand! \033[0m" 906 return ${FAIL} 907 fi 908 909 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/SolverControl/ 910 cd ${FASTCAESOURCEINSTALLDIR}/build/SolverControl/ 911 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/SolverControl/solverControl.pro 912 make ver=release 913 if [ $? -ne 0 ]; then 914 echo -e "\033[31mFailed to compile module solverControl! \033[0m" 915 return ${FAIL} 916 fi 917 918 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/ProjectTreeExtend/ 919 cd ${FASTCAESOURCEINSTALLDIR}/build/ProjectTreeExtend/ 920 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/ProjectTreeExtend/ProjectTreeExtend.pro 921 make ver=release 922 if [ $? -ne 0 ]; then 923 echo -e "\033[31mFailed to compile module ProjectTreeExtend! \033[0m" 924 return ${FAIL} 925 fi 926 927 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/GeometryWidgets/ 928 cd ${FASTCAESOURCEINSTALLDIR}/build/GeometryWidgets/ 929 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/GeometryWidgets/geometryWidgets.pro 930 make ver=release 931 if [ $? -ne 0 ]; then 932 echo -e "\033[31mFailed to compile module geometryWidgets! \033[0m" 933 return ${FAIL} 934 fi 935 936 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/MainWidgets/ 937 cd ${FASTCAESOURCEINSTALLDIR}/build/MainWidgets/ 938 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/MainWidgets/mainwidgets.pro 939 make ver=release 940 if [ $? -ne 0 ]; then 941 echo -e "\033[31mFailed to compile module mainwidgets! \033[0m" 942 return ${FAIL} 943 fi 944 945 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PluginManager/ 946 cd ${FASTCAESOURCEINSTALLDIR}/build/PluginManager/ 947 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PluginManager/PluginManager.pro 948 make ver=release 949 if [ $? -ne 0 ]; then 950 echo -e "\033[31mFailed to compile module PluginManager! \033[0m" 951 return ${FAIL} 952 fi 953 954 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/Gmsh/ 955 cd ${FASTCAESOURCEINSTALLDIR}/build/Gmsh/ 956 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/Gmsh/GmshModule.pro 957 #cp -d ./gmsh441/lib/* ../../output/bin/ 958 make ver=release 959 if [ $? -ne 0 ]; then 960 echo -e "\033[31mFailed to compile module GmshModule! \033[0m" 961 return ${FAIL} 962 fi 963 964 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/UserGuidence/ 965 cd ${FASTCAESOURCEINSTALLDIR}/build/UserGuidence/ 966 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/UserGuidence/UserGuidence.pro 967 make ver=release 968 if [ $? -ne 0 ]; then 969 echo -e "\033[31mFailed to compile module UserGuidence! \033[0m" 970 return ${FAIL} 971 fi 972 973 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/mainWindow/ 974 cd ${FASTCAESOURCEINSTALLDIR}/build/mainWindow/ 975 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/mainWindow/mainWindow.pro 976 make ver=release 977 if [ $? -ne 0 ]; then 978 echo -e "\033[31mFailed to compile module mainWindow! \033[0m" 979 return ${FAIL} 980 fi 981 982 echo ${VARPWD} | sudo -S /sbin/ldconfig 983 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/main/ 984 cd ${FASTCAESOURCEINSTALLDIR}/build/main/ 985 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/main/main.pro 986 make ver=release 987 if [ $? -ne 0 ]; then 988 echo -e "\033[31mFailed to compile module main! \033[0m" 989 return ${FAIL} 990 fi 991 992 993 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PluginMeshDataExchange/ 994 cd ${FASTCAESOURCEINSTALLDIR}/build/PluginMeshDataExchange/ 995 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PluginMeshDataExchange/meshDataExchangePlugin.pro 996 make ver=release 997 if [ $? -ne 0 ]; then 998 echo -e "\033[31mFailed to compile module meshDataExchangePlugin! \033[0m" 999 return ${FAIL} 1000 fi 1001 1002 mkdir -p ${FASTCAESOURCEINSTALLDIR}/build/PluginCustomizer/ 1003 cd ${FASTCAESOURCEINSTALLDIR}/build/PluginCustomizer/ 1004 ${QMAKE} -o Makefile -Wnone ${FASTCAESOURCEINSTALLDIR}/Code/PluginCustomizer/pluginCustomizer.pro 1005 make ver=release 1006 if [ $? -ne 0 ]; then 1007 echo -e "\033[31mFailed to compile module pluginCustomizer! \033[0m" 1008 return ${FAIL} 1009 fi 1010 1011 return ${SUCCESS} 1012 } 1013 installFastCAE () 1014 { 1015 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/Code/FastCAE.pro ]; then 1016 cd ${WORKDIR} 1017 echo ${VARPWD} | sudo -S apt-get install build-essential libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libglew-dev libglew-dev libgl1-mesa-glx libxmu-dev -y 1018 echo -e "\033[32mUnpack fastcae code... \033[0m" 1019 mkdir -p ${FASTCAESOURCEINSTALLDIR}/Code 1020 if [ ${ISVTK6} = "YES" ];then 1021 tar -zxvf ${WORKDIR}/package/FastCAE-vtk6.tar.gz -C ${FASTCAESOURCEINSTALLDIR} 1022 else 1023 tar -zxvf ${WORKDIR}/package/FastCAE.tar.gz -C ${FASTCAESOURCEINSTALLDIR} 1024 fi 1025 mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1026 mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/temp/ 1027 cp ${FASTCAESOURCEINSTALLDIR}/Code/python/Py/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1028 1029 #gmsh 1030 mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh 1031 cp -a ${FASTCAESOURCEINSTALLDIR}/Code/Gmsh/gmsh454/gmsh ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh/ 1032 cp -a ${FASTCAESOURCEINSTALLDIR}/Code/Gmsh/gmsh454/gmsh.Geo ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh/ 1033 chmod +x ${FASTCAESOURCEINSTALLDIR}/output/bin/gmsh/gmsh 1034 fi 1035 1036 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/output/python37/bin/python3 ]; then 1037 if ! installPython; then 1038 exit ${FAIL} 1039 fi 1040 echo -e "\033[32mCopy python library... \033[0m" 1041 mkdir -p ${FASTCAESOURCEINSTALLDIR}/output/python37/ 1042 cp -rf /opt/python-3.7.0/* ${FASTCAESOURCEINSTALLDIR}/output/python37/ 1043 mv ${FASTCAESOURCEINSTALLDIR}/output/python37/include/python3.7m/* ${FASTCAESOURCEINSTALLDIR}/output/python37/include/ 1044 #python 1045 cp -a ${FASTCAESOURCEINSTALLDIR}/output/python37/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1046 rm -rf ${FASTCAESOURCEINSTALLDIR}/output/python37/include/python3.7m 1047 fi 1048 1049 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/quazip/lib/libquazip.so ]; then 1050 if ! installQuazip; then 1051 exit ${FAIL} 1052 fi 1053 echo -e "\033[32mCopy quazip library... \033[0m" 1054 mkdir -p ${FASTCAESOURCEINSTALLDIR}/quazip/ 1055 cp -rf ${TEMPDIR}/quazip-0.7.3/bin/* ${FASTCAESOURCEINSTALLDIR}/quazip/ 1056 #quazip 1057 cp -a ${FASTCAESOURCEINSTALLDIR}/quazip/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1058 rm -rf ${TEMPDIR}/quazip-0.7.3/ 1059 fi 1060 1061 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/Qwt/lib/libqwtpolar.so ]; then 1062 if ! installQwt; then 1063 exit ${FAIL} 1064 fi 1065 echo -e "\033[32mCopy qwt library... \033[0m" 1066 mkdir -p ${FASTCAESOURCEINSTALLDIR}/Qwt/ 1067 cp -rf ${TEMPDIR}/qwtpolar-1.1.1/bin/* ${FASTCAESOURCEINSTALLDIR}/Qwt/ 1068 cp -rf ${TEMPDIR}/qwt-6.1.6/bin/* ${FASTCAESOURCEINSTALLDIR}/Qwt/ 1069 #Qwt 1070 cp -a ${FASTCAESOURCEINSTALLDIR}/Qwt/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1071 rm -rf ${TEMPDIR}/qwtpolar-1.1.1/ 1072 rm -rf ${TEMPDIR}/qwt-6.1.6/ 1073 fi 1074 if [ ${ISVTK6} = "YES" ]; then 1075 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/VTK/lib/libvtkRenderingCore-6.1.so ]; then 1076 if ! installVtk610; then 1077 exit ${FAIL} 1078 fi 1079 echo -e "\033[32mCopy vtk library... \033[0m" 1080 mkdir -p ${FASTCAESOURCEINSTALLDIR}/VTK/ 1081 cp -rf ${TEMPDIR}/vtk-6.1.0/install/* ${FASTCAESOURCEINSTALLDIR}/VTK/ 1082 #VTK 1083 cp -a ${FASTCAESOURCEINSTALLDIR}/VTK/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1084 rm -rf ${TEMPDIR}/vtk-6.1.0/ 1085 fi 1086 else 1087 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/VTK/lib/libvtkRenderingCore-9.0.so ]; then 1088 if ! installVtk901; then 1089 exit ${FAIL} 1090 fi 1091 echo -e "\033[32mCopy vtk library... \033[0m" 1092 mkdir -p ${FASTCAESOURCEINSTALLDIR}/VTK/ 1093 cp -rf ${TEMPDIR}/vtk-9.0.1/install/* ${FASTCAESOURCEINSTALLDIR}/VTK/ 1094 #VTK 1095 cp -a ${FASTCAESOURCEINSTALLDIR}/VTK/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1096 rm -rf ${TEMPDIR}/vtk-9.0.1/ 1097 fi 1098 fi 1099 1100 1101 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/OCC/lib/libTKIVtk.so ]; then 1102 1103 # if ! installTclTk; then 1104 # exit ${FAIL} 1105 # fi 1106 1107 if ! installFreeImage; then 1108 exit ${FAIL} 1109 fi 1110 1111 cd ${WORKDIR} 1112 echo ${VARPWD} | sudo -s apt install libfontconfig1-dev -y 1113 if ! installFreeType; then 1114 exit ${FAIL} 1115 fi 1116 1117 if ! installOpenCascade; then 1118 exit ${FAIL} 1119 fi 1120 echo -e "\033[32mCopy opencascade library... \033[0m" 1121 mkdir -p ${FASTCAESOURCEINSTALLDIR}/OCC/ 1122 cp -rf ${TEMPDIR}/occ-7.5.0/install/* ${FASTCAESOURCEINSTALLDIR}/OCC/ 1123 1124 #OCC 1125 cp -a ${FASTCAESOURCEINSTALLDIR}/OCC/lib/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1126 1127 rm -rf ${TEMPDIR}/occ-7.5.0/ 1128 fi 1129 if [ ! -f ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/cgnslib.h ]; then 1130 if ! installCgns; then 1131 exit ${FAIL} 1132 fi 1133 1134 echo -e "\033[32mCopy cgns library... \033[0m" 1135 mkdir -p ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1136 cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/include/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1137 cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/lib/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1138 cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/bin/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1139 cp -rf ${TEMPDIR}/hdf5-1.12.1/HDF_Group/HDF5/1.12.1/share/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1140 1141 cp -rf ${TEMPDIR}/cgns-4.2.0/install/include/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1142 cp -rf ${TEMPDIR}/cgns-4.2.0/install/lib/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1143 cp -rf ${TEMPDIR}/cgns-4.2.0/install/bin/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1144 cp -rf ${TEMPDIR}/cgns-4.2.0/install/share/* ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/ 1145 1146 cp -a ${FASTCAESOURCEINSTALLDIR}/cgns/cgns_linux/* ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1147 rm -rf ${TEMPDIR}/hdf5-1.12.1/ 1148 rm -rf ${TEMPDIR}/cgns-4.2.0/ 1149 fi 1150 1151 1152 1153 g=$(groups) 1154 n=$(whoami) 1155 chown -R ${n}:${n} ${FASTCAESOURCEINSTALLDIR} 1156 cd ${WORKDIR} 1157 echo ${VARPWD} | sudo -S apt install libopenmpi* -y 1158 echo "unix:!macx: LIBS += -lmpi" >> ${FASTCAESOURCEINSTALLDIR}/Code/MainWidgets/mainwidgets.pro 1159 echo "unix:!macx: LIBS += -ldl" >> ${FASTCAESOURCEINSTALLDIR}/Code/main/main.pro 1160 1161 if [ ! -f /etc/ld.so.conf.d/fastcae.conf ];then 1162 echo ${VARPWD} | sudo su - root << EOF 1163 echo "${FASTCAESOURCEINSTALLDIR}/output/bin/" >> /etc/ld.so.conf.d/fastcae.conf; 1164 exit; 1165 EOF 1166 elif [ $(grep -c "${FASTCAESOURCEINSTALLDIR}/output/bin/" /etc/ld.so.conf.d/fastcae.conf) -eq 0 ];then 1167 echo ${VARPWD} | sudo su - root << EOF 1168 exit; 1169 EOF 1170 fi 1171 1172 echo ${VARPWD} | sudo -S ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld 1173 echo ${VARPWD} | sudo -S /sbin/ldconfig 1174 1175 if ! compileFastCAE; then 1176 echo -e "\033[31mFailed to compile FastCAE! \033[0m" 1177 exit ${FAIL} 1178 fi 1179 1180 cd ${FASTCAESOURCEINSTALLDIR}/output/bin/ 1181 echo "export PYTHONHOME=\$PYTHONHOME:/opt/python-3.7.0/" > StartFastCAE.sh 1182 echo "export PYTHONPATH=\$PYTHONPATH:/opt/python-3.7.0/lib/python3.7/" >> StartFastCAE.sh 1183 echo "cd ${FASTCAESOURCEINSTALLDIR}/output/bin/" >> StartFastCAE.sh 1184 echo "./FastCAE" >> StartFastCAE.sh 1185 1186 1187 1188 1189 1190 chmod +x ./StartFastCAE.sh 1191 cp -rf ${FASTCAESOURCEINSTALLDIR}/Code/qrc/QUI/main.ico ${FASTCAESOURCEINSTALLDIR}/output/bin/fastcae.ico 1192 1193 echo ${VARPWD} | sudo su - root << EOF 1194 echo "[Desktop Entry]" > /usr/share/applications/fastcae.desktop 1195 echo "Name=FastCAE" >> /usr/share/applications/fastcae.desktop 1196 echo "Comment=FastCAE2.5" >> /usr/share/applications/fastcae.desktop 1197 echo "Exec=${FASTCAESOURCEINSTALLDIR}/output/bin/StartFastCAE.sh" >> /usr/share/applications/fastcae.desktop 1198 echo "Icon=${FASTCAESOURCEINSTALLDIR}/output/bin/fastcae.ico" >> /usr/share/applications/fastcae.desktop 1199 echo "Terminal=false" >> /usr/share/applications/fastcae.desktop 1200 echo "Type=Application" >> /usr/share/applications/fastcae.desktop 1201 exit; 1202 EOF 1203 ./StartFastCAE.sh & 1204 1205 } 1206 1207 if [ ! -d ${TEMPDIR} ];then 1208 mkdir -p ${TEMPDIR} 1209 fi 1210 1211 echo ${VARPWD} | sudo -S apt update 1212 1213 1214 if [ ${ISVTK6} = "YES" ]; then 1215 if [ -f /usr/bin/qmake ]; then 1216 if [ $(echo $(qmake -version) | grep -c "Using Qt version 5.4.2") -eq 0 ]; then 1217 if ! installQt542; then 1218 exit ${FAIL} 1219 else 1220 QMAKE=/opt/Qt5.4.2/5.4/gcc_64/bin/qmake; 1221 fi 1222 else 1223 QMAKE=qmake; 1224 fi 1225 else 1226 if ! installQt542; then 1227 exit ${FAIL} 1228 else 1229 QMAKE=/opt/Qt5.4.2/5.4/gcc_64/bin/qmake; 1230 fi 1231 fi 1232 else 1233 if [ -f /usr/bin/qmake ]; then 1234 if [ $(echo $(qmake -version) | grep -c "Using Qt version 5.14.2") -eq 0 ]; then 1235 if ! installQt5142; then 1236 exit ${FAIL} 1237 else 1238 QMAKE=/opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake; 1239 fi 1240 else 1241 QMAKE=qmake; 1242 fi 1243 else 1244 if ! installQt5142; then 1245 exit ${FAIL} 1246 else 1247 QMAKE=/opt/Qt5.14.2/5.14.2/gcc_64/bin/qmake; 1248 fi 1249 fi 1250 1251 fi 1252 1253 if ! installCmake3213; then 1254 exit ${FAIL} 1255 fi 1256 CMAKE=/opt/cmake-3.21/bin/cmake; 1257 1258 if ! installFastCAE; then 1259 exit ${FAIL} 1260 fi