docker.sh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/bash -ex
  2. # SPDX-FileCopyrightText: 2019 yuzu Emulator Project
  3. # SPDX-FileCopyrightText: 2024 suyu Emulator Project
  4. # SPDX-License-Identifier: GPL-2.0-or-later
  5. # Exit on error, rather than continuing with the rest of the script.
  6. set -e
  7. ccache -s
  8. git submodule update --init --recursive
  9. mkdir build || true && cd build
  10. cmake .. \
  11. -DBoost_USE_STATIC_LIBS=ON \
  12. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  13. -DSUYU_USE_PRECOMPILED_HEADERS=OFF \
  14. -DDYNARMIC_USE_PRECOMPILED_HEADERS=OFF \
  15. -DCMAKE_CXX_FLAGS="-march=x86-64-v2" \
  16. -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ \
  17. -DCMAKE_C_COMPILER=/usr/local/bin/gcc \
  18. -DCMAKE_INSTALL_PREFIX="/usr" \
  19. -DDISPLAY_VERSION=$1 \
  20. -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF \
  21. -DENABLE_QT_TRANSLATION=OFF \
  22. -DUSE_DISCORD_PRESENCE=ON \
  23. -DSUYU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \
  24. -DSUYU_USE_BUNDLED_FFMPEG=ON \
  25. -DSUYU_ENABLE_LTO=OFF \
  26. -DSUYU_CRASH_DUMPS=ON \
  27. -DSUYU_USE_FASTER_LD=ON \
  28. -GNinja
  29. ninja
  30. ccache -sv
  31. ctest -VV -C Release
  32. # Separate debug symbols from specified executables
  33. for EXE in suyu; do
  34. EXE_PATH="bin/$EXE"
  35. # Copy debug symbols out
  36. objcopy --only-keep-debug $EXE_PATH $EXE_PATH.debug
  37. # Add debug link and strip debug symbols
  38. objcopy -g --add-gnu-debuglink=$EXE_PATH.debug $EXE_PATH $EXE_PATH.out
  39. # Overwrite original with stripped copy
  40. mv $EXE_PATH.out $EXE_PATH
  41. done
  42. # Strip debug symbols from all executables
  43. find bin/ -type f -not -regex '.*.debug' -exec strip -g {} ';'
  44. DESTDIR="$PWD/AppDir" ninja install
  45. rm -vf AppDir/usr/bin/suyu-cmd AppDir/usr/bin/suyu-tester
  46. # Download tools needed to build an AppImage
  47. wget -nc https://git.suyu.dev/suyu/ext-linux-bin/raw/branch/main/appimage/deploy-linux.sh
  48. wget -nc https://git.suyu.dev/suyu/ext-linux-bin/raw/branch/main/appimage/exec-x86_64.so
  49. wget -nc https://git.suyu.dev/suyu/AppImageKit-checkrt/raw/branch/gh-workflow/AppRun
  50. # Set executable bit
  51. chmod 755 \
  52. deploy-linux.sh \
  53. AppRun.sh \
  54. exec-x86_64.so \
  55. # Workaround for https://github.com/AppImage/AppImageKit/issues/828
  56. export APPIMAGE_EXTRACT_AND_RUN=1
  57. mkdir -p AppDir/usr/optional
  58. mkdir -p AppDir/usr/optional/libstdc++
  59. mkdir -p AppDir/usr/optional/libgcc_s
  60. # Deploy suyu's needed dependencies
  61. DEPLOY_QT=1 ./deploy-linux.sh AppDir/usr/bin/suyu AppDir
  62. # Workaround for libQt5MultimediaGstTools indirectly requiring libwayland-client and breaking Vulkan usage on end-user systems
  63. find AppDir -type f -regex '.*libwayland-client\.so.*' -delete -print
  64. # Workaround for building suyu with GCC 10 but also trying to distribute it to Ubuntu 18.04 et al.
  65. # See https://github.com/darealshinji/AppImageKit-checkrt
  66. cp exec-x86_64.so AppDir/usr/optional/exec.so
  67. cp AppRun.sh AppDir/AppRun
  68. cp --dereference /usr/lib/x86_64-linux-gnu/libstdc++.so.6 AppDir/usr/optional/libstdc++/libstdc++.so.6
  69. cp --dereference /lib/x86_64-linux-gnu/libgcc_s.so.1 AppDir/usr/optional/libgcc_s/libgcc_s.so.1