1 |
commit: 366e303e11e473c985f5ec470ab50cb0cc0adefe |
2 |
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 19 12:48:39 2020 +0000 |
4 |
Commit: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 19 12:48:55 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=366e303e |
7 |
|
8 |
dev-db/postgresql: Version Bump |
9 |
|
10 |
Versions: |
11 |
- 9.4.26 |
12 |
- 9.5.21 |
13 |
- 9.6.17 |
14 |
- 10.12 |
15 |
- 11.7 |
16 |
- 12.2 |
17 |
|
18 |
Bug: https://bugs.gentoo.org/709708 |
19 |
Package-Manager: Portage-2.3.84, Repoman-2.3.20 |
20 |
Signed-off-by: Aaron W. Swenson <titanofold <AT> gentoo.org> |
21 |
|
22 |
dev-db/postgresql/Manifest | 6 + |
23 |
dev-db/postgresql/postgresql-10.12.ebuild | 466 +++++++++++++++++++++++++++ |
24 |
dev-db/postgresql/postgresql-11.7.ebuild | 468 +++++++++++++++++++++++++++ |
25 |
dev-db/postgresql/postgresql-12.2.ebuild | 468 +++++++++++++++++++++++++++ |
26 |
dev-db/postgresql/postgresql-9.4.26.ebuild | 480 ++++++++++++++++++++++++++++ |
27 |
dev-db/postgresql/postgresql-9.5.21.ebuild | 486 ++++++++++++++++++++++++++++ |
28 |
dev-db/postgresql/postgresql-9.6.17.ebuild | 491 +++++++++++++++++++++++++++++ |
29 |
7 files changed, 2865 insertions(+) |
30 |
|
31 |
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest |
32 |
index 77316d391e1..afa06285713 100644 |
33 |
--- a/dev-db/postgresql/Manifest |
34 |
+++ b/dev-db/postgresql/Manifest |
35 |
@@ -1,20 +1,26 @@ |
36 |
DIST postgresql-10.10.tar.bz2 19012049 BLAKE2B 44ed5cfe2dc57ff3533faa1e921c981e0e437fe19adccc2ad87b939ec0c1bd5772ed8b0d6a7815dfc70c15149725250cb9431d58388fd3331a2bc2623b9959fb SHA512 60cafe4b27a194949aff482dcce4fa096a9916f37205868437a32afb8964df71934b619a0b891fe85eb7c7f9b11775cffbbedca589e78feb6c4184eb224b48bc |
37 |
DIST postgresql-10.11.tar.bz2 19017947 BLAKE2B 952d0fc76b665545eb512e0a6df6d2dafe0eaec4bdc774968d0a49dd6f6873b35a317ca6fd2bd74f36864d10f5a61e1920440e066522f982d0a7f1ce285143a9 SHA512 ce90b34e74d423b6db1f0e840b8e09579965c020fa2cfe3e567b604d3354d91e00a4347d559876be829aa89db44f84736e154495708ba9908f1d850446a1fc7b |
38 |
+DIST postgresql-10.12.tar.bz2 19020488 BLAKE2B 2177e9b63e21a634e1d8ea060b5bd0a7360d81ece64f50dd614e6cdd6b0cf0dcbd3896ef2c11bd1431ce7a964ac8876d24f368d7f7eb309e3d432856d7546f2a SHA512 6accc66cbbae811509095c33e8a8d17ddd11d9e307267312e3d09df90469db4700a5806166d66f25d77769d3ef88653c98dfc7d05dd053f10434b03e0a9e33b7 |
39 |
DIST postgresql-10.9.tar.bz2 18981395 BLAKE2B ef2ac003b393ea7cbf24c45fac6b3dc69df2a8694a9e891d5a68f7310d63fb816649d16a7351d03b63a4eb2256703efcab616a0146324478335267c39f3b9829 SHA512 4e2f30a0fd262f2e3ce5fc836425be635326600cd6cd4e117c57f59ea7ab2e9ea463a8d357fe7adb8c0dd0094e43d08efc2a137f8f9975715a5908e35920f98e |
40 |
DIST postgresql-11.4.tar.bz2 19759635 BLAKE2B a3f35df40d31dce52073eeacf4e16bc7ccb487dc0a6e15b84d087f04fd130b66b1168ece3edc63927c377ca1044b54ccb3db5fb9b4a5c86a5b0e179a6678c73c SHA512 159fb84134e05ddc58e40a879ca52ed4d58ced7bcd1e7310d59bda84f9055339a31a92cfaab2c063a88685f7417b9a828534394bf9a2477fc33d1fb6cd26186b |
41 |
DIST postgresql-11.5.tar.bz2 19773087 BLAKE2B 32dca67ddfe2f6a6801a5d82a25fe7df0cc2dd89c35eee87a57ebe6391b8d7d4bccc59d6cac3e821ad76731ab319e3303f2fcbce9ee8cda1cfef13b2185c0ab1 SHA512 537148079dc6c33cfb9bf9722171e524707b42ef01369deb968d0d6e8fa9b7f16f6ce67139d9dc45fb7385defbf56aa2c0affe5ee9d76e996f31e47486192141 |
42 |
DIST postgresql-11.6.tar.bz2 19843202 BLAKE2B 379953e0a0abb5a5abb109370cf2b95979321524031fe754c0a5a2cde636b2fdafa1da9c9ee84638a884cec3a312607f8ac7da6b1817c3b700a44c3025fd1944 SHA512 de6833c0df8dbac7bc498ac573dc4c3645070d9bbdd6b5d89db3ef41e86e7fc19d5e6450aa46ee2a1392d86c33acf6b9364b2863caac49f45351a46647feecbd |
43 |
+DIST postgresql-11.7.tar.bz2 19890063 BLAKE2B 461c372567ff0b4ff4da52889be5d2822b56889e4890b33c9a71f1105ad629b4f5bec95c4fbf5aebbdd4445e0ff451a7d8df04ae7b5bf7cf0075c3226a41b19b SHA512 32c7ace228f9895241ce0d925fbfc60c0cd39f4cd35368fb10dc7db046151ffd59a9895b4c30a529627f0103051e84b4992ed60312cccd292489f3037076ca1e |
44 |
DIST postgresql-12.0.tar.bz2 20177458 BLAKE2B 614222e43519a83044587981cb04ab7e437357d5b2784068d425aaeb67df54f44aef4aaaf780bd3f83f012c0fc8f41723bc83b6e44e7bf2707857c491b8d129b SHA512 231a0b5c181c33cb01c3f39de1802319b79eceec6997935ab8605dea1f4583a52d0d16e5a70fcdeea313462f062503361d543433ee03d858ba332c72a665f696 |
45 |
DIST postgresql-12.1.tar.bz2 20213711 BLAKE2B 670e33c23a14527aedb694647ff2d2670df159352ef10c11e5895aafffaa752bd49ee7b1991262f4c7548dc8c617e06f651c6098a676b4462ed06e3982d0f5fa SHA512 f45b1762fd60b6f7419305d108b7fc521e3a7afa833d3aacccba814465baf40d19f57ff9bf2909d726c4c94a1cd99a39f1aa8e45fd0364cdedbcbed36ff48caf |
46 |
+DIST postgresql-12.2.tar.bz2 20363545 BLAKE2B 7b0cfe841d46b117ff5dd793be5537e916f92255eb0d000681ed62c497eef34c5d1261126be408f2b7f95274485e2787869cd4063461ab248b650c168b62548d SHA512 0e0ce8e21856e8f43e58b840c10c4e3ffae6d5207e0d778e9176e36f8e20e34633cbb06f0030a7c963c3491bb7e941456d91b55444c561cfc6f283fba76f33ee |
47 |
DIST postgresql-9.4.22.tar.bz2 16848787 BLAKE2B 5c2aaef13ef0cf33c421e6839877a8e4e1fc5dbe41d9cabefddd369925869f92f6c6b8a124b5778f9b25359103f0a7ada1eddcaf4bac498709f563928f25e7e3 SHA512 f11623a89b2320616fd53eda52da544bdfcb63bff08cb78fccde134ef628eee7ee90b3de6952f4e08c10297d356624faabf0e5b181b0105f51797796cd04efef |
48 |
DIST postgresql-9.4.23.tar.bz2 16848808 BLAKE2B fd747fb3f6f540190ecbd53116ef7b8b812d05f5968e32c9d09c5902239eaf073281262dba9836514344303a3c894f48c617e050ce713be7c09f53ee49c7b3cd SHA512 b1eb392b939ac8369c76e4ecc142c78f380afc498b60ec0ea97acb16c21ffa5c11a24c2c46463032865955b7c531492c08feb6ef1efc46a549369f026594ea61 |
49 |
DIST postgresql-9.4.24.tar.bz2 16842941 BLAKE2B 999a33addd493d1169ba3222a269fea827f4ed866453727bf9545d6a8873943d56b8e71773daf0f116150dc557afaf2e80dc570e8f351ba64b196ae8bcd8fbc9 SHA512 8e7b4da8a5cf48cf4d98cce117614f7ab594087d0002f996c1fedc2a38af6eaa663ad3ce67ced6d6b0fd6d0b00aee932025bf50a4314933ba535716577e9393f |
50 |
DIST postgresql-9.4.25.tar.bz2 16849015 BLAKE2B 1d843fe29cdb122515f2bded8a04489772f7c40aa54774a454fe0815cc1c6306b42ff3115e1dfb7dc93b483d62611f1e773436c1370462326678f78bc25f3827 SHA512 be45c47a17788be40a2beca058b5dcbf1ded985838d1c85229fbece174fca222d5ac07025c764d40c92f823d6bf784975a25b79a545b903434be8bcd24efb9a0 |
51 |
+DIST postgresql-9.4.26.tar.bz2 16871195 BLAKE2B f26fd335293669a815a51ceb994b66e154c66f96f91e4c68d7df3490ad25f4b0366ebf7bfe2b209ff34965ea27a08562ace050f40d49cec94eb576d7a1becd1c SHA512 7d379d139c7b2bdac1df38743cbb46a1790a8d5174e8cf1141b7b4febcbc8f612e347bf4d355684eef24dfc73bb2796f85fc532908f26ba7195c685f198cbb72 |
52 |
DIST postgresql-9.5.17.tar.bz2 17563469 BLAKE2B d40b7f95d03db594144b4882f36bbe22f348faab0b8d67eda3f946448bb0e09188eccdeb4d1c92742fb29a920b30ede55e536a863b22d2009283eab66679122d SHA512 bb468528b1f18166cda0be136f31a632859ffe6e6800233b1cb0e91ce11d2d00d3dc108a74580b5552a4d30b9f1b6849c91576cd497beac788c429815c66eac5 |
53 |
DIST postgresql-9.5.18.tar.bz2 17570161 BLAKE2B aee7e4570f2571e507fd972e86d3a6a9243d8fd33c356305998a8dce461bc9b06b45e1ff4267a9eb47f58a793c0b70bce0babfc0dce939cb34b1436a55a5d9fd SHA512 0487ac2891c800de045135d4b153659ec10c28750a09e0b87343f8e7145a11f1783ed0b6ca60829776faae1430c8050cc7661c780f171f1b2621f1673a32e6d1 |
54 |
DIST postgresql-9.5.19.tar.bz2 17571998 BLAKE2B 24bd617ecef4d0add443d20ea3528eb8d48d83f31a3eaf726213c98211418efd2f35d846964049284332c9d20228308c7441cb3e8ee35f0188d060fc75239788 SHA512 46de40e49910311bf5291e1ece421ab9628641b18bf84cd1cb8093a584dd0358e3b6d2b086f82e9b06ce699a6e38018c3515ea591355078392e8d3d2fe4a7c64 |
55 |
DIST postgresql-9.5.20.tar.bz2 17610134 BLAKE2B 26400eb8906186c3d1bb2ee1a16248540ed11d61445caf9d657dd47faabc2df8116ffa02727152d37bf88ac10f935887dc449bc421c605fa107bd5a24f38c3d5 SHA512 75558d05f6bee6fad65ad0b4dcb428b50bcf003c4fbd878747010988958464d7119dd8121a8817c3cad83c20bcae6cd550fc01fbca39f54e670d93fc70688bea |
56 |
+DIST postgresql-9.5.21.tar.bz2 17640928 BLAKE2B 8ffcf0befc331317a32d63d3cdfe44f7743f72f18b4bc46bee5ee80f8c489b4b1ef26abc8219f277acc922657fc21e3dc31f3fc9838621f44d95cc9405fca43b SHA512 8527356ee3b4f151c832aef50a8b96e923e0a6c77e5fe6ad597f50527f9d084a8feab7bede8fdbe29aab44383577d3f86e5286fb34e2d2b696cde34bd922e69d |
57 |
DIST postgresql-9.6.13.tar.bz2 18767279 BLAKE2B c1ec780a7f938f878425cbd6556145e60a613135129daaacc52e9a699cc448a22481b01fac20d0c09373ea6a026f39bc58234aae4f1126333b94f621981a8135 SHA512 65cc70410ad4a1a738b92855b92eecdbb9efbbca0eb9a45a138d47b696c8f9c9cd19073fbfdf5c80eea7633d0be29b4ed8acbadd38724acf8f18c90bb30f9b26 |
58 |
DIST postgresql-9.6.14.tar.bz2 18787744 BLAKE2B be5a0d90fe1cd5ea682d8446e512271175f705bc49514215535d7aa4b631669846c0bd6167f985028c07dc5d6d394a1ea809028c5a5e15a5f010e85c2bede8cf SHA512 dccc183a6992ef4ece4ef5c638339708ab484e571ecd66ed993c9071cd55f250b4277fd3367f9a5ee545aa83e29dc5f7a239200e200e3314d5acc847f35e790c |
59 |
DIST postgresql-9.6.15.tar.bz2 18799121 BLAKE2B 5dee0fac7592cecf4412deaef54cedbd86eb6081fc268b6ef8a5f01c31af930747749fb54a77d766e1d6ef705bab5d550a7bace25c86d201f25ed69163d920fc SHA512 cc35a059bf59ea3487c17a8432b791ca2a19afaa24b07403a8d33904b3a97ebe601e3036ca8ec766c54cb87a7def7d4618a425a4446e6832391185d7c71117db |
60 |
DIST postgresql-9.6.16.tar.bz2 18806372 BLAKE2B f5d7287264b05ab6bd157adf05d78597c7e7281ef40d4616ad66f2434a686c68845ad21883bcc97f6ea299a785109e1541d6c75e40ba383d80e9703331d9c624 SHA512 7083d670883b203946f68bcf1216dd1cbd904220b4c95e25855f9a8904334fd7e87509c905f589398ad7b165869b75288c2e4f49b14263ce4891347ecd4485b4 |
61 |
+DIST postgresql-9.6.17.tar.bz2 18812282 BLAKE2B 0bb48445201aae1d6b4f5a77652aefaaa629799a019c3b81a14e554a88167530002931c2b0d658731b26a38bd09487f79a6ef514b0955982d6037b383c021819 SHA512 a76f328523517f664e4fc59a4d27e476bc6300e49370712030caae40aa160acb1e6aecc7cd3b3440125713069932df812eb8d75377a3df63e59c9292419c2aa8 |
62 |
|
63 |
diff --git a/dev-db/postgresql/postgresql-10.12.ebuild b/dev-db/postgresql/postgresql-10.12.ebuild |
64 |
new file mode 100644 |
65 |
index 00000000000..e52794e837d |
66 |
--- /dev/null |
67 |
+++ b/dev-db/postgresql/postgresql-10.12.ebuild |
68 |
@@ -0,0 +1,466 @@ |
69 |
+# Copyright 1999-2020 Gentoo Authors |
70 |
+# Distributed under the terms of the GNU General Public License v2 |
71 |
+ |
72 |
+EAPI=7 |
73 |
+ |
74 |
+PYTHON_COMPAT=( python3_{6,7} ) |
75 |
+ |
76 |
+PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
77 |
+ zh_TW" |
78 |
+ |
79 |
+inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
80 |
+ systemd user |
81 |
+ |
82 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-macos ~x86-solaris" |
83 |
+ |
84 |
+SLOT=$(ver_cut 1) |
85 |
+ |
86 |
+MY_PV=${PV/_/} |
87 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
88 |
+ |
89 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
90 |
+ |
91 |
+LICENSE="POSTGRESQL GPL-2" |
92 |
+DESCRIPTION="PostgreSQL RDBMS" |
93 |
+HOMEPAGE="https://www.postgresql.org/" |
94 |
+ |
95 |
+IUSE="debug doc icu kerberos kernel_linux ldap libressl nls pam perl |
96 |
+ python +readline selinux +server systemd ssl static-libs tcl |
97 |
+ threads uuid xml zlib" |
98 |
+ |
99 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
100 |
+ |
101 |
+CDEPEND=" |
102 |
+>=app-eselect/eselect-postgresql-2.0 |
103 |
+sys-apps/less |
104 |
+virtual/libintl |
105 |
+icu? ( dev-libs/icu:= ) |
106 |
+kerberos? ( virtual/krb5 ) |
107 |
+ldap? ( net-nds/openldap ) |
108 |
+pam? ( sys-libs/pam ) |
109 |
+perl? ( >=dev-lang/perl-5.8:= ) |
110 |
+python? ( ${PYTHON_DEPS} ) |
111 |
+readline? ( sys-libs/readline:0= ) |
112 |
+server? ( systemd? ( sys-apps/systemd ) ) |
113 |
+ssl? ( |
114 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
115 |
+ libressl? ( dev-libs/libressl:= ) |
116 |
+) |
117 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
118 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
119 |
+zlib? ( sys-libs/zlib ) |
120 |
+" |
121 |
+ |
122 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
123 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
124 |
+# the libc includes UUID functions. |
125 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
126 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
127 |
+ |
128 |
+nest_usedep() { |
129 |
+ local front back |
130 |
+ while [[ ${#} -gt 1 ]]; do |
131 |
+ front+="${1}? ( " |
132 |
+ back+=" )" |
133 |
+ shift |
134 |
+ done |
135 |
+ echo "${front}${1}${back}" |
136 |
+} |
137 |
+ |
138 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
139 |
+CDEPEND+=" |
140 |
+uuid? ( |
141 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
142 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
143 |
+)" |
144 |
+ |
145 |
+DEPEND="${CDEPEND} |
146 |
+!!<sys-apps/sandbox-2.0 |
147 |
+sys-devel/bison |
148 |
+sys-devel/flex |
149 |
+nls? ( sys-devel/gettext ) |
150 |
+xml? ( virtual/pkgconfig ) |
151 |
+" |
152 |
+ |
153 |
+RDEPEND="${CDEPEND} |
154 |
+!dev-db/postgresql-docs:${SLOT} |
155 |
+!dev-db/postgresql-base:${SLOT} |
156 |
+!dev-db/postgresql-server:${SLOT} |
157 |
+selinux? ( sec-policy/selinux-postgresql ) |
158 |
+" |
159 |
+ |
160 |
+pkg_setup() { |
161 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
162 |
+ |
163 |
+ enewgroup postgres 70 |
164 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
165 |
+ |
166 |
+ use python && python-single-r1_pkg_setup |
167 |
+} |
168 |
+ |
169 |
+src_prepare() { |
170 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
171 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
172 |
+ |
173 |
+ # Set proper run directory |
174 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
175 |
+ -i src/include/pg_config_manual.h || die |
176 |
+ |
177 |
+ # Rely on $PATH being in the proper order so that the correct |
178 |
+ # install program is used for modules utilizing PGXS in both |
179 |
+ # hardened and non-hardened environments. (Bug #528786) |
180 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
181 |
+ |
182 |
+ use server || eapply "${FILESDIR}/${PN}-10.2-no-server.patch" |
183 |
+ |
184 |
+ if use pam ; then |
185 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
186 |
+ -i src/backend/libpq/auth.c || \ |
187 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
188 |
+ fi |
189 |
+ |
190 |
+ eapply_user |
191 |
+} |
192 |
+ |
193 |
+src_configure() { |
194 |
+ case ${CHOST} in |
195 |
+ *-darwin*|*-solaris*) |
196 |
+ use nls && append-libs intl |
197 |
+ ;; |
198 |
+ esac |
199 |
+ |
200 |
+ export LDFLAGS_SL="${LDFLAGS}" |
201 |
+ export LDFLAGS_EX="${LDFLAGS}" |
202 |
+ |
203 |
+ local PO="${EPREFIX}" |
204 |
+ |
205 |
+ local i uuid_config="" |
206 |
+ if use uuid; then |
207 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
208 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
209 |
+ done |
210 |
+ for i in ${BSD_LIBC[@]}; do |
211 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
212 |
+ done |
213 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
214 |
+ fi |
215 |
+ |
216 |
+ econf \ |
217 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
218 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
219 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
220 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
221 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
222 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
223 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
224 |
+ $(use_enable !alpha spinlocks) \ |
225 |
+ $(use_enable debug) \ |
226 |
+ $(use_enable threads thread-safety) \ |
227 |
+ $(use_with icu) \ |
228 |
+ $(use_with kerberos gssapi) \ |
229 |
+ $(use_with ldap) \ |
230 |
+ $(use_with pam) \ |
231 |
+ $(use_with perl) \ |
232 |
+ $(use_with python) \ |
233 |
+ $(use_with readline) \ |
234 |
+ $(use_with ssl openssl) \ |
235 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
236 |
+ $(use_with tcl) \ |
237 |
+ ${uuid_config} \ |
238 |
+ $(use_with xml libxml) \ |
239 |
+ $(use_with xml libxslt) \ |
240 |
+ $(use_with zlib) \ |
241 |
+ $(use_enable nls nls "'$(l10n_get_locales)'") |
242 |
+} |
243 |
+ |
244 |
+src_compile() { |
245 |
+ emake |
246 |
+ emake -C contrib |
247 |
+} |
248 |
+ |
249 |
+src_install() { |
250 |
+ emake DESTDIR="${D}" install |
251 |
+ emake DESTDIR="${D}" install -C contrib |
252 |
+ |
253 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
254 |
+ |
255 |
+ # man pages are already built, but if we have the target make them, |
256 |
+ # they'll be generated from source before being installed so we |
257 |
+ # manually install man pages. |
258 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
259 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
260 |
+ doins -r doc/src/sgml/man{1,3,7} |
261 |
+ if ! use server; then |
262 |
+ # Remove man pages for non-existent binaries |
263 |
+ serverman=( |
264 |
+ initdb |
265 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
266 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
267 |
+ post{gres,master} |
268 |
+ ) |
269 |
+ for m in ${serverman[@]} ; do |
270 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
271 |
+ done |
272 |
+ fi |
273 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
274 |
+ |
275 |
+ # Create slot specific man pages |
276 |
+ local bn f mansec slotted_name |
277 |
+ for mansec in 1 3 7 ; do |
278 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
279 |
+ |
280 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
281 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
282 |
+ |
283 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
284 |
+ bn=$(basename "${f}") |
285 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
286 |
+ case ${bn} in |
287 |
+ TABLE.7|WITH.7) |
288 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
289 |
+ ;; |
290 |
+ *) |
291 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
292 |
+ ;; |
293 |
+ esac |
294 |
+ done |
295 |
+ |
296 |
+ popd > /dev/null |
297 |
+ done |
298 |
+ |
299 |
+ insinto /etc/postgresql-${SLOT} |
300 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
301 |
+ |
302 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
303 |
+ # needed by extensions utilizing PGXS. |
304 |
+ use static-libs || \ |
305 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
306 |
+ -delete |
307 |
+ |
308 |
+ # Make slot specific links to programs |
309 |
+ local f bn |
310 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
311 |
+ -mindepth 1 -maxdepth 1) |
312 |
+ do |
313 |
+ bn=$(basename "${f}") |
314 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
315 |
+ "/usr/bin/${bn}${SLOT/.}" |
316 |
+ done |
317 |
+ |
318 |
+ if use doc ; then |
319 |
+ docinto html |
320 |
+ dodoc doc/src/sgml/html/* |
321 |
+ fi |
322 |
+ |
323 |
+ if use server; then |
324 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
325 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
326 |
+ |
327 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
328 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
329 |
+ |
330 |
+ if use systemd; then |
331 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
332 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
333 |
+ systemd_newunit - ${PN}-${SLOT}.service |
334 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
335 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
336 |
+ fi |
337 |
+ |
338 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
339 |
+ |
340 |
+ if use prefix ; then |
341 |
+ keepdir /run/postgresql |
342 |
+ fperms 1775 /run/postgresql |
343 |
+ fi |
344 |
+ fi |
345 |
+} |
346 |
+ |
347 |
+pkg_postinst() { |
348 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
349 |
+ postgresql-config update |
350 |
+ |
351 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
352 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
353 |
+ |
354 |
+ if use server ; then |
355 |
+ elog |
356 |
+ elog "Gentoo specific documentation:" |
357 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
358 |
+ elog |
359 |
+ elog "Official documentation:" |
360 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
361 |
+ elog |
362 |
+ elog "The default location of the Unix-domain socket is:" |
363 |
+ elog " ${EROOT}/run/postgresql/" |
364 |
+ elog |
365 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
366 |
+ elog "so that it contains your preferred locale in:" |
367 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
368 |
+ elog |
369 |
+ elog "Then, execute the following command to setup the initial database" |
370 |
+ elog "environment:" |
371 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
372 |
+ |
373 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
374 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
375 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
376 |
+ ewarn "the following command after upgrading:" |
377 |
+ ewarn |
378 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
379 |
+ fi |
380 |
+ fi |
381 |
+} |
382 |
+ |
383 |
+pkg_prerm() { |
384 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
385 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
386 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
387 |
+ |
388 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
389 |
+ sleep 10 |
390 |
+ eend 0 |
391 |
+ fi |
392 |
+} |
393 |
+ |
394 |
+pkg_postrm() { |
395 |
+ postgresql-config update |
396 |
+} |
397 |
+ |
398 |
+pkg_config() { |
399 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
400 |
+ |
401 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
402 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
403 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
404 |
+ [[ -z "${DATA_DIR}" ]] \ |
405 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
406 |
+ |
407 |
+ # environment.bz2 may not contain the same locale as the current system |
408 |
+ # locale. Unset and source from the current system locale. |
409 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
410 |
+ unset LANG |
411 |
+ unset LC_CTYPE |
412 |
+ unset LC_NUMERIC |
413 |
+ unset LC_TIME |
414 |
+ unset LC_COLLATE |
415 |
+ unset LC_MONETARY |
416 |
+ unset LC_MESSAGES |
417 |
+ unset LC_ALL |
418 |
+ source "${EROOT}/etc/env.d/02locale" |
419 |
+ [ -n "${LANG}" ] && export LANG |
420 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
421 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
422 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
423 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
424 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
425 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
426 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
427 |
+ fi |
428 |
+ |
429 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
430 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
431 |
+ einfo |
432 |
+ einfo "Information on options that can be passed to initdb are found at:" |
433 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
434 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
435 |
+ einfo |
436 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
437 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
438 |
+ einfo " (none)" |
439 |
+ else |
440 |
+ einfo " ${PG_INITDB_OPTS}" |
441 |
+ fi |
442 |
+ einfo |
443 |
+ einfo "Configuration files will be installed to:" |
444 |
+ einfo " ${PGDATA}" |
445 |
+ einfo |
446 |
+ einfo "The database cluster will be created in:" |
447 |
+ einfo " ${DATA_DIR}" |
448 |
+ einfo |
449 |
+ |
450 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
451 |
+ sleep 5 |
452 |
+ eend 0 |
453 |
+ |
454 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
455 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
456 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
457 |
+ die "${DATA_DIR} is not empty." |
458 |
+ fi |
459 |
+ |
460 |
+ einfo "Creating the data directory ..." |
461 |
+ if [[ ${EUID} == 0 ]] ; then |
462 |
+ mkdir -p "${DATA_DIR}" |
463 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
464 |
+ chmod 0700 "${DATA_DIR}" |
465 |
+ fi |
466 |
+ |
467 |
+ einfo "Initializing the database ..." |
468 |
+ |
469 |
+ if [[ ${EUID} == 0 ]] ; then |
470 |
+ su postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
471 |
+ else |
472 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
473 |
+ fi |
474 |
+ |
475 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
476 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
477 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
478 |
+ fi |
479 |
+ |
480 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
481 |
+ # overridden in the initscript |
482 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
483 |
+ |
484 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
485 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
486 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
487 |
+ # characters in PL/Perl |
488 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
489 |
+ EOF |
490 |
+ |
491 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
492 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
493 |
+ einfo "by default. You can disable it in the cluster's:" |
494 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
495 |
+ einfo |
496 |
+ if ! use systemd; then |
497 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
498 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
499 |
+ einfo |
500 |
+ fi |
501 |
+ if use prefix ; then |
502 |
+ einfo "The location of the configuration files have moved to:" |
503 |
+ einfo " ${PGDATA}" |
504 |
+ einfo "To start the server:" |
505 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
506 |
+ einfo "To stop:" |
507 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
508 |
+ einfo |
509 |
+ einfo "Or move the configuration files back:" |
510 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
511 |
+ elif use systemd; then |
512 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
513 |
+ einfo "instead of 'pg_ctl'." |
514 |
+ else |
515 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
516 |
+ einfo "instead of 'pg_ctl'." |
517 |
+ fi |
518 |
+} |
519 |
+ |
520 |
+src_test() { |
521 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
522 |
+ emake check |
523 |
+ |
524 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
525 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
526 |
+ else |
527 |
+ use server || \ |
528 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
529 |
+ [[ ${UID} -eq 0 ]] || \ |
530 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
531 |
+ |
532 |
+ ewarn 'Skipping.' |
533 |
+ fi |
534 |
+} |
535 |
|
536 |
diff --git a/dev-db/postgresql/postgresql-11.7.ebuild b/dev-db/postgresql/postgresql-11.7.ebuild |
537 |
new file mode 100644 |
538 |
index 00000000000..6b5733b5761 |
539 |
--- /dev/null |
540 |
+++ b/dev-db/postgresql/postgresql-11.7.ebuild |
541 |
@@ -0,0 +1,468 @@ |
542 |
+# Copyright 1999-2020 Gentoo Authors |
543 |
+# Distributed under the terms of the GNU General Public License v2 |
544 |
+ |
545 |
+EAPI=7 |
546 |
+ |
547 |
+PYTHON_COMPAT=( python3_{6,7} ) |
548 |
+ |
549 |
+PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
550 |
+ zh_TW" |
551 |
+ |
552 |
+inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
553 |
+ systemd user |
554 |
+ |
555 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
556 |
+ |
557 |
+SLOT=$(ver_cut 1) |
558 |
+ |
559 |
+MY_PV=${PV/_/} |
560 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
561 |
+ |
562 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
563 |
+ |
564 |
+LICENSE="POSTGRESQL GPL-2" |
565 |
+DESCRIPTION="PostgreSQL RDBMS" |
566 |
+HOMEPAGE="http://www.postgresql.org/" |
567 |
+ |
568 |
+IUSE="debug doc icu kerberos kernel_linux ldap libressl llvm nls pam |
569 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
570 |
+ threads uuid xml zlib" |
571 |
+ |
572 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
573 |
+ |
574 |
+CDEPEND=" |
575 |
+>=app-eselect/eselect-postgresql-2.0 |
576 |
+sys-apps/less |
577 |
+virtual/libintl |
578 |
+icu? ( dev-libs/icu:= ) |
579 |
+kerberos? ( virtual/krb5 ) |
580 |
+ldap? ( net-nds/openldap ) |
581 |
+llvm? ( |
582 |
+ sys-devel/llvm:= |
583 |
+ sys-devel/clang:= |
584 |
+) |
585 |
+pam? ( sys-libs/pam ) |
586 |
+perl? ( >=dev-lang/perl-5.8:= ) |
587 |
+python? ( ${PYTHON_DEPS} ) |
588 |
+readline? ( sys-libs/readline:0= ) |
589 |
+server? ( systemd? ( sys-apps/systemd ) ) |
590 |
+ssl? ( |
591 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
592 |
+ libressl? ( dev-libs/libressl:= ) |
593 |
+) |
594 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
595 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
596 |
+zlib? ( sys-libs/zlib ) |
597 |
+" |
598 |
+ |
599 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
600 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
601 |
+# the libc includes UUID functions. |
602 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
603 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
604 |
+ |
605 |
+nest_usedep() { |
606 |
+ local front back |
607 |
+ while [[ ${#} -gt 1 ]]; do |
608 |
+ front+="${1}? ( " |
609 |
+ back+=" )" |
610 |
+ shift |
611 |
+ done |
612 |
+ echo "${front}${1}${back}" |
613 |
+} |
614 |
+ |
615 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
616 |
+CDEPEND+=" |
617 |
+uuid? ( |
618 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
619 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
620 |
+)" |
621 |
+ |
622 |
+DEPEND="${CDEPEND} |
623 |
+!!<sys-apps/sandbox-2.0 |
624 |
+sys-devel/bison |
625 |
+sys-devel/flex |
626 |
+nls? ( sys-devel/gettext ) |
627 |
+xml? ( virtual/pkgconfig ) |
628 |
+" |
629 |
+ |
630 |
+RDEPEND="${CDEPEND} |
631 |
+!dev-db/postgresql-docs:${SLOT} |
632 |
+!dev-db/postgresql-base:${SLOT} |
633 |
+!dev-db/postgresql-server:${SLOT} |
634 |
+selinux? ( sec-policy/selinux-postgresql ) |
635 |
+" |
636 |
+ |
637 |
+pkg_setup() { |
638 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
639 |
+ |
640 |
+ enewgroup postgres 70 |
641 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
642 |
+ |
643 |
+ use python && python-single-r1_pkg_setup |
644 |
+} |
645 |
+ |
646 |
+src_prepare() { |
647 |
+ # Set proper run directory |
648 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
649 |
+ -i src/include/pg_config_manual.h || die |
650 |
+ |
651 |
+ # Rely on $PATH being in the proper order so that the correct |
652 |
+ # install program is used for modules utilizing PGXS in both |
653 |
+ # hardened and non-hardened environments. (Bug #528786) |
654 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
655 |
+ |
656 |
+ use server || eapply "${FILESDIR}/${PN}-11_beta1-no-server.patch" |
657 |
+ |
658 |
+ if use pam ; then |
659 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
660 |
+ -i src/backend/libpq/auth.c || \ |
661 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
662 |
+ fi |
663 |
+ |
664 |
+ eapply_user |
665 |
+} |
666 |
+ |
667 |
+src_configure() { |
668 |
+ case ${CHOST} in |
669 |
+ *-darwin*|*-solaris*) |
670 |
+ use nls && append-libs intl |
671 |
+ ;; |
672 |
+ esac |
673 |
+ |
674 |
+ export LDFLAGS_SL="${LDFLAGS}" |
675 |
+ export LDFLAGS_EX="${LDFLAGS}" |
676 |
+ |
677 |
+ local PO="${EPREFIX}" |
678 |
+ |
679 |
+ local i uuid_config="" |
680 |
+ if use uuid; then |
681 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
682 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
683 |
+ done |
684 |
+ for i in ${BSD_LIBC[@]}; do |
685 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
686 |
+ done |
687 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
688 |
+ fi |
689 |
+ |
690 |
+ econf \ |
691 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
692 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
693 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
694 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
695 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
696 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
697 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
698 |
+ $(use_enable !alpha spinlocks) \ |
699 |
+ $(use_enable debug) \ |
700 |
+ $(use_enable threads thread-safety) \ |
701 |
+ $(use_with icu) \ |
702 |
+ $(use_with kerberos gssapi) \ |
703 |
+ $(use_with ldap) \ |
704 |
+ $(use_with llvm) \ |
705 |
+ $(use_with pam) \ |
706 |
+ $(use_with perl) \ |
707 |
+ $(use_with python) \ |
708 |
+ $(use_with readline) \ |
709 |
+ $(use_with ssl openssl) \ |
710 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
711 |
+ $(use_with tcl) \ |
712 |
+ ${uuid_config} \ |
713 |
+ $(use_with xml libxml) \ |
714 |
+ $(use_with xml libxslt) \ |
715 |
+ $(use_with zlib) \ |
716 |
+ $(use_enable nls nls "'$(l10n_get_locales)'") |
717 |
+} |
718 |
+ |
719 |
+src_compile() { |
720 |
+ emake |
721 |
+ emake -C contrib |
722 |
+} |
723 |
+ |
724 |
+src_install() { |
725 |
+ emake DESTDIR="${D}" install |
726 |
+ emake DESTDIR="${D}" install -C contrib |
727 |
+ |
728 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
729 |
+ |
730 |
+ # man pages are already built, but if we have the target make them, |
731 |
+ # they'll be generated from source before being installed so we |
732 |
+ # manually install man pages. |
733 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
734 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
735 |
+ doins -r doc/src/sgml/man{1,3,7} |
736 |
+ if ! use server; then |
737 |
+ # Remove man pages for non-existent binaries |
738 |
+ serverman=( |
739 |
+ initdb |
740 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
741 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
742 |
+ post{gres,master} |
743 |
+ ) |
744 |
+ for m in ${serverman[@]} ; do |
745 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
746 |
+ done |
747 |
+ fi |
748 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
749 |
+ |
750 |
+ # Create slot specific man pages |
751 |
+ local bn f mansec slotted_name |
752 |
+ for mansec in 1 3 7 ; do |
753 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
754 |
+ |
755 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
756 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
757 |
+ |
758 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
759 |
+ bn=$(basename "${f}") |
760 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
761 |
+ case ${bn} in |
762 |
+ TABLE.7|WITH.7) |
763 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
764 |
+ ;; |
765 |
+ *) |
766 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
767 |
+ ;; |
768 |
+ esac |
769 |
+ done |
770 |
+ |
771 |
+ popd > /dev/null |
772 |
+ done |
773 |
+ |
774 |
+ insinto /etc/postgresql-${SLOT} |
775 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
776 |
+ |
777 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
778 |
+ # needed by extensions utilizing PGXS. |
779 |
+ use static-libs || \ |
780 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
781 |
+ -delete |
782 |
+ |
783 |
+ # Make slot specific links to programs |
784 |
+ local f bn |
785 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
786 |
+ -mindepth 1 -maxdepth 1) |
787 |
+ do |
788 |
+ bn=$(basename "${f}") |
789 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
790 |
+ "/usr/bin/${bn}${SLOT/.}" |
791 |
+ done |
792 |
+ |
793 |
+ if use doc ; then |
794 |
+ docinto html |
795 |
+ dodoc doc/src/sgml/html/* |
796 |
+ fi |
797 |
+ |
798 |
+ if use server; then |
799 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
800 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
801 |
+ |
802 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
803 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
804 |
+ |
805 |
+ if use systemd; then |
806 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
807 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
808 |
+ systemd_newunit - ${PN}-${SLOT}.service |
809 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
810 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
811 |
+ fi |
812 |
+ |
813 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
814 |
+ |
815 |
+ if use prefix ; then |
816 |
+ keepdir /run/postgresql |
817 |
+ fperms 1775 /run/postgresql |
818 |
+ fi |
819 |
+ fi |
820 |
+} |
821 |
+ |
822 |
+pkg_postinst() { |
823 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
824 |
+ postgresql-config update |
825 |
+ |
826 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
827 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
828 |
+ |
829 |
+ if use server ; then |
830 |
+ elog |
831 |
+ elog "Gentoo specific documentation:" |
832 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
833 |
+ elog |
834 |
+ elog "Official documentation:" |
835 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
836 |
+ elog |
837 |
+ elog "The default location of the Unix-domain socket is:" |
838 |
+ elog " ${EROOT}/run/postgresql/" |
839 |
+ elog |
840 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
841 |
+ elog "so that it contains your preferred locale in:" |
842 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
843 |
+ elog |
844 |
+ elog "Then, execute the following command to setup the initial database" |
845 |
+ elog "environment:" |
846 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
847 |
+ |
848 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
849 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
850 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
851 |
+ ewarn "the following command after upgrading:" |
852 |
+ ewarn |
853 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
854 |
+ fi |
855 |
+ fi |
856 |
+} |
857 |
+ |
858 |
+pkg_prerm() { |
859 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
860 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
861 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
862 |
+ |
863 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
864 |
+ sleep 10 |
865 |
+ eend 0 |
866 |
+ fi |
867 |
+} |
868 |
+ |
869 |
+pkg_postrm() { |
870 |
+ postgresql-config update |
871 |
+} |
872 |
+ |
873 |
+pkg_config() { |
874 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
875 |
+ |
876 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
877 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
878 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
879 |
+ [[ -z "${DATA_DIR}" ]] \ |
880 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
881 |
+ |
882 |
+ # environment.bz2 may not contain the same locale as the current system |
883 |
+ # locale. Unset and source from the current system locale. |
884 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
885 |
+ unset LANG |
886 |
+ unset LC_CTYPE |
887 |
+ unset LC_NUMERIC |
888 |
+ unset LC_TIME |
889 |
+ unset LC_COLLATE |
890 |
+ unset LC_MONETARY |
891 |
+ unset LC_MESSAGES |
892 |
+ unset LC_ALL |
893 |
+ source "${EROOT}/etc/env.d/02locale" |
894 |
+ [ -n "${LANG}" ] && export LANG |
895 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
896 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
897 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
898 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
899 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
900 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
901 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
902 |
+ fi |
903 |
+ |
904 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
905 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
906 |
+ einfo |
907 |
+ einfo "Information on options that can be passed to initdb are found at:" |
908 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
909 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
910 |
+ einfo |
911 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
912 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
913 |
+ einfo " (none)" |
914 |
+ else |
915 |
+ einfo " ${PG_INITDB_OPTS}" |
916 |
+ fi |
917 |
+ einfo |
918 |
+ einfo "Configuration files will be installed to:" |
919 |
+ einfo " ${PGDATA}" |
920 |
+ einfo |
921 |
+ einfo "The database cluster will be created in:" |
922 |
+ einfo " ${DATA_DIR}" |
923 |
+ einfo |
924 |
+ |
925 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
926 |
+ sleep 5 |
927 |
+ eend 0 |
928 |
+ |
929 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
930 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
931 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
932 |
+ die "${DATA_DIR} is not empty." |
933 |
+ fi |
934 |
+ |
935 |
+ einfo "Creating the data directory ..." |
936 |
+ if [[ ${EUID} == 0 ]] ; then |
937 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
938 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
939 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
940 |
+ fi |
941 |
+ |
942 |
+ einfo "Initializing the database ..." |
943 |
+ |
944 |
+ if [[ ${EUID} == 0 ]] ; then |
945 |
+ su postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
946 |
+ else |
947 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
948 |
+ fi |
949 |
+ |
950 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
951 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
952 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
953 |
+ fi |
954 |
+ |
955 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
956 |
+ # overridden in the initscript |
957 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
958 |
+ |
959 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
960 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
961 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
962 |
+ # characters in PL/Perl |
963 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
964 |
+ EOF |
965 |
+ |
966 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
967 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
968 |
+ einfo "by default. You can disable it in the cluster's:" |
969 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
970 |
+ einfo |
971 |
+ if ! use systemd; then |
972 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
973 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
974 |
+ einfo |
975 |
+ fi |
976 |
+ if use prefix ; then |
977 |
+ einfo "The location of the configuration files have moved to:" |
978 |
+ einfo " ${PGDATA}" |
979 |
+ einfo "To start the server:" |
980 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
981 |
+ einfo "To stop:" |
982 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
983 |
+ einfo |
984 |
+ einfo "Or move the configuration files back:" |
985 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
986 |
+ elif use systemd; then |
987 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
988 |
+ einfo "instead of 'pg_ctl'." |
989 |
+ else |
990 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
991 |
+ einfo "instead of 'pg_ctl'." |
992 |
+ fi |
993 |
+} |
994 |
+ |
995 |
+src_test() { |
996 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
997 |
+ emake check |
998 |
+ |
999 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
1000 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
1001 |
+ else |
1002 |
+ use server || \ |
1003 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1004 |
+ [[ ${UID} -eq 0 ]] || \ |
1005 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1006 |
+ |
1007 |
+ ewarn 'Skipping.' |
1008 |
+ fi |
1009 |
+} |
1010 |
|
1011 |
diff --git a/dev-db/postgresql/postgresql-12.2.ebuild b/dev-db/postgresql/postgresql-12.2.ebuild |
1012 |
new file mode 100644 |
1013 |
index 00000000000..6f655f7085e |
1014 |
--- /dev/null |
1015 |
+++ b/dev-db/postgresql/postgresql-12.2.ebuild |
1016 |
@@ -0,0 +1,468 @@ |
1017 |
+# Copyright 1999-2020 Gentoo Authors |
1018 |
+# Distributed under the terms of the GNU General Public License v2 |
1019 |
+ |
1020 |
+EAPI=7 |
1021 |
+ |
1022 |
+PYTHON_COMPAT=( python3_{6,7} ) |
1023 |
+ |
1024 |
+PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
1025 |
+ zh_TW" |
1026 |
+ |
1027 |
+inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
1028 |
+ systemd user |
1029 |
+ |
1030 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
1031 |
+ |
1032 |
+SLOT=$(ver_cut 1) |
1033 |
+ |
1034 |
+MY_PV=${PV/_/} |
1035 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
1036 |
+ |
1037 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
1038 |
+ |
1039 |
+LICENSE="POSTGRESQL GPL-2" |
1040 |
+DESCRIPTION="PostgreSQL RDBMS" |
1041 |
+HOMEPAGE="http://www.postgresql.org/" |
1042 |
+ |
1043 |
+IUSE="debug doc icu kerberos kernel_linux ldap libressl llvm nls pam |
1044 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
1045 |
+ threads uuid xml zlib" |
1046 |
+ |
1047 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
1048 |
+ |
1049 |
+CDEPEND=" |
1050 |
+>=app-eselect/eselect-postgresql-2.0 |
1051 |
+sys-apps/less |
1052 |
+virtual/libintl |
1053 |
+icu? ( dev-libs/icu:= ) |
1054 |
+kerberos? ( virtual/krb5 ) |
1055 |
+ldap? ( net-nds/openldap ) |
1056 |
+llvm? ( |
1057 |
+ sys-devel/llvm:= |
1058 |
+ sys-devel/clang:= |
1059 |
+) |
1060 |
+pam? ( sys-libs/pam ) |
1061 |
+perl? ( >=dev-lang/perl-5.8:= ) |
1062 |
+python? ( ${PYTHON_DEPS} ) |
1063 |
+readline? ( sys-libs/readline:0= ) |
1064 |
+server? ( systemd? ( sys-apps/systemd ) ) |
1065 |
+ssl? ( |
1066 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1067 |
+ libressl? ( dev-libs/libressl:= ) |
1068 |
+) |
1069 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
1070 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1071 |
+zlib? ( sys-libs/zlib ) |
1072 |
+" |
1073 |
+ |
1074 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1075 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1076 |
+# the libc includes UUID functions. |
1077 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1078 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1079 |
+ |
1080 |
+nest_usedep() { |
1081 |
+ local front back |
1082 |
+ while [[ ${#} -gt 1 ]]; do |
1083 |
+ front+="${1}? ( " |
1084 |
+ back+=" )" |
1085 |
+ shift |
1086 |
+ done |
1087 |
+ echo "${front}${1}${back}" |
1088 |
+} |
1089 |
+ |
1090 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1091 |
+CDEPEND+=" |
1092 |
+uuid? ( |
1093 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1094 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1095 |
+)" |
1096 |
+ |
1097 |
+DEPEND="${CDEPEND} |
1098 |
+!!<sys-apps/sandbox-2.0 |
1099 |
+sys-devel/bison |
1100 |
+sys-devel/flex |
1101 |
+nls? ( sys-devel/gettext ) |
1102 |
+xml? ( virtual/pkgconfig ) |
1103 |
+" |
1104 |
+ |
1105 |
+RDEPEND="${CDEPEND} |
1106 |
+!dev-db/postgresql-docs:${SLOT} |
1107 |
+!dev-db/postgresql-base:${SLOT} |
1108 |
+!dev-db/postgresql-server:${SLOT} |
1109 |
+selinux? ( sec-policy/selinux-postgresql ) |
1110 |
+" |
1111 |
+ |
1112 |
+pkg_setup() { |
1113 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1114 |
+ |
1115 |
+ enewgroup postgres 70 |
1116 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1117 |
+ |
1118 |
+ use python && python-single-r1_pkg_setup |
1119 |
+} |
1120 |
+ |
1121 |
+src_prepare() { |
1122 |
+ # Set proper run directory |
1123 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1124 |
+ -i src/include/pg_config_manual.h || die |
1125 |
+ |
1126 |
+ # Rely on $PATH being in the proper order so that the correct |
1127 |
+ # install program is used for modules utilizing PGXS in both |
1128 |
+ # hardened and non-hardened environments. (Bug #528786) |
1129 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1130 |
+ |
1131 |
+ use server || eapply "${FILESDIR}/${PN}-12.1-no-server.patch" |
1132 |
+ |
1133 |
+ if use pam ; then |
1134 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1135 |
+ -i src/backend/libpq/auth.c || \ |
1136 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
1137 |
+ fi |
1138 |
+ |
1139 |
+ eapply_user |
1140 |
+} |
1141 |
+ |
1142 |
+src_configure() { |
1143 |
+ case ${CHOST} in |
1144 |
+ *-darwin*|*-solaris*) |
1145 |
+ use nls && append-libs intl |
1146 |
+ ;; |
1147 |
+ esac |
1148 |
+ |
1149 |
+ export LDFLAGS_SL="${LDFLAGS}" |
1150 |
+ export LDFLAGS_EX="${LDFLAGS}" |
1151 |
+ |
1152 |
+ local PO="${EPREFIX}" |
1153 |
+ |
1154 |
+ local i uuid_config="" |
1155 |
+ if use uuid; then |
1156 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1157 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1158 |
+ done |
1159 |
+ for i in ${BSD_LIBC[@]}; do |
1160 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
1161 |
+ done |
1162 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1163 |
+ fi |
1164 |
+ |
1165 |
+ econf \ |
1166 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1167 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1168 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
1169 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1170 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1171 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1172 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1173 |
+ $(use_enable !alpha spinlocks) \ |
1174 |
+ $(use_enable debug) \ |
1175 |
+ $(use_enable threads thread-safety) \ |
1176 |
+ $(use_with icu) \ |
1177 |
+ $(use_with kerberos gssapi) \ |
1178 |
+ $(use_with ldap) \ |
1179 |
+ $(use_with llvm) \ |
1180 |
+ $(use_with pam) \ |
1181 |
+ $(use_with perl) \ |
1182 |
+ $(use_with python) \ |
1183 |
+ $(use_with readline) \ |
1184 |
+ $(use_with ssl openssl) \ |
1185 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
1186 |
+ $(use_with tcl) \ |
1187 |
+ ${uuid_config} \ |
1188 |
+ $(use_with xml libxml) \ |
1189 |
+ $(use_with xml libxslt) \ |
1190 |
+ $(use_with zlib) \ |
1191 |
+ $(use_enable nls nls "'$(l10n_get_locales)'") |
1192 |
+} |
1193 |
+ |
1194 |
+src_compile() { |
1195 |
+ emake |
1196 |
+ emake -C contrib |
1197 |
+} |
1198 |
+ |
1199 |
+src_install() { |
1200 |
+ emake DESTDIR="${D}" install |
1201 |
+ emake DESTDIR="${D}" install -C contrib |
1202 |
+ |
1203 |
+ dodoc README HISTORY |
1204 |
+ |
1205 |
+ # man pages are already built, but if we have the target make them, |
1206 |
+ # they'll be generated from source before being installed so we |
1207 |
+ # manually install man pages. |
1208 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1209 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1210 |
+ doins -r doc/src/sgml/man{1,3,7} |
1211 |
+ if ! use server; then |
1212 |
+ # Remove man pages for non-existent binaries |
1213 |
+ serverman=( |
1214 |
+ initdb |
1215 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
1216 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
1217 |
+ post{gres,master} |
1218 |
+ ) |
1219 |
+ for m in ${serverman[@]} ; do |
1220 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1221 |
+ done |
1222 |
+ fi |
1223 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1224 |
+ |
1225 |
+ # Create slot specific man pages |
1226 |
+ local bn f mansec slotted_name |
1227 |
+ for mansec in 1 3 7 ; do |
1228 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
1229 |
+ |
1230 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
1231 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
1232 |
+ |
1233 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
1234 |
+ bn=$(basename "${f}") |
1235 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
1236 |
+ case ${bn} in |
1237 |
+ TABLE.7|WITH.7) |
1238 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
1239 |
+ ;; |
1240 |
+ *) |
1241 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
1242 |
+ ;; |
1243 |
+ esac |
1244 |
+ done |
1245 |
+ |
1246 |
+ popd > /dev/null |
1247 |
+ done |
1248 |
+ |
1249 |
+ insinto /etc/postgresql-${SLOT} |
1250 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
1251 |
+ |
1252 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
1253 |
+ # needed by extensions utilizing PGXS. |
1254 |
+ use static-libs || \ |
1255 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
1256 |
+ -delete |
1257 |
+ |
1258 |
+ # Make slot specific links to programs |
1259 |
+ local f bn |
1260 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1261 |
+ -mindepth 1 -maxdepth 1) |
1262 |
+ do |
1263 |
+ bn=$(basename "${f}") |
1264 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1265 |
+ "/usr/bin/${bn}${SLOT/.}" |
1266 |
+ done |
1267 |
+ |
1268 |
+ if use doc ; then |
1269 |
+ docinto html |
1270 |
+ dodoc doc/src/sgml/html/* |
1271 |
+ fi |
1272 |
+ |
1273 |
+ if use server; then |
1274 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1275 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1276 |
+ |
1277 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1278 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1279 |
+ |
1280 |
+ if use systemd; then |
1281 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1282 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
1283 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1284 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1285 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
1286 |
+ fi |
1287 |
+ |
1288 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1289 |
+ |
1290 |
+ if use prefix ; then |
1291 |
+ keepdir /run/postgresql |
1292 |
+ fperms 1775 /run/postgresql |
1293 |
+ fi |
1294 |
+ fi |
1295 |
+} |
1296 |
+ |
1297 |
+pkg_postinst() { |
1298 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
1299 |
+ postgresql-config update |
1300 |
+ |
1301 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
1302 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
1303 |
+ |
1304 |
+ if use server ; then |
1305 |
+ elog |
1306 |
+ elog "Gentoo specific documentation:" |
1307 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1308 |
+ elog |
1309 |
+ elog "Official documentation:" |
1310 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1311 |
+ elog |
1312 |
+ elog "The default location of the Unix-domain socket is:" |
1313 |
+ elog " ${EROOT}/run/postgresql/" |
1314 |
+ elog |
1315 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1316 |
+ elog "so that it contains your preferred locale in:" |
1317 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1318 |
+ elog |
1319 |
+ elog "Then, execute the following command to setup the initial database" |
1320 |
+ elog "environment:" |
1321 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1322 |
+ |
1323 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
1324 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
1325 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
1326 |
+ ewarn "the following command after upgrading:" |
1327 |
+ ewarn |
1328 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
1329 |
+ fi |
1330 |
+ fi |
1331 |
+} |
1332 |
+ |
1333 |
+pkg_prerm() { |
1334 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1335 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1336 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1337 |
+ |
1338 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1339 |
+ sleep 10 |
1340 |
+ eend 0 |
1341 |
+ fi |
1342 |
+} |
1343 |
+ |
1344 |
+pkg_postrm() { |
1345 |
+ postgresql-config update |
1346 |
+} |
1347 |
+ |
1348 |
+pkg_config() { |
1349 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1350 |
+ |
1351 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1352 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1353 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
1354 |
+ [[ -z "${DATA_DIR}" ]] \ |
1355 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
1356 |
+ |
1357 |
+ # environment.bz2 may not contain the same locale as the current system |
1358 |
+ # locale. Unset and source from the current system locale. |
1359 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
1360 |
+ unset LANG |
1361 |
+ unset LC_CTYPE |
1362 |
+ unset LC_NUMERIC |
1363 |
+ unset LC_TIME |
1364 |
+ unset LC_COLLATE |
1365 |
+ unset LC_MONETARY |
1366 |
+ unset LC_MESSAGES |
1367 |
+ unset LC_ALL |
1368 |
+ source "${EROOT}/etc/env.d/02locale" |
1369 |
+ [ -n "${LANG}" ] && export LANG |
1370 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1371 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1372 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
1373 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1374 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1375 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1376 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
1377 |
+ fi |
1378 |
+ |
1379 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
1380 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1381 |
+ einfo |
1382 |
+ einfo "Information on options that can be passed to initdb are found at:" |
1383 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1384 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1385 |
+ einfo |
1386 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
1387 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1388 |
+ einfo " (none)" |
1389 |
+ else |
1390 |
+ einfo " ${PG_INITDB_OPTS}" |
1391 |
+ fi |
1392 |
+ einfo |
1393 |
+ einfo "Configuration files will be installed to:" |
1394 |
+ einfo " ${PGDATA}" |
1395 |
+ einfo |
1396 |
+ einfo "The database cluster will be created in:" |
1397 |
+ einfo " ${DATA_DIR}" |
1398 |
+ einfo |
1399 |
+ |
1400 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1401 |
+ sleep 5 |
1402 |
+ eend 0 |
1403 |
+ |
1404 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1405 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
1406 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
1407 |
+ die "${DATA_DIR} is not empty." |
1408 |
+ fi |
1409 |
+ |
1410 |
+ einfo "Creating the data directory ..." |
1411 |
+ if [[ ${EUID} == 0 ]] ; then |
1412 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
1413 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
1414 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
1415 |
+ fi |
1416 |
+ |
1417 |
+ einfo "Initializing the database ..." |
1418 |
+ |
1419 |
+ if [[ ${EUID} == 0 ]] ; then |
1420 |
+ su postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1421 |
+ else |
1422 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1423 |
+ fi |
1424 |
+ |
1425 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1426 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1427 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1428 |
+ fi |
1429 |
+ |
1430 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
1431 |
+ # overridden in the initscript |
1432 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1433 |
+ |
1434 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1435 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1436 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
1437 |
+ # characters in PL/Perl |
1438 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1439 |
+ EOF |
1440 |
+ |
1441 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1442 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1443 |
+ einfo "by default. You can disable it in the cluster's:" |
1444 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
1445 |
+ einfo |
1446 |
+ if ! use systemd; then |
1447 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
1448 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
1449 |
+ einfo |
1450 |
+ fi |
1451 |
+ if use prefix ; then |
1452 |
+ einfo "The location of the configuration files have moved to:" |
1453 |
+ einfo " ${PGDATA}" |
1454 |
+ einfo "To start the server:" |
1455 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1456 |
+ einfo "To stop:" |
1457 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
1458 |
+ einfo |
1459 |
+ einfo "Or move the configuration files back:" |
1460 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1461 |
+ elif use systemd; then |
1462 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
1463 |
+ einfo "instead of 'pg_ctl'." |
1464 |
+ else |
1465 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1466 |
+ einfo "instead of 'pg_ctl'." |
1467 |
+ fi |
1468 |
+} |
1469 |
+ |
1470 |
+src_test() { |
1471 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1472 |
+ emake check |
1473 |
+ |
1474 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
1475 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
1476 |
+ else |
1477 |
+ use server || \ |
1478 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1479 |
+ [[ ${UID} -eq 0 ]] || \ |
1480 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1481 |
+ |
1482 |
+ ewarn 'Skipping.' |
1483 |
+ fi |
1484 |
+} |
1485 |
|
1486 |
diff --git a/dev-db/postgresql/postgresql-9.4.26.ebuild b/dev-db/postgresql/postgresql-9.4.26.ebuild |
1487 |
new file mode 100644 |
1488 |
index 00000000000..edf5af70b27 |
1489 |
--- /dev/null |
1490 |
+++ b/dev-db/postgresql/postgresql-9.4.26.ebuild |
1491 |
@@ -0,0 +1,480 @@ |
1492 |
+# Copyright 1999-2020 Gentoo Authors |
1493 |
+# Distributed under the terms of the GNU General Public License v2 |
1494 |
+ |
1495 |
+EAPI=7 |
1496 |
+ |
1497 |
+PYTHON_COMPAT=( python3_{6,7} ) |
1498 |
+ |
1499 |
+PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
1500 |
+ zh_TW" |
1501 |
+ |
1502 |
+inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
1503 |
+ systemd user |
1504 |
+ |
1505 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-macos ~x86-solaris" |
1506 |
+ |
1507 |
+SLOT=$(ver_cut 1-2) |
1508 |
+ |
1509 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${PV}/postgresql-${PV}.tar.bz2" |
1510 |
+ |
1511 |
+LICENSE="POSTGRESQL GPL-2" |
1512 |
+DESCRIPTION="PostgreSQL RDBMS" |
1513 |
+HOMEPAGE="https://www.postgresql.org/" |
1514 |
+ |
1515 |
+IUSE="debug doc kerberos kernel_linux ldap libressl nls pam perl |
1516 |
+ -pg_legacytimestamp python +readline selinux +server systemd ssl |
1517 |
+ static-libs tcl threads uuid xml zlib" |
1518 |
+ |
1519 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
1520 |
+ |
1521 |
+CDEPEND=" |
1522 |
+>=app-eselect/eselect-postgresql-2.0 |
1523 |
+sys-apps/less |
1524 |
+virtual/libintl |
1525 |
+kerberos? ( virtual/krb5 ) |
1526 |
+ldap? ( net-nds/openldap ) |
1527 |
+pam? ( sys-libs/pam ) |
1528 |
+perl? ( >=dev-lang/perl-5.8:= ) |
1529 |
+python? ( ${PYTHON_DEPS} ) |
1530 |
+readline? ( sys-libs/readline:0= ) |
1531 |
+ssl? ( |
1532 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1533 |
+ libressl? ( dev-libs/libressl:= ) |
1534 |
+) |
1535 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
1536 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1537 |
+zlib? ( sys-libs/zlib ) |
1538 |
+" |
1539 |
+ |
1540 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1541 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1542 |
+# the libc includes UUID functions. |
1543 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1544 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1545 |
+ |
1546 |
+nest_usedep() { |
1547 |
+ local front back |
1548 |
+ while [[ ${#} -gt 1 ]]; do |
1549 |
+ front+="${1}? ( " |
1550 |
+ back+=" )" |
1551 |
+ shift |
1552 |
+ done |
1553 |
+ echo "${front}${1}${back}" |
1554 |
+} |
1555 |
+ |
1556 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1557 |
+CDEPEND+=" |
1558 |
+uuid? ( |
1559 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1560 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1561 |
+)" |
1562 |
+ |
1563 |
+DEPEND="${CDEPEND} |
1564 |
+!!<sys-apps/sandbox-2.0 |
1565 |
+sys-devel/bison |
1566 |
+sys-devel/flex |
1567 |
+nls? ( sys-devel/gettext ) |
1568 |
+xml? ( virtual/pkgconfig ) |
1569 |
+" |
1570 |
+ |
1571 |
+RDEPEND="${CDEPEND} |
1572 |
+!dev-db/postgresql-docs:${SLOT} |
1573 |
+!dev-db/postgresql-base:${SLOT} |
1574 |
+!dev-db/postgresql-server:${SLOT} |
1575 |
+selinux? ( sec-policy/selinux-postgresql ) |
1576 |
+" |
1577 |
+ |
1578 |
+pkg_setup() { |
1579 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1580 |
+ |
1581 |
+ enewgroup postgres 70 |
1582 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1583 |
+ |
1584 |
+ use python && python-single-r1_pkg_setup |
1585 |
+} |
1586 |
+ |
1587 |
+src_prepare() { |
1588 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
1589 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
1590 |
+ |
1591 |
+ # Set proper run directory |
1592 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1593 |
+ -i src/include/pg_config_manual.h || die |
1594 |
+ |
1595 |
+ # Rely on $PATH being in the proper order so that the correct |
1596 |
+ # install program is used for modules utilizing PGXS in both |
1597 |
+ # hardened and non-hardened environments. (Bug #528786) |
1598 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1599 |
+ |
1600 |
+ use server || eapply "${FILESDIR}/${PN}-9.4.10-no-server.patch" |
1601 |
+ |
1602 |
+ if use pam ; then |
1603 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1604 |
+ -i src/backend/libpq/auth.c || \ |
1605 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
1606 |
+ fi |
1607 |
+ |
1608 |
+ eapply_user |
1609 |
+} |
1610 |
+ |
1611 |
+src_configure() { |
1612 |
+ case ${CHOST} in |
1613 |
+ *-darwin*|*-solaris*) |
1614 |
+ use nls && append-libs intl |
1615 |
+ ;; |
1616 |
+ esac |
1617 |
+ |
1618 |
+ export LDFLAGS_SL="${LDFLAGS}" |
1619 |
+ export LDFLAGS_EX="${LDFLAGS}" |
1620 |
+ |
1621 |
+ local PO="${EPREFIX}" |
1622 |
+ |
1623 |
+ local i uuid_config="" |
1624 |
+ if use uuid; then |
1625 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1626 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1627 |
+ done |
1628 |
+ for i in ${BSD_LIBC[@]}; do |
1629 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
1630 |
+ done |
1631 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1632 |
+ fi |
1633 |
+ |
1634 |
+ econf \ |
1635 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1636 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1637 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
1638 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1639 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1640 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1641 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1642 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
1643 |
+ $(use_enable debug) \ |
1644 |
+ $(use_enable threads thread-safety) \ |
1645 |
+ $(use_with kerberos gssapi) \ |
1646 |
+ $(use_with ldap) \ |
1647 |
+ $(use_with pam) \ |
1648 |
+ $(use_with perl) \ |
1649 |
+ $(use_with python) \ |
1650 |
+ $(use_with readline) \ |
1651 |
+ $(use_with ssl openssl) \ |
1652 |
+ $(use_with tcl) \ |
1653 |
+ ${uuid_config} \ |
1654 |
+ $(use_with xml libxml) \ |
1655 |
+ $(use_with xml libxslt) \ |
1656 |
+ $(use_with zlib) \ |
1657 |
+ $(use_enable nls nls "'$(l10n_get_locales)'") |
1658 |
+} |
1659 |
+ |
1660 |
+src_compile() { |
1661 |
+ emake |
1662 |
+ emake -C contrib |
1663 |
+} |
1664 |
+ |
1665 |
+src_install() { |
1666 |
+ emake DESTDIR="${D}" install |
1667 |
+ emake DESTDIR="${D}" install -C contrib |
1668 |
+ |
1669 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
1670 |
+ |
1671 |
+ # man pages are already built, but if we have the target make them, |
1672 |
+ # they'll be generated from source before being installed so we |
1673 |
+ # manually install man pages. |
1674 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1675 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1676 |
+ doins -r doc/src/sgml/man{1,3,7} |
1677 |
+ if ! use server; then |
1678 |
+ # Remove man pages for non-existent binaries |
1679 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1680 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1681 |
+ done |
1682 |
+ fi |
1683 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1684 |
+ |
1685 |
+ # Create slot specific man pages |
1686 |
+ local bn f mansec slotted_name |
1687 |
+ for mansec in 1 3 7 ; do |
1688 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
1689 |
+ |
1690 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
1691 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
1692 |
+ |
1693 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
1694 |
+ bn=$(basename "${f}") |
1695 |
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec} |
1696 |
+ case ${bn} in |
1697 |
+ TABLE.7|WITH.7) |
1698 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
1699 |
+ ;; |
1700 |
+ *) |
1701 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
1702 |
+ ;; |
1703 |
+ esac |
1704 |
+ done |
1705 |
+ |
1706 |
+ popd > /dev/null |
1707 |
+ done |
1708 |
+ |
1709 |
+ insinto /etc/postgresql-${SLOT} |
1710 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
1711 |
+ |
1712 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
1713 |
+ # needed by extensions utilizing PGXS. |
1714 |
+ use static-libs || \ |
1715 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
1716 |
+ -delete |
1717 |
+ |
1718 |
+ local f bn |
1719 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1720 |
+ -mindepth 1 -maxdepth 1) |
1721 |
+ do |
1722 |
+ bn=$(basename "${f}") |
1723 |
+ # Temporarily tack on tmp to workaround a file collision |
1724 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
1725 |
+ # had this issue. |
1726 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1727 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
1728 |
+ done |
1729 |
+ |
1730 |
+ if use doc ; then |
1731 |
+ docinto html |
1732 |
+ dodoc doc/src/sgml/html/* |
1733 |
+ |
1734 |
+ docinto sgml |
1735 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
1736 |
+ fi |
1737 |
+ |
1738 |
+ if use server; then |
1739 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1740 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1741 |
+ |
1742 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1743 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1744 |
+ |
1745 |
+ if use systemd; then |
1746 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1747 |
+ "${FILESDIR}/${PN}.service-9.2" | \ |
1748 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1749 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
1750 |
+ fi |
1751 |
+ |
1752 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1753 |
+ |
1754 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1755 |
+ |
1756 |
+ if use prefix ; then |
1757 |
+ keepdir /run/postgresql |
1758 |
+ fperms 1775 /run/postgresql |
1759 |
+ fi |
1760 |
+ fi |
1761 |
+} |
1762 |
+ |
1763 |
+pkg_preinst() { |
1764 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
1765 |
+ # /usr/bin/psql96). They may have been created by the |
1766 |
+ # postgresql.eselect module, but they're handled within this ebuild |
1767 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
1768 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
1769 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
1770 |
+ # handled in this manner. |
1771 |
+ local canonicalise |
1772 |
+ if type -p realpath > /dev/null; then |
1773 |
+ canonicalise=realpath |
1774 |
+ elif type -p readlink > /dev/null; then |
1775 |
+ canonicalise='readlink -f' |
1776 |
+ else |
1777 |
+ # can't die, subshell |
1778 |
+ die "No readlink nor realpath found, cannot canonicalise" |
1779 |
+ fi |
1780 |
+ |
1781 |
+ local l |
1782 |
+ # First remove any symlinks in /usr/bin that may have been created |
1783 |
+ # by the old eselect |
1784 |
+ for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
1785 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
1786 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
1787 |
+ fi |
1788 |
+ done |
1789 |
+ |
1790 |
+ # Then move the symlinks created by the ebuild to their proper place. |
1791 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
1792 |
+ mv "${l}" "${l%tmp}" \ |
1793 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
1794 |
+ done |
1795 |
+} |
1796 |
+ |
1797 |
+pkg_postinst() { |
1798 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
1799 |
+ postgresql-config update |
1800 |
+ |
1801 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
1802 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
1803 |
+ |
1804 |
+ if use server ; then |
1805 |
+ elog |
1806 |
+ elog "Gentoo specific documentation:" |
1807 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1808 |
+ elog |
1809 |
+ elog "Official documentation:" |
1810 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
1811 |
+ elog |
1812 |
+ elog "The default location of the Unix-domain socket is:" |
1813 |
+ elog " ${EROOT}/run/postgresql/" |
1814 |
+ elog |
1815 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1816 |
+ elog "so that it contains your preferred locale in:" |
1817 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1818 |
+ elog |
1819 |
+ elog "Then, execute the following command to setup the initial database" |
1820 |
+ elog "environment:" |
1821 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1822 |
+ fi |
1823 |
+} |
1824 |
+ |
1825 |
+pkg_prerm() { |
1826 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1827 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1828 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1829 |
+ |
1830 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1831 |
+ sleep 10 |
1832 |
+ eend 0 |
1833 |
+ fi |
1834 |
+} |
1835 |
+ |
1836 |
+pkg_postrm() { |
1837 |
+ postgresql-config update |
1838 |
+} |
1839 |
+ |
1840 |
+pkg_config() { |
1841 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1842 |
+ |
1843 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1844 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1845 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
1846 |
+ [[ -z "${DATA_DIR}" ]] \ |
1847 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
1848 |
+ |
1849 |
+ # environment.bz2 may not contain the same locale as the current system |
1850 |
+ # locale. Unset and source from the current system locale. |
1851 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
1852 |
+ unset LANG |
1853 |
+ unset LC_CTYPE |
1854 |
+ unset LC_NUMERIC |
1855 |
+ unset LC_TIME |
1856 |
+ unset LC_COLLATE |
1857 |
+ unset LC_MONETARY |
1858 |
+ unset LC_MESSAGES |
1859 |
+ unset LC_ALL |
1860 |
+ source "${EROOT}/etc/env.d/02locale" |
1861 |
+ [ -n "${LANG}" ] && export LANG |
1862 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1863 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1864 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
1865 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1866 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1867 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1868 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
1869 |
+ fi |
1870 |
+ |
1871 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
1872 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1873 |
+ einfo |
1874 |
+ einfo "Information on options that can be passed to initdb are found at:" |
1875 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1876 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1877 |
+ einfo |
1878 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
1879 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1880 |
+ einfo " (none)" |
1881 |
+ else |
1882 |
+ einfo " ${PG_INITDB_OPTS}" |
1883 |
+ fi |
1884 |
+ einfo |
1885 |
+ einfo "Configuration files will be installed to:" |
1886 |
+ einfo " ${PGDATA}" |
1887 |
+ einfo |
1888 |
+ einfo "The database cluster will be created in:" |
1889 |
+ einfo " ${DATA_DIR}" |
1890 |
+ einfo |
1891 |
+ |
1892 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1893 |
+ sleep 5 |
1894 |
+ eend 0 |
1895 |
+ |
1896 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1897 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
1898 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
1899 |
+ die "${DATA_DIR} is not empty." |
1900 |
+ fi |
1901 |
+ |
1902 |
+ einfo "Creating the data directory ..." |
1903 |
+ if [[ ${EUID} == 0 ]] ; then |
1904 |
+ mkdir -p "${DATA_DIR}" |
1905 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
1906 |
+ chmod 0700 "${DATA_DIR}" |
1907 |
+ fi |
1908 |
+ |
1909 |
+ einfo "Initializing the database ..." |
1910 |
+ |
1911 |
+ if [[ ${EUID} == 0 ]] ; then |
1912 |
+ su postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1913 |
+ else |
1914 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1915 |
+ fi |
1916 |
+ |
1917 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1918 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1919 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1920 |
+ fi |
1921 |
+ |
1922 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
1923 |
+ # overridden in the initscript |
1924 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1925 |
+ |
1926 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1927 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1928 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
1929 |
+ # characters in PL/Perl |
1930 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1931 |
+ EOF |
1932 |
+ |
1933 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1934 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1935 |
+ einfo "by default. You can disable it in the cluster's:" |
1936 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
1937 |
+ einfo |
1938 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
1939 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
1940 |
+ einfo |
1941 |
+ if use prefix ; then |
1942 |
+ einfo "The location of the configuration files have moved to:" |
1943 |
+ einfo " ${PGDATA}" |
1944 |
+ einfo "To start the server:" |
1945 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1946 |
+ einfo "To stop:" |
1947 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
1948 |
+ einfo |
1949 |
+ einfo "Or move the configuration files back:" |
1950 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1951 |
+ else |
1952 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1953 |
+ einfo "instead of 'pg_ctl'." |
1954 |
+ fi |
1955 |
+} |
1956 |
+ |
1957 |
+src_test() { |
1958 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1959 |
+ emake check |
1960 |
+ |
1961 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
1962 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
1963 |
+ else |
1964 |
+ use server || \ |
1965 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1966 |
+ [[ ${UID} -eq 0 ]] || \ |
1967 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1968 |
+ |
1969 |
+ ewarn 'Skipping.' |
1970 |
+ fi |
1971 |
+} |
1972 |
|
1973 |
diff --git a/dev-db/postgresql/postgresql-9.5.21.ebuild b/dev-db/postgresql/postgresql-9.5.21.ebuild |
1974 |
new file mode 100644 |
1975 |
index 00000000000..19566040ab2 |
1976 |
--- /dev/null |
1977 |
+++ b/dev-db/postgresql/postgresql-9.5.21.ebuild |
1978 |
@@ -0,0 +1,486 @@ |
1979 |
+# Copyright 1999-2020 Gentoo Authors |
1980 |
+# Distributed under the terms of the GNU General Public License v2 |
1981 |
+ |
1982 |
+EAPI=7 |
1983 |
+ |
1984 |
+PYTHON_COMPAT=( python3_{6,7} ) |
1985 |
+ |
1986 |
+PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
1987 |
+ zh_TW" |
1988 |
+ |
1989 |
+inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
1990 |
+ systemd user |
1991 |
+ |
1992 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-macos ~x86-solaris" |
1993 |
+ |
1994 |
+SLOT=$(ver_cut 1-2) |
1995 |
+ |
1996 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${PV}/postgresql-${PV}.tar.bz2" |
1997 |
+ |
1998 |
+LICENSE="POSTGRESQL GPL-2" |
1999 |
+DESCRIPTION="PostgreSQL RDBMS" |
2000 |
+HOMEPAGE="https://www.postgresql.org/" |
2001 |
+ |
2002 |
+IUSE="debug doc kerberos kernel_linux ldap libressl nls pam perl |
2003 |
+ -pg_legacytimestamp python +readline selinux +server systemd ssl |
2004 |
+ static-libs tcl threads uuid xml zlib" |
2005 |
+ |
2006 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
2007 |
+ |
2008 |
+CDEPEND=" |
2009 |
+>=app-eselect/eselect-postgresql-2.0 |
2010 |
+sys-apps/less |
2011 |
+virtual/libintl |
2012 |
+kerberos? ( virtual/krb5 ) |
2013 |
+ldap? ( net-nds/openldap ) |
2014 |
+pam? ( sys-libs/pam ) |
2015 |
+perl? ( >=dev-lang/perl-5.8:= ) |
2016 |
+python? ( ${PYTHON_DEPS} ) |
2017 |
+readline? ( sys-libs/readline:0= ) |
2018 |
+ssl? ( |
2019 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
2020 |
+ libressl? ( dev-libs/libressl:= ) |
2021 |
+) |
2022 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
2023 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
2024 |
+zlib? ( sys-libs/zlib ) |
2025 |
+" |
2026 |
+ |
2027 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
2028 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
2029 |
+# the libc includes UUID functions. |
2030 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
2031 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
2032 |
+ |
2033 |
+nest_usedep() { |
2034 |
+ local front back |
2035 |
+ while [[ ${#} -gt 1 ]]; do |
2036 |
+ front+="${1}? ( " |
2037 |
+ back+=" )" |
2038 |
+ shift |
2039 |
+ done |
2040 |
+ echo "${front}${1}${back}" |
2041 |
+} |
2042 |
+ |
2043 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
2044 |
+CDEPEND+=" |
2045 |
+uuid? ( |
2046 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
2047 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
2048 |
+)" |
2049 |
+ |
2050 |
+DEPEND="${CDEPEND} |
2051 |
+!!<sys-apps/sandbox-2.0 |
2052 |
+sys-devel/bison |
2053 |
+sys-devel/flex |
2054 |
+nls? ( sys-devel/gettext ) |
2055 |
+xml? ( virtual/pkgconfig ) |
2056 |
+" |
2057 |
+ |
2058 |
+RDEPEND="${CDEPEND} |
2059 |
+!dev-db/postgresql-docs:${SLOT} |
2060 |
+!dev-db/postgresql-base:${SLOT} |
2061 |
+!dev-db/postgresql-server:${SLOT} |
2062 |
+selinux? ( sec-policy/selinux-postgresql ) |
2063 |
+" |
2064 |
+ |
2065 |
+pkg_setup() { |
2066 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
2067 |
+ |
2068 |
+ enewgroup postgres 70 |
2069 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
2070 |
+ |
2071 |
+ use python && python-single-r1_pkg_setup |
2072 |
+} |
2073 |
+ |
2074 |
+src_prepare() { |
2075 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
2076 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
2077 |
+ |
2078 |
+ # Set proper run directory |
2079 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
2080 |
+ -i src/include/pg_config_manual.h || die |
2081 |
+ |
2082 |
+ # Rely on $PATH being in the proper order so that the correct |
2083 |
+ # install program is used for modules utilizing PGXS in both |
2084 |
+ # hardened and non-hardened environments. (Bug #528786) |
2085 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
2086 |
+ |
2087 |
+ use server || eapply "${FILESDIR}/${PN}-9.5.5-no-server.patch" |
2088 |
+ |
2089 |
+ if use pam ; then |
2090 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
2091 |
+ -i src/backend/libpq/auth.c || \ |
2092 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
2093 |
+ fi |
2094 |
+ |
2095 |
+ eapply_user |
2096 |
+} |
2097 |
+ |
2098 |
+src_configure() { |
2099 |
+ case ${CHOST} in |
2100 |
+ *-darwin*|*-solaris*) |
2101 |
+ use nls && append-libs intl |
2102 |
+ ;; |
2103 |
+ esac |
2104 |
+ |
2105 |
+ export LDFLAGS_SL="${LDFLAGS}" |
2106 |
+ export LDFLAGS_EX="${LDFLAGS}" |
2107 |
+ |
2108 |
+ local PO="${EPREFIX}" |
2109 |
+ |
2110 |
+ local i uuid_config="" |
2111 |
+ if use uuid; then |
2112 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
2113 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
2114 |
+ done |
2115 |
+ for i in ${BSD_LIBC[@]}; do |
2116 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
2117 |
+ done |
2118 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
2119 |
+ fi |
2120 |
+ |
2121 |
+ econf \ |
2122 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
2123 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
2124 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
2125 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
2126 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
2127 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
2128 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
2129 |
+ $(use_enable !alpha spinlocks) \ |
2130 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
2131 |
+ $(use_enable debug) \ |
2132 |
+ $(use_enable threads thread-safety) \ |
2133 |
+ $(use_with kerberos gssapi) \ |
2134 |
+ $(use_with ldap) \ |
2135 |
+ $(use_with pam) \ |
2136 |
+ $(use_with perl) \ |
2137 |
+ $(use_with python) \ |
2138 |
+ $(use_with readline) \ |
2139 |
+ $(use_with ssl openssl) \ |
2140 |
+ $(use_with tcl) \ |
2141 |
+ ${uuid_config} \ |
2142 |
+ $(use_with xml libxml) \ |
2143 |
+ $(use_with xml libxslt) \ |
2144 |
+ $(use_with zlib) \ |
2145 |
+ $(use_enable nls nls "'$(l10n_get_locales)'") |
2146 |
+} |
2147 |
+ |
2148 |
+src_compile() { |
2149 |
+ emake |
2150 |
+ emake -C contrib |
2151 |
+} |
2152 |
+ |
2153 |
+src_install() { |
2154 |
+ emake DESTDIR="${D}" install |
2155 |
+ emake DESTDIR="${D}" install -C contrib |
2156 |
+ |
2157 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
2158 |
+ |
2159 |
+ # man pages are already built, but if we have the target make them, |
2160 |
+ # they'll be generated from source before being installed so we |
2161 |
+ # manually install man pages. |
2162 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
2163 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
2164 |
+ doins -r doc/src/sgml/man{1,3,7} |
2165 |
+ if ! use server; then |
2166 |
+ # Remove man pages for non-existent binaries |
2167 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
2168 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
2169 |
+ done |
2170 |
+ fi |
2171 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
2172 |
+ |
2173 |
+ # Create slot specific man pages |
2174 |
+ local bn f mansec slotted_name |
2175 |
+ for mansec in 1 3 7 ; do |
2176 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
2177 |
+ |
2178 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
2179 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
2180 |
+ |
2181 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
2182 |
+ bn=$(basename "${f}") |
2183 |
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec} |
2184 |
+ case ${bn} in |
2185 |
+ TABLE.7|WITH.7) |
2186 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
2187 |
+ ;; |
2188 |
+ *) |
2189 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
2190 |
+ ;; |
2191 |
+ esac |
2192 |
+ done |
2193 |
+ |
2194 |
+ popd > /dev/null |
2195 |
+ done |
2196 |
+ |
2197 |
+ insinto /etc/postgresql-${SLOT} |
2198 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
2199 |
+ |
2200 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
2201 |
+ # needed by extensions utilizing PGXS. |
2202 |
+ use static-libs || \ |
2203 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
2204 |
+ -delete |
2205 |
+ |
2206 |
+ local f bn |
2207 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
2208 |
+ -mindepth 1 -maxdepth 1) |
2209 |
+ do |
2210 |
+ bn=$(basename "${f}") |
2211 |
+ # Temporarily tack on tmp to workaround a file collision |
2212 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
2213 |
+ # had this issue. |
2214 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
2215 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
2216 |
+ done |
2217 |
+ |
2218 |
+ if use doc ; then |
2219 |
+ docinto html |
2220 |
+ dodoc doc/src/sgml/html/* |
2221 |
+ |
2222 |
+ docinto sgml |
2223 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
2224 |
+ fi |
2225 |
+ |
2226 |
+ if use server; then |
2227 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2228 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
2229 |
+ |
2230 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2231 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
2232 |
+ |
2233 |
+ if use systemd; then |
2234 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2235 |
+ "${FILESDIR}/${PN}.service-9.2" | \ |
2236 |
+ systemd_newunit - ${PN}-${SLOT}.service |
2237 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
2238 |
+ fi |
2239 |
+ |
2240 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
2241 |
+ |
2242 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2243 |
+ |
2244 |
+ if use prefix ; then |
2245 |
+ keepdir /run/postgresql |
2246 |
+ fperms 1775 /run/postgresql |
2247 |
+ fi |
2248 |
+ fi |
2249 |
+} |
2250 |
+ |
2251 |
+pkg_preinst() { |
2252 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
2253 |
+ # /usr/bin/psql96). They may have been created by the |
2254 |
+ # postgresql.eselect module, but they're handled within this ebuild |
2255 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
2256 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
2257 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
2258 |
+ # handled in this manner. |
2259 |
+ local canonicalise |
2260 |
+ if type -p realpath > /dev/null; then |
2261 |
+ canonicalise=realpath |
2262 |
+ elif type -p readlink > /dev/null; then |
2263 |
+ canonicalise='readlink -f' |
2264 |
+ else |
2265 |
+ # can't die, subshell |
2266 |
+ die "No readlink nor realpath found, cannot canonicalise" |
2267 |
+ fi |
2268 |
+ |
2269 |
+ local l |
2270 |
+ # First remove any symlinks in /usr/bin that may have been created |
2271 |
+ # by the old eselect |
2272 |
+ for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
2273 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
2274 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
2275 |
+ fi |
2276 |
+ done |
2277 |
+ |
2278 |
+ # Then move the symlinks created by the ebuild to their proper place. |
2279 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
2280 |
+ mv "${l}" "${l%tmp}" \ |
2281 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
2282 |
+ done |
2283 |
+} |
2284 |
+ |
2285 |
+pkg_postinst() { |
2286 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
2287 |
+ postgresql-config update |
2288 |
+ |
2289 |
+ if use alpha && use server ; then |
2290 |
+ ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms." |
2291 |
+ ewarn "As a result, performance will be extremely degraded." |
2292 |
+ fi |
2293 |
+ |
2294 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
2295 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
2296 |
+ |
2297 |
+ if use server ; then |
2298 |
+ elog |
2299 |
+ elog "Gentoo specific documentation:" |
2300 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2301 |
+ elog |
2302 |
+ elog "Official documentation:" |
2303 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
2304 |
+ elog |
2305 |
+ elog "The default location of the Unix-domain socket is:" |
2306 |
+ elog " ${EROOT}/run/postgresql/" |
2307 |
+ elog |
2308 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2309 |
+ elog "so that it contains your preferred locale in:" |
2310 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2311 |
+ elog |
2312 |
+ elog "Then, execute the following command to setup the initial database" |
2313 |
+ elog "environment:" |
2314 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
2315 |
+ fi |
2316 |
+} |
2317 |
+ |
2318 |
+pkg_prerm() { |
2319 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2320 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
2321 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
2322 |
+ |
2323 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
2324 |
+ sleep 10 |
2325 |
+ eend 0 |
2326 |
+ fi |
2327 |
+} |
2328 |
+ |
2329 |
+pkg_postrm() { |
2330 |
+ postgresql-config update |
2331 |
+} |
2332 |
+ |
2333 |
+pkg_config() { |
2334 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
2335 |
+ |
2336 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
2337 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2338 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
2339 |
+ [[ -z "${DATA_DIR}" ]] \ |
2340 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
2341 |
+ |
2342 |
+ # environment.bz2 may not contain the same locale as the current system |
2343 |
+ # locale. Unset and source from the current system locale. |
2344 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
2345 |
+ unset LANG |
2346 |
+ unset LC_CTYPE |
2347 |
+ unset LC_NUMERIC |
2348 |
+ unset LC_TIME |
2349 |
+ unset LC_COLLATE |
2350 |
+ unset LC_MONETARY |
2351 |
+ unset LC_MESSAGES |
2352 |
+ unset LC_ALL |
2353 |
+ source "${EROOT}/etc/env.d/02locale" |
2354 |
+ [ -n "${LANG}" ] && export LANG |
2355 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
2356 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
2357 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
2358 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
2359 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
2360 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
2361 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
2362 |
+ fi |
2363 |
+ |
2364 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
2365 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2366 |
+ einfo |
2367 |
+ einfo "Information on options that can be passed to initdb are found at:" |
2368 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
2369 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
2370 |
+ einfo |
2371 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
2372 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
2373 |
+ einfo " (none)" |
2374 |
+ else |
2375 |
+ einfo " ${PG_INITDB_OPTS}" |
2376 |
+ fi |
2377 |
+ einfo |
2378 |
+ einfo "Configuration files will be installed to:" |
2379 |
+ einfo " ${PGDATA}" |
2380 |
+ einfo |
2381 |
+ einfo "The database cluster will be created in:" |
2382 |
+ einfo " ${DATA_DIR}" |
2383 |
+ einfo |
2384 |
+ |
2385 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
2386 |
+ sleep 5 |
2387 |
+ eend 0 |
2388 |
+ |
2389 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2390 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
2391 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
2392 |
+ die "${DATA_DIR} is not empty." |
2393 |
+ fi |
2394 |
+ |
2395 |
+ einfo "Creating the data directory ..." |
2396 |
+ if [[ ${EUID} == 0 ]] ; then |
2397 |
+ mkdir -p "${DATA_DIR}" |
2398 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
2399 |
+ chmod 0700 "${DATA_DIR}" |
2400 |
+ fi |
2401 |
+ |
2402 |
+ einfo "Initializing the database ..." |
2403 |
+ |
2404 |
+ if [[ ${EUID} == 0 ]] ; then |
2405 |
+ su postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
2406 |
+ else |
2407 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
2408 |
+ fi |
2409 |
+ |
2410 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
2411 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
2412 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2413 |
+ fi |
2414 |
+ |
2415 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
2416 |
+ # overridden in the initscript |
2417 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
2418 |
+ |
2419 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2420 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2421 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
2422 |
+ # characters in PL/Perl |
2423 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
2424 |
+ EOF |
2425 |
+ |
2426 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
2427 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
2428 |
+ einfo "by default. You can disable it in the cluster's:" |
2429 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
2430 |
+ einfo |
2431 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
2432 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
2433 |
+ einfo |
2434 |
+ if use prefix ; then |
2435 |
+ einfo "The location of the configuration files have moved to:" |
2436 |
+ einfo " ${PGDATA}" |
2437 |
+ einfo "To start the server:" |
2438 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
2439 |
+ einfo "To stop:" |
2440 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
2441 |
+ einfo |
2442 |
+ einfo "Or move the configuration files back:" |
2443 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
2444 |
+ else |
2445 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
2446 |
+ einfo "instead of 'pg_ctl'." |
2447 |
+ fi |
2448 |
+} |
2449 |
+ |
2450 |
+src_test() { |
2451 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
2452 |
+ emake check |
2453 |
+ |
2454 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
2455 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
2456 |
+ else |
2457 |
+ use server || \ |
2458 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2459 |
+ [[ ${UID} -eq 0 ]] || \ |
2460 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2461 |
+ |
2462 |
+ ewarn 'Skipping.' |
2463 |
+ fi |
2464 |
+} |
2465 |
|
2466 |
diff --git a/dev-db/postgresql/postgresql-9.6.17.ebuild b/dev-db/postgresql/postgresql-9.6.17.ebuild |
2467 |
new file mode 100644 |
2468 |
index 00000000000..0aac8dd1aa2 |
2469 |
--- /dev/null |
2470 |
+++ b/dev-db/postgresql/postgresql-9.6.17.ebuild |
2471 |
@@ -0,0 +1,491 @@ |
2472 |
+# Copyright 1999-2020 Gentoo Authors |
2473 |
+# Distributed under the terms of the GNU General Public License v2 |
2474 |
+ |
2475 |
+EAPI=7 |
2476 |
+ |
2477 |
+PYTHON_COMPAT=( python3_{6,7} ) |
2478 |
+ |
2479 |
+PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
2480 |
+ zh_TW" |
2481 |
+ |
2482 |
+inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
2483 |
+ systemd user |
2484 |
+ |
2485 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
2486 |
+ |
2487 |
+SLOT=$(ver_cut 1-2) |
2488 |
+ |
2489 |
+MY_PV=${PV/_/} |
2490 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
2491 |
+ |
2492 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
2493 |
+ |
2494 |
+LICENSE="POSTGRESQL GPL-2" |
2495 |
+DESCRIPTION="PostgreSQL RDBMS" |
2496 |
+HOMEPAGE="https://www.postgresql.org/" |
2497 |
+ |
2498 |
+IUSE="debug doc kerberos kernel_linux ldap libressl nls pam perl |
2499 |
+ -pg_legacytimestamp python +readline selinux +server systemd ssl |
2500 |
+ static-libs tcl threads uuid xml zlib" |
2501 |
+ |
2502 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
2503 |
+ |
2504 |
+CDEPEND=" |
2505 |
+>=app-eselect/eselect-postgresql-2.0 |
2506 |
+sys-apps/less |
2507 |
+virtual/libintl |
2508 |
+kerberos? ( virtual/krb5 ) |
2509 |
+ldap? ( net-nds/openldap ) |
2510 |
+pam? ( sys-libs/pam ) |
2511 |
+perl? ( >=dev-lang/perl-5.8:= ) |
2512 |
+python? ( ${PYTHON_DEPS} ) |
2513 |
+readline? ( sys-libs/readline:0= ) |
2514 |
+ssl? ( |
2515 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
2516 |
+ libressl? ( dev-libs/libressl:= ) |
2517 |
+) |
2518 |
+server? ( systemd? ( sys-apps/systemd ) ) |
2519 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
2520 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
2521 |
+zlib? ( sys-libs/zlib ) |
2522 |
+" |
2523 |
+ |
2524 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
2525 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
2526 |
+# the libc includes UUID functions. |
2527 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
2528 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
2529 |
+ |
2530 |
+nest_usedep() { |
2531 |
+ local front back |
2532 |
+ while [[ ${#} -gt 1 ]]; do |
2533 |
+ front+="${1}? ( " |
2534 |
+ back+=" )" |
2535 |
+ shift |
2536 |
+ done |
2537 |
+ echo "${front}${1}${back}" |
2538 |
+} |
2539 |
+ |
2540 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
2541 |
+CDEPEND+=" |
2542 |
+uuid? ( |
2543 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
2544 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
2545 |
+)" |
2546 |
+ |
2547 |
+DEPEND="${CDEPEND} |
2548 |
+!!<sys-apps/sandbox-2.0 |
2549 |
+sys-devel/bison |
2550 |
+sys-devel/flex |
2551 |
+nls? ( sys-devel/gettext ) |
2552 |
+xml? ( virtual/pkgconfig ) |
2553 |
+" |
2554 |
+ |
2555 |
+RDEPEND="${CDEPEND} |
2556 |
+!dev-db/postgresql-docs:${SLOT} |
2557 |
+!dev-db/postgresql-base:${SLOT} |
2558 |
+!dev-db/postgresql-server:${SLOT} |
2559 |
+selinux? ( sec-policy/selinux-postgresql ) |
2560 |
+" |
2561 |
+ |
2562 |
+pkg_setup() { |
2563 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
2564 |
+ |
2565 |
+ enewgroup postgres 70 |
2566 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
2567 |
+ |
2568 |
+ use python && python-single-r1_pkg_setup |
2569 |
+} |
2570 |
+ |
2571 |
+src_prepare() { |
2572 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
2573 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
2574 |
+ |
2575 |
+ # Set proper run directory |
2576 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
2577 |
+ -i src/include/pg_config_manual.h || die |
2578 |
+ |
2579 |
+ # Rely on $PATH being in the proper order so that the correct |
2580 |
+ # install program is used for modules utilizing PGXS in both |
2581 |
+ # hardened and non-hardened environments. (Bug #528786) |
2582 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
2583 |
+ |
2584 |
+ use server || eapply "${FILESDIR}/${PN}-${SLOT}.3-no-server.patch" |
2585 |
+ |
2586 |
+ if use pam ; then |
2587 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
2588 |
+ -i src/backend/libpq/auth.c || \ |
2589 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
2590 |
+ fi |
2591 |
+ |
2592 |
+ eapply_user |
2593 |
+} |
2594 |
+ |
2595 |
+src_configure() { |
2596 |
+ case ${CHOST} in |
2597 |
+ *-darwin*|*-solaris*) |
2598 |
+ use nls && append-libs intl |
2599 |
+ ;; |
2600 |
+ esac |
2601 |
+ |
2602 |
+ export LDFLAGS_SL="${LDFLAGS}" |
2603 |
+ export LDFLAGS_EX="${LDFLAGS}" |
2604 |
+ |
2605 |
+ local PO="${EPREFIX}" |
2606 |
+ |
2607 |
+ local i uuid_config="" |
2608 |
+ if use uuid; then |
2609 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
2610 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
2611 |
+ done |
2612 |
+ for i in ${BSD_LIBC[@]}; do |
2613 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
2614 |
+ done |
2615 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
2616 |
+ fi |
2617 |
+ |
2618 |
+ econf \ |
2619 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
2620 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
2621 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
2622 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
2623 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
2624 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
2625 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
2626 |
+ $(use_enable !alpha spinlocks) \ |
2627 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
2628 |
+ $(use_enable debug) \ |
2629 |
+ $(use_enable threads thread-safety) \ |
2630 |
+ $(use_with kerberos gssapi) \ |
2631 |
+ $(use_with ldap) \ |
2632 |
+ $(use_with pam) \ |
2633 |
+ $(use_with perl) \ |
2634 |
+ $(use_with python) \ |
2635 |
+ $(use_with readline) \ |
2636 |
+ $(use_with ssl openssl) \ |
2637 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
2638 |
+ $(use_with tcl) \ |
2639 |
+ ${uuid_config} \ |
2640 |
+ $(use_with xml libxml) \ |
2641 |
+ $(use_with xml libxslt) \ |
2642 |
+ $(use_with zlib) \ |
2643 |
+ $(use_enable nls nls "'$(l10n_get_locales)'") |
2644 |
+} |
2645 |
+ |
2646 |
+src_compile() { |
2647 |
+ emake |
2648 |
+ emake -C contrib |
2649 |
+} |
2650 |
+ |
2651 |
+src_install() { |
2652 |
+ emake DESTDIR="${D}" install |
2653 |
+ emake DESTDIR="${D}" install -C contrib |
2654 |
+ |
2655 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
2656 |
+ |
2657 |
+ # man pages are already built, but if we have the target make them, |
2658 |
+ # they'll be generated from source before being installed so we |
2659 |
+ # manually install man pages. |
2660 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
2661 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
2662 |
+ doins -r doc/src/sgml/man{1,3,7} |
2663 |
+ if ! use server; then |
2664 |
+ # Remove man pages for non-existent binaries |
2665 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
2666 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
2667 |
+ done |
2668 |
+ fi |
2669 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
2670 |
+ |
2671 |
+ # Create slot specific man pages |
2672 |
+ local bn f mansec slotted_name |
2673 |
+ for mansec in 1 3 7 ; do |
2674 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
2675 |
+ |
2676 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
2677 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
2678 |
+ |
2679 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
2680 |
+ bn=$(basename "${f}") |
2681 |
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec} |
2682 |
+ case ${bn} in |
2683 |
+ TABLE.7|WITH.7) |
2684 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
2685 |
+ ;; |
2686 |
+ *) |
2687 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
2688 |
+ ;; |
2689 |
+ esac |
2690 |
+ done |
2691 |
+ |
2692 |
+ popd > /dev/null |
2693 |
+ done |
2694 |
+ |
2695 |
+ insinto /etc/postgresql-${SLOT} |
2696 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
2697 |
+ |
2698 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
2699 |
+ # needed by extensions utilizing PGXS. |
2700 |
+ use static-libs || \ |
2701 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
2702 |
+ -delete |
2703 |
+ |
2704 |
+ local f bn |
2705 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
2706 |
+ -mindepth 1 -maxdepth 1) |
2707 |
+ do |
2708 |
+ bn=$(basename "${f}") |
2709 |
+ # Temporarily tack on tmp to workaround a file collision |
2710 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
2711 |
+ # had this issue. |
2712 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
2713 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
2714 |
+ done |
2715 |
+ |
2716 |
+ if use doc ; then |
2717 |
+ docinto html |
2718 |
+ dodoc doc/src/sgml/html/* |
2719 |
+ |
2720 |
+ docinto sgml |
2721 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
2722 |
+ fi |
2723 |
+ |
2724 |
+ if use server; then |
2725 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2726 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
2727 |
+ |
2728 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2729 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
2730 |
+ |
2731 |
+ if use systemd; then |
2732 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2733 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
2734 |
+ systemd_newunit - ${PN}-${SLOT}.service |
2735 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
2736 |
+ fi |
2737 |
+ |
2738 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
2739 |
+ |
2740 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2741 |
+ |
2742 |
+ if use prefix ; then |
2743 |
+ keepdir /run/postgresql |
2744 |
+ fperms 1775 /run/postgresql |
2745 |
+ fi |
2746 |
+ fi |
2747 |
+} |
2748 |
+ |
2749 |
+pkg_preinst() { |
2750 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
2751 |
+ # /usr/bin/psql96). They may have been created by the |
2752 |
+ # postgresql.eselect module, but they're handled within this ebuild |
2753 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
2754 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
2755 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
2756 |
+ # handled in this manner. |
2757 |
+ local canonicalise |
2758 |
+ if type -p realpath > /dev/null; then |
2759 |
+ canonicalise=realpath |
2760 |
+ elif type -p readlink > /dev/null; then |
2761 |
+ canonicalise='readlink -f' |
2762 |
+ else |
2763 |
+ # can't die, subshell |
2764 |
+ die "No readlink nor realpath found, cannot canonicalise" |
2765 |
+ fi |
2766 |
+ |
2767 |
+ local l |
2768 |
+ # First remove any symlinks in /usr/bin that may have been created |
2769 |
+ # by the old eselect |
2770 |
+ for l in $(find "${ROOT}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
2771 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
2772 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
2773 |
+ fi |
2774 |
+ done |
2775 |
+ |
2776 |
+ # Then move the symlinks created by the ebuild to their proper place. |
2777 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
2778 |
+ mv "${l}" "${l%tmp}" \ |
2779 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
2780 |
+ done |
2781 |
+} |
2782 |
+ |
2783 |
+pkg_postinst() { |
2784 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
2785 |
+ postgresql-config update |
2786 |
+ |
2787 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
2788 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
2789 |
+ |
2790 |
+ if use server ; then |
2791 |
+ elog |
2792 |
+ elog "Gentoo specific documentation:" |
2793 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2794 |
+ elog |
2795 |
+ elog "Official documentation:" |
2796 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
2797 |
+ elog |
2798 |
+ elog "The default location of the Unix-domain socket is:" |
2799 |
+ elog " ${EROOT}/run/postgresql/" |
2800 |
+ elog |
2801 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2802 |
+ elog "so that it contains your preferred locale in:" |
2803 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2804 |
+ elog |
2805 |
+ elog "Then, execute the following command to setup the initial database" |
2806 |
+ elog "environment:" |
2807 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
2808 |
+ fi |
2809 |
+} |
2810 |
+ |
2811 |
+pkg_prerm() { |
2812 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2813 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
2814 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
2815 |
+ |
2816 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
2817 |
+ sleep 10 |
2818 |
+ eend 0 |
2819 |
+ fi |
2820 |
+} |
2821 |
+ |
2822 |
+pkg_postrm() { |
2823 |
+ postgresql-config update |
2824 |
+} |
2825 |
+ |
2826 |
+pkg_config() { |
2827 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
2828 |
+ |
2829 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
2830 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2831 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
2832 |
+ [[ -z "${DATA_DIR}" ]] \ |
2833 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
2834 |
+ |
2835 |
+ # environment.bz2 may not contain the same locale as the current system |
2836 |
+ # locale. Unset and source from the current system locale. |
2837 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
2838 |
+ unset LANG |
2839 |
+ unset LC_CTYPE |
2840 |
+ unset LC_NUMERIC |
2841 |
+ unset LC_TIME |
2842 |
+ unset LC_COLLATE |
2843 |
+ unset LC_MONETARY |
2844 |
+ unset LC_MESSAGES |
2845 |
+ unset LC_ALL |
2846 |
+ source "${EROOT}/etc/env.d/02locale" |
2847 |
+ [ -n "${LANG}" ] && export LANG |
2848 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
2849 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
2850 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
2851 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
2852 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
2853 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
2854 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
2855 |
+ fi |
2856 |
+ |
2857 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
2858 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2859 |
+ einfo |
2860 |
+ einfo "Information on options that can be passed to initdb are found at:" |
2861 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
2862 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
2863 |
+ einfo |
2864 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
2865 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
2866 |
+ einfo " (none)" |
2867 |
+ else |
2868 |
+ einfo " ${PG_INITDB_OPTS}" |
2869 |
+ fi |
2870 |
+ einfo |
2871 |
+ einfo "Configuration files will be installed to:" |
2872 |
+ einfo " ${PGDATA}" |
2873 |
+ einfo |
2874 |
+ einfo "The database cluster will be created in:" |
2875 |
+ einfo " ${DATA_DIR}" |
2876 |
+ einfo |
2877 |
+ |
2878 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
2879 |
+ sleep 5 |
2880 |
+ eend 0 |
2881 |
+ |
2882 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2883 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
2884 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
2885 |
+ die "${DATA_DIR} is not empty." |
2886 |
+ fi |
2887 |
+ |
2888 |
+ einfo "Creating the data directory ..." |
2889 |
+ if [[ ${EUID} == 0 ]] ; then |
2890 |
+ mkdir -p "${DATA_DIR}" |
2891 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
2892 |
+ chmod 0700 "${DATA_DIR}" |
2893 |
+ fi |
2894 |
+ |
2895 |
+ einfo "Initializing the database ..." |
2896 |
+ |
2897 |
+ if [[ ${EUID} == 0 ]] ; then |
2898 |
+ su postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
2899 |
+ else |
2900 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
2901 |
+ fi |
2902 |
+ |
2903 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
2904 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
2905 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2906 |
+ fi |
2907 |
+ |
2908 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
2909 |
+ # overridden in the initscript |
2910 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
2911 |
+ |
2912 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2913 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2914 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
2915 |
+ # characters in PL/Perl |
2916 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
2917 |
+ EOF |
2918 |
+ |
2919 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
2920 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
2921 |
+ einfo "by default. You can disable it in the cluster's:" |
2922 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
2923 |
+ einfo |
2924 |
+ if ! use systemd; then |
2925 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
2926 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
2927 |
+ einfo |
2928 |
+ fi |
2929 |
+ if use prefix ; then |
2930 |
+ einfo "The location of the configuration files have moved to:" |
2931 |
+ einfo " ${PGDATA}" |
2932 |
+ einfo "To start the server:" |
2933 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
2934 |
+ einfo "To stop:" |
2935 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
2936 |
+ einfo |
2937 |
+ einfo "Or move the configuration files back:" |
2938 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
2939 |
+ elif use systemd; then |
2940 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
2941 |
+ einfo "instead of 'pg_ctl'." |
2942 |
+ else |
2943 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
2944 |
+ einfo "instead of 'pg_ctl'." |
2945 |
+ fi |
2946 |
+} |
2947 |
+ |
2948 |
+src_test() { |
2949 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
2950 |
+ emake check |
2951 |
+ |
2952 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
2953 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
2954 |
+ else |
2955 |
+ use server || \ |
2956 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2957 |
+ [[ ${UID} -eq 0 ]] || \ |
2958 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2959 |
+ |
2960 |
+ ewarn 'Skipping.' |
2961 |
+ fi |
2962 |
+} |