# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=wxgtk2.8
pkgver=2.8.12.1
pkgrel=4
pkgdesc="GTK2 port of the wxWidgets GUI library"
url="http://www.wxwidgets.org/"
arch="all"
license="wxWidgets"
depends=""
depends_dev="gtk+2.0-dev zlib-dev tiff-dev libpng-dev libjpeg-turbo-dev
	expat-dev libsm-dev"
makedepends="$depends_dev sdl-dev gst-plugins-base0.10-dev gstreamer0.10-dev
	gconf-dev"
install=""
replaces="wxgtk"
subpackages="$pkgname-dev $pkgname-lang $pkgname-media $pkgname-base"
source="http://downloads.sourceforge.net/wxpython/wxPython-src-${pkgver}.tar.bz2
	wxGTK-2.8.12-abicheck.patch
	wxGTK-narrowing.patch
	"

_builddir="$srcdir"/wxPython-src-$pkgver
prepare() {
	local i
	cd "$_builddir"
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-sdl \
		--enable-unicode \
		--enable-no_deps \
		--enable-shared \
		--enable-sound \
		--enable-mediactrl \
		--disable-rpath \
		--disable-optimise \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

dev() {
	default_dev
	mv "$pkgdir"/usr/lib/wx/config "$subpkgdir"/usr/lib/wx/ || return 1
	mv "$pkgdir"/usr/bin/wxrc* "$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/share/bakefile "$subpkgdir"/usr/share/ || return 1
}

media() {
	pkgdesc="Multimedia add-on for the wxWidgets library"
	replaces="wxgtk-media"
	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/libwx_gtk2u_media-*.so.* "$subpkgdir"/usr/lib/
}

base() {
	pkgdesc="Non-GUI support classes from the wxWidgets library"
	replaces="wxbase"
	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/libwx_baseu-*.so.* \
		"$pkgdir"/usr/lib/libwx_baseu_net-*.so.* \
		"$pkgdir"/usr/lib/libwx_baseu_xml-*.so.* \
		"$subpkgdir"/usr/lib/
}

md5sums="8c06c5941477beee213b4f2fa78be620  wxPython-src-2.8.12.1.tar.bz2
e71ac89e0ed2562d821cfbf1263ce4cb  wxGTK-2.8.12-abicheck.patch
e5bccf21fb5a37f8255bb626586ed6c7  wxGTK-narrowing.patch"
sha256sums="1f3f153d9f1504c6ce2d2c4b23e940b8f58b81f4cba35cda1a5bb31142243cd0  wxPython-src-2.8.12.1.tar.bz2
46a1bb97d69163547da13d5e23a4c73e68de27ee601da5d2fb5bc5c417931453  wxGTK-2.8.12-abicheck.patch
42ce51e6e73a1035908cba7b0c6d4a675705d9c79a735f8be197571c8f15e23f  wxGTK-narrowing.patch"
sha512sums="4f826ccb57d5f4fc03fe7cae67499be70c727a99aebf9d153ea1060a21641642606d44d079ba897c38b176846336aeaebc21d30d5c7a0abec3934d65cf4529f3  wxPython-src-2.8.12.1.tar.bz2
5b365d9e0f1e7c9a053514010bd78b4192a4472d6ae76590f6999a4bf04d1de0fae5847fac878ab2dd581f4e0ec3959b317e5efacd3bd6628b89c5f65756cf83  wxGTK-2.8.12-abicheck.patch
cd7fc58e883ff9ef185bc8deff333f7a785d8bd3e8abebef741b598436bc486f2904540be7d2c891ef070b45008f2e5f5961c7978b0a8166ef259e17b7481739  wxGTK-narrowing.patch"
