godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Include a script in the Godot repository to install build dependencies for Linux/BSD #1614

Open Calinou opened 3 years ago

Calinou commented 3 years ago

Describe the project you are working on:

The Godot editor :slightly_smiling_face:

Describe the problem or limitation you are having in your project:

To compile Godot on Linux, you need to install many dependencies using your distribution's package manager. Right now, you have to head to the Compiling for Linux, *BSD page and copy the distro-specific one-liner into a terminal.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:****

We can move those distro-specific one-liners to a script that detects the user's Linux distribution. If some dependencies can't be installed or are too old, we can also print an error message, tell the user where to find up-to-date versions and exit gracefully.

This is mainly relevant for Linux/BSD. I could see this being useful to install Android and HTML5 build dependencies as well, but this is a secondary step.

Advantages

Disadvantages

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

Add a script like install-linux-deps.sh in the misc/ folder. Users would be instructed to run misc/install-linux-deps.sh in the documentation, rather than pasting a distro-specific one-liner.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

This is buildsystem functionality.

Is there a reason why this should be core and not an add-on in the asset library?:

This is buildsystem functionality. It could be provided by a third-party, but keeping it up-to-date might be difficult this way.

Xrayez commented 3 years ago

We have to maintain this script, which can be more work than a simple list of one-liners.

It's either godot or godot-docs changes, assuming both are maintained equally (keep up-to-date), I don't see a problem here, the script itself wouldn't be too complex I presume.

Fun fact anecdote: I've had to copy those one-liners today, only to get bitten by wrong copy-paste later. 😃

Calinou commented 3 years ago

I started working on a script for this: https://github.com/Calinou/godot/blob/add-linux-dependencies-install-script/misc/scripts/install_linuxbsd_deps.sh

pdfrod commented 3 years ago

Have you thought about providing a development Docker / Podman file instead? An installation script would have to be super complex to support the dozens of distributions / versions out there, and would still give no guarantees of a working build environment if the user doesn't happen to be running a supported distribution / version. Plus, it's a maintenance nightmare to guarantee that the script is working for all supported distributions. A Dockerfile would in theory work for every distribution as long they are able to run containers.

I started playing with Godot and the first thing I did was look for a Dockerfile. I copied one from https://github.com/godotengine/build-containers, tweaked it, ran podman build and bam, I'm ready to roll!

Calinou commented 3 years ago

Have you thought about providing a development Docker / Podman file instead? An installation script would have to be super complex to support the dozens of distributions / versions out there, and would still give no guarantees of a working build environment if the user doesn't happen to be running a supported distribution / version. Plus, it's a maintenance nightmare to guarantee that the script is working for all supported distributions. A Dockerfile would in theory work for every distribution as long they are able to run containers.

I started playing with Godot and the first thing I did was look for a Dockerfile. I copied one from https://github.com/godotengine/build-containers, tweaked it, ran podman build and bam, I'm ready to roll!

Godot is a graphical application first and foremost. It's not meant to run in a container, except for headless builds. I understand that you can use a throwaway container to build Godot, but this is already provided by https://github.com/godotengine/build-containers. I'm not against Docker, but I don't want it to be the only way to build Godot since it's not supported everywhere (*BSD, OpenVZ-based VPSes, …).

Besides, most casual users who just want to build Godot for their own use don't have experience with Docker (or may not want to deal with its nontrivial setup procedure).

pdfrod commented 3 years ago

Godot is a graphical application first and foremost. It's not meant to run in a container, except for headless builds. I understand that you can use a throwaway container to build Godot, but this is already provided by https://github.com/godotengine/build-containers.

Yes, I was only suggesting using containers to build Godot, not actually running it (although totally possible). I'm building Godot inside a container and running the resulting binary outside the container, and it works really nice.

Besides, most casual users who just want to build Godot for their own use don't have experience with Docker

True, but I don't see that being a problem. I also had zero experience SCons and that wasn't a blocker - Godot documentation is nice enough to tell me which SCons command I need to run. The documentation could just as easily tell which Docker / Podman command users need to execute a build.

... (or deal with its nontrivial setup procedure)

I'm a bit confused by this; which nontrivial procedure is that? For me, all I had to do was apt-get install podman. I can see that to build a Windows Mono container there are more steps involved in the setup, but for a Linux build that doesn't seem to be necessary.

Anyway this is just my suggestion / feedback. When doing casual work on a project, that's when I find it more valuable to be able to simply run a podman build and have a working build. I don't want to go through the pain of installing a ton of dependencies and configuration just to be able to compile a project in which I'll only be working for a couple of days.

jasonliu-- commented 3 years ago

If you are familiar with VirtualBox, the Guest Additions script for Linux/BSD (VBoxGuestAdditions.sh) has a fairly comprehensive method of Linux distro detection. It might help with your if and case statements.

https://help.ubuntu.com/community/VirtualBox/GuestAdditions