### this file is sourced not run
PKGVER=1.20.14
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS svn 2018-5-26 updated to latest
TARBALL=xorg-server-$PKGVER.tar.xz
MD5SUM=46f571adb51ebadb6981bc25d771f2b9
SRC_URL=http://xorg.freedesktop.org/archive/individual/xserver/$TARBALL
BUNDLE=

SLACKREQ='mesa openssl pixman xkeyboard-config tslib mtdev xcb-util-renderutil
libunwind' # and xorg libs
SLACKDESC="xorg-server: xorg-server $PKGVER (X11 Core Server)  
xorg-server:  
xorg-server: The Xorg Server is the core of the X Window system.  
xorg-server: 
xorg-server: 
xorg-server: 
xorg-server: 
xorg-server: 
xorg-server: 
xorg-server: 
xorg-server:
"

PKG_NOSTRIP= # we build with -g if this is set to yes

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/xorg-server* &&

	# DosBox: grabbing mouse pointer no longer works. Jake
	# still needed in 1.20.6 - otherwise pressed keys can be lost.
	patch -Rp1 -i ../pkg/enterleave.c.patch && 

	# Restore 24bpp support for fbdev (make qemu cirrus works again)
	patch -Np1 -i ../pkg/fbdevhw-24bpp-fallback.patch &&

	# Restore 24bpp support for vesa (make qemu cirrus works again)
	patch -Np1 -i ../pkg/vbe-24bpp-fallback.patch &&

	# Turn on ShadowFB by default when running with cirrus. Restore slow performance.
	patch -Np1 -i ../pkg/cirrus-enable-shadow.patch &&

	true
}

### default pkg_package
### build
pkg_build() {
	#cd /tmp/xorg-server* && ./autogen.sh &&

	CONFFLAGS="$XORG_CONFIG --with-xkb-output=/var/lib/xkb \
    --enable-install-setuid \
    --enable-config-udev --enable-xephyr --enable-kdrive --enable-dmx \
    --enable-dri2 --enable-dri3 --enable-glamor --enable-libdrm \
    --enable-config-udev-kms --disable-config-hal  \
    --disable-systemd-logind --without-systemd-daemon \
    --enable-libunwind" # libunwind enables better backtrace
#   --enable-wayland
#   --enable-debug    
#   --enable-suid-wrapper
# Options gone since 1.20
#   --enable-xfbdev, --enable-tslib, --enable-kdrive-mouse, --enable-kdrive-evdev

	# get debugging symbols if we're building with nostrip
	[ $PKG_NOSTRIP ] && CFLAGS="$CFLAGS -g -rdynamic"
	
	pkg_build_autoconf && 
	pkg_build_slackdesc &&

	# enable zap
	mkdir -pv /etc/X11/xorg.conf.d &&
	install -m644 /tmp/pkg/xkb-defaults.conf /etc/X11/xorg.conf.d	
}
 
