docker.sh 2.7 KB

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