1 |
commit: 3832ae8c690ba898a93a5d23ff88cf3df36a5d50 |
2 |
Author: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 12 15:45:07 2022 +0000 |
4 |
Commit: 罗百科 <patrick <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 12 15:45:07 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3832ae8c |
7 |
|
8 |
dev-db/postgresql: Bump |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org> |
12 |
|
13 |
dev-db/postgresql/Manifest | 5 + |
14 |
dev-db/postgresql/postgresql-10.21.ebuild | 453 +++++++++++++++++++++++++++++ |
15 |
dev-db/postgresql/postgresql-11.16.ebuild | 453 +++++++++++++++++++++++++++++ |
16 |
dev-db/postgresql/postgresql-12.11.ebuild | 454 +++++++++++++++++++++++++++++ |
17 |
dev-db/postgresql/postgresql-13.7.ebuild | 466 ++++++++++++++++++++++++++++++ |
18 |
dev-db/postgresql/postgresql-14.3.ebuild | 463 +++++++++++++++++++++++++++++ |
19 |
6 files changed, 2294 insertions(+) |
20 |
|
21 |
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest |
22 |
index 7a52f0ef9a84..866ae18c66f8 100644 |
23 |
--- a/dev-db/postgresql/Manifest |
24 |
+++ b/dev-db/postgresql/Manifest |
25 |
@@ -1,11 +1,16 @@ |
26 |
DIST postgresql-10.19.tar.bz2 19261478 BLAKE2B 3ccd44d68980ddb0e394b811af20c213cf89eb8d4374d2c49c9cda5165f222ca849a2db4fe4d521991f15f9cc84ec35bafa91083b9625f2a6729159f490a94c9 SHA512 41b0f5026be7d563e41b54e9ea7199dd466a132d355be0b71a91d41f533d97fbf550eccf2a2ece3d60c5dab5921ebeea3ac4780c18c54b924df52d7423305a22 |
27 |
DIST postgresql-10.20.tar.bz2 19371473 BLAKE2B 24ce3e3dda749375e999206307154e79bf15d20b3cd598ba0b78bf27976241d71e88e6fa4cd459b675bc9a9047e9315321b1535dbb41ed9e558858c2a7e9dd31 SHA512 44cfca541947d58c70593b767d3c2423f20cc6904f3d4cea8f63c1802ccbc569130c4a2a15f1af152285926f6a200e13d59c21584295dafd6f6e74bd38251428 |
28 |
+DIST postgresql-10.21.tar.bz2 19409454 BLAKE2B 5e43abaee8156b9eb99360efeb25ba268f93a60ac2c29044d9025c4faa8753d84cb3c0c8cbcd65eb9e0eb094ebf63e0cc1cbd0ef12c0a2faa360754e63ae106a SHA512 1053e15505c0448df491119c9aad1617889b66118628a2155e3ec87e6648b2071a0a54e10d8fbbe00161b2aa86d1a6194d932a8cf5808c626e7972d135bb05c5 |
29 |
DIST postgresql-11.14.tar.bz2 20172910 BLAKE2B a033752fc5fc593c96fe63a258b2cc0d4b896548a366e3fefa8afde1f96ab64aab97eb395b10ae10494709963ed924623279f76f66870c4faee435969400c1b7 SHA512 ab71461ee6fb4cdc5b4240f7ecd8af2497ce6780283fde2abf5951ffdb616bd0c8ed22b26fdfca402a346e663ff77c4d17f3284c9d700e6fd6795b2aec97c9be |
30 |
DIST postgresql-11.15.tar.bz2 20245750 BLAKE2B f6a632606fe4b34b2a44df2c165ccfa6e890b85f4f6048994f781428bbd1de6888a24493fb5d0c231f3f34e6a4e94cfd23078a9afdaf5925d284b4854847d23f SHA512 1eba7bddee1edf034617102c1d61ad0aa1b58927dad63de1d054817966c4c9a1d7d3fa6f6896af3fe5a6880b09a6ec86be298256ee6ecc3705ff2654d3d00c74 |
31 |
+DIST postgresql-11.16.tar.bz2 20347100 BLAKE2B 240e86b68ff8833265f10802da2fb847d72e38ac9325fc56bb6864266b2ad98939170038ccdb7044ae16f9fd29e7a9e1d404456d8bc7d53430067d714b9bb563 SHA512 e1b6be0a97e60cdd95cd0ebc756b1de6abf2f33f41f6a80da3dff25483a30146fb6bf750ab787bb5bb4f2a04718946c7429e71f891cbd491001e9f9c2ea8e63c |
32 |
DIST postgresql-12.10.tar.bz2 20990621 BLAKE2B a7a56cf75944c558ae9bb9165dfb17b30cc5f7a865961e0a588677e4dd3e53d1fab15a212a21ec12f8e7b669a448d78efa0dfe985fd4902e16485a298c7adc62 SHA512 befedb14320aa033dc55bbb93bbbec4e67d9cfced63be0e4f631c7495a0fbc6fe280bd6d2fb941d7a2e6b2ac570b7f40d8db7f07a192a81bd9cd63c6c244a9c5 |
33 |
+DIST postgresql-12.11.tar.bz2 21086745 BLAKE2B 7062d334f3ef3b98f69e709f5de744324c7ce53ea516384902632a454a2ccadfd7bcc0c9ef4d51a685dd7a06e1fdccc292109294517831181c3db30bc2b7be91 SHA512 705e9e1ccf8202062cce61069b5ddb7db5f804dd0736c620640ce5622b9e42fdcbc1417771e77d51aa54beb4562a09b4307f2ff7dec135bd0e31f4941ca36ac8 |
34 |
DIST postgresql-12.9.tar.bz2 20904260 BLAKE2B fc88d61d369569a3054b889848eaf1405a4f5137cd8c2cf27282115f70853dd4d5d8b4bf0a9fc60c63db936246a0a64077c9bfdb90685d4dfe375558e4519b2b SHA512 11697d8283f5df5a9c74c2406e94d1b6da6df8358ad48f3b773825aab98e8395f9fd4e3fc8b1e6ebad3743c3dadbda8b795d4fe84a447d7913223e136cf2b88f |
35 |
DIST postgresql-13.5.tar.bz2 21186674 BLAKE2B 3e51d6d67bba09fb134cd71c48349674e0cacfaefee299620482c93f0b09edbfead578deb63083686ab691563b088fc0ea60a6281a0bcf9145689fb3ce1ec0f0 SHA512 c76effbca8ee63be48fa3aeb39c7038221848fe83ca2afc4e0904ba8c6a50b89aa2ad37080d4e3be75e9bdc2d6ca6dfefcda334ef55a5e1a8954bb955ce905e5 |
36 |
DIST postgresql-13.6.tar.bz2 21257213 BLAKE2B f5ea95fd9ffc8846e0aaf5bac03b02afa71e62e796bbe40f68af727a2f3c74eddd98cb68427bcc13b87b6fa00a8e2a7b18dd7749318f0a4a32cfdbf9b0e0a873 SHA512 2852726a3031b8d469f1c38f3019af02fc5afe40ec27b22288a29acefd30c63a98806bce88a214d0c2f9177f547b0b5010ad64e70bcbe2c2f1d97a27ae1984f8 |
37 |
+DIST postgresql-13.7.tar.bz2 21364433 BLAKE2B 2d8a505f6de4eb31cae415529eeac750a60abafcf45e7fde29043597b385a8150fac55df659f8c2ad200822e8063d388ed606dff9108d4407f9e26b893fa62f4 SHA512 9254f21519c8d4e926f70082503bb5593c91064a3d2a4ea18ac503dfd9aa94751d6f01ce00fca9fec9b2b7af40caf8d0951b661dd8be4d6aa87c1e35b6fa7a41 |
38 |
DIST postgresql-14.1.tar.bz2 21887101 BLAKE2B a496dfd513c52339d1b3cb72773f9611721fd7c5d2a702d6fd71f650a1d41c3d7bf6574eba23671c7f9f11718e007f51f9547949bdc3d7fe1ea2248ebfb8d70b SHA512 4a0bec157d5464bb9e5f5c0eb0efdede55526e03f6f4d660b87d161a47705eb152fa0878960b1581bce42a5ed28a1f457825ea54e8d22e34b5b8eb36473ceefd |
39 |
DIST postgresql-14.2.tar.bz2 21964841 BLAKE2B 6460533a40064404f18642147b949cf7c85d036c45ede478fb9af8919895ee7b09dc78b89ed08a292226911f07cfc9e46d7f2d42e0aaea546c5e97a291d599b9 SHA512 19aeb6528605dbcf5df84048b2eed8f54b202576134d3fe3900bb8f073179c4258d2581acd745887e7e6fa86ebdb5f7b159ffaa0a645d601efee7c5f7730456b |
40 |
+DIST postgresql-14.3.tar.bz2 22092190 BLAKE2B 8c9124cb758618d770a1084553f9e8f9a3fcb4e17e1aa4a1649e04f4c057f33ce1e5890bba3288bed2257236a4569735a77b3e5ddf989c2a2a4ef60ed494b3cc SHA512 70e6f67b5729a23f80b92b04e3fad2e09596b939660e3ddebf499d06af946459a45a019279e05413673e7b65d09a28a0440ed3c2ae565068466ed37e2d4f6f17 |
41 |
DIST postgresql-9.6.24.tar.bz2 19047518 BLAKE2B 63b53cfb2c9381fe09ed76ef3cad1ec5014bcd3b4dea388cda5b4ad8b8084abc15a38dcd62e0c3fe0bcc922749e7a4bef4ec39287c4b1ea952b8245bbc72bc2e SHA512 c17ef8e7149bd136f6058e20b28f9a7307625614e37ff837feb7a6fa37b6932dfab6379285120c9bb0198961eb446c9979d5ee1f3e8583b09f981f52bee33505 |
42 |
|
43 |
diff --git a/dev-db/postgresql/postgresql-10.21.ebuild b/dev-db/postgresql/postgresql-10.21.ebuild |
44 |
new file mode 100644 |
45 |
index 000000000000..93f17aa04271 |
46 |
--- /dev/null |
47 |
+++ b/dev-db/postgresql/postgresql-10.21.ebuild |
48 |
@@ -0,0 +1,453 @@ |
49 |
+# Copyright 1999-2022 Gentoo Authors |
50 |
+# Distributed under the terms of the GNU General Public License v2 |
51 |
+ |
52 |
+EAPI=7 |
53 |
+ |
54 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
55 |
+ |
56 |
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd tmpfiles |
57 |
+ |
58 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-macos ~x86-solaris" |
59 |
+ |
60 |
+SLOT=$(ver_cut 1) |
61 |
+ |
62 |
+MY_PV=${PV/_/} |
63 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
64 |
+ |
65 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
66 |
+ |
67 |
+LICENSE="POSTGRESQL GPL-2" |
68 |
+DESCRIPTION="PostgreSQL RDBMS" |
69 |
+HOMEPAGE="https://www.postgresql.org/" |
70 |
+ |
71 |
+IUSE="debug doc icu kerberos ldap nls pam perl |
72 |
+ python +readline selinux +server systemd ssl static-libs tcl |
73 |
+ threads uuid xml zlib" |
74 |
+ |
75 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
76 |
+ |
77 |
+CDEPEND=" |
78 |
+>=app-eselect/eselect-postgresql-2.0 |
79 |
+acct-group/postgres |
80 |
+acct-user/postgres |
81 |
+sys-apps/less |
82 |
+virtual/libcrypt:= |
83 |
+virtual/libintl |
84 |
+icu? ( dev-libs/icu:= ) |
85 |
+kerberos? ( virtual/krb5 ) |
86 |
+ldap? ( net-nds/openldap:= ) |
87 |
+pam? ( sys-libs/pam ) |
88 |
+perl? ( >=dev-lang/perl-5.8:= ) |
89 |
+python? ( ${PYTHON_DEPS} ) |
90 |
+readline? ( sys-libs/readline:0= ) |
91 |
+server? ( systemd? ( sys-apps/systemd ) ) |
92 |
+ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
93 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
94 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
95 |
+zlib? ( sys-libs/zlib ) |
96 |
+" |
97 |
+ |
98 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
99 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
100 |
+# the libc includes UUID functions. |
101 |
+UTIL_LINUX_LIBC=( elibc_{glibc,musl} ) |
102 |
+ |
103 |
+nest_usedep() { |
104 |
+ local front back |
105 |
+ while [[ ${#} -gt 1 ]]; do |
106 |
+ front+="${1}? ( " |
107 |
+ back+=" )" |
108 |
+ shift |
109 |
+ done |
110 |
+ echo "${front}${1}${back}" |
111 |
+} |
112 |
+ |
113 |
+CDEPEND+=" |
114 |
+uuid? ( |
115 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
116 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} dev-libs/ossp-uuid) |
117 |
+)" |
118 |
+ |
119 |
+DEPEND="${CDEPEND} |
120 |
+sys-devel/bison |
121 |
+sys-devel/flex |
122 |
+nls? ( sys-devel/gettext ) |
123 |
+xml? ( virtual/pkgconfig ) |
124 |
+" |
125 |
+ |
126 |
+RDEPEND="${CDEPEND} |
127 |
+selinux? ( sec-policy/selinux-postgresql ) |
128 |
+" |
129 |
+ |
130 |
+pkg_setup() { |
131 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
132 |
+ |
133 |
+ use python && python-single-r1_pkg_setup |
134 |
+} |
135 |
+ |
136 |
+src_prepare() { |
137 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
138 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
139 |
+ |
140 |
+ # Set proper run directory |
141 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
142 |
+ -i src/include/pg_config_manual.h || die |
143 |
+ |
144 |
+ # Rely on $PATH being in the proper order so that the correct |
145 |
+ # install program is used for modules utilizing PGXS in both |
146 |
+ # hardened and non-hardened environments. (Bug #528786) |
147 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
148 |
+ |
149 |
+ use server || eapply "${FILESDIR}/${PN}-10.2-no-server.patch" |
150 |
+ |
151 |
+ if use pam ; then |
152 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
153 |
+ -i src/backend/libpq/auth.c || \ |
154 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
155 |
+ fi |
156 |
+ |
157 |
+ # https://bugs.gentoo.org/753257 |
158 |
+ # https://bugs.gentoo.org/766225 |
159 |
+ eapply "${FILESDIR}"/postgresql-10.0-icu68.patch |
160 |
+ |
161 |
+ eapply_user |
162 |
+} |
163 |
+ |
164 |
+src_configure() { |
165 |
+ case ${CHOST} in |
166 |
+ *-darwin*|*-solaris*) |
167 |
+ use nls && append-libs intl |
168 |
+ ;; |
169 |
+ esac |
170 |
+ |
171 |
+ export LDFLAGS_SL="${LDFLAGS}" |
172 |
+ export LDFLAGS_EX="${LDFLAGS}" |
173 |
+ |
174 |
+ local PO="${EPREFIX}" |
175 |
+ |
176 |
+ local i uuid_config="" |
177 |
+ if use uuid; then |
178 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
179 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
180 |
+ done |
181 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
182 |
+ fi |
183 |
+ |
184 |
+ econf \ |
185 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
186 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
187 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
188 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
189 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
190 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
191 |
+ $(use_enable !alpha spinlocks) \ |
192 |
+ $(use_enable debug) \ |
193 |
+ $(use_enable threads thread-safety) \ |
194 |
+ $(use_with icu) \ |
195 |
+ $(use_with kerberos gssapi) \ |
196 |
+ $(use_with ldap) \ |
197 |
+ $(use_with pam) \ |
198 |
+ $(use_with perl) \ |
199 |
+ $(use_with python) \ |
200 |
+ $(use_with readline) \ |
201 |
+ $(use_with ssl openssl) \ |
202 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
203 |
+ $(use_with tcl) \ |
204 |
+ ${uuid_config} \ |
205 |
+ $(use_with xml libxml) \ |
206 |
+ $(use_with xml libxslt) \ |
207 |
+ $(use_with zlib) \ |
208 |
+ $(use_enable nls) |
209 |
+} |
210 |
+ |
211 |
+src_compile() { |
212 |
+ emake |
213 |
+ emake -C contrib |
214 |
+} |
215 |
+ |
216 |
+src_install() { |
217 |
+ emake DESTDIR="${D}" install |
218 |
+ emake DESTDIR="${D}" install -C contrib |
219 |
+ |
220 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
221 |
+ |
222 |
+ # man pages are already built, but if we have the target make them, |
223 |
+ # they'll be generated from source before being installed so we |
224 |
+ # manually install man pages. |
225 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
226 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
227 |
+ doins -r doc/src/sgml/man{1,3,7} |
228 |
+ if ! use server; then |
229 |
+ # Remove man pages for non-existent binaries |
230 |
+ serverman=( |
231 |
+ initdb |
232 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
233 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
234 |
+ post{gres,master} |
235 |
+ ) |
236 |
+ for m in ${serverman[@]} ; do |
237 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
238 |
+ done |
239 |
+ fi |
240 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
241 |
+ |
242 |
+ # Create slot specific man pages |
243 |
+ local bn f mansec slotted_name |
244 |
+ for mansec in 1 3 7 ; do |
245 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
246 |
+ |
247 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
248 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
249 |
+ |
250 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
251 |
+ bn=$(basename "${f}") |
252 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
253 |
+ case ${bn} in |
254 |
+ TABLE.7|WITH.7) |
255 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
256 |
+ ;; |
257 |
+ *) |
258 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
259 |
+ ;; |
260 |
+ esac |
261 |
+ done |
262 |
+ |
263 |
+ popd > /dev/null |
264 |
+ done |
265 |
+ |
266 |
+ insinto /etc/postgresql-${SLOT} |
267 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
268 |
+ |
269 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
270 |
+ # needed by extensions utilizing PGXS. |
271 |
+ use static-libs || \ |
272 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
273 |
+ -delete |
274 |
+ |
275 |
+ # Make slot specific links to programs |
276 |
+ local f bn |
277 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
278 |
+ -mindepth 1 -maxdepth 1) |
279 |
+ do |
280 |
+ bn=$(basename "${f}") |
281 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
282 |
+ "/usr/bin/${bn}${SLOT/.}" |
283 |
+ done |
284 |
+ |
285 |
+ if use doc ; then |
286 |
+ docinto html |
287 |
+ dodoc doc/src/sgml/html/* |
288 |
+ fi |
289 |
+ |
290 |
+ if use server; then |
291 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
292 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
293 |
+ |
294 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
295 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
296 |
+ |
297 |
+ if use systemd; then |
298 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
299 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
300 |
+ systemd_newunit - ${PN}-${SLOT}.service |
301 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
302 |
+ newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
303 |
+ fi |
304 |
+ |
305 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
306 |
+ |
307 |
+ if use prefix ; then |
308 |
+ keepdir /run/postgresql |
309 |
+ fperms 1775 /run/postgresql |
310 |
+ fi |
311 |
+ fi |
312 |
+} |
313 |
+ |
314 |
+pkg_postinst() { |
315 |
+ use server && use systemd && tmpfiles_process ${PN}-${SLOT}.conf |
316 |
+ postgresql-config update |
317 |
+ |
318 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
319 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
320 |
+ |
321 |
+ if use server ; then |
322 |
+ elog |
323 |
+ elog "Gentoo specific documentation:" |
324 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
325 |
+ elog |
326 |
+ elog "Official documentation:" |
327 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
328 |
+ elog |
329 |
+ elog "The default location of the Unix-domain socket is:" |
330 |
+ elog " ${EROOT}/run/postgresql/" |
331 |
+ elog |
332 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
333 |
+ elog "so that it contains your preferred locale in:" |
334 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
335 |
+ elog |
336 |
+ elog "Then, execute the following command to setup the initial database" |
337 |
+ elog "environment:" |
338 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
339 |
+ |
340 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
341 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
342 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
343 |
+ ewarn "the following command after upgrading:" |
344 |
+ ewarn |
345 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
346 |
+ fi |
347 |
+ fi |
348 |
+} |
349 |
+ |
350 |
+pkg_prerm() { |
351 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
352 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
353 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
354 |
+ |
355 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
356 |
+ sleep 10 |
357 |
+ eend 0 |
358 |
+ fi |
359 |
+} |
360 |
+ |
361 |
+pkg_postrm() { |
362 |
+ postgresql-config update |
363 |
+} |
364 |
+ |
365 |
+pkg_config() { |
366 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
367 |
+ |
368 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
369 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
370 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
371 |
+ [[ -z "${DATA_DIR}" ]] \ |
372 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
373 |
+ |
374 |
+ # environment.bz2 may not contain the same locale as the current system |
375 |
+ # locale. Unset and source from the current system locale. |
376 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
377 |
+ unset LANG |
378 |
+ unset LC_CTYPE |
379 |
+ unset LC_NUMERIC |
380 |
+ unset LC_TIME |
381 |
+ unset LC_COLLATE |
382 |
+ unset LC_MONETARY |
383 |
+ unset LC_MESSAGES |
384 |
+ unset LC_ALL |
385 |
+ source "${EROOT}/etc/env.d/02locale" |
386 |
+ [ -n "${LANG}" ] && export LANG |
387 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
388 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
389 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
390 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
391 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
392 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
393 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
394 |
+ fi |
395 |
+ |
396 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
397 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
398 |
+ einfo |
399 |
+ einfo "Information on options that can be passed to initdb are found at:" |
400 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
401 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
402 |
+ einfo |
403 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
404 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
405 |
+ einfo " (none)" |
406 |
+ else |
407 |
+ einfo " ${PG_INITDB_OPTS}" |
408 |
+ fi |
409 |
+ einfo |
410 |
+ einfo "Configuration files will be installed to:" |
411 |
+ einfo " ${PGDATA}" |
412 |
+ einfo |
413 |
+ einfo "The database cluster will be created in:" |
414 |
+ einfo " ${DATA_DIR}" |
415 |
+ einfo |
416 |
+ |
417 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
418 |
+ sleep 5 |
419 |
+ eend 0 |
420 |
+ |
421 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
422 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
423 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
424 |
+ die "${DATA_DIR} is not empty." |
425 |
+ fi |
426 |
+ |
427 |
+ einfo "Creating the data directory ..." |
428 |
+ if [[ ${EUID} == 0 ]] ; then |
429 |
+ mkdir -p "${DATA_DIR}" |
430 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
431 |
+ chmod 0700 "${DATA_DIR}" |
432 |
+ fi |
433 |
+ |
434 |
+ einfo "Initializing the database ..." |
435 |
+ |
436 |
+ if [[ ${EUID} == 0 ]] ; then |
437 |
+ su - postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
438 |
+ else |
439 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
440 |
+ fi |
441 |
+ |
442 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
443 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
444 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
445 |
+ fi |
446 |
+ |
447 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
448 |
+ # overridden in the initscript |
449 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
450 |
+ |
451 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
452 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
453 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
454 |
+ # characters in PL/Perl |
455 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
456 |
+ EOF |
457 |
+ |
458 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
459 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
460 |
+ einfo "by default. You can disable it in the cluster's:" |
461 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
462 |
+ einfo |
463 |
+ if ! use systemd; then |
464 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
465 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
466 |
+ einfo |
467 |
+ fi |
468 |
+ if use prefix ; then |
469 |
+ einfo "The location of the configuration files have moved to:" |
470 |
+ einfo " ${PGDATA}" |
471 |
+ einfo "To start the server:" |
472 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
473 |
+ einfo "To stop:" |
474 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
475 |
+ einfo |
476 |
+ einfo "Or move the configuration files back:" |
477 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
478 |
+ elif use systemd; then |
479 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
480 |
+ einfo "instead of 'pg_ctl'." |
481 |
+ else |
482 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
483 |
+ einfo "instead of 'pg_ctl'." |
484 |
+ fi |
485 |
+} |
486 |
+ |
487 |
+src_test() { |
488 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
489 |
+ emake check |
490 |
+ |
491 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
492 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
493 |
+ else |
494 |
+ use server || \ |
495 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
496 |
+ [[ ${UID} -eq 0 ]] || \ |
497 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
498 |
+ |
499 |
+ ewarn 'Skipping.' |
500 |
+ fi |
501 |
+} |
502 |
|
503 |
diff --git a/dev-db/postgresql/postgresql-11.16.ebuild b/dev-db/postgresql/postgresql-11.16.ebuild |
504 |
new file mode 100644 |
505 |
index 000000000000..4be0a8926b5d |
506 |
--- /dev/null |
507 |
+++ b/dev-db/postgresql/postgresql-11.16.ebuild |
508 |
@@ -0,0 +1,453 @@ |
509 |
+# Copyright 1999-2022 Gentoo Authors |
510 |
+# Distributed under the terms of the GNU General Public License v2 |
511 |
+ |
512 |
+EAPI=7 |
513 |
+ |
514 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
515 |
+LLVM_MAX_SLOT=13 |
516 |
+ |
517 |
+inherit flag-o-matic linux-info llvm multilib pam prefix python-single-r1 systemd tmpfiles |
518 |
+ |
519 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
520 |
+ |
521 |
+SLOT=$(ver_cut 1) |
522 |
+ |
523 |
+MY_PV=${PV/_/} |
524 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
525 |
+ |
526 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
527 |
+ |
528 |
+LICENSE="POSTGRESQL GPL-2" |
529 |
+DESCRIPTION="PostgreSQL RDBMS" |
530 |
+HOMEPAGE="https://www.postgresql.org/" |
531 |
+ |
532 |
+IUSE="debug doc icu kerberos ldap llvm nls pam |
533 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
534 |
+ threads uuid xml zlib" |
535 |
+ |
536 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
537 |
+ |
538 |
+CDEPEND=" |
539 |
+>=app-eselect/eselect-postgresql-2.0 |
540 |
+acct-group/postgres |
541 |
+acct-user/postgres |
542 |
+sys-apps/less |
543 |
+virtual/libintl |
544 |
+icu? ( dev-libs/icu:= ) |
545 |
+kerberos? ( virtual/krb5 ) |
546 |
+ldap? ( net-nds/openldap:= ) |
547 |
+llvm? ( |
548 |
+ <sys-devel/llvm-14:= |
549 |
+ <sys-devel/clang-14:= |
550 |
+) |
551 |
+pam? ( sys-libs/pam ) |
552 |
+perl? ( >=dev-lang/perl-5.8:= ) |
553 |
+python? ( ${PYTHON_DEPS} ) |
554 |
+readline? ( sys-libs/readline:0= ) |
555 |
+server? ( systemd? ( sys-apps/systemd ) ) |
556 |
+ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
557 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
558 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
559 |
+zlib? ( sys-libs/zlib ) |
560 |
+" |
561 |
+ |
562 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
563 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
564 |
+# the libc includes UUID functions. |
565 |
+UTIL_LINUX_LIBC=( elibc_{glibc,musl} ) |
566 |
+ |
567 |
+nest_usedep() { |
568 |
+ local front back |
569 |
+ while [[ ${#} -gt 1 ]]; do |
570 |
+ front+="${1}? ( " |
571 |
+ back+=" )" |
572 |
+ shift |
573 |
+ done |
574 |
+ echo "${front}${1}${back}" |
575 |
+} |
576 |
+ |
577 |
+CDEPEND+=" |
578 |
+uuid? ( |
579 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
580 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} dev-libs/ossp-uuid) |
581 |
+)" |
582 |
+ |
583 |
+DEPEND="${CDEPEND} |
584 |
+sys-devel/bison |
585 |
+sys-devel/flex |
586 |
+nls? ( sys-devel/gettext ) |
587 |
+xml? ( virtual/pkgconfig ) |
588 |
+" |
589 |
+ |
590 |
+RDEPEND="${CDEPEND} |
591 |
+selinux? ( sec-policy/selinux-postgresql ) |
592 |
+" |
593 |
+ |
594 |
+pkg_setup() { |
595 |
+ use llvm && llvm_pkg_setup |
596 |
+ |
597 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
598 |
+ |
599 |
+ use python && python-single-r1_pkg_setup |
600 |
+} |
601 |
+ |
602 |
+src_prepare() { |
603 |
+ # Set proper run directory |
604 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
605 |
+ -i src/include/pg_config_manual.h || die |
606 |
+ |
607 |
+ # Rely on $PATH being in the proper order so that the correct |
608 |
+ # install program is used for modules utilizing PGXS in both |
609 |
+ # hardened and non-hardened environments. (Bug #528786) |
610 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
611 |
+ |
612 |
+ use server || eapply "${FILESDIR}/${PN}-11_beta1-no-server.patch" |
613 |
+ |
614 |
+ if use pam ; then |
615 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
616 |
+ -i src/backend/libpq/auth.c || \ |
617 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
618 |
+ fi |
619 |
+ |
620 |
+ eapply_user |
621 |
+} |
622 |
+ |
623 |
+src_configure() { |
624 |
+ case ${CHOST} in |
625 |
+ *-darwin*|*-solaris*) |
626 |
+ use nls && append-libs intl |
627 |
+ ;; |
628 |
+ esac |
629 |
+ |
630 |
+ export LDFLAGS_SL="${LDFLAGS}" |
631 |
+ export LDFLAGS_EX="${LDFLAGS}" |
632 |
+ |
633 |
+ local PO="${EPREFIX}" |
634 |
+ |
635 |
+ local i uuid_config="" |
636 |
+ if use uuid; then |
637 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
638 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
639 |
+ done |
640 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
641 |
+ fi |
642 |
+ |
643 |
+ econf \ |
644 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
645 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
646 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
647 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
648 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
649 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
650 |
+ $(use_enable !alpha spinlocks) \ |
651 |
+ $(use_enable debug) \ |
652 |
+ $(use_enable threads thread-safety) \ |
653 |
+ $(use_with icu) \ |
654 |
+ $(use_with kerberos gssapi) \ |
655 |
+ $(use_with ldap) \ |
656 |
+ $(use_with llvm) \ |
657 |
+ $(use_with pam) \ |
658 |
+ $(use_with perl) \ |
659 |
+ $(use_with python) \ |
660 |
+ $(use_with readline) \ |
661 |
+ $(use_with ssl openssl) \ |
662 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
663 |
+ $(use_with tcl) \ |
664 |
+ ${uuid_config} \ |
665 |
+ $(use_with xml libxml) \ |
666 |
+ $(use_with xml libxslt) \ |
667 |
+ $(use_with zlib) \ |
668 |
+ $(use_enable nls) |
669 |
+} |
670 |
+ |
671 |
+src_compile() { |
672 |
+ emake |
673 |
+ emake -C contrib |
674 |
+} |
675 |
+ |
676 |
+src_install() { |
677 |
+ emake DESTDIR="${D}" install |
678 |
+ emake DESTDIR="${D}" install -C contrib |
679 |
+ |
680 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
681 |
+ |
682 |
+ # man pages are already built, but if we have the target make them, |
683 |
+ # they'll be generated from source before being installed so we |
684 |
+ # manually install man pages. |
685 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
686 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
687 |
+ doins -r doc/src/sgml/man{1,3,7} |
688 |
+ if ! use server; then |
689 |
+ # Remove man pages for non-existent binaries |
690 |
+ serverman=( |
691 |
+ initdb |
692 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
693 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
694 |
+ post{gres,master} |
695 |
+ ) |
696 |
+ for m in ${serverman[@]} ; do |
697 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
698 |
+ done |
699 |
+ fi |
700 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
701 |
+ |
702 |
+ # Create slot specific man pages |
703 |
+ local bn f mansec slotted_name |
704 |
+ for mansec in 1 3 7 ; do |
705 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
706 |
+ |
707 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
708 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
709 |
+ |
710 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
711 |
+ bn=$(basename "${f}") |
712 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
713 |
+ case ${bn} in |
714 |
+ TABLE.7|WITH.7) |
715 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
716 |
+ ;; |
717 |
+ *) |
718 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
719 |
+ ;; |
720 |
+ esac |
721 |
+ done |
722 |
+ |
723 |
+ popd > /dev/null |
724 |
+ done |
725 |
+ |
726 |
+ insinto /etc/postgresql-${SLOT} |
727 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
728 |
+ |
729 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
730 |
+ # needed by extensions utilizing PGXS. |
731 |
+ use static-libs || \ |
732 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
733 |
+ -delete |
734 |
+ |
735 |
+ # Make slot specific links to programs |
736 |
+ local f bn |
737 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
738 |
+ -mindepth 1 -maxdepth 1) |
739 |
+ do |
740 |
+ bn=$(basename "${f}") |
741 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
742 |
+ "/usr/bin/${bn}${SLOT/.}" |
743 |
+ done |
744 |
+ |
745 |
+ if use doc ; then |
746 |
+ docinto html |
747 |
+ dodoc doc/src/sgml/html/* |
748 |
+ fi |
749 |
+ |
750 |
+ if use server; then |
751 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
752 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
753 |
+ |
754 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
755 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
756 |
+ |
757 |
+ if use systemd; then |
758 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
759 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
760 |
+ systemd_newunit - ${PN}-${SLOT}.service |
761 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
762 |
+ newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
763 |
+ fi |
764 |
+ |
765 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
766 |
+ |
767 |
+ if use prefix ; then |
768 |
+ keepdir /run/postgresql |
769 |
+ fperms 1775 /run/postgresql |
770 |
+ fi |
771 |
+ fi |
772 |
+} |
773 |
+ |
774 |
+pkg_postinst() { |
775 |
+ use server && use systemd && tmpfiles_process ${PN}-${SLOT}.conf |
776 |
+ postgresql-config update |
777 |
+ |
778 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
779 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
780 |
+ |
781 |
+ if use server ; then |
782 |
+ elog |
783 |
+ elog "Gentoo specific documentation:" |
784 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
785 |
+ elog |
786 |
+ elog "Official documentation:" |
787 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
788 |
+ elog |
789 |
+ elog "The default location of the Unix-domain socket is:" |
790 |
+ elog " ${EROOT}/run/postgresql/" |
791 |
+ elog |
792 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
793 |
+ elog "so that it contains your preferred locale in:" |
794 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
795 |
+ elog |
796 |
+ elog "Then, execute the following command to setup the initial database" |
797 |
+ elog "environment:" |
798 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
799 |
+ |
800 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
801 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
802 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
803 |
+ ewarn "the following command after upgrading:" |
804 |
+ ewarn |
805 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
806 |
+ fi |
807 |
+ fi |
808 |
+} |
809 |
+ |
810 |
+pkg_prerm() { |
811 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
812 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
813 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
814 |
+ |
815 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
816 |
+ sleep 10 |
817 |
+ eend 0 |
818 |
+ fi |
819 |
+} |
820 |
+ |
821 |
+pkg_postrm() { |
822 |
+ postgresql-config update |
823 |
+} |
824 |
+ |
825 |
+pkg_config() { |
826 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
827 |
+ |
828 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
829 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
830 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
831 |
+ [[ -z "${DATA_DIR}" ]] \ |
832 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
833 |
+ |
834 |
+ # environment.bz2 may not contain the same locale as the current system |
835 |
+ # locale. Unset and source from the current system locale. |
836 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
837 |
+ unset LANG |
838 |
+ unset LC_CTYPE |
839 |
+ unset LC_NUMERIC |
840 |
+ unset LC_TIME |
841 |
+ unset LC_COLLATE |
842 |
+ unset LC_MONETARY |
843 |
+ unset LC_MESSAGES |
844 |
+ unset LC_ALL |
845 |
+ source "${EROOT}/etc/env.d/02locale" |
846 |
+ [ -n "${LANG}" ] && export LANG |
847 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
848 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
849 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
850 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
851 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
852 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
853 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
854 |
+ fi |
855 |
+ |
856 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
857 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
858 |
+ einfo |
859 |
+ einfo "Information on options that can be passed to initdb are found at:" |
860 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
861 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
862 |
+ einfo |
863 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
864 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
865 |
+ einfo " (none)" |
866 |
+ else |
867 |
+ einfo " ${PG_INITDB_OPTS}" |
868 |
+ fi |
869 |
+ einfo |
870 |
+ einfo "Configuration files will be installed to:" |
871 |
+ einfo " ${PGDATA}" |
872 |
+ einfo |
873 |
+ einfo "The database cluster will be created in:" |
874 |
+ einfo " ${DATA_DIR}" |
875 |
+ einfo |
876 |
+ |
877 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
878 |
+ sleep 5 |
879 |
+ eend 0 |
880 |
+ |
881 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
882 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
883 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
884 |
+ die "${DATA_DIR} is not empty." |
885 |
+ fi |
886 |
+ |
887 |
+ einfo "Creating the data directory ..." |
888 |
+ if [[ ${EUID} == 0 ]] ; then |
889 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
890 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
891 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
892 |
+ fi |
893 |
+ |
894 |
+ einfo "Initializing the database ..." |
895 |
+ |
896 |
+ if [[ ${EUID} == 0 ]] ; then |
897 |
+ su - postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
898 |
+ else |
899 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
900 |
+ fi |
901 |
+ |
902 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
903 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
904 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
905 |
+ fi |
906 |
+ |
907 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
908 |
+ # overridden in the initscript |
909 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
910 |
+ |
911 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
912 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
913 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
914 |
+ # characters in PL/Perl |
915 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
916 |
+ EOF |
917 |
+ |
918 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
919 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
920 |
+ einfo "by default. You can disable it in the cluster's:" |
921 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
922 |
+ einfo |
923 |
+ if ! use systemd; then |
924 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
925 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
926 |
+ einfo |
927 |
+ fi |
928 |
+ if use prefix ; then |
929 |
+ einfo "The location of the configuration files have moved to:" |
930 |
+ einfo " ${PGDATA}" |
931 |
+ einfo "To start the server:" |
932 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
933 |
+ einfo "To stop:" |
934 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
935 |
+ einfo |
936 |
+ einfo "Or move the configuration files back:" |
937 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
938 |
+ elif use systemd; then |
939 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
940 |
+ einfo "instead of 'pg_ctl'." |
941 |
+ else |
942 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
943 |
+ einfo "instead of 'pg_ctl'." |
944 |
+ fi |
945 |
+} |
946 |
+ |
947 |
+src_test() { |
948 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
949 |
+ emake check |
950 |
+ |
951 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
952 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
953 |
+ else |
954 |
+ use server || \ |
955 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
956 |
+ [[ ${UID} -eq 0 ]] || \ |
957 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
958 |
+ |
959 |
+ ewarn 'Skipping.' |
960 |
+ fi |
961 |
+} |
962 |
|
963 |
diff --git a/dev-db/postgresql/postgresql-12.11.ebuild b/dev-db/postgresql/postgresql-12.11.ebuild |
964 |
new file mode 100644 |
965 |
index 000000000000..b34da8d7f42d |
966 |
--- /dev/null |
967 |
+++ b/dev-db/postgresql/postgresql-12.11.ebuild |
968 |
@@ -0,0 +1,454 @@ |
969 |
+# Copyright 1999-2022 Gentoo Authors |
970 |
+# Distributed under the terms of the GNU General Public License v2 |
971 |
+ |
972 |
+EAPI=7 |
973 |
+ |
974 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
975 |
+LLVM_MAX_SLOT=14 |
976 |
+ |
977 |
+inherit flag-o-matic linux-info llvm multilib pam prefix python-single-r1 systemd tmpfiles |
978 |
+ |
979 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
980 |
+ |
981 |
+SLOT=$(ver_cut 1) |
982 |
+ |
983 |
+MY_PV=${PV/_/} |
984 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
985 |
+ |
986 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
987 |
+ |
988 |
+LICENSE="POSTGRESQL GPL-2" |
989 |
+DESCRIPTION="PostgreSQL RDBMS" |
990 |
+HOMEPAGE="https://www.postgresql.org/" |
991 |
+ |
992 |
+IUSE="debug doc icu kerberos ldap llvm nls pam |
993 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
994 |
+ threads uuid xml zlib" |
995 |
+ |
996 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
997 |
+ |
998 |
+CDEPEND=" |
999 |
+>=app-eselect/eselect-postgresql-2.0 |
1000 |
+acct-group/postgres |
1001 |
+acct-user/postgres |
1002 |
+sys-apps/less |
1003 |
+virtual/libintl |
1004 |
+icu? ( dev-libs/icu:= ) |
1005 |
+kerberos? ( virtual/krb5 ) |
1006 |
+ldap? ( net-nds/openldap:= ) |
1007 |
+llvm? ( |
1008 |
+ <sys-devel/llvm-15:= |
1009 |
+ <sys-devel/clang-15:= |
1010 |
+) |
1011 |
+pam? ( sys-libs/pam ) |
1012 |
+perl? ( >=dev-lang/perl-5.8:= ) |
1013 |
+python? ( ${PYTHON_DEPS} ) |
1014 |
+readline? ( sys-libs/readline:0= ) |
1015 |
+server? ( systemd? ( sys-apps/systemd ) ) |
1016 |
+ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1017 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
1018 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1019 |
+zlib? ( sys-libs/zlib ) |
1020 |
+" |
1021 |
+ |
1022 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1023 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1024 |
+# the libc includes UUID functions. |
1025 |
+UTIL_LINUX_LIBC=( elibc_{glibc,musl} ) |
1026 |
+ |
1027 |
+nest_usedep() { |
1028 |
+ local front back |
1029 |
+ while [[ ${#} -gt 1 ]]; do |
1030 |
+ front+="${1}? ( " |
1031 |
+ back+=" )" |
1032 |
+ shift |
1033 |
+ done |
1034 |
+ echo "${front}${1}${back}" |
1035 |
+} |
1036 |
+ |
1037 |
+CDEPEND+=" |
1038 |
+uuid? ( |
1039 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1040 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1041 |
+)" |
1042 |
+ |
1043 |
+DEPEND="${CDEPEND} |
1044 |
+sys-devel/bison |
1045 |
+sys-devel/flex |
1046 |
+nls? ( sys-devel/gettext ) |
1047 |
+xml? ( virtual/pkgconfig ) |
1048 |
+" |
1049 |
+ |
1050 |
+RDEPEND="${CDEPEND} |
1051 |
+selinux? ( sec-policy/selinux-postgresql ) |
1052 |
+" |
1053 |
+ |
1054 |
+pkg_setup() { |
1055 |
+ use llvm && llvm_pkg_setup |
1056 |
+ |
1057 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1058 |
+ |
1059 |
+ use python && python-single-r1_pkg_setup |
1060 |
+} |
1061 |
+ |
1062 |
+src_prepare() { |
1063 |
+ # Set proper run directory |
1064 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1065 |
+ -i src/include/pg_config_manual.h || die |
1066 |
+ |
1067 |
+ # Rely on $PATH being in the proper order so that the correct |
1068 |
+ # install program is used for modules utilizing PGXS in both |
1069 |
+ # hardened and non-hardened environments. (Bug #528786) |
1070 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1071 |
+ |
1072 |
+ use server || eapply "${FILESDIR}/${PN}-12.1-no-server.patch" |
1073 |
+ use llvm && eapply "${FILESDIR}/postgres-llvm14.patch" |
1074 |
+ |
1075 |
+ if use pam ; then |
1076 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1077 |
+ -i src/backend/libpq/auth.c || \ |
1078 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
1079 |
+ fi |
1080 |
+ |
1081 |
+ eapply_user |
1082 |
+} |
1083 |
+ |
1084 |
+src_configure() { |
1085 |
+ case ${CHOST} in |
1086 |
+ *-darwin*|*-solaris*) |
1087 |
+ use nls && append-libs intl |
1088 |
+ ;; |
1089 |
+ esac |
1090 |
+ |
1091 |
+ export LDFLAGS_SL="${LDFLAGS}" |
1092 |
+ export LDFLAGS_EX="${LDFLAGS}" |
1093 |
+ |
1094 |
+ local PO="${EPREFIX}" |
1095 |
+ |
1096 |
+ local i uuid_config="" |
1097 |
+ if use uuid; then |
1098 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1099 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1100 |
+ done |
1101 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1102 |
+ fi |
1103 |
+ |
1104 |
+ econf \ |
1105 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1106 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1107 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1108 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1109 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1110 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1111 |
+ $(use_enable !alpha spinlocks) \ |
1112 |
+ $(use_enable debug) \ |
1113 |
+ $(use_enable threads thread-safety) \ |
1114 |
+ $(use_with icu) \ |
1115 |
+ $(use_with kerberos gssapi) \ |
1116 |
+ $(use_with ldap) \ |
1117 |
+ $(use_with llvm) \ |
1118 |
+ $(use_with pam) \ |
1119 |
+ $(use_with perl) \ |
1120 |
+ $(use_with python) \ |
1121 |
+ $(use_with readline) \ |
1122 |
+ $(use_with ssl openssl) \ |
1123 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
1124 |
+ $(use_with tcl) \ |
1125 |
+ ${uuid_config} \ |
1126 |
+ $(use_with xml libxml) \ |
1127 |
+ $(use_with xml libxslt) \ |
1128 |
+ $(use_with zlib) \ |
1129 |
+ $(use_enable nls) |
1130 |
+} |
1131 |
+ |
1132 |
+src_compile() { |
1133 |
+ emake |
1134 |
+ emake -C contrib |
1135 |
+} |
1136 |
+ |
1137 |
+src_install() { |
1138 |
+ emake DESTDIR="${D}" install |
1139 |
+ emake DESTDIR="${D}" install -C contrib |
1140 |
+ |
1141 |
+ dodoc README HISTORY |
1142 |
+ |
1143 |
+ # man pages are already built, but if we have the target make them, |
1144 |
+ # they'll be generated from source before being installed so we |
1145 |
+ # manually install man pages. |
1146 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1147 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1148 |
+ doins -r doc/src/sgml/man{1,3,7} |
1149 |
+ if ! use server; then |
1150 |
+ # Remove man pages for non-existent binaries |
1151 |
+ serverman=( |
1152 |
+ initdb |
1153 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
1154 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
1155 |
+ post{gres,master} |
1156 |
+ ) |
1157 |
+ for m in ${serverman[@]} ; do |
1158 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1159 |
+ done |
1160 |
+ fi |
1161 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1162 |
+ |
1163 |
+ # Create slot specific man pages |
1164 |
+ local bn f mansec slotted_name |
1165 |
+ for mansec in 1 3 7 ; do |
1166 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
1167 |
+ |
1168 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
1169 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
1170 |
+ |
1171 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
1172 |
+ bn=$(basename "${f}") |
1173 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
1174 |
+ case ${bn} in |
1175 |
+ TABLE.7|WITH.7) |
1176 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
1177 |
+ ;; |
1178 |
+ *) |
1179 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
1180 |
+ ;; |
1181 |
+ esac |
1182 |
+ done |
1183 |
+ |
1184 |
+ popd > /dev/null |
1185 |
+ done |
1186 |
+ |
1187 |
+ insinto /etc/postgresql-${SLOT} |
1188 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
1189 |
+ |
1190 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
1191 |
+ # needed by extensions utilizing PGXS. |
1192 |
+ use static-libs || \ |
1193 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
1194 |
+ -delete |
1195 |
+ |
1196 |
+ # Make slot specific links to programs |
1197 |
+ local f bn |
1198 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1199 |
+ -mindepth 1 -maxdepth 1) |
1200 |
+ do |
1201 |
+ bn=$(basename "${f}") |
1202 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1203 |
+ "/usr/bin/${bn}${SLOT/.}" |
1204 |
+ done |
1205 |
+ |
1206 |
+ if use doc ; then |
1207 |
+ docinto html |
1208 |
+ dodoc doc/src/sgml/html/* |
1209 |
+ fi |
1210 |
+ |
1211 |
+ if use server; then |
1212 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1213 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1214 |
+ |
1215 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1216 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1217 |
+ |
1218 |
+ if use systemd; then |
1219 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1220 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
1221 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1222 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1223 |
+ newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
1224 |
+ fi |
1225 |
+ |
1226 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1227 |
+ |
1228 |
+ if use prefix ; then |
1229 |
+ keepdir /run/postgresql |
1230 |
+ fperms 1775 /run/postgresql |
1231 |
+ fi |
1232 |
+ fi |
1233 |
+} |
1234 |
+ |
1235 |
+pkg_postinst() { |
1236 |
+ use server && use systemd && tmpfiles_process ${PN}-${SLOT}.conf |
1237 |
+ postgresql-config update |
1238 |
+ |
1239 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
1240 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
1241 |
+ |
1242 |
+ if use server ; then |
1243 |
+ elog |
1244 |
+ elog "Gentoo specific documentation:" |
1245 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1246 |
+ elog |
1247 |
+ elog "Official documentation:" |
1248 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
1249 |
+ elog |
1250 |
+ elog "The default location of the Unix-domain socket is:" |
1251 |
+ elog " ${EROOT}/run/postgresql/" |
1252 |
+ elog |
1253 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1254 |
+ elog "so that it contains your preferred locale in:" |
1255 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1256 |
+ elog |
1257 |
+ elog "Then, execute the following command to setup the initial database" |
1258 |
+ elog "environment:" |
1259 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1260 |
+ |
1261 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
1262 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
1263 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
1264 |
+ ewarn "the following command after upgrading:" |
1265 |
+ ewarn |
1266 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
1267 |
+ fi |
1268 |
+ fi |
1269 |
+} |
1270 |
+ |
1271 |
+pkg_prerm() { |
1272 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1273 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1274 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1275 |
+ |
1276 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1277 |
+ sleep 10 |
1278 |
+ eend 0 |
1279 |
+ fi |
1280 |
+} |
1281 |
+ |
1282 |
+pkg_postrm() { |
1283 |
+ postgresql-config update |
1284 |
+} |
1285 |
+ |
1286 |
+pkg_config() { |
1287 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1288 |
+ |
1289 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1290 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1291 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
1292 |
+ [[ -z "${DATA_DIR}" ]] \ |
1293 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
1294 |
+ |
1295 |
+ # environment.bz2 may not contain the same locale as the current system |
1296 |
+ # locale. Unset and source from the current system locale. |
1297 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
1298 |
+ unset LANG |
1299 |
+ unset LC_CTYPE |
1300 |
+ unset LC_NUMERIC |
1301 |
+ unset LC_TIME |
1302 |
+ unset LC_COLLATE |
1303 |
+ unset LC_MONETARY |
1304 |
+ unset LC_MESSAGES |
1305 |
+ unset LC_ALL |
1306 |
+ source "${EROOT}/etc/env.d/02locale" |
1307 |
+ [ -n "${LANG}" ] && export LANG |
1308 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1309 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1310 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
1311 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1312 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1313 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1314 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
1315 |
+ fi |
1316 |
+ |
1317 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
1318 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1319 |
+ einfo |
1320 |
+ einfo "Information on options that can be passed to initdb are found at:" |
1321 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1322 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1323 |
+ einfo |
1324 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
1325 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1326 |
+ einfo " (none)" |
1327 |
+ else |
1328 |
+ einfo " ${PG_INITDB_OPTS}" |
1329 |
+ fi |
1330 |
+ einfo |
1331 |
+ einfo "Configuration files will be installed to:" |
1332 |
+ einfo " ${PGDATA}" |
1333 |
+ einfo |
1334 |
+ einfo "The database cluster will be created in:" |
1335 |
+ einfo " ${DATA_DIR}" |
1336 |
+ einfo |
1337 |
+ |
1338 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1339 |
+ sleep 5 |
1340 |
+ eend 0 |
1341 |
+ |
1342 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1343 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
1344 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
1345 |
+ die "${DATA_DIR} is not empty." |
1346 |
+ fi |
1347 |
+ |
1348 |
+ einfo "Creating the data directory ..." |
1349 |
+ if [[ ${EUID} == 0 ]] ; then |
1350 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
1351 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
1352 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
1353 |
+ fi |
1354 |
+ |
1355 |
+ einfo "Initializing the database ..." |
1356 |
+ |
1357 |
+ if [[ ${EUID} == 0 ]] ; then |
1358 |
+ su - postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1359 |
+ else |
1360 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1361 |
+ fi |
1362 |
+ |
1363 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1364 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1365 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1366 |
+ fi |
1367 |
+ |
1368 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
1369 |
+ # overridden in the initscript |
1370 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1371 |
+ |
1372 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1373 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1374 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
1375 |
+ # characters in PL/Perl |
1376 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1377 |
+ EOF |
1378 |
+ |
1379 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1380 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1381 |
+ einfo "by default. You can disable it in the cluster's:" |
1382 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
1383 |
+ einfo |
1384 |
+ if ! use systemd; then |
1385 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
1386 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
1387 |
+ einfo |
1388 |
+ fi |
1389 |
+ if use prefix ; then |
1390 |
+ einfo "The location of the configuration files have moved to:" |
1391 |
+ einfo " ${PGDATA}" |
1392 |
+ einfo "To start the server:" |
1393 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1394 |
+ einfo "To stop:" |
1395 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
1396 |
+ einfo |
1397 |
+ einfo "Or move the configuration files back:" |
1398 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1399 |
+ elif use systemd; then |
1400 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
1401 |
+ einfo "instead of 'pg_ctl'." |
1402 |
+ else |
1403 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1404 |
+ einfo "instead of 'pg_ctl'." |
1405 |
+ fi |
1406 |
+} |
1407 |
+ |
1408 |
+src_test() { |
1409 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1410 |
+ emake check |
1411 |
+ |
1412 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
1413 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
1414 |
+ else |
1415 |
+ use server || \ |
1416 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1417 |
+ [[ ${UID} -eq 0 ]] || \ |
1418 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1419 |
+ |
1420 |
+ ewarn 'Skipping.' |
1421 |
+ fi |
1422 |
+} |
1423 |
|
1424 |
diff --git a/dev-db/postgresql/postgresql-13.7.ebuild b/dev-db/postgresql/postgresql-13.7.ebuild |
1425 |
new file mode 100644 |
1426 |
index 000000000000..3ecf907af22e |
1427 |
--- /dev/null |
1428 |
+++ b/dev-db/postgresql/postgresql-13.7.ebuild |
1429 |
@@ -0,0 +1,466 @@ |
1430 |
+# Copyright 1999-2022 Gentoo Authors |
1431 |
+# Distributed under the terms of the GNU General Public License v2 |
1432 |
+ |
1433 |
+EAPI=7 |
1434 |
+ |
1435 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
1436 |
+LLVM_MAX_SLOT=14 |
1437 |
+ |
1438 |
+inherit flag-o-matic linux-info llvm multilib pam prefix python-single-r1 systemd tmpfiles |
1439 |
+ |
1440 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
1441 |
+ |
1442 |
+SLOT=$(ver_cut 1) |
1443 |
+ |
1444 |
+MY_PV=${PV/_/} |
1445 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
1446 |
+ |
1447 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
1448 |
+ |
1449 |
+LICENSE="POSTGRESQL GPL-2" |
1450 |
+DESCRIPTION="PostgreSQL RDBMS" |
1451 |
+HOMEPAGE="https://www.postgresql.org/" |
1452 |
+ |
1453 |
+IUSE="debug doc icu kerberos ldap llvm nls pam |
1454 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
1455 |
+ threads uuid xml zlib" |
1456 |
+ |
1457 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
1458 |
+ |
1459 |
+CDEPEND=" |
1460 |
+>=app-eselect/eselect-postgresql-2.0 |
1461 |
+acct-group/postgres |
1462 |
+acct-user/postgres |
1463 |
+sys-apps/less |
1464 |
+virtual/libintl |
1465 |
+icu? ( dev-libs/icu:= ) |
1466 |
+kerberos? ( virtual/krb5 ) |
1467 |
+ldap? ( net-nds/openldap:= ) |
1468 |
+llvm? ( |
1469 |
+ <sys-devel/llvm-15:= |
1470 |
+ <sys-devel/clang-15:= |
1471 |
+) |
1472 |
+pam? ( sys-libs/pam ) |
1473 |
+perl? ( >=dev-lang/perl-5.8:= ) |
1474 |
+python? ( ${PYTHON_DEPS} ) |
1475 |
+readline? ( sys-libs/readline:0= ) |
1476 |
+server? ( systemd? ( sys-apps/systemd ) ) |
1477 |
+ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1478 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
1479 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1480 |
+zlib? ( sys-libs/zlib ) |
1481 |
+" |
1482 |
+ |
1483 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1484 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1485 |
+# the libc includes UUID functions. |
1486 |
+UTIL_LINUX_LIBC=( elibc_{glibc,musl} ) |
1487 |
+ |
1488 |
+nest_usedep() { |
1489 |
+ local front back |
1490 |
+ while [[ ${#} -gt 1 ]]; do |
1491 |
+ front+="${1}? ( " |
1492 |
+ back+=" )" |
1493 |
+ shift |
1494 |
+ done |
1495 |
+ echo "${front}${1}${back}" |
1496 |
+} |
1497 |
+ |
1498 |
+CDEPEND+=" |
1499 |
+uuid? ( |
1500 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1501 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1502 |
+)" |
1503 |
+ |
1504 |
+DEPEND="${CDEPEND} |
1505 |
+sys-devel/bison |
1506 |
+sys-devel/flex |
1507 |
+nls? ( sys-devel/gettext ) |
1508 |
+xml? ( virtual/pkgconfig ) |
1509 |
+" |
1510 |
+ |
1511 |
+RDEPEND="${CDEPEND} |
1512 |
+selinux? ( sec-policy/selinux-postgresql ) |
1513 |
+" |
1514 |
+ |
1515 |
+pkg_setup() { |
1516 |
+ use llvm && llvm_pkg_setup |
1517 |
+ |
1518 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1519 |
+ |
1520 |
+ use python && python-single-r1_pkg_setup |
1521 |
+} |
1522 |
+ |
1523 |
+src_prepare() { |
1524 |
+ eapply "${FILESDIR}"/${PN}-13.3-riscv-spinlocks.patch |
1525 |
+ |
1526 |
+ # Set proper run directory |
1527 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1528 |
+ -i src/include/pg_config_manual.h || die |
1529 |
+ |
1530 |
+ # Rely on $PATH being in the proper order so that the correct |
1531 |
+ # install program is used for modules utilizing PGXS in both |
1532 |
+ # hardened and non-hardened environments. (Bug #528786) |
1533 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1534 |
+ |
1535 |
+ use server || eapply "${FILESDIR}/${PN}-13_beta1-no-server.patch" |
1536 |
+ use llvm && eapply "${FILESDIR}/postgres-llvm14.patch" |
1537 |
+ |
1538 |
+ if use pam ; then |
1539 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1540 |
+ -i src/backend/libpq/auth.c || \ |
1541 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
1542 |
+ fi |
1543 |
+ |
1544 |
+ eapply_user |
1545 |
+} |
1546 |
+ |
1547 |
+src_configure() { |
1548 |
+ case ${CHOST} in |
1549 |
+ *-darwin*|*-solaris*) |
1550 |
+ use nls && append-libs intl |
1551 |
+ ;; |
1552 |
+ esac |
1553 |
+ |
1554 |
+ export LDFLAGS_SL="${LDFLAGS}" |
1555 |
+ export LDFLAGS_EX="${LDFLAGS}" |
1556 |
+ |
1557 |
+ local PO="${EPREFIX}" |
1558 |
+ |
1559 |
+ local i uuid_config="" |
1560 |
+ if use uuid; then |
1561 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1562 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1563 |
+ done |
1564 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1565 |
+ fi |
1566 |
+ |
1567 |
+ local myconf="\ |
1568 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1569 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1570 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1571 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1572 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1573 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1574 |
+ $(use_enable debug) \ |
1575 |
+ $(use_enable threads thread-safety) \ |
1576 |
+ $(use_with icu) \ |
1577 |
+ $(use_with kerberos gssapi) \ |
1578 |
+ $(use_with ldap) \ |
1579 |
+ $(use_with llvm) \ |
1580 |
+ $(use_with pam) \ |
1581 |
+ $(use_with perl) \ |
1582 |
+ $(use_with python) \ |
1583 |
+ $(use_with readline) \ |
1584 |
+ $(use_with ssl openssl) \ |
1585 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
1586 |
+ $(use_with tcl) \ |
1587 |
+ ${uuid_config} \ |
1588 |
+ $(use_with xml libxml) \ |
1589 |
+ $(use_with xml libxslt) \ |
1590 |
+ $(use_with zlib) \ |
1591 |
+ $(use_enable nls)" |
1592 |
+ if use alpha; then |
1593 |
+ myconf+=" --disable-spinlocks" |
1594 |
+ else |
1595 |
+ # Should be the default but just in case |
1596 |
+ myconf+=" --enable-spinlocks" |
1597 |
+ fi |
1598 |
+ econf ${myconf} |
1599 |
+} |
1600 |
+ |
1601 |
+src_compile() { |
1602 |
+ emake |
1603 |
+ emake -C contrib |
1604 |
+} |
1605 |
+ |
1606 |
+src_install() { |
1607 |
+ emake DESTDIR="${D}" install |
1608 |
+ emake DESTDIR="${D}" install -C contrib |
1609 |
+ |
1610 |
+ dodoc README HISTORY |
1611 |
+ |
1612 |
+ # man pages are already built, but if we have the target make them, |
1613 |
+ # they'll be generated from source before being installed so we |
1614 |
+ # manually install man pages. |
1615 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1616 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1617 |
+ doins -r doc/src/sgml/man{1,3,7} |
1618 |
+ if ! use server; then |
1619 |
+ # Remove man pages for non-existent binaries |
1620 |
+ serverman=( |
1621 |
+ initdb |
1622 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
1623 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
1624 |
+ post{gres,master} |
1625 |
+ ) |
1626 |
+ for m in ${serverman[@]} ; do |
1627 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1628 |
+ done |
1629 |
+ fi |
1630 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1631 |
+ |
1632 |
+ # Create slot specific man pages |
1633 |
+ local bn f mansec slotted_name |
1634 |
+ for mansec in 1 3 7 ; do |
1635 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
1636 |
+ |
1637 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
1638 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
1639 |
+ |
1640 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
1641 |
+ bn=$(basename "${f}") |
1642 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
1643 |
+ case ${bn} in |
1644 |
+ TABLE.7|WITH.7) |
1645 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
1646 |
+ ;; |
1647 |
+ *) |
1648 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
1649 |
+ ;; |
1650 |
+ esac |
1651 |
+ done |
1652 |
+ |
1653 |
+ popd > /dev/null |
1654 |
+ done |
1655 |
+ |
1656 |
+ insinto /etc/postgresql-${SLOT} |
1657 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
1658 |
+ |
1659 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
1660 |
+ # needed by extensions utilizing PGXS. |
1661 |
+ use static-libs || \ |
1662 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
1663 |
+ -delete |
1664 |
+ |
1665 |
+ # Make slot specific links to programs |
1666 |
+ local f bn |
1667 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1668 |
+ -mindepth 1 -maxdepth 1) |
1669 |
+ do |
1670 |
+ bn=$(basename "${f}") |
1671 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1672 |
+ "/usr/bin/${bn}${SLOT/.}" |
1673 |
+ done |
1674 |
+ |
1675 |
+ if use doc ; then |
1676 |
+ docinto html |
1677 |
+ dodoc doc/src/sgml/html/* |
1678 |
+ fi |
1679 |
+ |
1680 |
+ if use server; then |
1681 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1682 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1683 |
+ |
1684 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1685 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1686 |
+ |
1687 |
+ if use systemd; then |
1688 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1689 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
1690 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1691 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1692 |
+ newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
1693 |
+ fi |
1694 |
+ |
1695 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1696 |
+ |
1697 |
+ if use prefix ; then |
1698 |
+ keepdir /run/postgresql |
1699 |
+ fperms 1775 /run/postgresql |
1700 |
+ fi |
1701 |
+ fi |
1702 |
+} |
1703 |
+ |
1704 |
+pkg_postinst() { |
1705 |
+ use server && use systemd && tmpfiles_process ${PN}-${SLOT}.conf |
1706 |
+ postgresql-config update |
1707 |
+ |
1708 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
1709 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
1710 |
+ |
1711 |
+ if use server ; then |
1712 |
+ elog |
1713 |
+ elog "Gentoo specific documentation:" |
1714 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1715 |
+ elog |
1716 |
+ elog "Official documentation:" |
1717 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
1718 |
+ elog |
1719 |
+ elog "The default location of the Unix-domain socket is:" |
1720 |
+ elog " ${EROOT}/run/postgresql/" |
1721 |
+ elog |
1722 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1723 |
+ elog "so that it contains your preferred locale in:" |
1724 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1725 |
+ elog |
1726 |
+ elog "Then, execute the following command to setup the initial database" |
1727 |
+ elog "environment:" |
1728 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1729 |
+ |
1730 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
1731 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
1732 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
1733 |
+ ewarn "the following command after upgrading:" |
1734 |
+ ewarn |
1735 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
1736 |
+ fi |
1737 |
+ fi |
1738 |
+} |
1739 |
+ |
1740 |
+pkg_prerm() { |
1741 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1742 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1743 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1744 |
+ |
1745 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1746 |
+ sleep 10 |
1747 |
+ eend 0 |
1748 |
+ fi |
1749 |
+} |
1750 |
+ |
1751 |
+pkg_postrm() { |
1752 |
+ postgresql-config update |
1753 |
+} |
1754 |
+ |
1755 |
+pkg_config() { |
1756 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1757 |
+ |
1758 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1759 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1760 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
1761 |
+ [[ -z "${DATA_DIR}" ]] \ |
1762 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
1763 |
+ |
1764 |
+ # environment.bz2 may not contain the same locale as the current system |
1765 |
+ # locale. Unset and source from the current system locale. |
1766 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
1767 |
+ unset LANG |
1768 |
+ unset LC_CTYPE |
1769 |
+ unset LC_NUMERIC |
1770 |
+ unset LC_TIME |
1771 |
+ unset LC_COLLATE |
1772 |
+ unset LC_MONETARY |
1773 |
+ unset LC_MESSAGES |
1774 |
+ unset LC_ALL |
1775 |
+ source "${EROOT}/etc/env.d/02locale" |
1776 |
+ [ -n "${LANG}" ] && export LANG |
1777 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1778 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1779 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
1780 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1781 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1782 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1783 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
1784 |
+ fi |
1785 |
+ |
1786 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
1787 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
1788 |
+ einfo |
1789 |
+ einfo "Information on options that can be passed to initdb are found at:" |
1790 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1791 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1792 |
+ einfo |
1793 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
1794 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1795 |
+ einfo " (none)" |
1796 |
+ else |
1797 |
+ einfo " ${PG_INITDB_OPTS}" |
1798 |
+ fi |
1799 |
+ einfo |
1800 |
+ einfo "Configuration files will be installed to:" |
1801 |
+ einfo " ${PGDATA}" |
1802 |
+ einfo |
1803 |
+ einfo "The database cluster will be created in:" |
1804 |
+ einfo " ${DATA_DIR}" |
1805 |
+ einfo |
1806 |
+ |
1807 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1808 |
+ sleep 5 |
1809 |
+ eend 0 |
1810 |
+ |
1811 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1812 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
1813 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
1814 |
+ die "${DATA_DIR} is not empty." |
1815 |
+ fi |
1816 |
+ |
1817 |
+ einfo "Creating the data directory ..." |
1818 |
+ if [[ ${EUID} == 0 ]] ; then |
1819 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
1820 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
1821 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
1822 |
+ fi |
1823 |
+ |
1824 |
+ einfo "Initializing the database ..." |
1825 |
+ |
1826 |
+ if [[ ${EUID} == 0 ]] ; then |
1827 |
+ su - postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1828 |
+ else |
1829 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1830 |
+ fi |
1831 |
+ |
1832 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1833 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1834 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1835 |
+ fi |
1836 |
+ |
1837 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
1838 |
+ # overridden in the initscript |
1839 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1840 |
+ |
1841 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1842 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1843 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
1844 |
+ # characters in PL/Perl |
1845 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1846 |
+ EOF |
1847 |
+ |
1848 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1849 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1850 |
+ einfo "by default. You can disable it in the cluster's:" |
1851 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
1852 |
+ einfo |
1853 |
+ if ! use systemd; then |
1854 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
1855 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
1856 |
+ einfo |
1857 |
+ fi |
1858 |
+ if use prefix ; then |
1859 |
+ einfo "The location of the configuration files have moved to:" |
1860 |
+ einfo " ${PGDATA}" |
1861 |
+ einfo "To start the server:" |
1862 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1863 |
+ einfo "To stop:" |
1864 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
1865 |
+ einfo |
1866 |
+ einfo "Or move the configuration files back:" |
1867 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1868 |
+ elif use systemd; then |
1869 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
1870 |
+ einfo "instead of 'pg_ctl'." |
1871 |
+ else |
1872 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1873 |
+ einfo "instead of 'pg_ctl'." |
1874 |
+ fi |
1875 |
+} |
1876 |
+ |
1877 |
+src_test() { |
1878 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1879 |
+ # Some ICU tests fail if LC_CTYPE and LC_COLLATE aren't the same. We set |
1880 |
+ # LC_CTYPE to be equal to LC_COLLATE since LC_COLLATE is set by Portage. |
1881 |
+ local old_ctype=${LC_CTYPE} |
1882 |
+ export LC_CTYPE=${LC_COLLATE} |
1883 |
+ emake check |
1884 |
+ export LC_CTYPE=${old_ctype} |
1885 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
1886 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
1887 |
+ else |
1888 |
+ use server || \ |
1889 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1890 |
+ [[ ${UID} -eq 0 ]] || \ |
1891 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1892 |
+ |
1893 |
+ ewarn 'Skipping.' |
1894 |
+ fi |
1895 |
+} |
1896 |
|
1897 |
diff --git a/dev-db/postgresql/postgresql-14.3.ebuild b/dev-db/postgresql/postgresql-14.3.ebuild |
1898 |
new file mode 100644 |
1899 |
index 000000000000..669ad0e26b8a |
1900 |
--- /dev/null |
1901 |
+++ b/dev-db/postgresql/postgresql-14.3.ebuild |
1902 |
@@ -0,0 +1,463 @@ |
1903 |
+# Copyright 1999-2022 Gentoo Authors |
1904 |
+# Distributed under the terms of the GNU General Public License v2 |
1905 |
+ |
1906 |
+EAPI=7 |
1907 |
+ |
1908 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
1909 |
+ |
1910 |
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd tmpfiles |
1911 |
+ |
1912 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
1913 |
+ |
1914 |
+SLOT=$(ver_cut 1) |
1915 |
+ |
1916 |
+MY_PV=${PV/_/} |
1917 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
1918 |
+ |
1919 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
1920 |
+ |
1921 |
+LICENSE="POSTGRESQL GPL-2" |
1922 |
+DESCRIPTION="PostgreSQL RDBMS" |
1923 |
+HOMEPAGE="https://www.postgresql.org/" |
1924 |
+ |
1925 |
+IUSE="debug doc icu kerberos ldap llvm lz4 nls pam |
1926 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
1927 |
+ threads uuid xml zlib" |
1928 |
+ |
1929 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
1930 |
+ |
1931 |
+CDEPEND=" |
1932 |
+>=app-eselect/eselect-postgresql-2.0 |
1933 |
+acct-group/postgres |
1934 |
+acct-user/postgres |
1935 |
+sys-apps/less |
1936 |
+virtual/libintl |
1937 |
+icu? ( dev-libs/icu:= ) |
1938 |
+kerberos? ( virtual/krb5 ) |
1939 |
+ldap? ( net-nds/openldap:= ) |
1940 |
+llvm? ( |
1941 |
+ sys-devel/llvm:= |
1942 |
+ sys-devel/clang:= |
1943 |
+) |
1944 |
+lz4? ( app-arch/lz4 ) |
1945 |
+pam? ( sys-libs/pam ) |
1946 |
+perl? ( >=dev-lang/perl-5.8:= ) |
1947 |
+python? ( ${PYTHON_DEPS} ) |
1948 |
+readline? ( sys-libs/readline:0= ) |
1949 |
+server? ( systemd? ( sys-apps/systemd ) ) |
1950 |
+ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1951 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
1952 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1953 |
+zlib? ( sys-libs/zlib ) |
1954 |
+" |
1955 |
+ |
1956 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1957 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1958 |
+# the libc includes UUID functions. |
1959 |
+UTIL_LINUX_LIBC=( elibc_{glibc,musl} ) |
1960 |
+ |
1961 |
+nest_usedep() { |
1962 |
+ local front back |
1963 |
+ while [[ ${#} -gt 1 ]]; do |
1964 |
+ front+="${1}? ( " |
1965 |
+ back+=" )" |
1966 |
+ shift |
1967 |
+ done |
1968 |
+ echo "${front}${1}${back}" |
1969 |
+} |
1970 |
+ |
1971 |
+CDEPEND+=" |
1972 |
+uuid? ( |
1973 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1974 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1975 |
+)" |
1976 |
+ |
1977 |
+DEPEND="${CDEPEND} |
1978 |
+sys-devel/bison |
1979 |
+sys-devel/flex |
1980 |
+nls? ( sys-devel/gettext ) |
1981 |
+xml? ( virtual/pkgconfig ) |
1982 |
+" |
1983 |
+ |
1984 |
+RDEPEND="${CDEPEND} |
1985 |
+selinux? ( sec-policy/selinux-postgresql ) |
1986 |
+" |
1987 |
+ |
1988 |
+pkg_setup() { |
1989 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1990 |
+ |
1991 |
+ use python && python-single-r1_pkg_setup |
1992 |
+} |
1993 |
+ |
1994 |
+src_prepare() { |
1995 |
+ # Set proper run directory |
1996 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1997 |
+ -i src/include/pg_config_manual.h || die |
1998 |
+ |
1999 |
+ # Rely on $PATH being in the proper order so that the correct |
2000 |
+ # install program is used for modules utilizing PGXS in both |
2001 |
+ # hardened and non-hardened environments. (Bug #528786) |
2002 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
2003 |
+ |
2004 |
+ use server || eapply "${FILESDIR}/${PN}-14_rc1-no-server.patch" |
2005 |
+ use llvm && eapply "${FILESDIR}/postgres-llvm14.patch" |
2006 |
+ |
2007 |
+ if use pam ; then |
2008 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
2009 |
+ -i src/backend/libpq/auth.c || \ |
2010 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
2011 |
+ fi |
2012 |
+ |
2013 |
+ eapply_user |
2014 |
+} |
2015 |
+ |
2016 |
+src_configure() { |
2017 |
+ case ${CHOST} in |
2018 |
+ *-darwin*|*-solaris*) |
2019 |
+ use nls && append-libs intl |
2020 |
+ ;; |
2021 |
+ esac |
2022 |
+ |
2023 |
+ export LDFLAGS_SL="${LDFLAGS}" |
2024 |
+ export LDFLAGS_EX="${LDFLAGS}" |
2025 |
+ |
2026 |
+ local PO="${EPREFIX}" |
2027 |
+ |
2028 |
+ local i uuid_config="" |
2029 |
+ if use uuid; then |
2030 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
2031 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
2032 |
+ done |
2033 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
2034 |
+ fi |
2035 |
+ |
2036 |
+ local myconf="\ |
2037 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
2038 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
2039 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
2040 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
2041 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
2042 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
2043 |
+ $(use_enable debug) \ |
2044 |
+ $(use_enable threads thread-safety) \ |
2045 |
+ $(use_with icu) \ |
2046 |
+ $(use_with kerberos gssapi) \ |
2047 |
+ $(use_with ldap) \ |
2048 |
+ $(use_with llvm) \ |
2049 |
+ $(use_with lz4) \ |
2050 |
+ $(use_with pam) \ |
2051 |
+ $(use_with perl) \ |
2052 |
+ $(use_with python) \ |
2053 |
+ $(use_with readline) \ |
2054 |
+ $(use_with ssl openssl) \ |
2055 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
2056 |
+ $(use_with tcl) \ |
2057 |
+ ${uuid_config} \ |
2058 |
+ $(use_with xml libxml) \ |
2059 |
+ $(use_with xml libxslt) \ |
2060 |
+ $(use_with zlib) \ |
2061 |
+ $(use_enable nls)" |
2062 |
+ if use alpha; then |
2063 |
+ myconf+=" --disable-spinlocks" |
2064 |
+ else |
2065 |
+ # Should be the default but just in case |
2066 |
+ myconf+=" --enable-spinlocks" |
2067 |
+ fi |
2068 |
+ econf ${myconf} |
2069 |
+} |
2070 |
+ |
2071 |
+src_compile() { |
2072 |
+ emake |
2073 |
+ emake -C contrib |
2074 |
+} |
2075 |
+ |
2076 |
+src_install() { |
2077 |
+ emake DESTDIR="${D}" install |
2078 |
+ emake DESTDIR="${D}" install -C contrib |
2079 |
+ |
2080 |
+ dodoc README HISTORY |
2081 |
+ |
2082 |
+ # man pages are already built, but if we have the target make them, |
2083 |
+ # they'll be generated from source before being installed so we |
2084 |
+ # manually install man pages. |
2085 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
2086 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
2087 |
+ doins -r doc/src/sgml/man{1,3,7} |
2088 |
+ if ! use server; then |
2089 |
+ # Remove man pages for non-existent binaries |
2090 |
+ serverman=( |
2091 |
+ initdb |
2092 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
2093 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
2094 |
+ post{gres,master} |
2095 |
+ ) |
2096 |
+ for m in ${serverman[@]} ; do |
2097 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
2098 |
+ done |
2099 |
+ fi |
2100 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
2101 |
+ |
2102 |
+ # Create slot specific man pages |
2103 |
+ local bn f mansec slotted_name |
2104 |
+ for mansec in 1 3 7 ; do |
2105 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
2106 |
+ |
2107 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
2108 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
2109 |
+ |
2110 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
2111 |
+ bn=$(basename "${f}") |
2112 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
2113 |
+ case ${bn} in |
2114 |
+ TABLE.7|WITH.7) |
2115 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
2116 |
+ ;; |
2117 |
+ *) |
2118 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
2119 |
+ ;; |
2120 |
+ esac |
2121 |
+ done |
2122 |
+ |
2123 |
+ popd > /dev/null |
2124 |
+ done |
2125 |
+ |
2126 |
+ insinto /etc/postgresql-${SLOT} |
2127 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
2128 |
+ |
2129 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
2130 |
+ # needed by extensions utilizing PGXS. |
2131 |
+ use static-libs || \ |
2132 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
2133 |
+ -delete |
2134 |
+ |
2135 |
+ # Make slot specific links to programs |
2136 |
+ local f bn |
2137 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
2138 |
+ -mindepth 1 -maxdepth 1) |
2139 |
+ do |
2140 |
+ bn=$(basename "${f}") |
2141 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
2142 |
+ "/usr/bin/${bn}${SLOT/.}" |
2143 |
+ done |
2144 |
+ |
2145 |
+ if use doc ; then |
2146 |
+ docinto html |
2147 |
+ dodoc doc/src/sgml/html/* |
2148 |
+ fi |
2149 |
+ |
2150 |
+ if use server; then |
2151 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2152 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
2153 |
+ |
2154 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2155 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
2156 |
+ |
2157 |
+ if use systemd; then |
2158 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2159 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
2160 |
+ systemd_newunit - ${PN}-${SLOT}.service |
2161 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
2162 |
+ newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
2163 |
+ fi |
2164 |
+ |
2165 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2166 |
+ |
2167 |
+ if use prefix ; then |
2168 |
+ keepdir /run/postgresql |
2169 |
+ fperms 1775 /run/postgresql |
2170 |
+ fi |
2171 |
+ fi |
2172 |
+} |
2173 |
+ |
2174 |
+pkg_postinst() { |
2175 |
+ use server && use systemd && tmpfiles_process ${PN}-${SLOT}.conf |
2176 |
+ postgresql-config update |
2177 |
+ |
2178 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
2179 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
2180 |
+ |
2181 |
+ if use server ; then |
2182 |
+ elog |
2183 |
+ elog "Gentoo specific documentation:" |
2184 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2185 |
+ elog |
2186 |
+ elog "Official documentation:" |
2187 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
2188 |
+ elog |
2189 |
+ elog "The default location of the Unix-domain socket is:" |
2190 |
+ elog " ${EROOT}/run/postgresql/" |
2191 |
+ elog |
2192 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2193 |
+ elog "so that it contains your preferred locale in:" |
2194 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2195 |
+ elog |
2196 |
+ elog "Then, execute the following command to setup the initial database" |
2197 |
+ elog "environment:" |
2198 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
2199 |
+ |
2200 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
2201 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
2202 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
2203 |
+ ewarn "the following command after upgrading:" |
2204 |
+ ewarn |
2205 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
2206 |
+ fi |
2207 |
+ fi |
2208 |
+} |
2209 |
+ |
2210 |
+pkg_prerm() { |
2211 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2212 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
2213 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
2214 |
+ |
2215 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
2216 |
+ sleep 10 |
2217 |
+ eend 0 |
2218 |
+ fi |
2219 |
+} |
2220 |
+ |
2221 |
+pkg_postrm() { |
2222 |
+ postgresql-config update |
2223 |
+} |
2224 |
+ |
2225 |
+pkg_config() { |
2226 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
2227 |
+ |
2228 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
2229 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2230 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
2231 |
+ [[ -z "${DATA_DIR}" ]] \ |
2232 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
2233 |
+ |
2234 |
+ # environment.bz2 may not contain the same locale as the current system |
2235 |
+ # locale. Unset and source from the current system locale. |
2236 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
2237 |
+ unset LANG |
2238 |
+ unset LC_CTYPE |
2239 |
+ unset LC_NUMERIC |
2240 |
+ unset LC_TIME |
2241 |
+ unset LC_COLLATE |
2242 |
+ unset LC_MONETARY |
2243 |
+ unset LC_MESSAGES |
2244 |
+ unset LC_ALL |
2245 |
+ source "${EROOT}/etc/env.d/02locale" |
2246 |
+ [ -n "${LANG}" ] && export LANG |
2247 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
2248 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
2249 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
2250 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
2251 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
2252 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
2253 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
2254 |
+ fi |
2255 |
+ |
2256 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
2257 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
2258 |
+ einfo |
2259 |
+ einfo "Information on options that can be passed to initdb are found at:" |
2260 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
2261 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
2262 |
+ einfo |
2263 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
2264 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
2265 |
+ einfo " (none)" |
2266 |
+ else |
2267 |
+ einfo " ${PG_INITDB_OPTS}" |
2268 |
+ fi |
2269 |
+ einfo |
2270 |
+ einfo "Configuration files will be installed to:" |
2271 |
+ einfo " ${PGDATA}" |
2272 |
+ einfo |
2273 |
+ einfo "The database cluster will be created in:" |
2274 |
+ einfo " ${DATA_DIR}" |
2275 |
+ einfo |
2276 |
+ |
2277 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
2278 |
+ sleep 5 |
2279 |
+ eend 0 |
2280 |
+ |
2281 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2282 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
2283 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
2284 |
+ die "${DATA_DIR} is not empty." |
2285 |
+ fi |
2286 |
+ |
2287 |
+ einfo "Creating the data directory ..." |
2288 |
+ if [[ ${EUID} == 0 ]] ; then |
2289 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
2290 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
2291 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
2292 |
+ fi |
2293 |
+ |
2294 |
+ einfo "Initializing the database ..." |
2295 |
+ |
2296 |
+ if [[ ${EUID} == 0 ]] ; then |
2297 |
+ su - postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
2298 |
+ else |
2299 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
2300 |
+ fi |
2301 |
+ |
2302 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
2303 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
2304 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2305 |
+ fi |
2306 |
+ |
2307 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
2308 |
+ # overridden in the initscript |
2309 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
2310 |
+ |
2311 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2312 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2313 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
2314 |
+ # characters in PL/Perl |
2315 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
2316 |
+ EOF |
2317 |
+ |
2318 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
2319 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
2320 |
+ einfo "by default. You can disable it in the cluster's:" |
2321 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
2322 |
+ einfo |
2323 |
+ if ! use systemd; then |
2324 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
2325 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
2326 |
+ einfo |
2327 |
+ fi |
2328 |
+ if use prefix ; then |
2329 |
+ einfo "The location of the configuration files have moved to:" |
2330 |
+ einfo " ${PGDATA}" |
2331 |
+ einfo "To start the server:" |
2332 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
2333 |
+ einfo "To stop:" |
2334 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
2335 |
+ einfo |
2336 |
+ einfo "Or move the configuration files back:" |
2337 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
2338 |
+ elif use systemd; then |
2339 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
2340 |
+ einfo "instead of 'pg_ctl'." |
2341 |
+ else |
2342 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
2343 |
+ einfo "instead of 'pg_ctl'." |
2344 |
+ fi |
2345 |
+} |
2346 |
+ |
2347 |
+src_test() { |
2348 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
2349 |
+ # Some ICU tests fail if LC_CTYPE and LC_COLLATE aren't the same. We set |
2350 |
+ # LC_CTYPE to be equal to LC_COLLATE since LC_COLLATE is set by Portage. |
2351 |
+ local old_ctype=${LC_CTYPE} |
2352 |
+ export LC_CTYPE=${LC_COLLATE} |
2353 |
+ emake check |
2354 |
+ export LC_CTYPE=${old_ctype} |
2355 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
2356 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
2357 |
+ else |
2358 |
+ use server || \ |
2359 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2360 |
+ [[ ${UID} -eq 0 ]] || \ |
2361 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2362 |
+ |
2363 |
+ ewarn 'Skipping.' |
2364 |
+ fi |
2365 |
+} |