summaryrefslogtreecommitdiff
blob: 281b51b2d1fa1afe09df006f23c076b466c00381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/libpqxx/libpqxx-3.0.2.ebuild,v 1.1 2009/09/10 13:10:42 patrick Exp $

EAPI="2"

inherit eutils

KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"

DESCRIPTION="C++ client API for PostgreSQL. The standard front-end for writing C++ programs that use PostgreSQL. Supersedes older libpq++ interface."
SRC_URI="http://pqxx.org/download/software/${PN}/${P}.tar.gz"
HOMEPAGE="http://pqxx.org/development/libpqxx/"
LICENSE="BSD"
SLOT="0"
IUSE=""

DEPEND="virtual/postgresql-base"
RDEPEND="${DEPEND}"

src_prepare() {
	# should be safe enough to remove the lines directly from configure,
	# since it's copied directly from configure.ac
	sed -i \
		-e 's/\(gcc_visibility\)=yes/\1=no/g' \
		-e 's@\(#define PQXX_HAVE_GCC_VISIBILITY 1\)@/* \1 */@g' \
		-e '/-Werror/d' \
		configure || die "sed failed"
}

src_compile() {
	econf --enable-shared || die "econf failed"
	emake || die "emake failed"
}

src_install () {
	emake DESTDIR="${D}" install || die "emake install failed"

	dodoc AUTHORS ChangeLog NEWS README* TODO
	dohtml -r doc/html/*
}

src_test() {
	ewarn "The tests need a running PostgreSQL server and an existing database!"
	ewarn "You can set the following environment variables to change the connection parameters:"
	ewarn "PGDATABASE (default: username, probably root)"
	ewarn "PGHOST (default: localhost)"
	ewarn "PGPORT (default: pg's UNIX domain-socket)"
	ewarn "PGUSER (default: username, probably root)"
	epause 10

	if [[ -n ${PGDATABASE} ]] ; then
		cd "${S}/test"
		# Working around a mysterious bug in gcc-4.1
		sed -i -e 's/-O2/-O1/' Makefile
		emake -j1 check || die "emake check failed"
	else
		ewarn "Tests skipped since PGDATABASE is not defined or empty"
	fi
}