In previous post I showed how to correctly use 3rd party dependencies. While I wrote that post I realized that making we need to do many things: create wrap file, create meson.build file, get checksums and upload archive with meson.build file to any http/ftp server. So we started thinking how to make it more easy for developers who just want to use dependency.
We discussed it and created web application which taking a care about making project.wrap and archive with meson.build available to developers – Wrap DB. It’s creating something like tags when pull request are merged in github. Let’s look at example.
Suppose you have a project that depends on the zlib compression library. First you go to http://wrapdb.mesonbuild.com and find the list of provided projects. After a few clicks you’ll get to the actual build definition, which can be found here: http://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/4/get_wrap
Then you just add the contents of that page to the subprojects directory called zlib.wrap. The second step is to declare in your main build definition that you wish to use the subproject. That is all you need to do.
We feel that this is a great step in reducing dependency problems that plaque native code development. We hope you do too. Enjoy!
Common questions about Wrap
Q: Isn’t this just Go get or Rust cargo but for C and C++?
A: Yes. But our aim is to provide this experience for projects that do not support it natively.
Q: How can I contribute?
A: The simplest thing is to just use the service and give us your feedback. If you want to do more, we recommend creating your own wraps and submitting them to the database. The process is extremely simple and fully documented in wiki.
Q: Isn’t it unsafe to download and execute random source packages?
A: Wrap definition files are plain text so they are easy to audit. All downloaded files are checksum verified so you know that you are not man-in-the-middled.
Q: How is this different from existing dependency systems (biicode etc)?
A: To our knowledge this is the first system of its kind that combines the following features:
- based on source code rather than prebuilt binaries
- build system having a native concept of subproject embedding
- fully open source and community-driven, no CLAs
Q: What about subprojects that themselves use subprojects?
A: This is fully supported of course. If you have two subprojects that use a common subsubproject, Meson will automatically detect this and do the right thing.
Q: What if I’m too lazy to search projects through the web ui?
A: We are working on a client that allows you to search and add subprojects directly from the command line.
Q: Can I run an internal version of the server for mirroring and keeping my internal projects?
A: Sure, the code is available. You might not even need the server, though, because hosting wrap files only requires putting a few files on an intranet server. Wrap also supports using Git checkouts as subprojects.
P.S. Original post (doesn’t have my thoughts and histories) is in maillist.
P.P.S. Web interface for Wrap DB is not good, we will make it nicer in the near future 😉