dev-libs/libpqxx: stable 5.1.0 for ia64, bug #641128
[gentoo.git] / dev-libs / libpqxx / libpqxx-5.1.0.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 PYTHON_COMPAT=( python2_7 )
7 inherit python-any-r1
8
9 KEYWORDS="~alpha ~amd64 ~hppa ia64 ppc ppc64 ~sparc x86 ~x86-fbsd"
10
11 DESCRIPTION="Standard front-end for writing C++ programs that use PostgreSQL"
12 SRC_URI="https://github.com/jtv/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
13 HOMEPAGE="http://pqxx.org/development/libpqxx/"
14 LICENSE="BSD"
15 SLOT="0"
16 IUSE="doc static-libs"
17
18 RDEPEND="dev-db/postgresql:="
19 DEPEND="${RDEPEND}
20         ${PYTHON_DEPS}
21         doc? (
22                 app-doc/doxygen
23                 app-text/xmlto
24         )
25 "
26
27 DOCS=( AUTHORS NEWS README{.md,-UPGRADE} )
28
29 src_prepare() {
30         default
31
32         sed -e 's/python/python2/' \
33                 -i tools/{splitconfig,template2mak.py} \
34                 || die "Couldn't fix Python shebangs"
35 }
36
37 src_configure() {
38         econf \
39                 --enable-shared \
40                 $(use_enable doc documentation) \
41                 $(use_enable static-libs static)
42 }
43
44 src_test() {
45         einfo "The tests need a running PostgreSQL server and an existing database."
46         einfo "Test requires PGDATABASE and PGUSER to be set at a minimum. Optionally,"
47         einfo "set PGPORT and PGHOST. Define them at the command line or in:"
48         einfo "    ${EROOT%/}/etc/libpqxx_test_env"
49
50         if [[ -z $PGDATABASE || -z $PGUSER ]] ; then
51                 if [[ -f ${EROOT%/}/etc/libpqxx_test_env ]] ; then
52                         source "${EROOT%/}/etc/libpqxx_test_env"
53                         [[ -n $PGDATABASE ]] && export PGDATABASE
54                         [[ -n $PGHOST ]] && export PGHOST
55                         [[ -n $PGPORT ]] && export PGPORT
56                         [[ -n $PGUSER ]] && export PGUSER
57                 fi
58         fi
59
60         if [[ -n $PGDATABASE && -n $PGUSER ]] ; then
61                 local server_version
62                 server_version=$(psql -Aqtc 'SELECT version();' 2> /dev/null)
63                 if [[ $? = 0 ]] ; then
64                         cd "${S}/test" || die
65                         emake check
66                 else
67                         eerror "Is the server running?"
68                         eerror "Verify role and database exist, and are permitted in pg_hba.conf for:"
69                         eerror "    Role: ${PGUSER}"
70                         eerror "    Database: ${PGDATABASE}"
71                         die "Couldn't connect to server."
72                 fi
73         else
74                 eerror "PGDATABASE and PGUSER must be set to perform tests."
75                 eerror "Skipping tests."
76         fi
77 }
78
79 src_install () {
80         use doc && HTML_DOCS=( doc/html/. )
81         default
82
83         if ! use static-libs; then
84                 find "${D}" -name '*.la' -delete || die
85         fi
86 }