Merge pull request #1117 from neheb/bs

remove libbsd support
This commit is contained in:
Sebastian Pipping 2026-01-03 20:38:11 +01:00 committed by GitHub
commit c483473da4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 7 additions and 76 deletions

View File

@ -65,7 +65,6 @@ jobs:
gcc-multilib \
g++-multilib \
lcov \
libbsd-dev \
lzip \
moreutils \
retry

View File

@ -8,7 +8,6 @@ HAVE_FCNTL_H
HAVE_GETPAGESIZE
HAVE_GETRANDOM
HAVE_INTTYPES_H
HAVE_LIBBSD
HAVE_MEMORY_H
HAVE_MMAP
HAVE_STDINT_H

View File

@ -10,7 +10,6 @@ HAVE_FCNTL_H
HAVE_GETPAGESIZE
HAVE_GETRANDOM
HAVE_INTTYPES_H
HAVE_LIBBSD
HAVE_MMAP
HAVE_STDINT_H
HAVE_STDIO_H

View File

@ -121,7 +121,6 @@ jobs:
gcc-multilib \
g++-multilib \
lcov \
libbsd-dev \
lzip \
moreutils
- name: Perform check "${{ matrix.MODE }}"

View File

@ -135,9 +135,6 @@ expat_shy_set(EXPAT_BUILD_DOCS ${_EXPAT_BUILD_DOCS_DEFAULT} CACHE BOOL "Build ma
expat_shy_set(EXPAT_BUILD_FUZZERS OFF CACHE BOOL "Build fuzzers for the expat library")
expat_shy_set(EXPAT_BUILD_PKGCONFIG ${_EXPAT_BUILD_PKGCONFIG_DEFAULT} CACHE BOOL "Build pkg-config file")
expat_shy_set(EXPAT_OSSFUZZ_BUILD OFF CACHE BOOL "Build fuzzers via OSS-Fuzz for the expat library")
if(UNIX OR _EXPAT_HELP)
expat_shy_set(EXPAT_WITH_LIBBSD OFF CACHE BOOL "Utilize libbsd (for arc4random_buf)")
endif()
expat_shy_set(EXPAT_ENABLE_INSTALL ON CACHE BOOL "Install expat files in cmake install target")
expat_shy_set(EXPAT_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point, 0 to disable")
mark_as_advanced(EXPAT_CONTEXT_BYTES)
@ -190,15 +187,6 @@ if(EXPAT_DTD AND NOT EXPAT_GE)
message(SEND_ERROR "Please either enable option EXPAT_GE (recommended) or disable EXPAT_DTD also.")
endif()
if(EXPAT_WITH_LIBBSD)
find_library(LIB_BSD NAMES bsd)
if(NOT LIB_BSD)
message(SEND_ERROR "EXPAT_WITH_LIBBSD option is enabled, but libbsd was not found")
else()
set(HAVE_LIBBSD TRUE)
endif()
endif()
if(MSVC)
# For the three types of MSVC version values, please see:
# - https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
@ -427,9 +415,6 @@ add_library(expat::expat ALIAS expat)
if(_EXPAT_LIBM_FOUND)
target_link_libraries(expat m)
endif()
if(EXPAT_WITH_LIBBSD)
target_link_libraries(expat ${LIB_BSD})
endif()
#
# Library filename postfix
@ -683,10 +668,6 @@ if(EXPAT_BUILD_TESTS)
if(_EXPAT_LIBM_FOUND)
target_link_libraries(${_target} m)
endif()
if(EXPAT_WITH_LIBBSD)
target_link_libraries(${_target} ${LIB_BSD})
endif()
endforeach()
add_executable(benchmark tests/benchmark/benchmark.c)
@ -1012,7 +993,6 @@ if(WIN32)
else()
message(STATUS " getrandom ................ ${HAVE_GETRANDOM}")
message(STATUS " syscall SYS_getrandom .... ${HAVE_SYSCALL_GETRANDOM}")
message(STATUS " libbsd ................... ${EXPAT_WITH_LIBBSD}")
message(STATUS " /dev/random .............. ${EXPAT_DEV_URANDOM}")
endif()
message(STATUS "")

View File

@ -22,15 +22,9 @@ check_symbol_exists("getpagesize" "unistd.h" HAVE_GETPAGESIZE)
check_symbol_exists("mmap" "sys/mman.h" HAVE_MMAP)
check_symbol_exists("getrandom" "sys/random.h" HAVE_GETRANDOM)
if(EXPAT_WITH_LIBBSD)
set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")
set(_bsd "bsd/")
else()
set(_bsd "")
endif()
check_symbol_exists("arc4random_buf" "${_bsd}stdlib.h" HAVE_ARC4RANDOM_BUF)
check_symbol_exists("arc4random_buf" "stdlib.h" HAVE_ARC4RANDOM_BUF)
if(NOT HAVE_ARC4RANDOM_BUF)
check_symbol_exists("arc4random" "${_bsd}stdlib.h" HAVE_ARC4RANDOM)
check_symbol_exists("arc4random" "stdlib.h" HAVE_ARC4RANDOM)
endif()
set(CMAKE_REQUIRED_LIBRARIES)

View File

@ -303,9 +303,6 @@ EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF
// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]
EXPAT_WITH_GETRANDOM:STRING=AUTO
// Utilize libbsd (for arc4random_buf)
EXPAT_WITH_LIBBSD:BOOL=OFF
// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]
EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO
```

View File

@ -199,23 +199,9 @@ AM_CONDITIONAL([_INTERNAL_LARGE_SIZE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP
LT_LIB_M
AC_ARG_WITH([libbsd],
[AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)])],
[],
[with_libbsd=no])
AS_IF([test "x${with_libbsd}" != xno],
[AC_CHECK_LIB([bsd],
[arc4random_buf],
[],
[AS_IF([test "x${with_libbsd}" = xyes],
[AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.])])])])
AC_MSG_CHECKING([for arc4random_buf (BSD, libbsd or glibc 2.36+)])
AC_MSG_CHECKING([for arc4random_buf (BSD or glibc 2.36+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#if defined(HAVE_LIBBSD)
# include <bsd/stdlib.h>
#else
# include <stdlib.h> /* for arc4random_buf on BSD */
#endif
#include <stdlib.h>
int main(void) {
char dummy[[123]]; // double brackets for m4
arc4random_buf(dummy, 0U);
@ -226,13 +212,9 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([for arc4random (BSD, macOS, libbsd or glibc 2.36+)])
AC_MSG_CHECKING([for arc4random (BSD, macOS, or glibc 2.36+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#if defined(HAVE_LIBBSD)
# include <bsd/stdlib.h>
#else
# include <stdlib.h>
#endif
#include <stdlib.h>
int main(void) {
arc4random();
return 0;

View File

@ -39,11 +39,6 @@ _get_source_dir() {
_get_build_dir() {
local libbsd_part=
if ${with_libbsd}; then
libbsd_part=__libbsd
fi
local mingw_part=
if ${with_mingw}; then
mingw_part=__windows
@ -78,7 +73,7 @@ _get_build_dir() {
dtd_part=__dtd
fi
echo "build__${version}__xml_context_${xml_context}${libbsd_part}${mingw_part}${char_part}${ge_part}${dtd_part}${xml_attr_part}${m32_part}"
echo "build__${version}__xml_context_${xml_context}${mingw_part}${char_part}${ge_part}${dtd_part}${xml_attr_part}${m32_part}"
}
@ -102,7 +97,6 @@ _call_cmake() {
cmake_args+=( -DEXPAT_CONTEXT_BYTES=${xml_context} )
fi
${with_libbsd} && cmake_args+=( -DEXPAT_WITH_LIBBSD=ON )
${with_mingw} && cmake_args+=( -DCMAKE_TOOLCHAIN_FILE="${abs_source_dir}"/cmake/mingw-toolchain.cmake )
${with_m32} && cmake_args+=( -D_EXPAT_M32=ON )
${with_ge} || cmake_args+=( -DEXPAT_GE=OFF )
@ -311,7 +305,6 @@ _main() {
# All combinations:
with_unsigned_char=false
with_libbsd=false
with_m32=false
with_dtd=true
with_ge=true
@ -330,7 +323,6 @@ _main() {
done
# Single cases:
with_libbsd=true _build_case
with_unsigned_char=true _build_case
with_m32=true _build_case
with_dtd=false with_ge=true _build_case

View File

@ -27,9 +27,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H
/* Define to 1 if you have the `bsd' library (-lbsd). */
#cmakedefine HAVE_LIBBSD
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H

View File

@ -134,11 +134,6 @@
# endif /* defined(GRND_NONBLOCK) */
#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */
#if defined(HAVE_LIBBSD) \
&& (defined(HAVE_ARC4RANDOM_BUF) || defined(HAVE_ARC4RANDOM))
# include <bsd/stdlib.h>
#endif
#if defined(_WIN32) && ! defined(LOAD_LIBRARY_SEARCH_SYSTEM32)
# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#endif
@ -155,8 +150,6 @@
* Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \
* BSD / macOS >=10.7 / glibc >=2.36 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \
* BSD / macOS (including <10.7) / glibc >=2.36 (arc4random): HAVE_ARC4RANDOM, \
* libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, \
* libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, \
* Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, \
* Windows >=Vista (rand_s): _WIN32. \
\