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