/[gentoo-alt]/trunk/prefix-overlay/dev-db/postgresql/postgresql-8.1.0.ebuild
Gentoo

Contents of /trunk/prefix-overlay/dev-db/postgresql/postgresql-8.1.0.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 889 - (show annotations) (download)
Wed Nov 23 17:45:11 2005 UTC (8 years, 9 months ago) by kito
File size: 7630 byte(s)
postgresql-8.1.0 initial import.
1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.1.0.ebuild,v 1.3 2005/11/12 23:09:52 nakano Exp $
4
5 EAPI="prefix"
6
7 inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs
8
9 DESCRIPTION="sophisticated Object-Relational DBMS."
10 HOMEPAGE="http://www.postgresql.org/"
11 #P_HIERPG="hier-Pg8.0.1-0.5.4"
12 SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2
13 mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2
14 doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 )"
15 # pg-hier? ( http://gppl.moonbone.ru/${P_HIERPG}.diff.gz )"
16
17 LICENSE="POSTGRESQL"
18 SLOT="0"
19 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc-macos ~ppc64 ~s390 ~sh ~sparc ~x86"
20 #IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime pg-hier"
21 IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime"
22
23 DEPEND="virtual/libc
24 =dev-db/libpq-8.1*
25 sys-devel/autoconf
26 >=sys-libs/ncurses-5.2
27 >=sys-devel/bison-1.875
28 zlib? ( >=sys-libs/zlib-1.1.3 )
29 readline? ( >=sys-libs/readline-4.1 )
30 tcltk? ( >=dev-lang/tcl-8 >=dev-lang/tk-8.3.3-r1 )
31 perl? ( >=dev-lang/perl-5.6.1-r2 )
32 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
33 ssl? ( >=dev-libs/openssl-0.9.6-r1 )
34 xml2? ( dev-libs/libxml2 dev-libs/libxslt dev-util/pkgconfig )
35 nls? ( sys-devel/gettext )
36 kerberos? ( virtual/krb5 )"
37 RDEPEND="virtual/libc
38 =dev-db/libpq-8.1*
39 zlib? ( >=sys-libs/zlib-1.1.3 )
40 tcltk? ( >=dev-lang/tcl-8 )
41 perl? ( >=dev-lang/perl-5.6.1-r2 )
42 python? ( >=dev-lang/python-2.2 )
43 selinux? ( sec-policy/selinux-postgresql )
44 ssl? ( >=dev-libs/openssl-0.9.6-r1 )
45 xml2? ( dev-libs/libxml2 dev-libs/libxslt )
46 kerberos? ( virtual/krb5 )"
47
48 PG_DIR="${PREFIX}/var/lib/postgresql"
49
50 pkg_setup() {
51 if [ -f ${PG_DIR}/data/PG_VERSION ] ; then
52 PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.`
53 PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.`
54 if [ ${PG_MAJOR} -lt 8 ] || [ ${PG_MAJOR} -eq 8 -a ${PG_MINOR} -lt 0 ] ; then
55 eerror "Postgres ${PV} cannot upgrade your existing databases, you must"
56 eerror "use pg_dump to export your existing databases to a file, and then"
57 eerror "pg_restore to import them when you have upgraded completely."
58 eerror "You must remove your entire database directory to continue."
59 eerror "(database directory = ${PG_DIR})."
60 exit 1
61 fi
62 fi
63 enewgroup postgres 70 \
64 || die "problem adding group postgres"
65 enewuser postgres 70 ${PREFIX}/bin/bash /var/lib/postgresql postgres \
66 || die "problem adding user postgres"
67 }
68
69 src_unpack() {
70 unpack ${A} || die
71 cd ${S}
72 # use pg-hier && epatch ${WORKDIR}/${P_HIERPG}.diff
73 epatch ${FILESDIR}/${P}-gentoo.patch
74 epatch ${FILESDIR}/${P}-sh.patch
75 }
76
77 src_compile() {
78 filter-flags -ffast-math -feliminate-dwarf2-dups
79
80 # these are the only working CFLAGS I could get on ppc, so locking them
81 # down, anything more aggressive fails (i.e. -mcpu or -Ox)
82 # Gerk - Nov 26, 2002
83 use ppc && CFLAGS="-pipe -fsigned-char"
84
85 # Detect mips systems properly
86 gnuconfig_update
87
88 ./configure \
89 $(with_prefix) \
90 $(with_mandir) \
91 --host=${CHOST} \
92 --with-docdir=${PREFIX}/usr/share/doc/${PF} \
93 --libdir=${PREFIX}/usr/$(get_libdir) \
94 --enable-depend \
95 $(use_with kerberos krb5) \
96 $(use_with libg++ CXX) \
97 $(use_enable nls) \
98 $(use_with pam) \
99 $(use_with perl) \
100 $(use_enable pg-intdatetime integer-datetimes) \
101 $(use_with python) \
102 $(use_with readline) \
103 $(use_with ssl openssl) \
104 $(use_with tcltk tcl) \
105 $(use_with zeroconf bonjour) \
106 $(use_with zlib) \
107 || die "configure failed."
108
109 make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die
110 cd contrib
111 make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die
112 if use xml2; then
113 cd xml2
114 make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die
115 fi
116 }
117
118 src_install() {
119 if use perl; then
120 mv ${S}/src/pl/plperl/Makefile ${S}/src/pl/plperl/Makefile_orig
121 sed -e "s:(INST_DYNAMIC) /usr/lib:(INST_DYNAMIC) ${D}/usr/lib:" \
122 ${S}/src/pl/plperl/Makefile_orig > ${S}/src/pl/plperl/Makefile
123 mv ${S}/src/pl/plperl/GNUmakefile ${S}/src/pl/plperl/GNUmakefile_orig
124 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
125 ${S}/src/pl/plperl/GNUmakefile_orig > ${S}/src/pl/plperl/GNUmakefile
126 fi
127
128 make DESTDIR=${DEST} LIBDIR=${D}/usr/lib install || die
129 # make DESTDIR=${D} install-all-headers || die
130 cd ${S}/contrib
131 make DESTDIR=${DEST} LIBDIR=${D}/usr/lib install || die
132 if use xml2; then
133 cd ${S}/contrib/xml2
134 make DESTDIR=${DEST} LIBDIR=${D}/usr/lib install || die
135 fi
136 cd ${S}
137 dodoc README HISTORY COPYRIGHT INSTALL
138 dodoc contrib/adddepend/*
139
140 exeinto /usr/bin
141
142 cd ${S}/doc
143 dodoc FAQ* README.* TODO bug.template
144 if use doc; then
145 cd ${S}/doc
146 docinto FAQ_html || die
147 dodoc src/FAQ/* || die
148 docinto sgml || die
149 dodoc src/sgml/*.{sgml,dsl} || die
150 docinto sgml/ref || die
151 dodoc src/sgml/ref/*.sgml || die
152 docinto TODO.detail || die
153 dodoc TODO.detail/* || die
154 fi
155
156 cd ${S}
157 exeinto /etc/init.d/
158 newexe ${FILESDIR}/postgresql.init-${PV} postgresql || die
159
160 insinto /etc/conf.d/
161 newins ${FILESDIR}/postgresql.conf-${PV} postgresql || die
162
163 rm ${D}/usr/include/postgres_ext.h
164 }
165
166 pkg_postinst() {
167 einfo "Make sure the postgres user in /etc/passwd has an account setup with /bin/bash as the shell"
168
169 einfo ""
170 einfo "Execute the following command when you want to setup the initial database environment."
171 einfo "emerge --config =${PF}"
172 einfo ""
173 einfo "autovacuum function, which was in contrib, has moved to main PostgreSQL function from 8.1."
174 einfo "You can enable it in postgresql.conf."
175 einfo ""
176 }
177
178 pkg_config() {
179 einfo "Creating the data directory ..."
180 mkdir -p ${PG_DIR}/data
181 chown -Rf postgres:postgres ${PG_DIR}
182 chmod 700 ${PG_DIR}/data
183
184 einfo "Initializing the database ..."
185 if [ -f ${PG_DIR}/data/PG_VERSION ] ; then
186 eerror "Postgres ${PV} cannot upgrade your existing databases."
187 eerror "You must remove your entire database directory to continue."
188 eerror "(database directory = ${PG_DIR})."
189 exit 1
190 elif [[ "${USERLAND}" == "Darwin" ]]; then
191 su postgres -c "${PREFIX}/usr/bin/initdb --pgdata ${PG_DIR}/data"
192 else
193 local SEM=`sysctl -n kernel.sem | cut -f-3`
194 local SEMMNI=`sysctl -n kernel.sem | cut -f4`
195 local SEMMNI_MIN=`expr \( ${MAX_CONNECTIONS} + 15 \) / 16`
196 local SHMMAX=`sysctl -n kernel.shmmax`
197 local SHMMAX_MIN=`expr 250000 + 8200 \* 1000 + 14200 \* 100`
198
199 if [ ${SEMMNI} -lt ${SEMMNI_MIN} ]; then
200 eerror "The current value of SEMMNI is too low"
201 eerror "for postgresql to run ${MAX_CONNECTIONS} connections"
202 eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database."
203 echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem
204 fi
205 su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
206
207 if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then
208 echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem
209 ewarn "Restoring the SEMMNI value to the previous value"
210 ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf"
211 ewarn "and set it to at least ${SEMMNI_MIN}"
212 ewarn ""
213 ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}"
214 ewarn ""
215 fi
216
217 if [ ${SHMMAX} -lt ${SHMMAX_MIN} ]; then
218 eerror "The current value of SHMMAX is too low for postgresql to run."
219 eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}."
220 eerror ""
221 eerror " kernel.shmmax = ${SHMMAX_MIN}"
222 eerror ""
223
224 fi
225 einfo ""
226 einfo "You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl."
227 einfo ""
228 fi
229 }

  ViewVC Help
Powered by ViewVC 1.1.20