I propose including pkg-config support.
Many software repositories vending C libraries have support for pkg-config by generating a *.pc file (during the build configuration phase, when installation paths become known), which significantly improves discoverability of the C library, as well as improves interoperability with other build systems.
Feature
Including pkg-config support means producing a wasmtime.pc file as part of each release. The wasmtime.pc would be used in conjunction with the pkg-config tool to streamline C API usage and would contain all necessary information like the include path, the library path, and the library to be linked with.
Benefit
- Wasmtime exposes a stable C embedding API via
wasmtime.h and libwasmtime.dylib, which at the moment aren't easy to integrate into build processes without custom environment configuration.
- Build systems like SwiftPM, Meson, Autotools, CMake, and many others can consume libraries through
pkg-config.
Implementation
I created a separate homebrew formula that depends on the existing wasmtime formula and generates the wasmtime.pc file. I was going to create a pull request for homebrew-core.git, but having the build process generate the wasmtime.pc file seems like a better approach.
Here's the source code of my homebrew formula for reference (I tentatively named it libwasmtime for disambiguation purposes).
libwasmtime.rb.txt
Alternatives
Alternatively, the ruby code that generates the wasmtime.pc file inside the install function of my homebrew formula could be copied into wasmtime.rb, making the existing wasmtime homebrew formula install the wasmtime.pc file.
I propose including pkg-config support.
Many software repositories vending C libraries have support for
pkg-configby generating a*.pcfile (during the build configuration phase, when installation paths become known), which significantly improves discoverability of the C library, as well as improves interoperability with other build systems.Feature
Including pkg-config support means producing a
wasmtime.pcfile as part of each release. Thewasmtime.pcwould be used in conjunction with thepkg-configtool to streamline C API usage and would contain all necessary information like the include path, the library path, and the library to be linked with.Benefit
wasmtime.handlibwasmtime.dylib, which at the moment aren't easy to integrate into build processes without custom environment configuration.pkg-config.Implementation
I created a separate homebrew formula that depends on the existing
wasmtimeformula and generates thewasmtime.pcfile. I was going to create a pull request for homebrew-core.git, but having the build process generate thewasmtime.pcfile seems like a better approach.Here's the source code of my homebrew formula for reference (I tentatively named it libwasmtime for disambiguation purposes).
libwasmtime.rb.txt
Alternatives
Alternatively, the ruby code that generates the
wasmtime.pcfile inside theinstallfunction of my homebrew formula could be copied intowasmtime.rb, making the existing wasmtime homebrew formula install thewasmtime.pcfile.