#
# Original maintainer: Andreas Radke <andyrtr@archlinux.org>
# Original maintainer: Jan de Groot <jgc@archlinux.org>
#
# This is a modified version of xkeyboard-config to provide emulation for ducky
# mini fn key layout that I got used to very much
#
# they don't make those keyboards any more :(

_pkgname=xkeyboard-config
pkgname=xkeyboard-config-ducky
pkgver=2.25
pkgrel=1
pkgdesc="X keyboard configuration files"
arch=(any)
license=('custom')
url="https://www.freedesktop.org/wiki/Software/XKeyboardConfig"
makedepends=('intltool' 'xorg-xkbcomp' 'libxslt')
provides=('xkbdata' "${_pkgname}")
replaces=('xkbdata' "${_pkgname}")
conflicts=('xkbdata' "${_pkgname}")
source=("https://xorg.freedesktop.org/archive/individual/data/${_pkgname}/${_pkgname}-${pkgver}.tar.bz2"
        'ducky_mini'
        'ru.patch'
        'us.patch')
sha512sums=('2d9d6bdd885edc8e03e5a2c136c3b29b4ea795122709fa210bf151c4e7416a44fa2928bb29137ee8c6691d8646c1f645748576dea3f940ce84c8d4d0f91e09eb'
            '2f3561852475959e884a09662e248155d642e1e3ae3996020333dee0709907917f05a43f4351dffde898fd0a10954078fe998763a4df0a35167afaafa9abf600'
            '854c52d168837a5c72559498d10dff7843275323c4082d1c741c832d068108be3a51e823c98a27ea47c5fe4f335499fdbcaa3698117740ef24c07c41161ad59b'
            '7d9c692980c77a3b0658a5dd707ecdcd1e3fe47c2958f539f1f81dd04d5f204f779569d6b880c3f12872397d6171b2ec2caab9a4e79461c9f5828ca1c45acb08')

build() {
  cd ${_pkgname}-${pkgver}
  cp -v ${srcdir}/ducky_mini symbols
  patch -p1 < ${srcdir}/ru.patch
  patch -p1 < ${srcdir}/us.patch
  ./configure --prefix=/usr \
      --with-xkb-base=/usr/share/X11/xkb \
      --with-xkb-rules-symlink=xorg \
      --enable-compat-rules=yes
  make
 }

 package() {
  cd ${_pkgname}-${pkgver}

  make DESTDIR="${pkgdir}" install
  rm -f "${pkgdir}/usr/share/X11/xkb/compiled"

  install -m755 -d "${pkgdir}/var/lib/xkb"
  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}