build.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. # Clone O3DE and bootstrap
  9. echo "Cloning o3de"
  10. git clone --single-branch -b $O3DE_BRANCH $O3DE_REPO $O3DE_ROOT && \
  11. git -C $O3DE_ROOT lfs install && \
  12. git -C $O3DE_ROOT lfs pull && \
  13. git -C $O3DE_ROOT reset --hard $O3DE_COMMIT
  14. if [ $? -ne 0 ]
  15. then
  16. echo "Error cloning o3de from $O3DE_REPO"
  17. exit 1
  18. fi
  19. $O3DE_ROOT/python/get_python.sh
  20. if [ $? -ne 0 ]
  21. then
  22. echo "Error bootstrapping O3DE from $O3DE_REPO"
  23. exit 1
  24. fi
  25. # Build the installer package
  26. export O3DE_BUILD=$WORKSPACE/build
  27. export CONFIGURATION=profile
  28. export OUTPUT_DIRECTORY=$O3DE_BUILD
  29. export O3DE_PACKAGE_TYPE=DEB
  30. export CMAKE_OPTIONS="-G 'Ninja Multi-Config' -DLY_PARALLEL_LINK_JOBS=4 -DLY_DISABLE_TEST_MODULES=TRUE -DO3DE_INSTALL_ENGINE_NAME=o3de-sdk -DLY_STRIP_DEBUG_SYMBOLS=TRUE"
  31. export EXTRA_CMAKE_OPTIONS="-DLY_INSTALLER_AUTO_GEN_TAG=TRUE -DLY_INSTALLER_DOWNLOAD_URL=${INSTALLER_DOWNLOAD_URL} -DLY_INSTALLER_LICENSE_URL=${INSTALLER_DOWNLOAD_URL}/license -DO3DE_INCLUDE_INSTALL_IN_PACKAGE=TRUE"
  32. export CPACK_OPTIONS="-D CPACK_UPLOAD_URL=${CPACK_UPLOAD_URL}"
  33. export CMAKE_TARGET=all
  34. cd $O3DE_ROOT && \
  35. $O3DE_ROOT/scripts/build/Platform/Linux/build_installer_linux.sh
  36. if [ $? -ne 0 ]
  37. then
  38. echo "Error building installer"
  39. exit 1
  40. fi
  41. # Install from the installer package
  42. su $O3DE_USER -c "sudo dpkg -i $O3DE_BUILD/CPackUploads/o3de_4.2.0.deb"
  43. if [ $? -ne 0 ]
  44. then
  45. echo "Error installing O3DE for the o3de user"
  46. exit 1
  47. fi
  48. # Cleanup the source from github and all intermediate files
  49. rm -rf $O3DE_ROOT
  50. rm -rf $O3DE_BUILD
  51. rm -rf $HOME/.o3de
  52. rm -rf $HOME/O3DE
  53. rm -rf /home/o3de/.o3de
  54. rm -rf /home/o3de/O3DE
  55. # The python libraries that are linked in the engine needs to be writable during python bootstrapping for the O3DE user from the installer
  56. chmod -R a+w /opt/O3DE/$(ls /opt/O3DE/)/Tools/LyTestTools \
  57. && chmod -R a+w /opt/O3DE/$(ls /opt/O3DE/)/Tools/RemoteConsole/ly_remote_console \
  58. && chmod -R a+w /opt/O3DE/$(ls /opt/O3DE/)/Gems/Atom/RPI/Tools \
  59. && chmod -R a+w /opt/O3DE/$(ls /opt/O3DE/)/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface \
  60. && chmod -R a+w /opt/O3DE/$(ls /opt/O3DE/)/scripts/o3de
  61. if [ $? -ne 0 ]
  62. then
  63. echo "Error making O3DE python library folders writeable."
  64. exit 1
  65. fi
  66. exit 0