Skip to content

Commit de025de

Browse files
yarshureclaude
andcommitted
CI: forward-declare getentropy for FreeBSD in getentropy.cc
getentropy is in unistd.h behind #if __BSD_VISIBLE on FreeBSD, which is 0 when BoringSSL's compile flags restrict POSIX visibility. Forward- declaring extern "C" int getentropy(void*, size_t) at line 1 bypasses the feature macro issue entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0f1f45e commit de025de

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ jobs:
7575
echo "Patched $SSL_LIB"
7676
}
7777
fi
78+
# CNIOBoringSSL: getentropy in unistd.h is behind __BSD_VISIBLE on FreeBSD.
79+
# Forward-declare it directly so no feature macros are needed.
80+
GE=$(find .build/checkouts -path "*/CNIOBoringSSL*/crypto/rand/getentropy.cc" 2>/dev/null | head -1)
81+
if [ -n "$GE" ]; then
82+
grep -qF 'FreeBSD-getentropy-fix' "$GE" || {
83+
awk 'NR==1{print "/* FreeBSD-getentropy-fix */\n#if defined(__FreeBSD__)\nextern \"C\" int getentropy(void*, __SIZE_TYPE__);\n#endif"}1' "$GE" > /tmp/_ge.cc
84+
mv /tmp/_ge.cc "$GE"
85+
echo "Patched $GE"
86+
}
87+
fi
7888
# All NIO-style lock files: FreeBSD pthread types are opaque pointers like OpenBSD
7989
find .build/checkouts \( -name "Locks.swift" -o -name "NIOLock.swift" \) 2>/dev/null | while read LOCKS; do
8090
grep -qF "pthread" "$LOCKS" || continue

0 commit comments

Comments
 (0)