#!/bin/sh -e

patch -p1 < rootless_modesetting.patch

./configure \
    --prefix=/usr \
    --localstatedir=/var \
    --disable-shared \
    --disable-systemd-logind \
    --disable-unit-tests \
    --enable-glx \
    --enable-dri \
    --enable-dri2 \
    --enable-dri3 \
    --enable-glamor \
    --enable-xorg \
    --with-systemd-daemon=off

make
make DESTDIR="$1" install

rm -f "$1/usr/share/X11/xorg.conf.d/10-evdev.conf"