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