cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.21k stars 474 forks source link

Add support for the Meson build system #495

Closed nirbheek closed 4 years ago

nirbheek commented 4 years ago

Hi! I'm a GStreamer developer, and for the same reasons as OpenH264, we've written Meson build files for libsrtp. We use libsrtp in gstreamer for WebRTC DTLS.

The Meson build system is being adopted by projects such as GNOME, GTK, Mesa, GStreamer, etc. I am not sure if such a pull request is welcome, but it would be amazing if you could consider merging this :)


These Meson build files have feature-parity with the Autoconf/Make build files, the Visual Studio solution, and the CMake build files. They are also simpler, faster, and support all target platforms supported by libsrtp (that I know of). The following have been tested:

Linux, macOS, Windows (MinGW), Windows (MSVC), Windows (UWP/WinRT), Cross-Android (all arches), Cross-iOS (all arches), Cross-Linux, Cross-Windows (MinGW).

Meson supports a superset of the currently-supported target platforms, and no platform-specific code should be needed for those, so this also improves cross-platform support.

The build outputs should be ABI-compatible with the outputs by Autoconf, but this has not been verified in detail.

I've also updated the README, and (pasted from there) the steps to try this out are:

# Setup the build subdirectory
meson setup --prefix=/path/to/prefix builddir
# Build the project
meson compile -C builddir
# Run tests
meson test -C builddir
# Optionally, install
meson install -C builddir
pabuhler commented 4 years ago

Hi, I have nothing really against including meson besides the potential maintenance over head. There has been no real discussion on replacing autotools and the current cmake support was seen both as a way to replace hard coded windows project files and to provide a "cross platform" solution to reduce maintenance. If this was to be accepted and you would like to maintain some hope that it does not get broken then I would suggest adding at least a standard linux build to the travis build file. If meson is gaining traction and it helps (more than one) other projects to have it here then I am ok with it. Lets see what others think?

nirbheek commented 4 years ago

Thanks for looking at this @pabuhler :)

Sorry for not being clear, my intention is not to advocate for Meson to replace any of the build systems used by libsrtp. I'm an outsider to the project after all.

As for maintenance overhead, I'd be happy to maintain these build files. I can add a CODEOWNERS file with myself in it and I'll get email about all PRs that touch the build files. We're going to be using this in GStreamer, so we will be doing active maintenance too.

I'll also add some Travis CI builds, thanks for the suggestion!

nirbheek commented 4 years ago

A datapoint in favour of the idea that this would help more than one project is that there's also a set of meson build files in Meson's WrapDB (code: https://github.com/mesonbuild/libsrtp2/tree/2.2.0) written independently by @xhaakon.

@xhaakon would you also like to be in CODEOWNERS for the meson build files in libsrtp if this is merged?

nirbheek commented 4 years ago

I'll also add some Travis CI builds, thanks for the suggestion!

I've implemented Meson counterparts for all CI build jobs, and I added a new one specifically for testing the build on WinRT/UWP too. Tests seem to be passing everywhere they could be run.

CI now takes ~1-2min more than it used to because the big-endian mips test is the bottleneck and we run tests using Meson there too now.

havardgraff commented 4 years ago

@pabuhler I can warmly recommend Meson! It makes everything hard and clunky about cross-platform development easy and lean.

pabuhler commented 4 years ago

@nirbheek thanks for adding the builds to travis, that would have taken me a bit of time to figure out. I think my position has not changed, this is fine for me as long as there is not to much maintenance and if that becomes an issue we can just bin it later. Will wait abit to see if any other people have comments. @havardgraff I'll take your advice in to consideration ;-)

nirbheek commented 4 years ago

@tp-m pointed out to me that it would be good to add a make distcheck target that checks whether the project version in the meson build files is correct. I'm not sure if I did it correctly, but I've added a rough check to the make distribution target with instructions on how to update it. It looks like this:

===================================================
Meson project version is 2.3.0 which is incorrect.
Please edit meson.build and change the 'version:'
field in the project() call to 2.4.0
===================================================

The project() call is the first line in the build file, so should be easy to find.

xhaakon commented 4 years ago

@xhaakon would you also like to be in CODEOWNERS for the meson build files in libsrtp if this is merged?

Nothing against that, feel free to add me.

nirbheek commented 4 years ago

Nothing against that, feel free to add me.

Done, thanks!

Also fixed a build failure on msvc-32-bit and added CI for windows UWP arm64.

Edit: CI has passed, but it's not showing status on the PR for some reason.

nirbheek commented 4 years ago

Gentle poke :)

pabuhler commented 4 years ago

@nirbheek , sorry for the delay, have been out of the office for a few weeks. Will follow up now.

pabuhler commented 4 years ago

@nirbheek for me supporting meson seams non trivial as with all build systems there is lots to learn and when adapting to an existing projects there are always special case handling that require even more work. So we can see how this goes and if it does not cause to much work then great but if it becomes a problem we will have to review it.

tp-m commented 4 years ago

Thanks a lot for merging this!

I'm also happy to help out if there are any issues related to the Meson build, or with keeping it up to date.

nirbheek commented 4 years ago

Many thanks for merging this 😄 I hope it works out for all of us. Please poke me when you have questions. Either on GitHub, or on FreeNode (nirbheek). I am on #gstreamer and #mesonbuild. And of course, since we're all in the CODEOWNERS file, we will get email for PRs to the meson build files.