From 190e0678a9f1da6e4c66299489698c99539c4bb8 Mon Sep 17 00:00:00 2001 From: Nikolay Govorov Date: Sun, 3 May 2026 06:42:17 +0100 Subject: [PATCH 1/5] Add build.zig.zon manifest --- .gitignore | 1 + build.zig.zon | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 build.zig.zon diff --git a/.gitignore b/.gitignore index 4ffdb8594..3b29a7e4f 100644 --- a/.gitignore +++ b/.gitignore @@ -116,6 +116,7 @@ src/stamp-h1 /bazel-* *.bazel.lock +zig-pkg/ zig-out/ zig-cache/ .zig-cache/ diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 000000000..c27199e7e --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,14 @@ +.{ + .name = .pcre2, + .version = "10.48.0-DEV", + .fingerprint = 0x914b3d63ebab9e21, // Changing this has security and trust implications. + .minimum_zig_version = "0.15.2", + .dependencies = .{}, + .paths = .{ + "build.zig", "build.zig.zon", + "src/", "doc/", + "HACKING", "INSTALL", + "README.md", "LICENCE.md", + "AUTHORS.md", "SECURITY.md", + }, +} From 69b3cb42f8aae61b8046fd28c63110cb136c5169 Mon Sep 17 00:00:00 2001 From: Nikolay Govorov Date: Sun, 3 May 2026 06:47:39 +0100 Subject: [PATCH 2/5] Use stable Zig version in Github Actions --- .github/workflows/dev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index ce9593da4..ba9e2cf24 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -634,9 +634,9 @@ jobs: (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'zebrilus')) || github.event_name == 'push' steps: - - name: Setup - run: | - sudo snap install zig --classic --beta + # The zig version from minimum_zig_version in build.zig.zon will be installed. + - name: Install zig + uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1 - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 From dfb9b3c7ea660cee3d974eaf6d0b229c60e7e10e Mon Sep 17 00:00:00 2001 From: Nikolay Govorov Date: Sun, 3 May 2026 07:20:55 +0100 Subject: [PATCH 3/5] Add build.zig.zon to releases tarballs --- Makefile.am | 3 ++- README | 1 + doc/html/README.txt | 1 + maint/UpdateAlways | 1 + maint/UpdateRelease.py | 8 ++++++++ maint/manifest-tarball | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3a6a5da1d..e5409e0dc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -294,7 +294,8 @@ EXTRA_DIST += \ EXTRA_DIST += \ BUILD.bazel \ MODULE.bazel \ - build.zig + build.zig \ + build.zig.zon # These are support files for building under VMS diff --git a/README b/README index 1c064770b..29768ad3b 100644 --- a/README +++ b/README @@ -991,6 +991,7 @@ The distribution should contain the files listed below. BUILD.bazel ) files used by the Bazel MODULE.bazel ) build system build.zig file used by zig's build system + build.zig.zon file used by zig's package manager (G) Auxiliary files for building PCRE2 under OpenVMS diff --git a/doc/html/README.txt b/doc/html/README.txt index 1c064770b..29768ad3b 100644 --- a/doc/html/README.txt +++ b/doc/html/README.txt @@ -991,6 +991,7 @@ The distribution should contain the files listed below. BUILD.bazel ) files used by the Bazel MODULE.bazel ) build system build.zig file used by zig's build system + build.zig.zon file used by zig's package manager (G) Auxiliary files for building PCRE2 under OpenVMS diff --git a/maint/UpdateAlways b/maint/UpdateAlways index a6e96d638..a6e857941 100755 --- a/maint/UpdateAlways +++ b/maint/UpdateAlways @@ -240,6 +240,7 @@ txt_files=( RunTest SECURITY.md build.zig + build.zig.zon configure.ac libpcre2-8.pc.in libpcre2-16.pc.in diff --git a/maint/UpdateRelease.py b/maint/UpdateRelease.py index 01fd09ac6..076896db6 100755 --- a/maint/UpdateRelease.py +++ b/maint/UpdateRelease.py @@ -3,10 +3,12 @@ # Script to update all the hardcoded release numbers in the source tree. # - Documentation manpages. # - Bazel MODULE file. +# - Zig package manifest. # This script should be run in the main PCRE2 directory. import glob +import re from UpdateCommon import update_file, CURRENT_RELEASE @@ -27,3 +29,9 @@ def update_man_version(filename): # MODULE.bazel print('Updating MODULE.bazel') update_file('MODULE.bazel', r'(?m)^ version = ".*?"', ' version = "%s"' % CURRENT_RELEASE) + +# build.zig.zon +# Zig requires a semver MAJOR.MINOR.PATCH[-prerelease], so insert .0 as patch. +print('Updating build.zig.zon') +ZIG_VERSION = re.sub(r'^(\d+\.\d+)(.*)$', r'\1.0\2', CURRENT_RELEASE) +update_file('build.zig.zon', r'(?m)^ \.version = ".*?"', ' .version = "%s"' % ZIG_VERSION) diff --git a/maint/manifest-tarball b/maint/manifest-tarball index 720c5f641..efd29ff4a 100644 --- a/maint/manifest-tarball +++ b/maint/manifest-tarball @@ -22,6 +22,7 @@ drwxr-xr-x tarball-dir/pcre2-SNAPSHOT -rw-r--r-- tarball-dir/pcre2-SNAPSHOT/aclocal.m4 -rwxr-xr-x tarball-dir/pcre2-SNAPSHOT/ar-lib -rw-r--r-- tarball-dir/pcre2-SNAPSHOT/build.zig +-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/build.zig.zon drwxr-xr-x tarball-dir/pcre2-SNAPSHOT/cmake -rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/COPYING-CMAKE-SCRIPTS -rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/FindEditline.cmake From d38aef742a62df3d47280c5a0582a3d49ad1a90f Mon Sep 17 00:00:00 2001 From: Nicholas Wilson Date: Mon, 4 May 2026 11:33:23 +0100 Subject: [PATCH 4/5] Make comment more prescriptive on fingerprint --- build.zig.zon | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.zig.zon b/build.zig.zon index c27199e7e..b1dfc47b3 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,11 @@ .{ .name = .pcre2, .version = "10.48.0-DEV", - .fingerprint = 0x914b3d63ebab9e21, // Changing this has security and trust implications. + + // Do NOT change this for new releases. + // DO change this if making a fork of PCRE2 which is used by any Zig clients. + .fingerprint = 0x914b3d63ebab9e21, + .minimum_zig_version = "0.15.2", .dependencies = .{}, .paths = .{ From 15068fd1643d906f37482aab50efd0d084721b8d Mon Sep 17 00:00:00 2001 From: Nikolay Govorov Date: Mon, 4 May 2026 17:15:55 +0100 Subject: [PATCH 5/5] Add docs to zig package files --- build.zig.zon | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index b1dfc47b3..447cc57e5 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,10 +9,11 @@ .minimum_zig_version = "0.15.2", .dependencies = .{}, .paths = .{ - "build.zig", "build.zig.zon", - "src/", "doc/", - "HACKING", "INSTALL", - "README.md", "LICENCE.md", - "AUTHORS.md", "SECURITY.md", + "build.zig", "build.zig.zon", + "src/", "doc/", + "deps/", "HACKING", + "INSTALL", "README.md", + "LICENCE.md", "AUTHORS.md", + "SECURITY.md", }, }