# Maintainer: Alexander Shiryaev <shiryaev.a.v@gmail.com>
pkgname=bbcb-git
_name=${pkgname%-git}
pkgver=r671.e957750
pkgrel=1
pkgdesc="BlackBox Component Builder"
arch=('i686' 'x86_64')
url="https://blackbox.oberon.org/"
license=('custom')
depends=(lib32-glibc lib32-gtk2)
makedepends=('git' 'pax')
provides=("$_name")
conflicts=("$_name")
options=(!emptydirs)
source=($_name::git+https://github.com/bbcb/bbcp.git)
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/$_name"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$srcdir/$_name/BlackBox"
	./switch-target `uname -s` Interp
	./build
	./pack-dev0
	./switch-target `uname -s` GUI
	./build
}

package() {
	cd "$srcdir/$_name/BlackBox"
	mkdir -p "$pkgdir"/usr/{lib,bin}
	./export "$pkgdir"/usr/lib/$_name
	cd "$pkgdir"/usr/bin
	ln -s ../lib/$_name/run-BlackBox $_name

	install -Dm644 "$srcdir/$_name/BlackBox/LICENSE.txt" \
		"$pkgdir/usr/share/licenses/$_name/LICENSE.txt"
	rm -f "$pkgdir"/usr/lib/$_name/LICENSE.txt
}
