# New ports collection makefile for:	Ruby-BDB
# Date created:		8 March 2001
# Whom:			Akinori MUSHA aka knu <knu@idaemons.org>
#
# $FreeBSD: ports/databases/ruby-bdb/Makefile,v 1.32 2003/03/03 17:39:27 knu Exp $
#

PORTNAME=	bdb
PORTVERSION=	0.4.0
CATEGORIES=	databases ruby
MASTER_SITES=	ftp://moulon.inra.fr/pub/ruby/
PKGNAMEPREFIX=	${RUBY_PKGNAMEPREFIX}
.if defined(WITH_BDB4)
PKGNAMESUFFIX=	4
.endif
DIST_SUBDIR=	ruby

MAINTAINER=	knu@FreeBSD.org
COMMENT=	Ruby interface to Sleepycat's Berkeley DB revision 2 or later

.if defined(WITH_BDB41)
LIB_DEPENDS=	db41.1:${PORTSDIR}/databases/db41
.elif defined(WITH_BDB4)
LIB_DEPENDS=	db4.0:${PORTSDIR}/databases/db4
.else
LIB_DEPENDS=	db3.3:${PORTSDIR}/databases/db3
.endif

USE_RUBY=	yes
USE_RUBY_EXTCONF=	yes
USE_RUBY_RDOC=		yes

.if defined(WITH_BDB4)
CONFIGURE_ARGS=	--with-db-include-dir="${PREFIX}/include/db4" \
		--with-db-version=4
.else
CONFIGURE_ARGS=	--with-db-include-dir="${PREFIX}/include/db3" \
		--with-db-version=3
.endif
INSTALL_TARGET=	site-install

DOCS=		Changes \
		README.en \
		bdb.html \
		bdb.rd \
		docs/*.html \
		docs/*.rd \
		docs/doc

post-build:
.if !defined(NOPORTDOCS)
	cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} rdoc
.endif

post-install:
.if !defined(NOPORTDOCS)
	${MKDIR} ${RUBY_MODEXAMPLESDIR}/
	${CP} -R ${WRKSRC}/examples/* ${RUBY_MODEXAMPLESDIR}/
	${MKDIR} ${RUBY_MODDOCDIR}
.for f in ${DOCS}
	${CP} -R ${WRKSRC}/${f} ${RUBY_MODDOCDIR}/
.endfor
.endif

.include <bsd.port.mk>
