Skip to content

Include pkg-config support #13611

@gor-gyolchanyan

Description

@gor-gyolchanyan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions