Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Meson build system #12

Closed
Eonfge opened this issue Apr 8, 2021 · 4 comments
Closed

Implement Meson build system #12

Eonfge opened this issue Apr 8, 2021 · 4 comments
Labels
info needed More information is needed to continue

Comments

@Eonfge
Copy link

Eonfge commented Apr 8, 2021

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)
@Aurailus
Copy link
Owner

Aurailus commented Apr 8, 2021

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.

@rubenwardy
Copy link

rubenwardy commented Apr 8, 2021

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

@Aurailus Aurailus added question Further information is requested info needed More information is needed to continue and removed question Further information is requested labels Apr 8, 2021
@Eonfge
Copy link
Author

Eonfge commented Apr 9, 2021

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.

@Aurailus
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info needed More information is needed to continue
Projects
None yet
Development

No branches or pull requests

3 participants