Skip to content

feat: support building on FreeBSD#86

Open
Ignition wants to merge 1 commit into
masterfrom
feat/freebsd-support
Open

feat: support building on FreeBSD#86
Ignition wants to merge 1 commit into
masterfrom
feat/freebsd-support

Conversation

@Ignition

Copy link
Copy Markdown

Accept FreeBSD in the CMake OS check and reuse the existing POSIX socket path (src/linux/). Two source portability fixes make that path compile on FreeBSD:

  • endian: FreeBSD provides the byte-order helpers via <sys/endian.h>
    rather than glibc's <endian.h>.
  • SOL_TCP: use the portable POSIX IPPROTO_TCP for TCP-level setsockopt options; SOL_TCP is a Linux-only alias (equal to IPPROTO_TCP there).

Also rename the MGCLIENT_ON_LINUX macro/CMake variable to MGCLIENT_ON_POSIX, since Linux and FreeBSD now share that build path.

Verified: static and shared libraries build with clang on FreeBSD 14.

Accept FreeBSD in the CMake OS check and reuse the existing POSIX socket
path (src/linux/). Two source portability fixes make that path compile
on FreeBSD:

- endian: FreeBSD provides the byte-order helpers via <sys/endian.h>
  rather than glibc's <endian.h>.
- SOL_TCP: use the portable POSIX IPPROTO_TCP for TCP-level setsockopt
  options; SOL_TCP is a Linux-only alias (equal to IPPROTO_TCP there).

Also rename the MGCLIENT_ON_LINUX macro/CMake variable to
MGCLIENT_ON_POSIX, since Linux and FreeBSD now share that build path.

Verified: static and shared libraries build with clang on FreeBSD 14.
@Ignition Ignition self-assigned this Jul 14, 2026
@Ignition Ignition requested review from gitbuda and mattkjames7 July 14, 2026 21:30
@Ignition Ignition added the Docs - changelog only Docs - changelog only label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs - changelog only Docs - changelog only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant