💾 Archived View for kwiecien.us › logarion › building-veloren-on-fedora.gmi captured on 2020-09-24 at 00:58:51. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Authors: Ben <benulo@systemli.org>
Dated: 2020-04-22
I recently got interested in an open source computer game called [Veloren], which as of this writing is still rather new and undergoing active development. After some interactions with its developers I decided that the best course of action would be to build it from source on my machine, though my first experience with the game was from a recent release on [Flathub].
Now, there are lots of benefits to building from source, particularly staying up to date with the latest version, which could change daily. Also there is a better opportunity to give feedback to and work with the developers, try alternative branches of the code, and so on. You don't have to be a programmer to benefit from these things.
While sometimes building and running code for the first time gets too complicated and difficult, the good thing with this particular project is that the overall process is not hard. For Fedora users, this guide should assist in making the process as quick and easy as possible. Perhaps users of other distros can also figure something out based on this.
Information on how to build Veloren is generally found at [book.veloren.net] and it helped with writing this guide. Particularly we are utilizing the details in section 3, "Compile from source". It is mostly complete, but the need for some finer details inspired me to write this. (Hopefully this can help with future versions of the docs!)
Note: The commands provided in this document are meant to be run as your own user, and anything that needs root privileges I explicitly wrote with "sudo" in the command. Aside from installing RPM's with dnf, you don't need root privileges.
The book mentions that you are going to need Rust, Git, Git LFS, and bash. There are few Linux systems that don't have bash as their default shell, and Fedora is no exception.
My system already happened to have Git. Part of preparing for writing this was testing the setup and build process in a fresh toolbox on Silverblue 32 with no additional packages installed. This was the easiest and most practical thing for me, though I suspect there may be some package differences between Silverblue and Fedora Workstation. If your system does not have Git, you can run `sudo dnf install git`
Most importantly, we need Git LFS in order to clone Veloren from its repository, otherwise it won't pull all the game files. Therefore: `sudo dnf install git-lfs`
There is a note in the book that says you must run `git lfs install` for the feature to work. While installing the package with dnf, I noticed that the package manager apparently does the initialization on its own. You might be able to skip this, but running it once for good measure doesn't seem to hurt, and it takes less than a second.
At this point you can also install Rust if you don't have it already, but I prefer cloning Veloren first in order to streamline that part, since we need the Veloren directory when configuring our Rust environment.
Now you can run: `git clone https://gitlab.com/veloren/veloren.git`
How exciting!
When they say you need Rust, what you really need is rustup, which is very conveniently located at [rustup.rs]. You don't need to install any Fedora packages and probably shouldn't. If you have Rust already installed through dnf then the rustup installer will complain.
This part is also easy and fun; simply enter the following at the command line:
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
Use the default settings (ie press enter at the prompt) and let it do its thing. If for some reason your system does not have curl then you can dnf install that.
Veloren currently depends on Rust nightly rather than the stable release, so there is one more critical step to getting the compilation working:
Go into the "veloren" directory you cloned earlier and do `rustup override set nightly`
Now your Rust is ready.
At this point you're almost ready to build. Rust is pretty good at taking care of its own dependencies, but there are still some C libraries and utilities that need to be present on your system that you are otherwise unaware that you're going to need. (Figuring this part out is where most of the work of this guide went into.)
On a fresh Fedora system like the one I was working with, it's important to have the "Development Tools" package group installed. Beyond that there's just a couple of other necessary packages, so running the following command should be sufficient:
`sudo dnf install alsa-lib-devel @development-tools gtk3-devel systemd-devel`
You could have installed these packages back when you installed git-lfs, but I figured I'd order the operations this way to make it more clear. There's no harm in installing all the Fedora packages at once in the very beginning.
If you're not familiar, you'll notice the @ sign in @development-tools; this is necessary for installing a package group here.
Without further ado, you should be able to run `cargo build` in the veloren directory. If this guide worked it'll simply run to completion. :) If not, it may complain that something is missing and then stop. That's when you need to search for the appropriate package to install and then try again.
After building successfully you can run the binaries from the target directory on their own, but `cargo run` works too and can be used instead of `cargo build`, as it will automatically build source as necessary.
Enjoy!