NAME="xorg-server"
DESC="Core of the X Window system"
VERSION="21.1.8"
FILES=("https://www.x.org/pub/individual/xserver/xorg-server-$VERSION.tar.xz")
HASHES=("79a6eb04b1b17ad6c7aab46da73944e8")
DEPENDS=(
  "libxcvt" "pixman" "fonts"
  "xkeyboard-config" "systemd" "libinput"
  "libepoxy"
)

PACKAGE() {
  tar xf $NAME-$VERSION.tar.xz
  cd $NAME-$VERSION

  sed -i '/ModeLine "1024x768"   44.9 1024 1032 1208 1264    768  768  776  817 +hsync +vsync Interlace/c\ModeLine "1024x768"   44.9 1024 1032 1208 1264    768  768  776  817 +hsync +vsync' hw/xfree86/common/vesamodes 

  mkdir build
  cd    build

  meson setup ..            \
      --prefix=$XORG_PREFIX \
      --localstatedir=/var  \
      -Dglamor=true         \
      -Dxkb_output_dir=/var/lib/xkb
  ninja && DESTDIR=${ROOTDIR} ninja install
  mkdir -pv "${ROOTDIR}/etc/X11/xorg.conf.d"

  cd ../.. && rm -rf $NAME-$VERSION
}
