# Maintainer: Brad Fanella <cesura@archlinux.org>
# Contributor: Martin Wimpress <code@flexion.org>

pkgname=pluma
pkgver=1.22.1
pkgrel=1
pkgdesc="A powerful text editor for MATE"
url="https://mate-desktop.org"
arch=('x86_64')
license=('GPL')
depends=('iso-codes' 'mate-desktop' 'zenity' 'gtksourceview3' 'libpeas' 'python2')
makedepends=('intltool' 'itstool' 'gobject-introspection' 'python2' 'mate-common' 'yelp-tools')
optdepends=('python2-gobject: to use the python plugins')
groups=('mate-extra')
conflicts=('pluma-gtk3')
replaces=('pluma-gtk3')
source=("https://pub.mate-desktop.org/releases/${pkgver%.*}/${pkgname}-${pkgver}.tar.xz")
sha256sums=('af8d19927f1571d6b63462b8e51fed9ac851326b6ff800535ea785f15c61a591')

prepare() {
    	cd "${pkgname}-${pkgver}"
    	sed -i 's/python/python2/' plugins/externaltools/data/switch-c.tool.in
    	sed -i 's/, enchant/, enchant-2/' configure.ac
}

build() {
    	cd "${pkgname}-${pkgver}"
    	./autogen.sh
    	PYTHON=/usr/bin/python2 ./configure \
        	--prefix=/usr \
        	--libexecdir=/usr/lib/${pkgname} \
        	--enable-gtk-doc=no \
        	--enable-python

    	#https://bugzilla.gnome.org/show_bug.cgi?id=656231
    	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

    	make
}

package() {
    	cd "${pkgname}-${pkgver}"
    	make DESTDIR="${pkgdir}" install
}
