How to Setup a Modern GStreamer Development Environment Using Meson and gst-build

As you might already know, many open source projects are moving away from autotools as a build system and are embracing Meson. GStreamer was one of the first projects to initiate this move as the community pushed for it to happen.

Meson has many advantages over autotools, but one I would like to talk about in this post is the notion of subprojects, which Meson introduces. Basically, thanks to this it’s easy to build several projects as if it was one; GStreamer has many components that were formerly independent in the build system, meaning that if you wanted to build the latest version of, say, gst-plugins-bad, you also needed to build GStreamer core and GStreamer base one way or another. Previously, we had some scripts to help with this process, but it was still necessary to clone and build everything separately and handle interdependency between things manually.

Today, things are different when using meson; we developed a new module called gst-build that basically sets up all GStreamer modules as subprojects and allows you to build everything in one go! It exposes options to define what gets built using the meson infrastructure. The final impression is that GStreamer becomes one single project to work with when developing with any of its components. For example, tests from all components can be run in one go using ninja test. Also, updating all of GStreamer becomes as easy as running ninja update to update all subprojects and rebuild. In the long run, we would like to have all dependencies built with meson, but for now external dependencies still need to be available using another method (for example, with a package manager on Linux).

Note: gst-build is continuously tested on Linux and Windows (using the script from gst-build).

How to Get Started with gst-build

First, get build dependencies for GStreamer core and plugins on your distribution. Commands to do this on some popular distributions follow. This will install a lot of packages, but should mean that you won’t have to play find-the-plugin-dependency for your local build.

  • Fedora: $ sudo yum-builddep gstreamer1-*
  • Debian/Ubuntu: $ sudo apt-get build-dep gstreamer1.0-plugins-{base,good,bad,ugly}
  • Gentoo: having the GStreamer core and plugin packages should suffice
  • Others: drop me a note with the command for your favourite distro, and I’ll add it here

Assuming you have meson, ninja installed, using gst-build is as easy as running the following command.

git clone git:// && mkdir build && meson build/ && ninja -C build/

Now, it’s possible to get directly into an uninstalled environment with

ninja -C build/ uninstalled

All GStreamer modules are cloned when running meson, and the repository can be accessed in the root folder of gst-build. Development and hacking can be done from this directory and rebuilding is a matter of running ninja -C build/ which will rebuild each component that needs it after changes have been made.

Happy hacking!

Author: Thibault Saunier

Thibault Saunier is a open source Multimedia engineer mostly developing and maintaining the GStreamer framework and the Pitivi Video editor.