Skip to content

feat(pkg): add libevent 2.1.13 compat package - #503

Merged
Sunrisepeak merged 9 commits into
mcpplibs:mainfrom
XxingGoD:feat/add-libevent
Oct 1, 2026
Merged

Sunrisepeak merged 9 commits into
mcpplibs:mainfrom
XxingGoD:feat/add-libevent

Conversation

@XxingGoD

@XxingGoD XxingGoD commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Adds compat.libevent 2.1.13 as a cross-platform C-source package and registers a workspace behavior test.

Shape and source selection

Libevent is a third-party C library with no upstream mcpp.toml, so this is a Form B compat package. The descriptor compiles the CMake SRC_CORE and SRC_EXTRA translation units directly through mcpp, using separate Linux epoll, macOS kqueue and Windows IOCP/select backends. It also compiles POSIX pthread or Win32 thread support per platform. Upstream CMake is run by the install hook only to generate event2/event-config.h and evconfig-private.h; the library objects are compiled by the consuming mcpp toolchain.

CMake's Linux/macOS platform probes explicitly use the native /usr/bin/cc, avoiding incomplete config headers from the ambient mcpp toolchain wrapper. The C sources themselves remain compiled by the consumer's selected mcpp toolchain.

OpenSSL, Mbed TLS, tests, benchmarks and sample programs are explicitly disabled. The TLS adapters are not advertised as features or included in the target. Windows links ws2_32, shell32, advapi32 and iphlpapi; the behavior test initializes Winsock before creating the event base and cleans it up afterward.

Upstream source, version and license

  • Repository: libevent/libevent
  • Stable tag: release-2.1.13-stable (the observed 2.2 tags were alpha prereleases)
  • SHA-256: 1a0885e17dc78afbaeddf13cf849f9238bbc24acdc178464a0d1934d7c5ffbd5, calculated twice on the archive.
  • Licenses: BSD-3-Clause for the main code, ISC for the arc4random implementation included through evutil_rand.c, MIT for the Windows timer code derived from libutp. The selected metadata includes these SPDX IDs.
  • Mirror: plain upstream URL; no GitCode mirror asset is configured.

Test member

tests/examples/libevent checks a one-shot timeout callback, an evbuffer write/read round trip, and creation/freeing of an HTTP object. The event loop uses EVLOOP_ONCE: event_base_dispatch() returns 1 when a one-shot event empties the queue, even if the callback ran successfully. Windows initializes and cleans up Winsock explicitly.

Verification

With CI-pinned mcpp 2026.10.1.2, Linux, macOS and Windows all passed mcpp xpkg parse --all-os pkgs/c/compat.libevent.lua and mcpp test -p libevent --cache off:

An initial Linux default-GCC run failed because CMake's host probes used the ambient toolchain wrapper and generated an incomplete event-config.h. Selecting /usr/bin/cc for Linux/macOS CMake probes fixed it; the subsequent full PR validation passed. The Windows probe initially could not invoke a quoted CMake executable directly, so the hook uses cmd /c; its final behavior test passes without the earlier uninitialized-Winsock warning. Local Linux GCC 16.1.0 and LLVM 22.1.8 smoke tests also passed.

README

Per request, the package is intentionally not added to either README. This PR also removes the merged muduo/Boost example rows from both READMEs; no other README content is changed.

@XxingGoD

XxingGoD commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

@Sunrisepeak

@Sunrisepeak
Sunrisepeak merged commit 064d42b into mcpplibs:main Oct 1, 2026
17 checks passed
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