| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-base/postgresql-base-9.0.8.ebuild,v 1.6 2012/07/01 16:21:10 armin76 Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
|
| 7 |
WANT_AUTOMAKE="none" |
| 8 |
|
| 9 |
inherit autotools eutils flag-o-matic multilib prefix versionator |
| 10 |
|
| 11 |
SLOT="$(get_version_component_range 1-2)" |
| 12 |
|
| 13 |
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ~ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
| 14 |
|
| 15 |
DESCRIPTION="PostgreSQL libraries and clients" |
| 16 |
HOMEPAGE="http://www.postgresql.org/" |
| 17 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 |
| 18 |
http://dev.gentoo.org/~titanofold/postgresql-patches-9.0-r3.tbz2" |
| 19 |
LICENSE="POSTGRESQL" |
| 20 |
|
| 21 |
S="${WORKDIR}/postgresql-${PV}" |
| 22 |
|
| 23 |
# No tests to be done for clients and libraries |
| 24 |
RESTRICT="test" |
| 25 |
|
| 26 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" |
| 27 |
IUSE="doc kerberos ldap nls pam pg_legacytimestamp readline ssl threads zlib" |
| 28 |
|
| 29 |
for lingua in ${LINGUAS} ; do |
| 30 |
IUSE+=" linguas_${lingua}" |
| 31 |
done |
| 32 |
|
| 33 |
wanted_languages() { |
| 34 |
local enable_langs |
| 35 |
|
| 36 |
for lingua in ${LINGUAS} ; do |
| 37 |
use linguas_${lingua} && enable_langs+="${lingua} " |
| 38 |
done |
| 39 |
|
| 40 |
echo -n ${enable_langs} |
| 41 |
} |
| 42 |
|
| 43 |
RDEPEND=">=app-admin/eselect-postgresql-1.0.7 |
| 44 |
virtual/libintl |
| 45 |
!!dev-db/libpq |
| 46 |
!!dev-db/postgresql |
| 47 |
!!dev-db/postgresql-client |
| 48 |
!!dev-db/postgresql-libs |
| 49 |
kerberos? ( virtual/krb5 ) |
| 50 |
ldap? ( net-nds/openldap ) |
| 51 |
pam? ( virtual/pam ) |
| 52 |
readline? ( sys-libs/readline ) |
| 53 |
ssl? ( >=dev-libs/openssl-0.9.6-r1 ) |
| 54 |
zlib? ( sys-libs/zlib )" |
| 55 |
|
| 56 |
DEPEND="${RDEPEND} |
| 57 |
sys-devel/bison |
| 58 |
sys-devel/flex |
| 59 |
!!<sys-apps/sandbox-2.0 |
| 60 |
nls? ( sys-devel/gettext )" |
| 61 |
|
| 62 |
PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" |
| 63 |
|
| 64 |
# Support /var/run or /run for the socket directory |
| 65 |
[[ ! -d /run ]] && RUNDIR=/var |
| 66 |
|
| 67 |
src_prepare() { |
| 68 |
epatch "${WORKDIR}/autoconf.patch" "${WORKDIR}/base.patch" \ |
| 69 |
"${WORKDIR}/bool.patch" |
| 70 |
|
| 71 |
eprefixify src/include/pg_config_manual.h |
| 72 |
|
| 73 |
# to avoid collision - it only should be installed by server |
| 74 |
rm "${S}/src/backend/nls.mk" |
| 75 |
|
| 76 |
# because psql/help.c includes the file |
| 77 |
ln -s "${S}/src/include/libpq/pqsignal.h" "${S}/src/bin/psql/" || die |
| 78 |
|
| 79 |
sed -e "s|@RUNDIR@|${RUNDIR}|g" \ |
| 80 |
-i src/include/pg_config_manual.h || \ |
| 81 |
die "RUNDIR sed failed" |
| 82 |
|
| 83 |
eautoconf |
| 84 |
} |
| 85 |
|
| 86 |
src_configure() { |
| 87 |
case ${CHOST} in |
| 88 |
*-darwin*|*-solaris*) |
| 89 |
use nls && append-libs intl |
| 90 |
;; |
| 91 |
esac |
| 92 |
export LDFLAGS_SL="${LDFLAGS}" |
| 93 |
export LDFLAGS_EX="${LDFLAGS}" |
| 94 |
local PO="${EPREFIX%/}" |
| 95 |
econf --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
| 96 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
| 97 |
--docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \ |
| 98 |
--includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
| 99 |
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
| 100 |
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
| 101 |
--without-tcl \ |
| 102 |
--without-perl \ |
| 103 |
--without-python \ |
| 104 |
$(use_with kerberos krb5) \ |
| 105 |
$(use_with kerberos gssapi) \ |
| 106 |
$(use_with ldap) \ |
| 107 |
"$(use_enable nls nls "$(wanted_languages)")" \ |
| 108 |
$(use_with pam) \ |
| 109 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
| 110 |
$(use_with readline) \ |
| 111 |
$(use_with ssl openssl) \ |
| 112 |
$(use_enable threads thread-safety) \ |
| 113 |
$(use_with zlib) |
| 114 |
} |
| 115 |
|
| 116 |
src_compile() { |
| 117 |
emake |
| 118 |
|
| 119 |
cd "${S}/contrib" |
| 120 |
emake |
| 121 |
} |
| 122 |
|
| 123 |
src_install() { |
| 124 |
emake DESTDIR="${D}" install |
| 125 |
insinto /usr/include/postgresql-${SLOT}/postmaster |
| 126 |
doins "${S}"/src/include/postmaster/*.h |
| 127 |
|
| 128 |
dodir /usr/share/postgresql-${SLOT}/man/ |
| 129 |
cp -r "${S}"/doc/src/sgml/man{1,7} "${ED}"/usr/share/postgresql-${SLOT}/man/ || die |
| 130 |
rm "${ED}/usr/share/postgresql-${SLOT}/man/man1"/{initdb,pg_controldata,pg_ctl,pg_resetxlog,postgres,postmaster}.1 |
| 131 |
docompress /usr/share/postgresql-${SLOT}/man/man{1,7} |
| 132 |
|
| 133 |
dodoc README HISTORY doc/{README.*,TODO,bug.template} |
| 134 |
|
| 135 |
cd "${S}/contrib" |
| 136 |
emake DESTDIR="${D}" install |
| 137 |
cd "${S}" |
| 138 |
|
| 139 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
| 140 |
|
| 141 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \ |
| 142 |
> "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
| 143 |
|
| 144 |
keepdir /etc/postgresql-${SLOT} |
| 145 |
} |
| 146 |
|
| 147 |
pkg_postinst() { |
| 148 |
postgresql-config update |
| 149 |
|
| 150 |
elog "If you need a global psqlrc-file, you can place it in:" |
| 151 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
| 152 |
} |
| 153 |
|
| 154 |
pkg_postrm() { |
| 155 |
postgresql-config update |
| 156 |
} |