# Copyright 2005 Marian Bonda
# Distributed under the terms of the GNU Lesser General Public License v2
# $Header: $

DESCRIPTION="A modular, multi-threaded, SQL-integrated weakly-typed scripting language with procedural and object-oriented features."

HOMEPAGE="http://qore.sourceforge.net"
SRC_URI="mirror://sourceforge/qore/qore-0.4.3-src.tar.gz"
LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="xml oracle mysql tibco"

inherit eutils

RDEPEND=">=sys-devel/flex-2.5.31
>=sys-devel/bison-1.875d"
DEPEND="${RDEPEND}"

src_unpack() {
	unpack ${A}
	cd ${S}
}

src_compile(){
	local myconf="--enable-debug --enable-threads --enable-sql"
	
	if use xml ; then 
		myconf="${myconf} --with-xml"
	else 
		myconf="${myconf} --without-xml"
	fi
	if use oracle ; then 
		myconf="${myconf} --with-oracle"
	else 
		myconf="${myconf} --without-oracle"
	fi
	if use mysql ; then 
		myconf="${myconf} --with-mysql"
	else 
		myconf="${myconf} --without-mysql"
	fi
	if use tibco ; then 
		myconf="${myconf} --enable-tibco"
	else 
		myconf="${myconf} --disable-tibco"
	fi    
	
	./configure --prefix=/ ${myconf} || die "configure failed"
	
	make || die "failed to compile"
}

src_install() {
	make prefix=${D} install || die "install failed"
	dodoc AUTHORS README COPYING NEWS WHATISQORE TODO
}

pkg_postinst(){
	einfo "Run man qore for further information."
}