### this file is sourced not run
# source: step

repo=yad
pkgname=$repo # for SLACKDESC

# Uncomment either section [1] master commit or [2] official release below.

# [1] Master commit

hash=8957347fc6376bc4ec992adef078a7b53399850e
MD5SUM=5d0d24260753729693d9090ba46eadfd
hash7=${hash#???????}; hash7=${hash%$hash7}
PKGVER=0.40.3_2018.07.30_$hash7

TARBALL=$pkgname-$hash.tar.gz
SRC_URL=https://github.com/v1cont/$repo/archive/$hash.tar.gz

# [2] Official release

# MD5SUM=daeba7bbd18ecb1c64bfa33ccd5a545f
# PKGVER=0.40.3

# TARBALL=$pkgname-$PKGVER.tar.gz
# SRC_URL=https://github.com/v1cont/$pkgname/archive/v$PKGVER.tar.gz

PKGARCH=x86_64
PKGBUILD=1
BUNDLE=

SLACKREQ='gtk2 libgtksourceview libgtkspell3 '
SLACKDESC="$pkgname: yad $PKGVER $hash7 (GUI dialog for shell scripts)
$pkgname: 
$pkgname: YAD (yet another dialog) creates graphical dialogs from 
$pkgname: shell scripts. Similar to Xdialog, gtkdialog, etc.
$pkgname: 
$pkgname: License: GNU GPL3
$pkgname: 
$pkgname: https://sourceforge.net/projects/yad-dialog
$pkgname: https://github.com/v1cont/yad
$pkgname: 
$pkgname: 
"

### default pkg_download
pkg_prepare() {
	pkg_prepare_default &&
		cd tmp/yad-* || return 1
	patch -p1 -i ../pkg/upstream-PR-25-fix-icon-browser-gtk2.patch &&
	patch -p1 -i ../pkg/upstream-PR-26-fix-list-prints-empty-cell-as-null.patch &&
	patch -p1 -i ../pkg/upstream-PR-23-add-disable-list-column-tooltip-markup.patch &&
	patch -p1 -i ../pkg/upstream-PR-29-add-iconbox-option-icon-width.patch &&
	patch -p1 -i ../pkg/upstream-PR-30-fix-notebook-active-tab.patch &&
  patch -p1 -i ../pkg/upstream-PR-31-fix-two-race-conditions.patch &&
	if [ "$hash7" ]; then
		build_date=$(date +%F)
		sed -i -e 's/PACKAGE_VERSION/(& " git '$hash7' built '$build_date'")/' src/about.c &&
			sed -i -e '/, VERSION,/{s/[)]\\n/, git '$hash7' built '$build_date'&/}' src/main.c
	fi
}
### default pkg_package
### build
pkg_build() {
	CONFFLAGS="$CONFFLAGS --enable-icon-browser \
		--enable-html --enable-gio --enable-spell \
		--enable-sourceview \
		--with-gtk=gtk2 --with-rgb=/usr/share/X11/rgb.txt"
	cd /tmp/yad-* || return 1
	! [ -e configure ] && autoreconf -fi
	intltoolize --force &&
	pkg_build_autoconf && pkg_build_slackdesc &&
	rm /usr/share/icons/hicolor/icon-theme.cache
}

# vim:ft=sh:

