# Maintainer: Dan Printzell <arch@vild.io>
# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Contributor: Severen Redwood <severen@shrike.me>
# Contributor: Robert Welin <robert.welin@gmail.com>
# Contributorr: dsboger <https://github.com/dsboger>

pkgname=gtkd
pkgver=3.9.0
pkgrel=3
pkgdesc='D bindings for GTK+ and related libraries.'
arch=('x86_64')
url='https://gtkd.org'
license=('LGPL')
depends=('liblphobos' 'gtk3')
makedepends=('ldc')
optdepends=('pango' 'atk' 'gdk-pixbuf2' 'gtksourceview3' 'gstreamer' 'vte3' 'libpeas')
source=("https://github.com/gtkd-developers/GtkD/archive/v$pkgver.tar.gz"
        'https://github.com/FFY00/GtkD/commit/5a3aabfc7e253eef7ce727a47c3ea0801776a472.patch')
sha512sums=('ea83322933958fa62883bc5f9d9c37fca78c369f6567b4fd62bd39d5d41b7caaab186752a836904b70c1dd70370d683bf35ae3e9201cac12410356ad4c020b90'
            '6de0e734362f12036c54373b096806ef3aca073ec76c1e6d8245a4642a32a4c6ac4eb5a477055a15064176b61636069e74f2b83c968a87cfc3bcabbc943886c3')

prepare() {
    cd GtkD-$pkgver

    # https://github.com/gtkd-developers/GtkD/pull/273
    # makefile: fix install path for pkconfig files
    patch -p1 < ../5a3aabfc7e253eef7ce727a47c3ea0801776a472.patch
}

build() {
    cd GtkD-$pkgver

    make \
    	DC='ldc' \
    	LDFLAGS="-L=\"$LDFLAGS\"" \
    	libdir='lib/' \
        shared-{gtkd,gtkdgl,sv,gstreamer,vte,peas}
}

check() {
    cd GtkD-$pkgver

    make LDFLAGS='' test
}

package() {
    cd GtkD-$pkgver

    make \
    	prefix='/usr' \
    	libdir='lib/' \
    	DESTDIR="$pkgdir" \
    	install-{shared,headers}-{gtkd,gtkdgl,gtkdsv,gstreamer,vte,peas}
}

