build_partial.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/bash
  2. #qt_com=$(arch)
  3. qt_com=`arch`
  4. if [ $qt_com = "aarch64" ];then
  5. qtmake="/usr/lib/aarch64-linux-gnu/qt5/bin/qmake"
  6. else
  7. qtmake="/opt/Qt5.10.1/5.10.1/gcc_64/bin/qmake"
  8. fi
  9. check_result()
  10. {
  11. if [ "$1" != 0 ];then
  12. echo -e "\e[33m*************************************************\e[0m"
  13. echo -e "\e[31m Please modify build error first,Exit!\e[0m"
  14. echo -e "\e[33m*************************************************\e[0m"
  15. exit 1
  16. fi
  17. }
  18. module=$1
  19. echo -e "\e[33m module name: \e[1;33m $module \e[0m"
  20. projectDir=`pwd`
  21. echo -e "project folder \e[33m$projectDir\e[0m"
  22. MAKEOPT=-j8
  23. mkdir bin
  24. outputDir=$projectDir"/bin"
  25. echo -e "output folder \e[33m$outputDir\e[0m"
  26. cd src
  27. sourceDir=`pwd`
  28. echo -e "source code folder \e[33m$sourceDir\e[0m"
  29. moduleDir=`find . -type d -name $module`
  30. if [ $moduleDir ];then
  31. moduleDir=$sourceDir${moduleDir#*.}
  32. echo -e "module code folder \e[33m$moduleDir\e[0m"
  33. cd $moduleDir
  34. moduleName=$module".pro"
  35. echo -e "\e[1;35;47m START BUILD\e[0m"
  36. $qtmake $moduleName
  37. make $MAKEOPT
  38. check_result $?
  39. make clean
  40. cp $module $outputDir
  41. rm Makefile
  42. rm .qmake.stash
  43. rm $module
  44. cd $projectDir
  45. echo -e "\e[1;33;44m Build $module Success \e[0m"
  46. sleep 1
  47. echo -e "\e[35m Start deploy\e[0m"
  48. cp $outputDir"/"$module ./
  49. bash deploy.sh $module
  50. if [ "$?" == 1 ];then
  51. exit 1
  52. fi
  53. rm $module
  54. echo -e "\e[1;33;44m Deploy $module Success \e[0m"
  55. else
  56. echo -e "\e[31m Can't find module code, exit.....\e[0m"
  57. exit
  58. fi
  59. qt_com=`arch`
  60. if [ $qt_com = "aarch64" ];then
  61. cp -r /usr/lib/aarch64-linux-gnu/nss/* ./deploy/app/lib/
  62. else
  63. cp -r /usr/lib/x86_64-linux-gnu/nss/* ./deploy/app/lib/
  64. fi
  65. #cp ./sh/BaiDuMap.html ./deploy/app/
  66. #cp ./sh/car.png ./deploy/app/
  67. #cp ./sh/asphalt.jpg ./deploy/app/