axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
922 stars 205 forks source link

The build scripts install random stuff on my system and break it. #1431

Closed j-jorge closed 10 months ago

j-jorge commented 1 year ago

The build scripts install tools and libraries on my system as if it was alone on it. All dependencies not explicitly installed by the user should be put in the build directory instead.

Steps to Reproduce: Follow https://github.com/axmolengine/axmol/blob/dev/docs/DevSetup.md

  1. install-pwsh will download .deb files from https://github.com/PowerShell/PowerShell/releases and install them on my system, prompting for sudo rights. IMHO using sudo in a script is bad practice as a broken script may break the user's environment.
    • Suggested alternative: use CMake's FetchContent to download the required tools in the build directory if they cannot be found on the system. Ask the user to install them.
  2. setup.ps1 runs the following command: sudo apt install --allow-unauthenticated --yes $DEPENDS > /dev/null. Again, there is the sudo problem. There is also a security problem with --allow-unauthenticated, and the output is hidden from the user!
    • Suggested alternative: use CMake's find_library/find_program functions and ask the user to install de missing dependencies themselves. Don't mess with the user's environment.
  3. Still in setup.ps1, we have an installation of FreeType in /usr: cmake … '-DCMAKE_INSTALL_PREFIX=/usr' …', then sudo cmake --build build --config Release --target install. Now the FreeType library and headers I had installed from my distribution's repository are broken, as well as my other development requiring them >:(
    • Suggested alternative: use CMake facilities. Ask the user to install the dependency, let them pass the search paths to CMake. Do your internal matter in the build directory.
halx99 commented 1 year ago

I think you mean dev on linux:

  1. install-pwsh is only for user to easy install powershell, not the only way.
  2. inherited from cocos2d-x
  3. if ubuntu system installed libfreetype-dev, due to freetype source code use include <freetype/xxx.h>, it will include system installed freetype(depended by fontconfig), if installed freetype version not match with axmol required, will trigger compile error, that why I force install it to /usr/ in script setup.ps1
stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.