xserver: Branch 'server-21.1-branch'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 24 03:41:39 UTC 2023


 configure.ac |   12 ++++++++++--
 include/os.h |    9 +++------
 meson.build  |    2 +-
 os/auth.c    |    4 +---
 4 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 2c33ee9f1d6da648a5176795608eb3138ef46e49
Author: Sam James <sam at gentoo.org>
Date:   Wed Aug 2 12:33:19 2023 +0100

    Switch to libbsd-overlay
    
    This is more portable than libbsd as everything Just Works, even on BSD systems,
    and is the recommended method of consuming libbsd nowadays.
    
    It also helpfully lets things work with glibc-provided functions for new
    enough glibc.
    
    [For the 21.1.x backport, take inspiration from @alanc's commit to libxdmcp
    at https://gitlab.freedesktop.org/xorg/lib/libxdmcp/-/commit/c01da8ebd0969efd15388ce999e121127cc46f67.]
    
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/973
    Co-authored-by: Guillem Jover <guillem at hadrons.org>
    (cherry picked from commit 94945a52746ee2612c6cd394692f49e2ed5fc56b)
    Signed-off-by: Sam James <sam at gentoo.org>

diff --git a/configure.ac b/configure.ac
index 60ea2c316..bebf08432 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,8 +164,16 @@ AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
 	timingsafe_memcmp])
 AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"])
 
-AC_CHECK_LIB([bsd], [arc4random_buf])
-AC_CHECK_FUNCS([arc4random_buf])
+# Checks for non-standard functions and fallback to libbsd if we can
+# We only check for arc4random_buf, because if we have that, we don't
+# need/use getentropy.
+AC_LINK_IFELSE([AC_LANG_CALL([], [arc4random_buf])],
+               [TRY_LIBBSD="no"], [TRY_LIBBSD="yes"])
+AS_IF([test "x$TRY_LIBBSD" = "xyes"],
+      [PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [
+	CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
+	LIBS="$LIBS $LIBBSD_LIBS"
+], [:])])
 
 AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
 
diff --git a/include/os.h b/include/os.h
index bb3348b18..7db24088f 100644
--- a/include/os.h
+++ b/include/os.h
@@ -50,16 +50,13 @@ SOFTWARE.
 #include "misc.h"
 #include <stdarg.h>
 #include <stdint.h>
+#if defined(HAVE_REALLOCARRAY)
+#include <stdlib.h>       /* for reallocarray */
+#endif
 #include <string.h>
 #ifdef MONOTONIC_CLOCK
 #include <time.h>
 #endif
-#if defined(HAVE_LIBBSD) && defined(HAVE_REALLOCARRAY)
-#include <bsd/stdlib.h>       /* for reallocarray */
-#endif
-#if defined(HAVE_LIBBSD) && defined(HAVE_STRLCPY)
-#include <bsd/string.h>       /* for strlcpy, strlcat */
-#endif
 
 #define SCREEN_SAVER_ON   0
 #define SCREEN_SAVER_OFF  1
diff --git a/meson.build b/meson.build
index 637938a1b..7174cb542 100644
--- a/meson.build
+++ b/meson.build
@@ -96,7 +96,7 @@ applewmproto_dep = dependency('applewmproto', version: '>= 1.4', fallback: ['xor
 xshmfence_dep = dependency('xshmfence', version: '>= 1.1', required: false)
 
 pixman_dep = dependency('pixman-1')
-libbsd_dep = dependency('libbsd', required: false)
+libbsd_dep = dependency('libbsd-overlay', required: false)
 xkbcomp_dep = dependency('xkbcomp', required: false)
 xkbfile_dep = dependency('xkbfile')
 xfont2_dep = dependency('xfont2', version: '>= 2.0')
diff --git a/os/auth.c b/os/auth.c
index 611e4efb1..243d3c5a8 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -46,9 +46,7 @@ from The Open Group.
 #ifdef WIN32
 #include    <X11/Xw32defs.h>
 #endif
-#ifdef HAVE_LIBBSD
-#include   <bsd/stdlib.h>       /* for arc4random_buf() */
-#endif
+#include   <stdlib.h>       /* for arc4random_buf() */
 
 struct protocol {
     unsigned short name_length;


More information about the xorg-commit mailing list