| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
inherit eutils
|
| 8 |
|
| 9 |
DESCRIPTION="PG'OCaml is a set of OCaml bindings for the PostgreSQL database"
|
| 10 |
HOMEPAGE="http://pgocaml.forge.ocamlcore.org/"
|
| 11 |
SRC_URI="http://forge.ocamlcore.org/frs/download.php/922/${P}.tgz"
|
| 12 |
|
| 13 |
LICENSE="LGPL-2.1-with-linking-exception"
|
| 14 |
SLOT="0"
|
| 15 |
KEYWORDS="~amd64"
|
| 16 |
IUSE="doc batteries"
|
| 17 |
|
| 18 |
DEPEND="dev-ml/calendar
|
| 19 |
!batteries? ( dev-ml/extlib )
|
| 20 |
batteries? ( dev-ml/batteries )
|
| 21 |
dev-ml/csv
|
| 22 |
dev-ml/pcre-ocaml
|
| 23 |
>=dev-lang/ocaml-3.10[ocamlopt]"
|
| 24 |
RDEPEND="${DEPEND}"
|
| 25 |
|
| 26 |
src_prepare() {
|
| 27 |
epatch "${FILESDIR}/${P}-test.patch"
|
| 28 |
epatch "${FILESDIR}/${P}-makefile.patch"
|
| 29 |
}
|
| 30 |
|
| 31 |
src_configure() {
|
| 32 |
echo "DESTDIR := \"${ED}/\"" >> Makefile.config
|
| 33 |
use batteries && echo "USE_BATTERIES := yes" >> Makefile.config
|
| 34 |
emake depend
|
| 35 |
}
|
| 36 |
|
| 37 |
src_compile() {
|
| 38 |
use doc && emake doc
|
| 39 |
emake
|
| 40 |
}
|
| 41 |
|
| 42 |
src_test() {
|
| 43 |
local default_pguser="postgres"
|
| 44 |
local default_pghost="localhost"
|
| 45 |
local default_pgport=""
|
| 46 |
|
| 47 |
einfo "The tests need a running PostgreSQL server."
|
| 48 |
einfo "Test requires PGUSER or/and PGPORT or/and PGHOST to be set."
|
| 49 |
einfo "If there are not, defaults are:"
|
| 50 |
einfo " PGUSER=${default_pguser}"
|
| 51 |
einfo " PGHOST=${default_pghost}"
|
| 52 |
einfo " PGPORT=${default_pgport}"
|
| 53 |
einfo "Define them at the command line or in:"
|
| 54 |
einfo " ${EROOT%/}/etc/pgocaml_test_env"
|
| 55 |
|
| 56 |
local user_defined_pguser=$PGUSER
|
| 57 |
local user_defined_pghost=$PGHOST
|
| 58 |
local user_defined_pgport=$PGPORT
|
| 59 |
|
| 60 |
unset PGUSER
|
| 61 |
unset PGHOST
|
| 62 |
unset PGPORT
|
| 63 |
|
| 64 |
if [[ -f ${EROOT%/}/etc/pgocaml_test_env ]]; then
|
| 65 |
source "${EROOT%/}/etc/pgocaml_test_env"
|
| 66 |
fi
|
| 67 |
[[ -n $PGUSER ]] && export PGUSER
|
| 68 |
[[ -n $PGHOST ]] && export PGHOST
|
| 69 |
[[ -n $PGPORT ]] && export PGPORT
|
| 70 |
|
| 71 |
[[ -n $user_defined_pguser ]] && export PGUSER=$user_defined_pguser
|
| 72 |
[[ -n $user_defined_pghost ]] && export PGHOST=$user_defined_pghost
|
| 73 |
[[ -n $user_defined_pgport ]] && export PGPORT=$user_defined_pgport
|
| 74 |
|
| 75 |
[[ -z $PGUSER ]] && export PGUSER=${default_pguser}
|
| 76 |
[[ -z $PGHOST ]] && export PGHOST=${default_pghost}
|
| 77 |
[[ -z $PGPORT ]] && export PGPORT=${default_pgport}
|
| 78 |
|
| 79 |
einfo "PGUSER set to: ${PGUSER}"
|
| 80 |
einfo "PGHOST set to: ${PGHOST}"
|
| 81 |
einfo "PGPORT set to: ${PGPORT}"
|
| 82 |
|
| 83 |
emake test
|
| 84 |
}
|
| 85 |
|
| 86 |
src_install() {
|
| 87 |
emake install
|
| 88 |
dodoc BUGS.txt CONTRIBUTORS.txt HOW_IT_WORKS.txt README.txt \
|
| 89 |
CHANGELOG.txt README.profiling
|
| 90 |
use doc && dohtml -r html
|
| 91 |
}
|