docker.sh 2.8 KB

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