Mercurial > hg > portage
comparison dev-db/postgresql-server/postgresql-server-8.4.1.ebuild @ 159:9014d136897e
update postgres to 8.4.1
author | holger |
---|---|
date | Wed, 09 Sep 2009 17:22:48 +0200 |
parents | dev-db/postgresql-server/postgresql-server-8.4.0.ebuild@fb0267e87240 |
children | 7ce3014adf4b |
comparison
equal
deleted
inserted
replaced
158:cc901061d3c6 | 159:9014d136897e |
---|---|
1 # Copyright 1999-2009 Gentoo Foundation | |
2 # Distributed under the terms of the GNU General Public License v2 | |
3 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.7.ebuild,v 1.1 2009/04/09 22:36:34 caleb Exp $ | |
4 | |
5 EAPI="1" | |
6 | |
7 WANT_AUTOCONF="latest" | |
8 WANT_AUTOMAKE="none" | |
9 inherit eutils multilib toolchain-funcs versionator autotools | |
10 | |
11 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" | |
12 | |
13 DESCRIPTION="PostgreSQL server" | |
14 HOMEPAGE="http://www.postgresql.org/" | |
15 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" | |
16 LICENSE="POSTGRESQL" | |
17 SLOT="$(get_version_component_range 1-2)" | |
18 IUSE_LINGUAS=" | |
19 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr | |
20 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl | |
21 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv | |
22 linguas_tr linguas_zh_CN linguas_zh_TW" | |
23 IUSE="doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}" | |
24 | |
25 wanted_languages() { | |
26 for u in ${IUSE_LINGUAS} ; do | |
27 use $u && echo -n "${u#linguas_} " | |
28 done | |
29 } | |
30 | |
31 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT} | |
32 perl? ( >=dev-lang/perl-5.6.1-r2 ) | |
33 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base ) | |
34 selinux? ( sec-policy/selinux-postgresql ) | |
35 tcl? ( >=dev-lang/tcl-8 ) | |
36 uuid? ( dev-libs/ossp-uuid ) | |
37 xml? ( dev-libs/libxml2 dev-libs/libxslt )" | |
38 DEPEND="${RDEPEND} | |
39 sys-devel/flex | |
40 xml? ( dev-util/pkgconfig )" | |
41 PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )" | |
42 | |
43 S="${WORKDIR}/postgresql-${PV}" | |
44 | |
45 pkg_setup() { | |
46 enewgroup postgres 70 | |
47 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres | |
48 } | |
49 | |
50 src_unpack() { | |
51 unpack ${A} | |
52 cd "${S}" | |
53 | |
54 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \ | |
55 "${FILESDIR}/postgresql-${SLOT}-server.patch" | |
56 | |
57 if hasq test ${FEATURES}; then | |
58 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source | |
59 else | |
60 echo "all install:" > "${S}/src/test/regress/GNUmakefile" | |
61 fi | |
62 | |
63 eautoconf | |
64 } | |
65 | |
66 src_compile() { | |
67 # TODO: test if PPC really cannot work with other CFLAGS settings | |
68 # use ppc && CFLAGS="-pipe -fsigned-char" | |
69 | |
70 # eval is needed to get along with pg_config quotation of space-rich entities. | |
71 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ | |
72 --disable-thread-safety \ | |
73 $(use_with perl) \ | |
74 $(use_with python) \ | |
75 $(use_with tcl) \ | |
76 $(use_with xml libxml) \ | |
77 $(use_with xml libxslt) \ | |
78 $(use_with uuid ossp-uuid) \ | |
79 --with-system-tzdata="/usr/share/zoneinfo" \ | |
80 --with-includes="/usr/include/postgresql-${SLOT}/" \ | |
81 "$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \ | |
82 || die "configure failed" | |
83 | |
84 for bd in . contrib $(use xml && echo contrib/xml2); do | |
85 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ | |
86 emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \ | |
87 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ | |
88 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \ | |
89 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed" | |
90 done | |
91 } | |
92 | |
93 src_install() { | |
94 if use perl ; then | |
95 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig" | |
96 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ | |
97 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile" | |
98 fi | |
99 | |
100 for bd in . contrib $(use xml && echo contrib/xml2) ; do | |
101 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ | |
102 emake install -C $bd -j1 DESTDIR="${D}" \ | |
103 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \ | |
104 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ | |
105 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed" | |
106 done | |
107 | |
108 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html" | |
109 rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1 | |
110 | |
111 dodoc README HISTORY doc/{README.*,TODO,bug.template} | |
112 | |
113 dodir /etc/eselect/postgresql/slots/${SLOT} | |
114 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__ | |
115 postgres_ebuilds="\${postgres_ebuilds} ${PF}" | |
116 postgres_service="postgresql-${SLOT}" | |
117 __EOF__ | |
118 | |
119 newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed" | |
120 newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed" | |
121 | |
122 keepdir /var/run/postgresql | |
123 fperms 0770 /var/run/postgresql | |
124 fowners postgres:postgres /var/run/postgresql | |
125 } | |
126 | |
127 pkg_postinst() { | |
128 eselect postgresql update | |
129 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT} | |
130 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT} | |
131 | |
132 ewarn "Please note that the standard location of the socket has changed from /tmp" | |
133 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access" | |
134 ewarn "the socket." | |
135 ewarn "This can break applications which have the standard location hard-coded." | |
136 ewarn "If such an application links against the libpq, please re-emerge it," | |
137 ewarn "if that doesn't help or the application accesses the socket without using libpq," | |
138 ewarn "please file a bug-report." | |
139 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location." | |
140 | |
141 elog "Execute the following command to setup the initial database environment:" | |
142 elog | |
143 elog "emerge --config =${CATEGORY}/${PF}" | |
144 elog | |
145 elog "The autovacuum function, which was in contrib, has been moved to the main" | |
146 elog "PostgreSQL functions starting with 8.1." | |
147 elog "You can enable it in the clusters postgresql.conf." | |
148 } | |
149 | |
150 pkg_postrm() { | |
151 eselect postgresql update | |
152 } | |
153 | |
154 pkg_config() { | |
155 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data" | |
156 | |
157 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable." | |
158 einfo "More information can be found here:" | |
159 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" | |
160 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" | |
161 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable." | |
162 einfo | |
163 einfo "You can change the directory where the database cluster is being created by setting" | |
164 einfo "the PGDATA variable." | |
165 einfo | |
166 einfo "PG_INITDB_OPTS is currently set to:" | |
167 einfo " \"${PG_INITDB_OPTS}\"" | |
168 einfo "and the database cluster will be created in:" | |
169 einfo " \"${PGDATA}\"" | |
170 einfo "Are you ready to continue? (Y/n)" | |
171 read answer | |
172 [ -z $answer ] && answer=Y | |
173 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted" | |
174 | |
175 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then | |
176 eerror "The given directory \"${PGDATA}\" already contains a database cluster." | |
177 die "cluster already exists" | |
178 fi | |
179 | |
180 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128" | |
181 einfo "Checking system parameters..." | |
182 | |
183 if ! use kernel_linux ; then | |
184 SKIP_SYSTEM_TESTS=yes | |
185 einfo " Tests not supported on this OS (yet)" | |
186 fi | |
187 | |
188 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then | |
189 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..." | |
190 | |
191 local SEMMSL=$(sysctl -n kernel.sem | cut -f1) | |
192 local SEMMNS=$(sysctl -n kernel.sem | cut -f2) | |
193 local SEMMNI=$(sysctl -n kernel.sem | cut -f4) | |
194 local SHMMAX=$(sysctl -n kernel.shmmax) | |
195 | |
196 local SEMMSL_MIN=17 | |
197 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) | |
198 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) | |
199 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) | |
200 | |
201 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do | |
202 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then | |
203 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" | |
204 eerror "You have now several options:" | |
205 eerror " - Change the mentioned system parameter" | |
206 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}" | |
207 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" | |
208 eerror "More information can be found here:" | |
209 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" | |
210 die "system test failed" | |
211 fi | |
212 done | |
213 einfo "Passed." | |
214 else | |
215 einfo "Skipped." | |
216 fi | |
217 | |
218 einfo "Creating the data directory ..." | |
219 mkdir -p "${PGDATA}" | |
220 chown -Rf postgres:postgres "${PGDATA}" | |
221 chmod 0700 "${PGDATA}" | |
222 | |
223 einfo "Initializing the database ..." | |
224 | |
225 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}" | |
226 | |
227 einfo | |
228 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'." | |
229 einfo | |
230 | |
231 if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then | |
232 ewarn "You didn't install the database cluster in the standard location, please make sure that you set" | |
233 ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})" | |
234 fi | |
235 } | |
236 | |
237 src_test() { | |
238 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" | |
239 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ | |
240 emake -j1 check \ | |
241 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ | |
242 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details." | |
243 | |
244 einfo "Yes, there are other tests which could be run." | |
245 einfo "... and no, we don't plan to add/support them." | |
246 einfo "For now, the main regressions tests will suffice." | |
247 einfo "If you think other tests are necessary, please submit a" | |
248 einfo "bug including a patch for this ebuild to enable them." | |
249 } |