deploy.sh 1.6 KB

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