commit:     66cf4d2b144650479c745c2713bbe2b103d94772
Author:     Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 11 11:39:28 2018 +0000
Commit:     Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Aug 11 11:39:28 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66cf4d2b

dev-db/postgresql: Bring 9999 up to speed

There have been various improvements over time to the versioned
ebuilds that haven’t made their way in the live ebuild. This fixes
that.

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 dev-db/postgresql/postgresql-9999.ebuild | 94 ++++++++++++++++++++++----------
 1 file changed, 66 insertions(+), 28 deletions(-)

diff --git a/dev-db/postgresql/postgresql-9999.ebuild 
b/dev-db/postgresql/postgresql-9999.ebuild
index 65ea48f8b86..922c31f8f09 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9999.ebuild
@@ -5,8 +5,12 @@ EAPI="6"
 
 PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
 
-inherit eutils flag-o-matic git-r3 linux-info multilib pam prefix \
-               python-single-r1 systemd user versionator
+PLOCALES="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"
+PLOCALES="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"
+inherit flag-o-matic git-r3 linux-info multilib pam prefix python-single-r1 \
+               systemd user versionator
 
 KEYWORDS=""
 
@@ -19,21 +23,13 @@ LICENSE="POSTGRESQL GPL-2"
 DESCRIPTION="PostgreSQL RDBMS"
 HOMEPAGE="https://www.postgresql.org/";
 
-IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp 
python
-         +readline selinux +server systemd ssl static-libs tcl threads uuid 
xml zlib"
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
-
-wanted_languages() {
-       local 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"
-       local enable_langs lingua
+IUSE="kerberos kernel_linux ldap libressl llvm nls pam perl python +readline
+         selinux systemd ssl static-libs tcl threads uuid xml zlib"
+for my_locale in ${PLOCALES}; do
+       IUSE+=" l10n_${my_locale}"
+done
 
-       for lingua in ${linguas} ; do
-               has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
-       done
-
-       echo -n ${enable_langs}
-}
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
 CDEPEND="
 >=app-eselect/eselect-postgresql-2.0
@@ -41,6 +37,10 @@ sys-apps/less
 virtual/libintl
 kerberos? ( virtual/krb5 )
 ldap? ( net-nds/openldap )
+llvm? (
+       sys-devel/llvm:=
+       sys-devel/clang:=
+)
 pam? ( virtual/pam )
 perl? ( >=dev-lang/perl-5.8:= )
 python? ( ${PYTHON_DEPS} )
@@ -49,13 +49,36 @@ ssl? (
        !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
        libressl? ( dev-libs/libressl:= )
 )
-server? ( systemd? ( sys-apps/systemd ) )
+systemd? ( sys-apps/systemd )
 tcl? ( >=dev-lang/tcl-8:0= )
 uuid? ( dev-libs/ossp-uuid )
 xml? ( dev-libs/libxml2 dev-libs/libxslt )
 zlib? ( sys-libs/zlib )
 "
 
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
+# the libc includes UUID functions.
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
+BSD_LIBC=( elibc_{Free,Net,Open}BSD )
+
+nest_usedep() {
+       local front back
+       while [[ ${#} -gt 1 ]]; do
+               front+="${1}? ( "
+               back+=" )"
+               shift
+       done
+       echo "${front}${1}${back}"
+}
+
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
+CDEPEND+="
+uuid? (
+       ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
+       $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} 
dev-libs/ossp-uuid)
+)"
+
 DEPEND="${CDEPEND}
 !!<sys-apps/sandbox-2.0
 >=dev-lang/perl-5.8
@@ -78,6 +101,14 @@ RDEPEND="${CDEPEND}
 selinux? ( sec-policy/selinux-postgresql )
 "
 
+my_get_locales() {
+       local my_locale locale_list
+       for my_locale in ${PLOCALES[@]}; do
+               use l10n_${my_locale} && locale_list+=( ${my_locale} )
+       done
+       echo -n ${locale_list[@]}
+}
+
 pkg_pretend() {
        ewarn "You are using a live ebuild that uses the current source code as 
it is"
        ewarn "available from PostgreSQL's Git repository at emerge time. Given 
such,"
@@ -127,6 +158,17 @@ src_configure() {
 
        local PO="${EPREFIX%/}"
 
+       local i uuid_config=""
+       if use uuid; then
+               for i in ${UTIL_LINUX_LIBC[@]}; do
+                       use ${i} && uuid_config="--with-uuid=e2fs"
+               done
+               for i in ${BSD_LIBC[@]}; do
+                       use ${i} && uuid_config="--with-uuid=bsd"
+               done
+               [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
+       fi
+
        econf \
                --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
                --datadir="${PO}/usr/share/postgresql-${SLOT}" \
@@ -136,22 +178,22 @@ src_configure() {
                --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
                --with-system-tzdata="${PO}/usr/share/zoneinfo" \
                $(use_enable !alpha spinlocks) \
-               $(use_enable !pg_legacytimestamp integer-datetimes) \
+               $(use_enable nls nls "'$(my_get_locales)'") \
                $(use_enable threads thread-safety) \
                $(use_with kerberos gssapi) \
                $(use_with ldap) \
+               $(use_with llvm) \
                $(use_with pam) \
                $(use_with perl) \
                $(use_with python) \
                $(use_with readline) \
                $(use_with ssl openssl) \
-               $(usex server "$(use_with systemd)" '--without-systemd') \
                $(use_with tcl) \
-               $(use_with uuid ossp-uuid) \
                $(use_with xml libxml) \
                $(use_with xml libxslt) \
                $(use_with zlib) \
-               "$(use_enable nls nls "$(wanted_languages)")"
+               $(use_with systemd) \
+               ${uuid_config}
 }
 
 src_compile() {
@@ -262,7 +304,7 @@ pkg_preinst() {
 }
 
 pkg_postinst() {
-       use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
+       use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
        postgresql-config update
 
        elog "If you need a global psqlrc-file, you can place it in:"
@@ -423,17 +465,13 @@ pkg_config() {
 }
 
 src_test() {
-       einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
-
        if [[ ${UID} -ne 0 ]] ; then
                emake check
 
                einfo "If you think other tests besides the regression tests 
are necessary, please"
                einfo "submit a bug including a patch for this ebuild to enable 
them."
        else
-               [[ ${UID} -eq 0 ]] || \
-                       ewarn "Tests cannot be run as root. Enable 'userpriv' 
in FEATURES."
-
-               ewarn "Skipping."
+               ewarn 'Tests cannot be run as root. Enable "userpriv" in 
FEATURES.'
+               ewarn 'Skipping.'
        fi
 }

Reply via email to