# Template file for 'libdbi-drivers'
pkgname=libdbi-drivers
version=0.9.0
revision=2
build_style=gnu-configure
configure_args="--with-mysql --with-pgsql --with-sqlite3"
hostmakedepends="automake docbook docbook-dsssl libtool openjade
 postgresql-libs-devel"
makedepends="libdbi-devel libmariadbclient-devel postgresql-libs-devel
 sqlite-devel zlib-devel"
depends="libdbdmysql libdbdpgsql libdbdsqlite"
short_desc="Database drivers for libdbi (MySQL, PostgreSQL, and SQLite)"
maintainer="cinerea0 <cinerea0@protonmail.com>"
license="LGPL-2.1-only"
homepage="https://libdbi-drivers.sourceforge.net/"
changelog="https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/ci/master/tree/NEWS"
distfiles="${SOURCEFORGE_SITE}/libdbi-drivers/libdbi-drivers-${version}.tar.gz"
checksum=43d2eacd573a4faff296fa925dd97fbf2aedbf1ae35c6263478210c61004c854
make_check=no  # tests require full DB environments and hang

if [ "${CROSS_BUILD}" ]; then
	configure_args+=" --with-dbi-libdir=${XBPS_CROSS_BASE}/usr/lib"
fi

pre_configure() {
	autoreconf -fi
}

libdbdmysql_package() {
	short_desc="MySQL driver for libdbi"
	pkg_install() {
		vmove usr/lib/dbd/libdbdmysql.so
	}
}

libdbdpgsql_package() {
	short_desc="PostgreSQL driver for libdbi"
	pkg_install() {
		vmove usr/lib/dbd/libdbdpgsql.so
	}
}

libdbdsqlite_package() {
	short_desc="SQLite driver for libdbi"
	pkg_install() {
		vmove usr/lib/dbd/libdbdsqlite3.so
	}
}

libdbi-drivers-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove "usr/lib/dbd/*.a"
	}
}
