deploywithfind.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #! /bin/bash
  2. Qtgccdir=''
  3. if [ ${#Qtgccdir} -lt 6 ]; then
  4. echo "Because not set gcc_64 , so auto find gcc_64 "
  5. optfiles=`find /opt -name 'gcc_64'`
  6. for entry in $optfiles
  7. do
  8. if [ ${entry:0-6:6} == "gcc_64" ]; then
  9. if [ -d $entry ]; then
  10. Qtgccdir="$entry"
  11. echo -e "\033[32m"" -----found gccdir:"$Qtgccdir"\033[0m"
  12. fi
  13. fi
  14. done
  15. fi
  16. if [ ${#Qtgccdir} -lt 6 ]; then
  17. if [ -d '/usr/lib/aarch64-linux-gnu/qt5' ]; then
  18. Qtgccdir='/usr/lib/aarch64-linux-gnu/qt5'
  19. else
  20. echo "if NVIDIA,please sudo apt install qt"
  21. fi
  22. fi
  23. if [ ${#Qtgccdir} -lt 6 ]; then
  24. echo -e "\033[31m"" -----not found gccdir: so exit""\033[0m"
  25. exit 1
  26. fi
  27. ignore_lib_name=(
  28. #libstdc++.so.*
  29. libm.so.*
  30. #libgcc_s.so.*
  31. #libc.so.*
  32. libpthread.so.*
  33. libGL.so.*
  34. libz.so.*
  35. libgthread*
  36. libglib*
  37. libexpat*
  38. libxcb*
  39. libdl.so.*
  40. libxshmfence*
  41. libglapi.so.*
  42. libXext.so.*
  43. libXdamage.so.*
  44. libXfixes.so.*
  45. libX11*
  46. libXxf86vm.so.*
  47. libdrm.so.*
  48. libpcre.so.*
  49. libXau.so.*
  50. libXdmcp.so.*
  51. )
  52. EXE="$1"
  53. PWD=`pwd`
  54. rm -rf app
  55. mkdir app
  56. cd app
  57. mkdir lib
  58. cd ..
  59. mkdir commonlib
  60. cd commonlib
  61. mkdir platforms
  62. cp $QtPlatformdir/libqxcb.so platforms
  63. cd platforms
  64. mkdir lib
  65. libfiles=`ldd libqxcb.so | awk '{ if(match($3,"^/"))printf("%s "),$3 }'`
  66. cp $libfiles $PWD/lib
  67. cd ..
  68. mkdir lib
  69. cp $QtLibDir/libQt5DBus.* $PWD/lib
  70. cp $QtLibDir/libQt5XcbQpa.* $PWD/lib
  71. rm -rf $PWD/platforms/lib
  72. cd platforms
  73. cd ..
  74. cd ..
  75. files=`ldd $EXE | awk '{ if(match($3,"^/"))printf("%s "),$3 }'`
  76. cp $files $PWD/app/lib
  77. cp $PWD/commonlib/lib/* $PWD/app/lib
  78. cp -r $PWD/commonlib/platforms $PWD/app
  79. cp $EXE $PWD/app
  80. for x in ${ignore_lib_name[@]}
  81. do
  82. rm -f $PWD/app/lib/${x}
  83. done
  84. rm -rf commonlib
  85. cd app
  86. patchelf --set-rpath '$ORIGIN/lib/' $EXE
  87. if [ "$?" != 0 ];then
  88. echo -e "\e[31m deploy.sh: patchelf $EXE faile, Ensure patchelf tool installed\e[0m"
  89. exit 1
  90. fi
  91. cd platforms
  92. patchelf --set-rpath '$ORIGIN/../lib/' libqxcb.so
  93. if [ "$?" != 0 ];then
  94. echo -e "\e[31m deploy.sh: patchelf $EXE faile, Ensure patchelf tool installed\e[0m"
  95. # exit 1
  96. fi
  97. cd ..
  98. cd ..
  99. cp -r app $PWD/deploy/
  100. rm -rf app