Meson and 3rd party dependencies. Only one correct way

Intro

As you know, many projects bundling libs (including source code of 3rd party libs). For example, SuperTuxKart bundles angelscript, bullet, enet, glew, irrlicht, jpeglib, libpng, wiiuse, zlib. All of this libs package in my favorite distro Fedora.

As Fedora maintainer I need to check what changed in bundled libs code, if nothing – write patch to use system lib, if few changes – write patch to use system lib and report bug against this lib in Fedora, if big changes – try to understand what changed, why it’s not in upstream, create FPC ticket and they will accept bundle – use bundle. If all devs will allow to use system libs – this will be great (0 A.D. and Xonotic does this). Yes, this is also cross-platform games.

In CMake I need to write custom FindSomething.cmake and fix some things in CMakeLists.txt. Providing switch between system and bundled sources is not easy. For example, in stuntrally to unbundle ~ 50% of libs I should Showing 49 changed files with 238 additions and 108 deletions. I hate it.

In Autotools I never tried to do this, I think I will kill myself if will try.

With Meson it’s really simple. Meson is designed to be simple for developers, maintainers and fast. Hi to m4 and that black magic.

I don’t want to write more here, please read manual at official meson wiki. Much better to see real example.

Example

If we don’t have library in system (I renamed libenet to libent to not delete enet from my system):
Meson wrap bundled
If we have library in system:
Meson wrap system

Feedback

Please do not hesitate to contact us via IRC (#mesonbuild on freenode) or send patches/issues via GitHub (https://github.com/jpakkane/meson)

P.S. When I wrote this example I found some missing functionality and minor bugs and sent patches[1][2]. If you want to try this example – you need apply those patches.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments are closed.

  1. […] previous post I showed how to correctly use 3rd party dependencies. While I wrote that post I realized that […]

    [WORDPRESS HASHCASH] Snoopy failed to fetch results for the comment blog url (https://blogs.gnome.org/ignatenko/2015/05/30/meson-and-3rd-party-dependencies-wrap-db-is-here/) with error ” and so is spam.

css.php