ngtcp2: avoid building examples on FreeBSD due to Linux-specific socket APIs

The ngtcp2 examples use Linux-specific socket options (IP_PKTINFO,
IPTOS_ECN_MASK, IP_RECVTOS) for packet metadata and ECN support that
are not available on FreeBSD.

Enable ENABLE_LIB_ONLY on FreeBSD to skip examples while building
the core library.
This commit is contained in:
Jon Hermansen
2025-10-31 17:43:37 -04:00
parent 9a94527704
commit 212ef28fc0
@@ -39,7 +39,8 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [
# The examples try to link against `ngtcp2_crypto_ossl` and `ngtcp2` libraries.
# This works in the dynamic case where the targets have the same name, but not here where they're suffixed with `_static`.
(lib.cmakeBool "ENABLE_LIB_ONLY" stdenv.hostPlatform.isStatic)
# Also, the examples depend on Linux-specific APIs, so we avoid them on FreeBSD too.
(lib.cmakeBool "ENABLE_LIB_ONLY" (stdenv.hostPlatform.isStatic || stdenv.hostPlatform.isFreeBSD))
(lib.cmakeBool "ENABLE_SHARED_LIB" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "ENABLE_STATIC_LIB" stdenv.hostPlatform.isStatic)
];