build_partial.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/bash
  2. qtmake=" "
  3. if [ ${#qtmake} -lt 5 ]; then
  4. echo "now need find qmake "
  5. optfiles=`find /opt -name 'qmake'`
  6. for entry in $optfiles
  7. do
  8. x=${entry:0-10:10}
  9. if [ "$x" == "/bin/qmake" ]; then
  10. qtmake="$entry"
  11. echo " -----find qmake"
  12. echo "$qtmake"
  13. fi
  14. done
  15. fi
  16. if [ ${#qtmake} -lt 5 ]; then
  17. echo "maybe agx,find qmake in usr folder "
  18. optfiles=`find /usr -name 'qmake'`
  19. for entry in $optfiles
  20. do
  21. x=${entry:0-14:14}
  22. if [ "$x" == "/qt5/bin/qmake" ]; then
  23. qtmake="$entry"
  24. echo " -----find qmake"
  25. echo "$qtmake"
  26. fi
  27. done
  28. fi
  29. check_result()
  30. {
  31. if [ "$1" != 0 ];then
  32. echo -e "\e[33m*************************************************\e[0m"
  33. echo -e "\e[31m Please modify build error first,Exit!\e[0m"
  34. echo -e "\e[33m*************************************************\e[0m"
  35. exit 1
  36. fi
  37. }
  38. module=$1
  39. echo -e "\e[33m module name: \e[1;33m $module \e[0m"
  40. projectDir=`pwd`
  41. echo -e "project folder \e[33m$projectDir\e[0m"
  42. MAKEOPT=-j8
  43. mkdir bin
  44. outputDir=$projectDir"/bin"
  45. echo -e "output folder \e[33m$outputDir\e[0m"
  46. cd src
  47. sourceDir=`pwd`
  48. echo -e "source code folder \e[33m$sourceDir\e[0m"
  49. moduleDir=`find . -type d -name $module`
  50. if [ $moduleDir ];then
  51. moduleDir=$sourceDir${moduleDir#*.}
  52. echo -e "module code folder \e[33m$moduleDir\e[0m"
  53. cd $moduleDir
  54. moduleName=$module".pro"
  55. echo -e "\e[1;35;47m START BUILD\e[0m"
  56. $qtmake $moduleName
  57. make $MAKEOPT
  58. check_result $?
  59. make clean
  60. cp $module $outputDir
  61. rm Makefile
  62. rm .qmake.stash
  63. rm $module
  64. cd $projectDir
  65. echo -e "\e[1;33;44m Build $module Success \e[0m"
  66. sleep 1
  67. echo -e "\e[35m Start deploy\e[0m"
  68. cp $outputDir"/"$module ./
  69. bash deploy.sh $module
  70. if [ "$?" == 1 ];then
  71. exit 1
  72. fi
  73. rm $module
  74. echo -e "\e[1;33;44m Deploy $module Success \e[0m"
  75. else
  76. echo -e "\e[31m Can't find module code, exit.....\e[0m"
  77. exit
  78. fi