Skip to content

Update build.zig to compile on the latest stable Zig 0.15.2#894

Merged
NWilson merged 3 commits intoPCRE2Project:mainfrom
bernardassan:main
Apr 3, 2026
Merged

Update build.zig to compile on the latest stable Zig 0.15.2#894
NWilson merged 3 commits intoPCRE2Project:mainfrom
bernardassan:main

Conversation

@bernardassan
Copy link
Copy Markdown
Contributor

Add a named LazyPath called pcre2.h, which library users can import and add to their projects' include directory, like https://github.com/bernardassan/Glib/blob/49ef9727f43d41011baa1f3961076a29ebebb515/build/glib/root.zig#L93

Add some more config_h options

Correctly set PCRE2_EXPORT

Add a named LazyPath to pcre2_h so library uses can add pcre2_h to
their projects include paths

Add some more config_h options

Correctly set PCRE2_EXPORT

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
@NWilson
Copy link
Copy Markdown
Member

NWilson commented Mar 21, 2026

Thank you for this contribution! I have raised some questions, but in principle, if it builds for you and on our CI, I am happy to accept it.

@bernardassan
Copy link
Copy Markdown
Contributor Author

I will update this PR in the morning, done some changes already

remove unused config options

make visibility actually work (tested to be working with my project https://github.com/bernardassan/Glib/tree/glib_tests)

even though I was resisting, expose "pcre2posix.h" as a named LazyPath
for users who want to use this api instead

Add sanitize_c option

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
@bernardassan
Copy link
Copy Markdown
Contributor Author

Updated PR with suggestions from the review

@bernardassan
Copy link
Copy Markdown
Contributor Author

@NWilson, can you have a look at the improvements made in your free time?

@NWilson
Copy link
Copy Markdown
Member

NWilson commented Apr 3, 2026

Thank you again @bernardassan. I have pushed one small change to set the flags consistently across the different zig modules.

I tested with nm -D on the shared library produced by zig and observed that the _pcre2_default_tables symbol was public, because the -fvisibility flag was only set on one of the addCSourceFiles calls.

That led to me passing the flags consistently to all of them.

I will merge your changes + my small addition.

Please do feel free to come back with any further changes if you object or disagree with any of the tweaks I made (I am, after all, a C developer not a Zig developer).

@NWilson NWilson merged commit c4cb38b into PCRE2Project:main Apr 3, 2026
38 checks passed
@bernardassan
Copy link
Copy Markdown
Contributor Author

@NWilson looks good to me. Maybe you will become a Zig developer someday in the future 😄.

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