Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig build support #206

Merged
merged 1 commit into from
Feb 9, 2023
Merged

zig build support #206

merged 1 commit into from
Feb 9, 2023

Conversation

star-tek-mb
Copy link
Contributor

Hello.

Zig is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software.

Zig can leverage C source code base and recently got support for package manager (master branch). So it would be easy to use pcre2 in Zig projects.

Build standalone library with:

zig build

Or use it in your project:

Specify dependency in manifest build.zig.zon:

.{
    .name = "example",
    .version = "0.0.0",

    .dependencies = .{
        .pcre2 = .{
            .url = "https://github.com/PCRE2Project/pcre2/archive/fa35393d7935f7ef2833bf89d16d49a05c17923b.tar.gz",
            .hash = "1220cd78969639ad750886231c71cdb991459792ac2187ad57552aab9df97a8ba98c",
        },
    },
}

Hash and commit will be different.

In build.zig link pcre2 to your executable.

const pcre2_dep = b.dependency("pcre2", .{
    .target = target,
    .optimize = optimize,
});
exe.linkLibrary(pcre2_dep.artifact("pcre2"));

@PhilipHazel
Copy link
Collaborator

There is a precedent here in the form of the .bazel files in the repo. I do not mind adding your zig file. However, would you want it included in the tarballs for PCRE2 releases? (I see that the Bazel files are not so included.)

@star-tek-mb
Copy link
Contributor Author

I don't mind. But it is not necessary for now. Most of the time, sha commit from git is fetched. And zig package manager is MVP for now. I will try to maintain it in time. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants