# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apps/gallery/gallery-2.0.2-r1.ebuild,v 1.6 2006/01/14 21:26:12 dertobi123 Exp $

inherit webapp eutils

DESCRIPTION="The Open Media Lending Database (OpenDb) is an extremely flexible
application to catalogue all sorts of things including DVD, VCD, CD, VHS, GAMES,
BOOKS & Laser Discs"
HOMEPAGE="http://opendb.iamvegan.net/"
SRC_URI="mirror://sourceforge/${PN}/OpenDb-0.81p13.zip
	amazonde? ( mirror://sourceforge/${PN}/amazonde-0.81p1.zip )
	amazonfr? ( mirror://sourceforge/${PN}/amazonfr-0.81.zip )
	amazonuk? ( mirror://sourceforge/${PN}/amazonuk-0.81p8.zip )
	hminfo? ( mirror://sourceforge/${PN}/hminfo-0.81p8.zip )
	dvdempire? ( mirror://sourceforge/${PN}/dvdempire-0.81p1.zip )
	iblist? ( mirror://sourceforge/${PN}/iblist-0.81.zip )"

LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"
IUSE="mysql amazonde amazonfr amazonuk hminfo dvdempire iblist"

RDEPEND="virtual/httpd-php
	mysql? ( >=dev-db/mysql-3.23.2 )
	virtual/mta"

S=${WORKDIR}

src_install() {
	webapp_src_preinst

	dodoc docs/INSTALL docs/LICENSE docs/MySQL_3.23.X-create_user_and_db.sql
	dodoc docs/MySQL_4.X.X-create_user_and_db.sql docs/README
	dodoc docs/check_for_zombie_items.sql docs/export/ExportPlugins.txt docs/import/ImportPlugins.txt
	dodoc docs/lang/LanguagePacks.txt docs/opendb-items_1.1.dtd docs/theme/Themes.txt
	dodoc docs/admin/new_attribute.txt
	use amazonde && dodoc amazonde.readme
	docinto lang-patch
	dodoc docs/lang-patch/*
	docinto misc
	dodoc docs/misc/*
	docinto notes
	dodoc docs/notes/*
	docinto test
	dodoc docs/test/*
	docinto scripts
	dodoc docs/scripts/*
	docinto site
	dodoc docs/site/*

	cp -R *.php export functions images import importcache ${D}/${MY_HTDOCSDIR}
	cp -R admin include lang log patch site theme upload ${D}/${MY_HTDOCSDIR}
	echo "order deny,allow" >${D}/${MY_HTDOCSDIR}/log/.htaccess
	echo "deny  from all" >>${D}/${MY_HTDOCSDIR}/log/.htaccess

	webapp_configfile ${MY_HTDOCSDIR}/include/config.php

	webapp_postinst_txt en ${FILESDIR}/postinstall-en.txt

	webapp_src_install
}

pkg_postinst() {
	if use amazonde; then
		einfo "You chose to install the amazon.de - plugin."
		einfo "Please read amazonde.readme in the docs-dir!"
	fi
	if use hminfo; then
		einfo "You chose to install the HometheaterInfo.com - plugin."
		einfo "This plugin requires the DVD_CSV.txt file downloaded from the"
		einfo "HomeTheaterInfo site. It is not distributed with the plugin. The"
		einfo "URL to download this file is currently"
		einfo "http://www.hometheaterinfo.com/download/dvd_csv.zip."
	fi
}