Skip to content

Pcre migrate - #1

Closed
pdx-daniel wants to merge 13 commits into
zig-0.12from
pcre-migrate
Closed

Pcre migrate#1
pdx-daniel wants to merge 13 commits into
zig-0.12from
pcre-migrate

Conversation

@pdx-daniel

Copy link
Copy Markdown
Owner

Pull Request: PCRE v1 → PCRE2 Migration with Zig 0.14+ Support

Overview

Migrates FastFEC from end-of-life PCRE v1 to PCRE2 while adding Zig 0.14+ support and cleaning up the build system.

Why This Change

  • Homebrew Compatibility: PCRE v1 is EOL, PCRE2 is required for modern distros
  • Zig Modernization: Support current Zig versions (≥0.14)
  • Build Simplification: Remove unnecessary complexity while maintaining functionality

What Changed

  • Added PCRE2: Vendored PCRE2 10.42 source tree in src/pcre2/
  • Thin Wrapper: Created src/regex.h and src/regex.c to maintain API compatibility
  • Build Updates: Modernized build.zig for Zig 0.14+ with flexible PCRE2 linking
  • Removed Legacy: Deleted old PCRE v1 source tree

Key Features

  • Zero Breaking Changes: All existing code works unchanged
  • Flexible Linking: -Dvendored-pcre option (defaults to true)
  • Cross-Platform: Works on macOS, Linux, Windows, WASM
  • Performance: Maintained ~11.89 MB/s processing speed

Test Results

  • C Tests: 21/21 passing
  • Python Tests: 8/8 passing
  • All Build Targets: Working across platforms
  • Performance: No regression in benchmark tests

Build Options

# Default (vendored PCRE2)
zig build

# System PCRE2 (for package maintainers)
zig build -Dvendored-pcre=false

# WASM build
zig build -Dwasm=true

Files Changed

  • 91 files changed: 41,021 insertions(+), 66,819 deletions(-)
  • Major additions: PCRE2 source tree, regex wrapper
  • Major removals: Legacy PCRE v1, build complexity

Ready for merge ✅ - All tests passing, no breaking changes.

…re2; remove PCRE v1 subtree; update build.zig for Zig 0.14+; wasm uses vendored PCRE2; docs updated
Removed complex error handling - We expect src/pcre2/ to exist
Removed b parameter - No longer needed for dynamic allocation
Added static pcre2Sources array - Like the original approach
Simplified function signature - Back to the original pattern
…y layer

- Remove @Hasfield and @hasDecl checks for main executable
- Simplify from 5 lines of compatibility code to 1 clean line
- Use direct addExecutable API with target and optimize parameters
- All tests pass: C tests (21/21), Python tests (8/8)
- All build targets work: main build and WASM build

Part of build.zig cleanup plan step 1
… layer

- Remove @hasDecl checks for addSharedLibrary, setTarget, and setOptimize
- Simplify from 3 lines of compatibility code to direct API usage
- Keep essential macOS headerpad_max_install_names setting
- All tests pass: C tests (21/21), Python tests (8/8)
- All build targets work: main build and WASM build

Part of build.zig cleanup plan step 2
…y layer

- Remove @Hasfield and @hasDecl checks for test executables
- Simplify from 4 lines of compatibility code to direct API usage
- Use direct addExecutable API with target and optimize parameters
- All tests pass: C tests (21/21), Python tests (8/8)
- All build targets work: main build and WASM build

Part of build.zig cleanup plan step 3
- Remove @Hasfield and @hasDecl checks for WASM executable
- Simplify from 4 lines of compatibility code to direct API usage
- Use direct addExecutable API with target and optimize parameters
- Keep essential WASM-specific settings: entry = .disabled, import_symbols = true
- All tests pass: C tests (21/21), Python tests (8/8)
- All build targets work: main build and WASM build

Part of build.zig cleanup plan step 4
- Add vendored-pcre build option (defaults to true for reliability)
- Restore linkPcre function signature to accept vendored_pcre parameter
- Support both vendored PCRE2 (src/pcre2/) and system PCRE2 (pcre2-8)
- Package maintainers can use -Dvendored-pcre=false for system libraries
- All tests pass: C tests (21/21), Python tests (8/8)
- All build targets work: main build, WASM build, and system PCRE2 build

Part of build.zig cleanup plan step 5 - restores flexibility lost in PCRE2 migration
@pdx-daniel pdx-daniel closed this Sep 26, 2025
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.

1 participant