deploywithfind.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #! /bin/bash
  2. Qtgccdir='/usr/lib/x86_64-linux-gnu/qt5'
  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. libc.so.*
  36. libgthread*
  37. libglib*
  38. libexpat*
  39. libxcb*
  40. #libdl.so.*
  41. libxshmfence*
  42. libglapi.so.*
  43. libXext.so.*
  44. libXdamage.so.*
  45. libXfixes.so.*
  46. libX11*
  47. libXxf86vm.so.*
  48. libdrm.so.*
  49. libpcre.so.*
  50. libXau.so.*
  51. libXdmcp.so.*
  52. )
  53. EXE="$1"
  54. PWD=`pwd`
  55. rm -rf app
  56. mkdir app
  57. cd app
  58. mkdir lib
  59. cd ..
  60. mkdir commonlib
  61. cd commonlib
  62. mkdir platforms
  63. cp $QtPlatformdir/libqxcb.so platforms
  64. cd platforms
  65. mkdir lib
  66. libfiles=`ldd libqxcb.so | awk '{ if(match($3,"^/"))printf("%s "),$3 }'`
  67. cp $libfiles $PWD/lib
  68. cd ..
  69. mkdir lib
  70. cp $QtLibDir/libQt5DBus.* $PWD/lib
  71. cp $QtLibDir/libQt5XcbQpa.* $PWD/lib
  72. rm -rf $PWD/platforms/lib
  73. cd platforms
  74. cd ..
  75. cd ..
  76. files=`ldd $EXE | awk '{ if(match($3,"^/"))printf("%s "),$3 }'`
  77. cp $files $PWD/app/lib
  78. cp $PWD/commonlib/lib/* $PWD/app/lib
  79. cp -r $PWD/commonlib/platforms $PWD/app
  80. cp $EXE $PWD/app
  81. for x in ${ignore_lib_name[@]}
  82. do
  83. rm -f $PWD/app/lib/${x}
  84. done
  85. rm -rf commonlib
  86. cd app
  87. patchelf --set-rpath '$ORIGIN/lib/' $EXE
  88. if [ "$?" != 0 ];then
  89. echo -e "\e[31m deploy.sh: patchelf $EXE faile, Ensure patchelf tool installed\e[0m"
  90. exit 1
  91. fi
  92. cd platforms
  93. patchelf --set-rpath '$ORIGIN/../lib/' libqxcb.so
  94. if [ "$?" != 0 ];then
  95. echo -e "\e[31m deploy.sh: patchelf $EXE faile, Ensure patchelf tool installed\e[0m"
  96. # exit 1
  97. fi
  98. cd ..
  99. cd ..
  100. cp -r app $PWD/deploy/
  101. rm -rf app