docker.sh 2.9 KB

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