# $Id: Portfile 86675 2011-10-31 18:15:07Z jmr@macports.org $

PortSystem		1.0
PortGroup		ruby 1.0

ruby.setup		{dbi ruby-dbi} 0.1.1 setup.rb \
				{README doc examples} \
				rubyforge:12368:ruby-dbi
revision		1
distname        ${ruby.module}-${version}
license			BSD
maintainers		nomaintainer
description		The Ruby port of DBI
long_description	A database independent interface for accessing \
					databases, similar to Perl's DBI. Database drivers \
					for it are now available as variants of this package.
categories-append	databases
checksums		md5 1077f898080bb0af1098ee4b5b54f8d1
platforms		darwin

worksrcdir		${ruby.project}

# The conjuring with the dbi_conf_args variable to set configure.args is to cope
# with the fact that setup.rb accepts a single "--with=<feature>,<feature>,..."
# argument, with the last one overriding the rest.  We must therefore append to
# the end of the string to get the desired variants, and for niceness we might
# as well delete the obsoleted "--with" argument.

set dbi_conf_args		--with=dbi
configure.args-append	${dbi_conf_args}

variant dbd_mysql {
	depends_lib-append	port:rb-mysql
	configure.args-delete	${dbi_conf_args}
	append dbi_conf_args	,dbd_mysql
	configure.args-append	${dbi_conf_args}
}

variant dbd_odbc {
	depends_lib-append	port:rb-odbc
	configure.args-delete	${dbi_conf_args}
	append dbi_conf_args	,dbd_odbc
	configure.args-append	${dbi_conf_args}
}

variant dbd_pg {
	depends_lib-append	port:rb-postgres
	configure.args-delete	${dbi_conf_args}
	append dbi_conf_args	,dbd_pg
	configure.args-append	${dbi_conf_args}
}

# dbd_proxy depends only on the fragment of the distributed Ruby library that is
# part of the standard Ruby library as of version 1.8
variant dbd_proxy {
	configure.args-delete	${dbi_conf_args}
	append dbi_conf_args	,dbd_proxy
	configure.args-append	${dbi_conf_args}
}
