Skip to content

enh(expat): Add patch system for POCO-specific xmlparse modifications#5099

Merged
matejk merged 1 commit intomainfrom
expat-patch-system
Dec 16, 2025
Merged

enh(expat): Add patch system for POCO-specific xmlparse modifications#5099
matejk merged 1 commit intomainfrom
expat-patch-system

Conversation

@matejk
Copy link
Copy Markdown
Contributor

@matejk matejk commented Dec 16, 2025

Summary

This PR adds a patch system to simplify future expat library upgrades. The src/xmlparse.cpp file contains POCO-specific modifications to expat's original xmlparse.c, and previously these changes had to be manually re-applied after each upgrade.

Changes

New files

  • xmlparse_poco.patch - Patch file containing all POCO-specific modifications
  • src/xmlparse.c - Original unmodified file from expat 2.7.1 (excluded from build)

POCO-specific modifications captured in the patch

  1. EXPAT_POCO mode - Enables POCO-specific entropy generation
  2. Poco::RandomInputStream - Uses POCO's random stream instead of OS-specific entropy sources
  3. C++ casts - Adds explicit casts for malloc_fcn calls (required for C++ compilation)
  4. expat_config.h - Includes the configuration header

CMake changes

  • Added version and source URL documentation to CMakeLists.txt
  • Exclude xmlparse.c from build (we use xmlparse.cpp)
  • Added patch_expat_xmlparse custom target (excluded from ALL)

How to upgrade expat in the future

  1. Download new expat release
  2. Replace files in dependencies/expat/src/ with new release files
  3. Run: cmake --build <build-dir> --target patch_expat_xmlparse
  4. The target will apply POCO patches to xmlparse.c and generate xmlparse.cpp

@matejk matejk added this to the Release 1.15.0 milestone Dec 16, 2025
@matejk matejk merged commit 159784b into main Dec 16, 2025
25 of 75 checks passed
@matejk matejk deleted the expat-patch-system branch December 16, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant