Mercurial > hg > portage
annotate dev-db/postgresql-server/postgresql-server-8.4.1.ebuild @ 168:46e9ed96ea3e
sync rabbitmq ebuild with portage
author | holger |
---|---|
date | Sun, 11 Oct 2009 20:19:34 +0200 |
parents | 7ce3014adf4b |
children |
rev | line source |
---|---|
148 | 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 | |
160
7ce3014adf4b
sync postgres ebuilds with Gentoo bug#276125, fixes misc. bugs
holger
parents:
159
diff
changeset
|
84 for bd in . contrib $(use xml && echo contrib/xml2); do |
148 | 85 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
160
7ce3014adf4b
sync postgres ebuilds with Gentoo bug#276125, fixes misc. bugs
holger
parents:
159
diff
changeset
|
86 emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "emake in $bd failed" |
148 | 87 done |
88 } | |
89 | |
90 src_install() { | |
91 if use perl ; then | |
92 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig" | |
93 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ | |
94 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile" | |
95 fi | |
96 | |
97 for bd in . contrib $(use xml && echo contrib/xml2) ; do | |
98 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ | |
160
7ce3014adf4b
sync postgres ebuilds with Gentoo bug#276125, fixes misc. bugs
holger
parents:
159
diff
changeset
|
99 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed" |
148 | 100 done |
101 | |
160
7ce3014adf4b
sync postgres ebuilds with Gentoo bug#276125, fixes misc. bugs
holger
parents:
159
diff
changeset
|
102 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/postgresql-${SLOT}/html" |
148 | 103 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 |
104 | |
105 dodoc README HISTORY doc/{README.*,TODO,bug.template} | |
106 | |
107 dodir /etc/eselect/postgresql/slots/${SLOT} | |
108 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__ | |
109 postgres_ebuilds="\${postgres_ebuilds} ${PF}" | |
110 postgres_service="postgresql-${SLOT}" | |
111 __EOF__ | |
112 | |
113 newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed" | |
114 newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed" | |
115 | |
116 keepdir /var/run/postgresql | |
117 fperms 0770 /var/run/postgresql | |
118 fowners postgres:postgres /var/run/postgresql | |
119 } | |
120 | |
121 pkg_postinst() { | |
122 eselect postgresql update | |
123 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT} | |
124 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT} | |
125 | |
126 ewarn "Please note that the standard location of the socket has changed from /tmp" | |
127 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access" | |
128 ewarn "the socket." | |
129 ewarn "This can break applications which have the standard location hard-coded." | |
130 ewarn "If such an application links against the libpq, please re-emerge it," | |
131 ewarn "if that doesn't help or the application accesses the socket without using libpq," | |
132 ewarn "please file a bug-report." | |
133 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location." | |
134 | |
135 elog "Execute the following command to setup the initial database environment:" | |
136 elog | |
137 elog "emerge --config =${CATEGORY}/${PF}" | |
138 elog | |
139 elog "The autovacuum function, which was in contrib, has been moved to the main" | |
140 elog "PostgreSQL functions starting with 8.1." | |
141 elog "You can enable it in the clusters postgresql.conf." | |
142 } | |
143 | |
144 pkg_postrm() { | |
145 eselect postgresql update | |
146 } | |
147 | |
148 pkg_config() { | |
149 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data" | |
150 | |
151 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable." | |
152 einfo "More information can be found here:" | |
153 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" | |
154 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" | |
155 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable." | |
156 einfo | |
157 einfo "You can change the directory where the database cluster is being created by setting" | |
158 einfo "the PGDATA variable." | |
159 einfo | |
160 einfo "PG_INITDB_OPTS is currently set to:" | |
161 einfo " \"${PG_INITDB_OPTS}\"" | |
162 einfo "and the database cluster will be created in:" | |
163 einfo " \"${PGDATA}\"" | |
164 einfo "Are you ready to continue? (Y/n)" | |
165 read answer | |
166 [ -z $answer ] && answer=Y | |
167 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted" | |
168 | |
169 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then | |
170 eerror "The given directory \"${PGDATA}\" already contains a database cluster." | |
171 die "cluster already exists" | |
172 fi | |
173 | |
174 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128" | |
175 einfo "Checking system parameters..." | |
176 | |
177 if ! use kernel_linux ; then | |
178 SKIP_SYSTEM_TESTS=yes | |
179 einfo " Tests not supported on this OS (yet)" | |
180 fi | |
181 | |
182 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then | |
183 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..." | |
184 | |
185 local SEMMSL=$(sysctl -n kernel.sem | cut -f1) | |
186 local SEMMNS=$(sysctl -n kernel.sem | cut -f2) | |
187 local SEMMNI=$(sysctl -n kernel.sem | cut -f4) | |
188 local SHMMAX=$(sysctl -n kernel.shmmax) | |
189 | |
190 local SEMMSL_MIN=17 | |
191 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) | |
192 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) | |
193 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) | |
194 | |
195 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do | |
196 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then | |
197 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" | |
198 eerror "You have now several options:" | |
199 eerror " - Change the mentioned system parameter" | |
200 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}" | |
201 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" | |
202 eerror "More information can be found here:" | |
203 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" | |
204 die "system test failed" | |
205 fi | |
206 done | |
207 einfo "Passed." | |
208 else | |
209 einfo "Skipped." | |
210 fi | |
211 | |
212 einfo "Creating the data directory ..." | |
213 mkdir -p "${PGDATA}" | |
214 chown -Rf postgres:postgres "${PGDATA}" | |
215 chmod 0700 "${PGDATA}" | |
216 | |
217 einfo "Initializing the database ..." | |
218 | |
219 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}" | |
220 | |
221 einfo | |
222 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'." | |
223 einfo | |
224 | |
225 if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then | |
226 ewarn "You didn't install the database cluster in the standard location, please make sure that you set" | |
227 ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})" | |
228 fi | |
229 } | |
230 | |
231 src_test() { | |
232 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" | |
233 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ | |
160
7ce3014adf4b
sync postgres ebuilds with Gentoo bug#276125, fixes misc. bugs
holger
parents:
159
diff
changeset
|
234 emake -j1 check || die "Make check failed. See above for details." |
148 | 235 |
236 einfo "Yes, there are other tests which could be run." | |
237 einfo "... and no, we don't plan to add/support them." | |
238 einfo "For now, the main regressions tests will suffice." | |
239 einfo "If you think other tests are necessary, please submit a" | |
240 einfo "bug including a patch for this ebuild to enable them." | |
241 } |