From 1f91fe819d33ebd3bc24b8867066f8ce6045b928 Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Sat, 23 Feb 2013 10:34:21 +0100
Subject: [PATCH] Link against -lbsd on kfreebsd

It gives us access to getpeereid() and makes MIT-SHM work with
non-world-accessible segments.  See Debian bug#700530.
---
 debian/changelog |    7 +++++++
 debian/rules     |    4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 4d8d03c..137c032 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+xorg-server (2:1.7.7-15) UNRELEASED; urgency=low
+
+  * Link against -lbsd on kfreebsd to get access to getpeereid() and make
+    MIT-SHM work with non-world-accessible segments.
+
+ -- Julien Cristau <jcristau@debian.org>  Sat, 23 Feb 2013 10:13:16 +0100
+
 xorg-server (2:1.7.7-14) squeeze; urgency=low
 
   * GLX: add missing input sanitization (CVE-2010-4818).  Also fix a couple
diff --git a/debian/rules b/debian/rules
index 52c0094..51d271a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -64,6 +64,7 @@ ifeq ($(DEB_HOST_ARCH_OS), linux)
 	config_backend += --enable-config-udev --disable-config-hal
 else ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
 	config_backend += --disable-config-udev --enable-config-hal
+	libs = LIBS=-lbsd
 else # hurd
 	config_backend += --disable-config-udev --disable-config-hal
 endif
@@ -112,7 +113,8 @@ confflags += \
 	     --disable-xwin \
 	     --disable-xsdl \
 	     --disable-xfake \
-	     --disable-install-setuid
+	     --disable-install-setuid \
+	     $(libs)
 
 confflags_main = \
 	--with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType,built-ins" \
-- 
1.7.10.4

