Aurailus/Myxer

Implement Meson build system

Closed this issue · 4 comments

Hey, I was looking into the options to package your application for Flathub, but I found that it's still quite rough around the corners.

One thing that's quite important, is a stand-alone build system. The most popular one is Meson, which uses Python to build and integrate a complete packaging system.

The best place to start, is by looking at another application that uses Meson in combination with Rust:
https://gitlab.gnome.org/GNOME/fractal

With a build system like Meson, you can do the following things:

  • Manage dependencies
  • Manage localization
  • Configure different build targets (release, production)
  • Copy-paste files in their respective directories (/usr/share/ stuff like icons, metainfo and desktop shortcuts)

Could you explain the need for an external build system? Like, I have different targets set up with CI already, the Debian build moves stuff to the proper directories, and dependencies are static and handled by cargo. I don't know how localization works, but then, I'm monolingual anyways so it's not like I'm going to be doing much translating.
Personally, it just seems like a lot of overhead for not much gain at the moment.

Rust already has Cargo as an integrated package manager (ie: for dependencies) and build system

Meson can be used as a build system on top of cargo to do other stuff, but it's worth having the other stuff to do

I don't know how localization works, but then, I'm monolingual anyways so it's not like I'm going to be doing much translating.

Localisation typically uses a program/script to updating source strings by scrapping the source code for them, and then updating translations in the repository. It's heavily dependent on what you use for translations, I don't know what Rust or GTK way tends to be

The primary reason that I mentioned it, is that Cargo as a build-system has some limits and problems that make it hard to integrate in build environments like Flatpak or RPM. For one, Cargo is also a package manager and that conflicts with the package managers themselves: Flatpak, Mock and similar do not support Cargo and it's unlikely that they ever will. NPM, PIP, Sbt and NuGet are also not supported, so Cargo is not alone in that.

One important part of a package manager, is to ensure reproducible builds through dynamic linking. You don't want every binary to compile it's own dependency tree into a single binary. You want to use shared resources like an .so, possibly in runtime like Flatpak. Build systems who are also package managers, generally focus on a one-size-fits-all solution where everything is bundled in one big executable. It's a cardinal sin in Linux packaging to resolve and download resources once the build has started.

It's not absolutely required to support Meson just so you can publish with Flatpak, but it certainly helps a lot. A project like Veloren is also written in Rust and they are also packaged on Flathub. They do require a lot of manual steps though, so if you want to streamline this process, than that's something Meson could help:

https://github.com/flathub/net.veloren.veloren

PS. If you want to try a one-click Meson-Rust poject, you can use GNOME Builder and start a new Rust project. It will auto-configure everything for you so you have a simple, nice, example.

Currently, I don't think that this is necessary given the scope of this project. I'm going to close this issue for now.