deploy-agx.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #! /bin/bash
  2. Qtgccdir='/usr/lib/aarch64-linux-gnu/qt5'
  3. QtPlatformdir=$Qtgccdir/plugins/platforms
  4. QtLibDir=$Qtgccdir/lib
  5. if [ "$#" -lt 1 ]; then
  6. echo "没有输入"
  7. echo "$1"
  8. exit
  9. fi
  10. ignore_lib_name=(
  11. #libstdc++.so.*
  12. #libm.so.*
  13. #libgcc_s.so.*
  14. libc.so.*
  15. libpthread.so.*
  16. #libGL.so.*
  17. #libz.so.*
  18. #libgthread*
  19. #libglib*
  20. #libexpat*
  21. #libxcb*
  22. libdl.so.*
  23. #libxshmfence*
  24. #libglapi.so.*
  25. #libXext.so.*
  26. #libXdamage.so.*
  27. #libXfixes.so.*
  28. #libX11*
  29. #libXxf86vm.so.*
  30. #libdrm.so.*
  31. #libpcre.so.*
  32. #libXau.so.*
  33. #libXdmcp.so.*
  34. )
  35. EXE="$1"
  36. PWD=`pwd`
  37. rm -rf app
  38. mkdir app
  39. cd app
  40. mkdir lib
  41. cd ..
  42. mkdir commonlib
  43. cd commonlib
  44. mkdir platforms
  45. cp $QtPlatformdir/libqxcb.so platforms
  46. cd platforms
  47. mkdir lib
  48. libfiles=`ldd libqxcb.so | awk '{ if(match($3,"^/"))printf("%s "),$3 }'`
  49. cp $libfiles $PWD/lib
  50. cd ..
  51. mkdir lib
  52. cp $QtLibDir/libQt5DBus.* $PWD/lib
  53. cp $QtLibDir/libQt5XcbQpa.* $PWD/lib
  54. rm -rf $PWD/platforms/lib
  55. cd platforms
  56. cd ..
  57. cd ..
  58. files=`ldd $EXE | awk '{ if(match($3,"^/"))printf("%s "),$3 }'`
  59. cp $files $PWD/app/lib
  60. cp $PWD/commonlib/lib/* $PWD/app/lib
  61. cp -r $PWD/commonlib/platforms $PWD/app
  62. cp $EXE $PWD/app
  63. for x in ${ignore_lib_name[@]}
  64. do
  65. rm -f $PWD/app/lib/${x}
  66. done
  67. rm -rf commonlib
  68. cd app
  69. patchelf --set-rpath '$ORIGIN/lib/' $EXE
  70. cd platforms
  71. patchelf --set-rpath '$ORIGIN/../lib/' libqxcb.so
  72. cd ..
  73. cd ..
  74. cp -r app $PWD/deploy/
  75. rm -rf app