# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Contributor: Dustin Falgout <dustin@antergos.com>

pkgname=lightdm-webkit2-greeter
_pkgname=web-greeter
pkgver=2.2.5
pkgrel=9
pkgdesc='LightDM greeter that uses WebKit2 for theming via HTML/JavaScript.'
arch=('x86_64')
url='https://github.com/antergos/web-greeter'
license=('GPL3')
depends=('lightdm' 'webkit2gtk-4.1' 'accountsservice' 'gnome-backgrounds')
makedepends=('gobject-introspection' 'meson' 'gettext' 'dbus-glib')
backup=("etc/lightdm/$pkgname.conf")
source=("$_pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
        'lightdm-webkit2-greeter-2.2.5-webkit2gtk-4.1.patch'
        'archlinux-logo.svg::https://sources.archlinux.org/other/artwork/archlinux-logo-light-scalable.svg'
        'archlinux-user.svg')
sha512sums=('173fe64dc3ff9bde0bc3d72319ab014001364eae8336a72b052333e0c6687167164277fd87de7051c689f12f64aeb441f95a9f0d38cc780ccb77751ab62204da'
            'fbccff31ad61508d56653c0237fb6c072f7c2c3c7e3f7ea2e4dfb37fc7195e328838ea062230833dac8740fd0c9185c7197c5a729a4d7954f0302c006bb82638'
            'a553510431d3771a0ef5c7aaec198f89302f11ea8fe6db83bdac496d087ded6d5a99e442d3d20fd7b9231a76ec0df0f1ffb3da2511f79d196c8516345241d1da'
            '4cf515e5eefa0a16d1ebda6e4cbef2103e405325e265472c3cdc4928f05749597913406494fc4384b268288efbc0bbb86fefb648d1dd6e62c1dbc6569c8253b6')

prepare() {
  cd $_pkgname-$pkgver
  patch -Np1 -i ../lightdm-webkit2-greeter-2.2.5-webkit2gtk-4.1.patch

  # Replace antergos logos
  sed -i \
  	-e 's|/usr.*antergos.png|/usr/share/pixmaps/archlinux-logo.svg|g;' \
  	-e 's|/usr.*logo-user.png|/usr/share/pixmaps/archlinux-user.svg|g' \
  	"data/$pkgname.conf"
}

build() {
  cd $_pkgname-$pkgver/build

  arch-meson ..

  ninja
}

package() {
  cd $_pkgname-$pkgver/build

  DESTDIR="$pkgdir" ninja install
}

