# Maintainer (arch): Maxime Gauduin <alucryd@archlinux.org>
# Contributor: TingPing <tingping@tingping.se>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Maintainer: Freemor <freemor@freemor.ca>

pkgname=hexchat
pkgver=2.14.3
pkgrel=1
pkgrel+=.parabola1
pkgdesc='A popular and easy to use graphical IRC (chat) client'
pkgdesc+=', without nonfree browser reference'
arch=('x86_64')
arch+=('i686' 'armv7h')
url='https://hexchat.github.io/'
license=('GPL')
depends=('dbus-glib' 'desktop-file-utils' 'gdk-pixbuf2' 'glib2' 'gtk2'
         'libcanberra' 'libnotify' 'libproxy' 'openssl' 'pango' 'pciutils')
makedepends=('git' 'intltool' 'iso-codes' 'lua' 'meson' 'perl' 'python-cffi')
optdepends=('enchant: Spell check'
            'iso-codes: Display language names instead of codes'
            'lua: Lua plugin'
            'perl: Perl plugin'
            'python-cffi: Python plugin')
replaces=(${pkgname}-libre)
conflicts=(${pkgname}-libre)
source=("git+https://github.com/hexchat/hexchat.git#tag=v${pkgver}"
        '0002-python-3-8.patch'
        'restore_ctrl-w.patch')
sha256sums=('SKIP'
            '8d17ce657e744272815b5fb33d8ad959f79ece3294349637eaadcf86d90496fa'
            'f78f986a064e6c5a8713a219fa042c94bb2b0236869d33b48801faedc9cef63e')

prepare() {
  cd hexchat
  patch -Np1 < ../0002-python-3-8.patch

# Remove nonfree browser references
  sed -i '\|NAME Open Link| s|Firefox|Iceweasel|' src/common/hexchat.c
  sed -i '\|NAME Open Link| s|firefox -new-window %s\\n\\n";|iceweasel -new-window %s\\n\\n"\\\n		"NAME Open Link in a new Icecat Window\\n"		"CMD !icecat -new-window %s\\n\\n";|' src/common/hexchat.c
#Restore CTRL-W
  patch -p1 src/fe-gtk/menu.c ../restore_ctrl-w.patch
}

build() {
  arch-meson hexchat build \
    -Dwith-lua='lua' \
    -Dwith-text='true'
  ninja -C build
}

package() {
  DESTDIR="${pkgdir}" ninja -C build install
}

# vim: ts=2 sw=2 et:
