# Maintainer: Celestia Ludenberg <ash8820@proton.me>
# Contributor: Antergos NeXT Team

pkgname=antergos-welcome
pkgver=0.1
pkgrel=3
pkgdesc="Welcome screen and support tool for new Antergos NeXT users"
arch=('any')
url="https://github.com/Antergos-NeXT/antergos-welcome"
license=('GPL3')
depends=(
  'gtk3'
  'python'
  'python-gobject'
  'python-cairo'
)
makedepends=('git')
source=("${pkgname}::git+https://github.com/Antergos-NeXT/antergos-welcome.git")
sha256sums=('SKIP')

package() {
  cd "${srcdir}/${pkgname}"

  install -dm755 "${pkgdir}/usr/share/antergos-next/antergos-welcome"

  cp -r src "${pkgdir}/usr/share/antergos-next/antergos-welcome/"
  cp -r data "${pkgdir}/usr/share/antergos-next/antergos-welcome/"
  cp data/preferences.json "${pkgdir}/usr/share/antergos-next/antergos-welcome/"
  cp -r ui "${pkgdir}/usr/share/antergos-next/antergos-welcome/"
  cp -r po "${pkgdir}/usr/share/antergos-next/antergos-welcome/"
  cp -r utils "${pkgdir}/usr/share/antergos-next/antergos-welcome/"

  find "${pkgdir}/usr/share/antergos-next/antergos-welcome/po" -name "*.po" -exec msgfmt -o {}.mo {} \; 2>/dev/null || true

  install -dm755 "${pkgdir}/usr/bin"
  cat > "${pkgdir}/usr/bin/antergos-welcome" << 'EOF'
#!/bin/bash
exec /usr/bin/python3 /usr/share/antergos-next/antergos-welcome/src/antergos_welcome.py "$@"
EOF
  chmod 755 "${pkgdir}/usr/bin/antergos-welcome"

  install -dm755 "${pkgdir}/usr/share/applications"
  cp antergos-welcome.desktop "${pkgdir}/usr/share/applications/"
}
