linux_script.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/bin/bash --
  2. set -e
  3. DIST_PATH=dist
  4. if [[ ! -d "${DIST_PATH}" ]]; then
  5. mkdir "${DIST_PATH}"
  6. fi
  7. if [[ "${DIST}" == "trusty" ]]; then
  8. project_dir="$(pwd)"
  9. BUILD_DST_PATH=build-test
  10. APPIMAGE_DST_PATH=build-appimage
  11. #source /opt/qt53/bin/qt53-env.sh
  12. QT_BASE_DIR=/opt/qt53
  13. export QTDIR="${QT_BASE_DIR}"
  14. export PATH="${QT_BASE_DIR}"/bin:"${PATH}"
  15. export LD_LIBRARY_PATH="${QT_BASE_DIR}"/lib/x86_64-linux-gnu:"${QT_BASE_DIR}"/lib:"${LD_LIBRARY_PATH}"
  16. export PKG_CONFIG_PATH="${QT_BASE_DIR}"/lib/pkgconfig:"${PKG_CONFIG_PATH}"
  17. qmake --version
  18. export CC=gcc-4.9 CXX=g++-4.9
  19. mkdir "${BUILD_DST_PATH}"
  20. qmake QMAKE_CXX="${CXX}" QMAKE_CC="${CC}" QMAKE_LINK="${CXX}" DESTDIR="${BUILD_DST_PATH}"
  21. # Building flameshot
  22. make -j$(nproc)
  23. # Running flameshot tests
  24. make check -j$(nproc)
  25. ls -alhR
  26. #
  27. # Packaging AppImage using linuxdeployqt
  28. #
  29. mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/bin
  30. mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications
  31. mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/interfaces
  32. mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/services
  33. mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/metainfo
  34. mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/bash-completion/completions
  35. mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/flameshot/translations
  36. cp \
  37. "${BUILD_DST_PATH}"/flameshot \
  38. "${APPIMAGE_DST_PATH}"/appdir/usr/bin/
  39. cp \
  40. "${project_dir}"/dbus/org.dharkael.Flameshot.xml \
  41. "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/interfaces/
  42. cp \
  43. "${project_dir}"/dbus/package/org.dharkael.Flameshot.service \
  44. "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/services/
  45. cp \
  46. "${project_dir}"/docs/appdata/flameshot.appdata.xml \
  47. "${APPIMAGE_DST_PATH}"/appdir/usr/share/metainfo/
  48. cp \
  49. "${project_dir}"/docs/bash-completion/flameshot \
  50. "${APPIMAGE_DST_PATH}"/appdir/usr/share/bash-completion/completions/
  51. cp \
  52. "${project_dir}"/translations/*.qm \
  53. "${APPIMAGE_DST_PATH}"/appdir/usr/share/flameshot/translations/
  54. cp \
  55. "${project_dir}"/docs/desktopEntry/package/* \
  56. "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications/
  57. cp \
  58. "${project_dir}"/img/app/flameshot.png \
  59. "${APPIMAGE_DST_PATH}"/appdir/
  60. ls -alhR "${APPIMAGE_DST_PATH}"/appdir
  61. # Copy other project files
  62. cp "${project_dir}"/README.md "${APPIMAGE_DST_PATH}"/appdir/README.md
  63. cp "${project_dir}"/LICENSE "${APPIMAGE_DST_PATH}"/appdir/LICENSE
  64. echo "${VERSION}" > "${APPIMAGE_DST_PATH}"/appdir/version
  65. echo "${TRAVIS_COMMIT}" >> "${APPIMAGE_DST_PATH}"/appdir/version
  66. # Configure env vars
  67. unset QTDIR
  68. unset QT_PLUGIN_PATH
  69. unset LD_LIBRARY_PATH
  70. tree "${APPIMAGE_DST_PATH}"/appdir
  71. # Packaging
  72. # -verbose=2
  73. ./linuxdeployqt "${APPIMAGE_DST_PATH}"/appdir/usr/bin/flameshot -bundle-non-qt-libs
  74. rm -f "${APPIMAGE_DST_PATH}"/appdir/usr/lib/libatk-1.0.so.0
  75. cp \
  76. /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
  77. "${APPIMAGE_DST_PATH}"/appdir/usr/plugins/platforminputcontexts/
  78. cd "${APPIMAGE_DST_PATH}"/appdir/usr/bin
  79. ln -sf ../plugins/platforms/ . # An unknown bug
  80. ln -sf ../share/flameshot/translations/ . # add translation soft link
  81. cd "${project_dir}"
  82. # -verbose=2
  83. ./linuxdeployqt "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications/flameshot.desktop -appimage
  84. ls -alhR -- *.AppImage
  85. cp -- *.AppImage "${APPIMAGE_DST_PATH}"/
  86. tree "${APPIMAGE_DST_PATH}"/
  87. ls -l "${APPIMAGE_DST_PATH}"/*.AppImage
  88. # Rename AppImage and move AppImage to DIST_PATH
  89. cd "${APPIMAGE_DST_PATH}"
  90. mv Flameshot-${VERSION}-${ARCH}.AppImage flameshot_${VERSION}_${ARCH}.AppImage
  91. cd ..
  92. cp \
  93. "${APPIMAGE_DST_PATH}"/flameshot_${VERSION}_${ARCH}.AppImage \
  94. "${DIST_PATH}"/flameshot_${VERSION}_${ARCH}.${EXTEN}
  95. pwd
  96. else
  97. travis_retry git clone https://github.com/flameshotapp/packpack.git
  98. travis_retry packpack/packpack
  99. pwd && ls
  100. case "${OS}" in
  101. "ubuntu"|"debian")
  102. # copy deb to dist path for distribution
  103. cp \
  104. build/flameshot_*_*.deb \
  105. "${DIST_PATH}"/flameshot_${VERSION}_${DIST}_${ARCH}.${EXTEN}
  106. ;;
  107. "fedora")
  108. cp \
  109. build/flameshot-${VERSION}-${RELEASE}.*.${ARCH}.rpm \
  110. "${DIST_PATH}"/flameshot_${VERSION}_fedora${DIST}_${ARCH}.${EXTEN}
  111. ;;
  112. esac
  113. fi