# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7

WX_GTK_VER="3.0"

inherit eutils multilib wxwidgets

DESCRIPTION="C++ wrapper around the public domain SQLite 3.x database"
HOMEPAGE="http://wxcode.sourceforge.net/components/wxsqlite3/"
SRC_URI="mirror://sourceforge/wxcode/${P}.tar.gz"

LICENSE="wxWinLL-3"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""

DEPEND="
	x11-libs/wxGTK:${WX_GTK_VER}[X]
	dev-db/sqlite:3"
RDEPEND="${DEPEND}"

#S="${WORKDIR}/${P%.1}"

src_prepare() {
	eapply "${FILESDIR}"/${P}-support-gtk3.patch
	rm -rf sqlite3 || die
	cp configure30 configure || die
	sed \
		-e "s:@WXVERSION@:${WX_GTK_VER}:g" \
		-e "s:@LIBDIR@:$(get_libdir):g" \
		-e "s:@VERSION@:${PV}:g" \
		-e "s:gtk2:gtk3:g" \
		"${FILESDIR}"/${P}.pc.in > ${PN}.pc || die
	eapply_user
}

src_configure() {
	econf \
		--enable-shared \
		--enable-unicode \
		--with-wx-config="${WX_CONFIG}" \
		--with-wxshared \
		--with-sqlite3-prefix="${PREFIX}/usr"
}

src_install() {
	default

	insinto /usr/$(get_libdir)/pkgconfig
	doins ${PN}.pc

	HTML_DOCS="docs/html/*" DOCS="Readme.txt samples/*" einstalldocs
	
#	dodoc Readme.txt
#	dohtml -r docs/html/*
#	docinto samples
#	dodoc -r samples/*
}