diff options
Diffstat (limited to 'dev-db/postgresql')
-rw-r--r-- | dev-db/postgresql/ChangeLog | 7 | ||||
-rw-r--r-- | dev-db/postgresql/files/digest-postgresql-7.3.15 | 9 | ||||
-rw-r--r-- | dev-db/postgresql/files/digest-postgresql-7.4.13 | 12 | ||||
-rw-r--r-- | dev-db/postgresql/files/digest-postgresql-8.0.8 | 12 | ||||
-rw-r--r-- | dev-db/postgresql/files/digest-postgresql-8.1.4 | 9 | ||||
-rw-r--r-- | dev-db/postgresql/postgresql-7.3.15.ebuild | 251 | ||||
-rw-r--r-- | dev-db/postgresql/postgresql-7.4.13.ebuild | 316 | ||||
-rw-r--r-- | dev-db/postgresql/postgresql-8.0.8.ebuild | 234 | ||||
-rw-r--r-- | dev-db/postgresql/postgresql-8.1.4.ebuild | 234 |
9 files changed, 1083 insertions, 1 deletions
diff --git a/dev-db/postgresql/ChangeLog b/dev-db/postgresql/ChangeLog index 20d598607325..af7a72b1f60e 100644 --- a/dev-db/postgresql/ChangeLog +++ b/dev-db/postgresql/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for dev-db/postgresql # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.268 2006/04/27 15:09:51 marienz Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.269 2006/05/31 17:41:47 voxus Exp $ + + 31 May 2006; Konstantin Arkhipov <voxus@gentoo.org> +postgresql-8.1.4.ebuild, + +postgresql-8.0.8.ebuild, +postgresql-7.4.13.ebuild, + +postgresql-7.3.15.ebuild: + Version bump wrt security bug #134168. 27 Apr 2006; Marien Zwart <marienz@gentoo.org> files/digest-postgresql-7.3.6-r2, files/digest-postgresql-7.3.9-r1, diff --git a/dev-db/postgresql/files/digest-postgresql-7.3.15 b/dev-db/postgresql/files/digest-postgresql-7.3.15 new file mode 100644 index 000000000000..974d3ea5fcc8 --- /dev/null +++ b/dev-db/postgresql/files/digest-postgresql-7.3.15 @@ -0,0 +1,9 @@ +MD5 dd23ef0e9cbd1a9bca19f8ee66a021db postgresql-base-7.3.15.tar.bz2 5695061 +RMD160 55cc363e1ce26ea0c7f79c5adfd90714988afb46 postgresql-base-7.3.15.tar.bz2 5695061 +SHA256 81da1ab6c3d9e19aef068cc1db81ca696771dfa5c8ff262bcb1bf977ac7429dc postgresql-base-7.3.15.tar.bz2 5695061 +MD5 9d18a5262a3a9b8a2b2c7962645572ab postgresql-docs-7.3.15.tar.bz2 2361345 +RMD160 7330f8f5e3d4061e28ec4fb28939011ae5038551 postgresql-docs-7.3.15.tar.bz2 2361345 +SHA256 832239ebdef5501a8b32f3d2b2f1684c2e9c18fa6cec0370e950b20a62f07cf9 postgresql-docs-7.3.15.tar.bz2 2361345 +MD5 f70a6f9163e204a116f44e752f4695ca postgresql-opt-7.3.15.tar.bz2 341753 +RMD160 8057276fff0ae87f49fb4853e6f3df681de405b9 postgresql-opt-7.3.15.tar.bz2 341753 +SHA256 9b513f3bdd2d63579698ecc9226866ca72fe2e13fd9f0367a07c5041dd8386f6 postgresql-opt-7.3.15.tar.bz2 341753 diff --git a/dev-db/postgresql/files/digest-postgresql-7.4.13 b/dev-db/postgresql/files/digest-postgresql-7.4.13 new file mode 100644 index 000000000000..e64fd1b299a8 --- /dev/null +++ b/dev-db/postgresql/files/digest-postgresql-7.4.13 @@ -0,0 +1,12 @@ +MD5 16d037213b879963724da7809a0a1589 hier-Pg7.4-0.5.3.tar.gz 34662 +RMD160 758a67262ad3dbad649cc8a6b3ef610e6123dd68 hier-Pg7.4-0.5.3.tar.gz 34662 +SHA256 1e56f76560c86227b08faabf78e3a53de4188c6a8f9d1f38b1481427e8fdf74c hier-Pg7.4-0.5.3.tar.gz 34662 +MD5 2e4574f84f6312909de87126bd2859f8 postgresql-base-7.4.13.tar.bz2 6576973 +RMD160 5f90ed85fdceb06fe15e324620e931140e3617ef postgresql-base-7.4.13.tar.bz2 6576973 +SHA256 2e2fa6b1cf3fc7a66a58762acfb64ce42d358e0dd799a467316e937d3a116cf7 postgresql-base-7.4.13.tar.bz2 6576973 +MD5 bad02bd460bccdcdc17c51c2ab555109 postgresql-docs-7.4.13.tar.bz2 2426721 +RMD160 4500c150a1638279394bf6f6882682f019ddf8ae postgresql-docs-7.4.13.tar.bz2 2426721 +SHA256 31d91342f23dc842839ee9f5b7475582a2e232c6831c6d514c3a414ed28ebdf8 postgresql-docs-7.4.13.tar.bz2 2426721 +MD5 1c92e80c8d5296ea4bbd83ad378368c3 postgresql-opt-7.4.13.tar.bz2 333860 +RMD160 9fd1caacd6d842a473725450a0973173f68ae7b8 postgresql-opt-7.4.13.tar.bz2 333860 +SHA256 8139a7161b2a55eba304b027896f0bfc81523dd41f7d1df222274b7a55e5aeab postgresql-opt-7.4.13.tar.bz2 333860 diff --git a/dev-db/postgresql/files/digest-postgresql-8.0.8 b/dev-db/postgresql/files/digest-postgresql-8.0.8 new file mode 100644 index 000000000000..254d1f2a9785 --- /dev/null +++ b/dev-db/postgresql/files/digest-postgresql-8.0.8 @@ -0,0 +1,12 @@ +MD5 1d410cfb38253675fee36c8f9ee655e2 hier-Pg8.0.1-0.5.4.diff.gz 30662 +RMD160 f212f840d06a914fd668398848baef5a269875eb hier-Pg8.0.1-0.5.4.diff.gz 30662 +SHA256 e6ec8792d6a33ec5f0031b530d794aa3877397c3f980f11dc958d480d2352eda hier-Pg8.0.1-0.5.4.diff.gz 30662 +MD5 4d84ff56ae9669b250060f9e2e36f788 postgresql-base-8.0.8.tar.bz2 7823046 +RMD160 2c60dc22f714bc0182051a94c3c1f513b30f574e postgresql-base-8.0.8.tar.bz2 7823046 +SHA256 906d86f2477309b9c2531d12fe720761fdffd73243a83ae31892bd7a0a618183 postgresql-base-8.0.8.tar.bz2 7823046 +MD5 ba6fbc2dff64d385f86344daeb51cab1 postgresql-docs-8.0.8.tar.bz2 2260219 +RMD160 e3dbde03b553000d5a263a93713c434e88dd4fe1 postgresql-docs-8.0.8.tar.bz2 2260219 +SHA256 60a93ee5b2b80f517696328d85f4db24791cb1099d89a0adc375ee740201dc54 postgresql-docs-8.0.8.tar.bz2 2260219 +MD5 e129cb889239da6c800a21be00a35da7 postgresql-opt-8.0.8.tar.bz2 134600 +RMD160 352f07aa25d0dcf1d2e3502f5cec7295c40bc3d5 postgresql-opt-8.0.8.tar.bz2 134600 +SHA256 427e82253b068b35e47235a1b78c521c89a9774b80dcc2433946f86220a34926 postgresql-opt-8.0.8.tar.bz2 134600 diff --git a/dev-db/postgresql/files/digest-postgresql-8.1.4 b/dev-db/postgresql/files/digest-postgresql-8.1.4 new file mode 100644 index 000000000000..bd9bf03aa00b --- /dev/null +++ b/dev-db/postgresql/files/digest-postgresql-8.1.4 @@ -0,0 +1,9 @@ +MD5 7ba24eaa31237eb8713782508de4dec7 postgresql-base-8.1.4.tar.bz2 8040435 +RMD160 b3389c51a9d3cc89935dd1cc6405a9dd9c07042d postgresql-base-8.1.4.tar.bz2 8040435 +SHA256 3d5e6cf4aa1593730c61676ffc4e3acbed73c0e13fb246035e54e4cf83fa60e1 postgresql-base-8.1.4.tar.bz2 8040435 +MD5 5edc420b949a22d9960fc72609a24af3 postgresql-docs-8.1.4.tar.bz2 2485052 +RMD160 4960b2d58da67ac88338c6b2508865cb20452b7e postgresql-docs-8.1.4.tar.bz2 2485052 +SHA256 1578423df71962e22fe94b1123db680983d4e2f82e5bbb4913d96d9f6265de7f postgresql-docs-8.1.4.tar.bz2 2485052 +MD5 6aad690bd918086cc3fbf673b74e65e6 postgresql-opt-8.1.4.tar.bz2 144696 +RMD160 8f25c6137a8cbd786a647cf4d8ef59c95573012d postgresql-opt-8.1.4.tar.bz2 144696 +SHA256 5a6d27e303ad9b073f91e51658b13cfeb153e3d886af5e5c1093ea315e15738c postgresql-opt-8.1.4.tar.bz2 144696 diff --git a/dev-db/postgresql/postgresql-7.3.15.ebuild b/dev-db/postgresql/postgresql-7.3.15.ebuild new file mode 100644 index 000000000000..e9f346374050 --- /dev/null +++ b/dev-db/postgresql/postgresql-7.3.15.ebuild @@ -0,0 +1,251 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-7.3.15.ebuild,v 1.1 2006/05/31 17:41:47 voxus Exp $ + +inherit eutils gnuconfig flag-o-matic java-pkg multilib + +DESCRIPTION="sophisticated Object-Relational DBMS" + +HOMEPAGE="http://www.postgresql.org/" +SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2 + mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2 + doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 )" + +LICENSE="POSTGRESQL" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 mips ~ppc ~sparc ~x86" +IUSE="doc java libg++ nls pam perl python readline ssl tcltk zlib threads selinux" + +DEPEND="virtual/libc + =dev-db/libpq-7.3.15* + sys-devel/autoconf + >=sys-libs/ncurses-5.2 + zlib? ( >=sys-libs/zlib-1.1.3 ) + readline? ( >=sys-libs/readline-4.1 ) + tcltk? ( >=dev-lang/tcl-8 >=dev-lang/tk-8.3.3-r1 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base ) + java? ( >=virtual/jdk-1.3 >=dev-java/ant-1.3 + dev-java/java-config ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + nls? ( sys-devel/gettext )" +# java dep workaround for portage bug +# x86? ( java? ( =dev-java/sun-jdk-1.3* >=dev-java/ant-1.3 ) ) +RDEPEND="virtual/libc + =dev-db/libpq-7.3.15* + zlib? ( >=sys-libs/zlib-1.1.3 ) + tcltk? ( >=dev-lang/tcl-8 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 ) + java? ( >=virtual/jdk-1.3 ) + selinux? ( sec-policy/selinux-postgresql ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 )" + +PG_DIR="/var/lib/postgresql" + +# misc files +FILES_VER="7.3.14" + +pkg_setup() { + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.` + PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.` + if [ ${PG_MAJOR} -lt 7 ] || [ ${PG_MAJOR} -eq 7 -a ${PG_MINOR} -lt 3 ] ; then + eerror "Postgres ${PV} cannot upgrade your existing databases, you must" + eerror "use pg_dump to export your existing databases to a file, and then" + eerror "pg_restore to import them when you have upgraded completely." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + fi + fi + enewgroup postgres 70 \ + || die "problem adding group postgres" + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres \ + || die "problem adding user postgres" +} + +check_java_config() { + JDKHOME="`java-config --jdk-home`" + if [[ -z "${JDKHOME}" || ! -d "${JDKHOME}" ]]; then + NOJDKERROR="You need to use java-config to set your JVM to a JDK!" + eerror "${NOJDKERROR}" + die "${NOJDKERROR}" + fi +} + +src_unpack() { + unpack ${A} || die + cd ${S} || die + + epatch ${FILESDIR}/${PN}-${FILES_VER}-gentoo.patch +} + +src_compile() { + filter-flags -ffast-math + + if use java; then + check_java_config + fi + + local myconf + use tcltk && myconf="--with-tcl" + use python && myconf="$myconf --with-python" + use perl && myconf="$myconf --with-perl" + use java && myconf="$myconf --with-java" + use ssl && myconf="$myconf --with-openssl" + use nls && myconf="$myconf --enable-nls" + use libg++ && myconf="$myconf --with-CXX" + use pam && myconf="$myconf --with-pam" + use readline || myconf="$myconf --without-readline" + use zlib || myconf="$myconf --without-zlib" + use threads && myconf="$myconf --enable-thread-safety" + + # these are the only working CFLAGS I could get on ppc, so locking them + # down, anything more aggressive fails (i.e. -mcpu or -Ox) + # Gerk - Nov 26, 2002 + use ppc && CFLAGS="-pipe -fsigned-char" + + # Detect mips systems properly + gnuconfig_update + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --host=${CHOST} \ + --docdir=/usr/share/doc/${PF} \ + --libdir=/usr/$(get_libdir) \ + --includedir=/usr/include/postgresql/pgsql \ + --enable-depend \ + --with-maxbackends=1024 \ + $myconf || die + + make || die + cd contrib + make || die +} + +src_install() { + if use perl; then + mv ${S}/src/pl/plperl/Makefile ${S}/src/pl/plperl/Makefile_orig + sed -e "s:(INST_DYNAMIC) /usr/lib:(INST_DYNAMIC) ${D}/usr/$(get_libdir):" \ + ${S}/src/pl/plperl/Makefile_orig > ${S}/src/pl/plperl/Makefile + mv ${S}/src/pl/plperl/GNUmakefile ${S}/src/pl/plperl/GNUmakefile_orig + sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ + ${S}/src/pl/plperl/GNUmakefile_orig > ${S}/src/pl/plperl/GNUmakefile + fi + + make DESTDIR=${D} includedir_server=/usr/include/postgresql/server \ + includedir_internal=/usr/include/postgresql/internal \ + LIBDIR=${D}/usr/$(get_libdir) \ + python_moduleexecdir="${python_execprefix}/$(get_libdir)/python${python_version}/site-packages" \ + install || die + make DESTDIR=${D} includedir_server=/usr/include/postgresql/server includedir_internal=/usr/include/postgresql/internal install-all-headers || die + cd ${S}/contrib + make DESTDIR=${D} LIBDIR=${D}/usr/$(get_libdir) install || die + cd ${S} + dodoc COPYRIGHT HISTORY INSTALL README register.txt + dodoc contrib/adddepend/* + + if use java; then + # we need to remove jar file after dojar; otherwise two same jar + # file are installed. + java-pkg_dojar ${D}/usr/share/postgresql/java/postgresql.jar + rm ${D}/usr/share/postgresql/java/postgresql.jar + fi + + # backward compatibility + for i in ${D}/usr/include/postgresql/pgsql/* + do + ln -s ${i} ${D}/usr/include/ + done + + cd ${S}/doc + dodoc FAQ* README.* TODO bug.template + if use doc; then + cd ${S}/doc + docinto FAQ_html + dodoc src/FAQ/* + docinto sgml + dodoc src/sgml/*.{sgml,dsl} + docinto sgml/ref + dodoc src/sgml/ref/*.sgml + docinto TODO.detail + dodoc TODO.detail/* + fi + + cd ${S} + exeinto /etc/init.d/ + newexe ${FILESDIR}/postgresql.init-${FILES_VER} postgresql || die + + insinto /etc/conf.d/ + newins ${FILESDIR}/postgresql.conf postgresql || die + + keepdir /var/lib/postgresql +} + +pkg_postinst() { + einfo "Execute the following command" + einfo "emerge --config =${PF}" + einfo "to setup the initial database environment." + einfo "" + einfo "Make sure the postgres user in /etc/passwd has an account setup with /bin/bash as the shell" +} + +pkg_config() { + einfo "Creating the data directory ..." + mkdir -p ${PG_DIR}/data + chown -Rf postgres:postgres ${PG_DIR} + chmod 700 ${PG_DIR}/data + + einfo "Initializing the database ..." + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.` + PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.` + if [ ${PG_MAJOR} -lt 7 ] || [ ${PG_MAJOR} -eq 7 -a ${PG_MINOR} -lt 3 ] ; then + eerror "Postgres ${PV} cannot upgrade your existing databases." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + else + einfon "A postgres data directory already exists from version "; cat ${PG_DIR}/data/PG_VERSION + einfo "Read the documentation to check how to upgrade to version ${PV}." + fi + else + # On hppa, postgresql need way more than the default sem index and shmmax + if [ "${ARCH}" = "hppa" ]; then + SEM_IDX_MIN=1024 + SHMMAX_MIN=100000000 + SEM_IDX=`sysctl kernel.sem | awk '{ print $6 }'` + if [ $SEM_IDX -lt ${SEM_IDX_MIN} ]; then + eerror "The last value of /proc/sys/kernel/sem is too low for postgresql to run" + eerror "Temporary setting this value to ${SEM_IDX_MIN} while creating the initial database." + cat /proc/sys/kernel/sem | sed -e "s/\t${SEM_IDX}/\t${SEM_IDX_MIN}/" > /proc/sys/kernel/sem + fi + fi + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + + if [ "${ARCH}" = "hppa" ]; then + if [ ! `sysctl kernel.sem | awk '{ print $6 }'` -eq ${SEM_IDX} ] ; then + cat /proc/sys/kernel/sem | sed -e "s/\t${SEM_IDX_MIN}/\t${SEM_IDX}/" > /proc/sys/kernel/sem + ewarn "Restoring the sem idx value to the previous value" + ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf" + ewarn "and set it to at least ${SEM_IDX_MIN}" + fi + + if [ `sysctl kernel.shmmax | awk '{ print $3 }'` -lt ${SHMMAX_MIN} ]; then + eerror "The current value of /proc/sys/kernel/shmmax is too low" + eerror "for postgresql to run. Please edit /etc/sysctl.conf and set" + eerror "this value to at least ${SHMMAX_MIN}." + + fi + fi + + einfo "If you are upgrading from a pre-7.3 version of PostgreSQL, please read" + einfo "the README.adddepend file for information on how to properly migrate" + einfo "all serial columns, unique keys and foreign keys to this version." + + einfo "" + einfo "You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl." + einfo "" + fi +} diff --git a/dev-db/postgresql/postgresql-7.4.13.ebuild b/dev-db/postgresql/postgresql-7.4.13.ebuild new file mode 100644 index 000000000000..b3af3b37ddb7 --- /dev/null +++ b/dev-db/postgresql/postgresql-7.4.13.ebuild @@ -0,0 +1,316 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-7.4.13.ebuild,v 1.1 2006/05/31 17:41:47 voxus Exp $ + +inherit eutils gnuconfig flag-o-matic java-pkg multilib toolchain-funcs + +DESCRIPTION="sophisticated Object-Relational DBMS." +HOMEPAGE="http://www.postgresql.org/" +P_HIERPG="hier-Pg7.4-0.5.3" +SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2 + mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2 + doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 ) + pg-hier? ( ftp://gborg.postgresql.org/pub/hierpg/stable/${P_HIERPG}.tar.gz )" + +LICENSE="POSTGRESQL" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="ssl nls java python tcltk perl libg++ pam readline zlib doc pg-hier pg-vacuumdelay pg-intdatetime threads xml2 selinux" + +DEPEND="virtual/libc + =dev-db/libpq-7.4.13* + sys-devel/autoconf + >=sys-libs/ncurses-5.2 + >=sys-devel/bison-1.875 + zlib? ( >=sys-libs/zlib-1.1.3 ) + readline? ( >=sys-libs/readline-4.1 ) + tcltk? ( >=dev-lang/tcl-8 >=dev-lang/tk-8.3.3-r1 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base ) + java? ( >=virtual/jdk-1.3 >=dev-java/ant-1.3 + dev-java/java-config ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + nls? ( sys-devel/gettext ) + xml2? ( dev-libs/libxml2 dev-libs/libxslt dev-util/pkgconfig )" +# java dep workaround for portage bug +# x86? ( java? ( =dev-java/sun-jdk-1.3* >=dev-java/ant-1.3 ) ) +RDEPEND="virtual/libc + =dev-db/libpq-7.4.13* + zlib? ( >=sys-libs/zlib-1.1.3 ) + tcltk? ( >=dev-lang/tcl-8 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 ) + java? ( >=virtual/jdk-1.3 ) + selinux? ( sec-policy/selinux-postgresql ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + xml2? ( dev-libs/libxml2 dev-libs/libxslt )" + +PG_DIR="/var/lib/postgresql" +MAX_CONNECTIONS=1024 + +# misc files +FILES_VER="7.4.12" + +pkg_setup() { + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.` + PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.` + if [ ${PG_MAJOR} -lt 7 ] || [ ${PG_MAJOR} -eq 7 -a ${PG_MINOR} -lt 4 ] ; then + eerror "Postgres ${PV} cannot upgrade your existing databases, you must" + eerror "use pg_dump to export your existing databases to a file, and then" + eerror "pg_restore to import them when you have upgraded completely." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + fi + fi + enewgroup postgres 70 \ + || die "problem adding group postgres" + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres \ + || die "problem adding user postgres" +} + +check_java_config() { + JDKHOME="`java-config --jdk-home`" + if [[ -z "${JDKHOME}" || ! -d "${JDKHOME}" ]]; then + NOJDKERROR="You need to use java-config to set your JVM to a JDK!" + eerror "${NOJDKERROR}" + die "${NOJDKERROR}" + fi +} + +src_unpack() { + unpack ${A} || die + cd ${S} || die + + epatch ${FILESDIR}/${PN}-${FILES_VER}-gentoo.patch + + if use pg-hier; then + cd ${S} || die + epatch ${WORKDIR}/${P_HIERPG}.diff + fi + + if use pg-vacuumdelay; then + cd ${S} || die + epatch ${FILESDIR}/${PN}-${FILES_VER}-vacuum-delay.patch + fi + + if [ "${ARCH}" = "hppa" ] + then + cd ${S} + epatch ${FILESDIR}/${PN}-${FILES_VER}-hppa-testandset.patch + fi +} + +src_compile() { + filter-flags -ffast-math + + if use java; then + check_java_config + fi + + local myconf + use tcltk && myconf="--with-tcl" + use python && myconf="$myconf --with-python" + use perl && myconf="$myconf --with-perl" + use java && myconf="$myconf --with-java" + use ssl && myconf="$myconf --with-openssl" + use nls && myconf="$myconf --enable-nls" + use libg++ && myconf="$myconf --with-CXX" + use pam && myconf="$myconf --with-pam" + use readline || myconf="$myconf --without-readline" + use zlib || myconf="$myconf --without-zlib" + use pg-intdatetime && myconf="$myconf --enable-integer-datetimes" + use threads && myconf="$myconf --enable-thread-safety" + + # these are the only working CFLAGS I could get on ppc, so locking them + # down, anything more aggressive fails (i.e. -mcpu or -Ox) + # Gerk - Nov 26, 2002 + use ppc && CFLAGS="-pipe -fsigned-char" + use xml2 && CFLAGS="${CFLAGS} $(pkg-config --cflags libxml-2.0)" + use xml2 && LIBS="${LIBS} $(pkg-config --libs libxml-2.0)" + + # Detect mips systems properly + gnuconfig_update + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --host=${CHOST} \ + --docdir=/usr/share/doc/${PF} \ + --libdir=/usr/$(get_libdir) \ + --includedir=/usr/include/postgresql/pgsql \ + --enable-depend \ + --with-maxbackends=${MAX_CONNECTIONS} \ + $myconf || die + + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + cd contrib + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + if use xml2; then + make -C xml LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + fi +} + +src_install() { + if use perl; then + mv ${S}/src/pl/plperl/Makefile ${S}/src/pl/plperl/Makefile_orig + sed -e "s:(INST_DYNAMIC) /usr/lib:(INST_DYNAMIC) ${D}/usr/lib:" \ + ${S}/src/pl/plperl/Makefile_orig > ${S}/src/pl/plperl/Makefile + mv ${S}/src/pl/plperl/GNUmakefile ${S}/src/pl/plperl/GNUmakefile_orig + sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ + ${S}/src/pl/plperl/GNUmakefile_orig > ${S}/src/pl/plperl/GNUmakefile + fi + + make DESTDIR=${D} includedir_server=/usr/include/postgresql/server includedir_internal=/usr/include/postgresql/internal LIBDIR=${D}/usr/lib install || die + make DESTDIR=${D} includedir_server=/usr/include/postgresql/server includedir_internal=/usr/include/postgresql/internal install-all-headers || die + cd ${S}/contrib + make DESTDIR=${D} LIBDIR=${D}/usr/lib install || die + if use xml2; then + make -C xml DESTDIR=${D} IBDIR=${D}/usr/lib install || die + fi + cd ${S} + if use pg-hier; then + dodoc ${WORKDIR}/README-${P_HIERPG}.html + fi + dodoc README HISTORY COPYRIGHT INSTALL + dodoc contrib/adddepend/* + + exeinto /usr/bin + + if use java; then + # we need to remove jar file after dojar; otherwise two same jar + # file are installed. + java-pkg_dojar ${D}/usr/share/postgresql/java/postgresql.jar || die + rm ${D}/usr/share/postgresql/java/postgresql.jar + java-pkg_dojar ${D}/usr/share/postgresql/java/postgresql-examples.jar || die + rm ${D}/usr/share/postgresql/java/postgresql-examples.jar + fi + + # backward compatibility + for i in ${D}/usr/include/postgresql/pgsql/* + do + ln -s ${i} ${D}/usr/include/ + done + + cd ${S}/doc + dodoc FAQ* README.* TODO bug.template + if use doc; then + cd ${S}/doc + docinto FAQ_html + dodoc src/FAQ/* + docinto sgml + dodoc src/sgml/*.{sgml,dsl} + docinto sgml/ref + dodoc src/sgml/ref/*.sgml + docinto TODO.detail + dodoc TODO.detail/* + fi + + cd ${S} + exeinto /etc/init.d/ + newexe ${FILESDIR}/postgresql.init-${FILES_VER} postgresql || die + newexe ${FILESDIR}/pg_autovacuum.init-${FILES_VER} pg_autovacuum || die + dosed "s:___DOCDIR___:/usr/share/doc/${PF}:" /etc/init.d/pg_autovacuum + + insinto /etc/conf.d/ + newins ${FILESDIR}/postgresql.conf-${FILES_VER} postgresql || die + newins ${FILESDIR}/pg_autovacuum.conf-${FILES_VER} pg_autovacuum || die +} + +pkg_postinst() { + einfo "Make sure the postgres user in /etc/passwd has an account setup with /bin/bash as the shell" + + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.` + PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.` + if [ ${PG_MAJOR} -lt 7 ] || [ ${PG_MAJOR} -eq 7 -a ${PG_MINOR} -eq 4 ] ; then + ewarn "" + ewarn "If you are upgrading from PostgreSQL 7.4 or 7.4.1, it is strongly recommended" + ewarn "that you read the release notes concerning changes to the system catalogs." + ewarn "You can run 7.4.2 without rerunning initdb, however you may still experience" + ewarn "random crashes due to an error in pg_statistic." + ewarn "" + ewarn "If you prefer not to re-initdb your installation, the release notes contain" + ewarn "a procedure for manually correcting the problem." + ewarn "" + fi + + if use pg-hier; then + ewarn "" + ewarn "REQUIRED!! After installing patched PostgreSQL by pg-hier" + ewarn "it is required to run 'initdb'. Without this Pg will fail " + ewarn "with error " + ewarn "ERROR: did not find '}' at end of input node. " + ewarn "" + fi + else + einfo "" + einfo "Execute the following command" + einfo "emerge --config =${PF}" + einfo "to setup the initial database environment." + einfo "" + fi + + einfo "" + einfo "Python modules was removed from PostgreSQL package." + einfo "If you need it, please run \"emerge dev-db/pygresql\"." + einfo "" +} + +pkg_config() { + einfo "Creating the data directory ..." + mkdir -p ${PG_DIR}/data + chown -Rf postgres:postgres ${PG_DIR} + chmod 700 ${PG_DIR}/data + + einfo "Initializing the database ..." + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.` + PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.` + if [ ${PG_MAJOR} -lt 7 ] || [ ${PG_MAJOR} -eq 7 -a ${PG_MINOR} -lt 3 ] ; then + eerror "Postgres ${PV} cannot upgrade your existing databases." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + else + einfon "A postgres data directory already exists from version "; cat ${PG_DIR}/data/PG_VERSION + einfo "Read the documentation to check how to upgrade to version ${PV}." + fi + else + local SEM=`sysctl -n kernel.sem | cut -f-3` + local SEMMNI=`sysctl -n kernel.sem | cut -f4` + local SEMMNI_MIN=`expr \( ${MAX_CONNECTIONS} + 15 \) / 16` + local SHMMAX=`sysctl -n kernel.shmmax` + local SHMMAX_MIN=`expr 250000 + 30600 \* ${MAX_CONNECTIONS}` + + if [ ${SEMMNI} -lt ${SEMMNI_MIN} ]; then + eerror "The current value of SEMMNI is too low" + eerror "for postgresql to run ${MAX_CONNECTIONS} connections" + eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database." + echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem + fi + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + + if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then + echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem + ewarn "Restoring the SEMMNI value to the previous value" + ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf" + ewarn "and set it to at least ${SEMMNI_MIN}" + ewarn "" + ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}" + ewarn "" + fi + + if [ ${SHMMAX} -lt ${SHMMAX_MIN} ]; then + eerror "The current value of SHMMAX is too low for postgresql to run." + eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}." + eerror "" + eerror " kernel.shmmax = ${SHMMAX_MIN}" + eerror "" + + fi + einfo "" + einfo "You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl." + einfo "" + fi +} diff --git a/dev-db/postgresql/postgresql-8.0.8.ebuild b/dev-db/postgresql/postgresql-8.0.8.ebuild new file mode 100644 index 000000000000..b5a5b2cfecf2 --- /dev/null +++ b/dev-db/postgresql/postgresql-8.0.8.ebuild @@ -0,0 +1,234 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.0.8.ebuild,v 1.1 2006/05/31 17:41:47 voxus Exp $ + +inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs + +DESCRIPTION="sophisticated Object-Relational DBMS." +HOMEPAGE="http://www.postgresql.org/" +P_HIERPG="hier-Pg8.0.1-0.5.4" +MY_PV=${PV/_/} +MY_P=${PN}-${MY_PV} +SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${MY_PV}.tar.bz2 + mirror://postgresql/source/v${PV}/${PN}-opt-${MY_PV}.tar.bz2 + doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${MY_PV}.tar.bz2 ) + pg-hier? ( http://gppl.moonbone.ru/${P_HIERPG}.diff.gz )" + +LICENSE="POSTGRESQL" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ia64 mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime pg-hier" + +S=${WORKDIR}/${MY_P} +DEPEND="virtual/libc + =dev-db/libpq-8.0.8* + sys-devel/autoconf + >=sys-libs/ncurses-5.2 + >=sys-devel/bison-1.875 + zlib? ( >=sys-libs/zlib-1.1.3 ) + readline? ( >=sys-libs/readline-4.1 ) + tcltk? ( >=dev-lang/tcl-8 >=dev-lang/tk-8.3.3-r1 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + xml2? ( dev-libs/libxml2 dev-libs/libxslt dev-util/pkgconfig ) + nls? ( sys-devel/gettext ) + kerberos? ( virtual/krb5 )" +RDEPEND="virtual/libc + =dev-db/libpq-8.0.8* + zlib? ( >=sys-libs/zlib-1.1.3 ) + tcltk? ( >=dev-lang/tcl-8 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 ) + selinux? ( sec-policy/selinux-postgresql ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + xml2? ( dev-libs/libxml2 dev-libs/libxslt ) + kerberos? ( virtual/krb5 )" + +PG_DIR="/var/lib/postgresql" + +# misc files +FILES_VER="8.0.7" + +pkg_setup() { + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.` + PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.` + if [ ${PG_MAJOR} -lt 8 ] || [ ${PG_MAJOR} -eq 8 -a ${PG_MINOR} -lt 0 ] ; then + eerror "Postgres ${MY_PV} cannot upgrade your existing databases, you must" + eerror "use pg_dump to export your existing databases to a file, and then" + eerror "pg_restore to import them when you have upgraded completely." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + fi + fi + enewgroup postgres 70 \ + || die "problem adding group postgres" + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres \ + || die "problem adding user postgres" +} + +src_unpack() { + unpack ${A} || die + cd ${S} + use pg-hier && epatch ${WORKDIR}/${P_HIERPG}.diff + + epatch ${FILESDIR}/${PN}-${FILES_VER}-gentoo.patch + epatch ${FILESDIR}/${PN}-${FILES_VER}-sh.patch +} + +src_compile() { + filter-flags -ffast-math -feliminate-dwarf2-dups + + local myconf + use tcltk && myconf="--with-tcl" + use python && myconf="$myconf --with-python" + use perl && myconf="$myconf --with-perl" + use ssl && myconf="$myconf --with-openssl" + use nls && myconf="$myconf --enable-nls" + use libg++ && myconf="$myconf --with-CXX" + use pam && myconf="$myconf --with-pam" + use readline || myconf="$myconf --without-readline" + use zlib || myconf="$myconf --without-zlib" + use kerberos && myconf="$myconf --with-krb5" + use pg-intdatetime && myconf="$myconf --enable-integer-datetimes" + + # these are the only working CFLAGS I could get on ppc, so locking them + # down, anything more aggressive fails (i.e. -mcpu or -Ox) + # Gerk - Nov 26, 2002 + use ppc && CFLAGS="-pipe -fsigned-char" + + # Detect mips systems properly + gnuconfig_update + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --host=${CHOST} \ + --with-docdir=/usr/share/doc/${PF} \ + --libdir=/usr/$(get_libdir) \ + --enable-depend \ + $myconf || die + + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + cd contrib + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + if use xml2; then + cd xml2 + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + fi +} + +src_install() { + if use perl; then + mv ${S}/src/pl/plperl/Makefile ${S}/src/pl/plperl/Makefile_orig + sed -e "s:(INST_DYNAMIC) /usr/lib:(INST_DYNAMIC) ${D}/usr/lib:" \ + ${S}/src/pl/plperl/Makefile_orig > ${S}/src/pl/plperl/Makefile + mv ${S}/src/pl/plperl/GNUmakefile ${S}/src/pl/plperl/GNUmakefile_orig + sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ + ${S}/src/pl/plperl/GNUmakefile_orig > ${S}/src/pl/plperl/GNUmakefile + fi + + make DESTDIR=${D} LIBDIR=${D}/usr/lib install || die +# make DESTDIR=${D} install-all-headers || die + cd ${S}/contrib + make DESTDIR=${D} LIBDIR=${D}/usr/lib install || die + if use xml2; then + cd ${S}/contrib/xml2 + make DESTDIR=${D} LIBDIR=${D}/usr/lib install || die + fi + cd ${S} + dodoc README HISTORY COPYRIGHT INSTALL + dodoc contrib/adddepend/* + + exeinto /usr/bin + + cd ${S}/doc + dodoc FAQ* README.* TODO bug.template + if use doc; then + cd ${S}/doc + docinto FAQ_html + dodoc src/FAQ/* + docinto sgml + dodoc src/sgml/*.{sgml,dsl} + docinto sgml/ref + dodoc src/sgml/ref/*.sgml + docinto TODO.detail + dodoc TODO.detail/* + fi + + cd ${S} + exeinto /etc/init.d/ + newexe ${FILESDIR}/postgresql.init-${FILES_VER} postgresql || die + newexe ${FILESDIR}/pg_autovacuum.init-${FILES_VER} pg_autovacuum || die + dosed "s:___DOCDIR___:/usr/share/doc/${PF}:" /etc/init.d/pg_autovacuum + + insinto /etc/conf.d/ + newins ${FILESDIR}/postgresql.conf-${FILES_VER} postgresql || die + newins ${FILESDIR}/pg_autovacuum.conf-${FILES_VER} pg_autovacuum || die + + rm ${D}/usr/include/postgres_ext.h +} + +pkg_postinst() { + einfo "Make sure the postgres user in /etc/passwd has an account setup with /bin/bash as the shell" + + if [ ! -f ${PG_DIR}/data/PG_VERSION ] ; then + einfo "" + einfo "Execute the following command" + einfo "emerge --config =${PF}" + einfo "to setup the initial database environment." + einfo "" + fi +} + +pkg_config() { + einfo "Creating the data directory ..." + mkdir -p ${PG_DIR}/data + chown -Rf postgres:postgres ${PG_DIR} + chmod 700 ${PG_DIR}/data + + einfo "Initializing the database ..." + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + eerror "Postgres ${MY_PV} cannot upgrade your existing databases." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + else + local SEM=`sysctl -n kernel.sem | cut -f-3` + local SEMMNI=`sysctl -n kernel.sem | cut -f4` + local SEMMNI_MIN=`expr \( ${MAX_CONNECTIONS} + 15 \) / 16` + local SHMMAX=`sysctl -n kernel.shmmax` + local SHMMAX_MIN=`expr 250000 + 8200 \* 1000 + 14200 \* 100` + + if [ ${SEMMNI} -lt ${SEMMNI_MIN} ]; then + eerror "The current value of SEMMNI is too low" + eerror "for postgresql to run ${MAX_CONNECTIONS} connections" + eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database." + echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem + fi + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + + if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then + echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem + ewarn "Restoring the SEMMNI value to the previous value" + ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf" + ewarn "and set it to at least ${SEMMNI_MIN}" + ewarn "" + ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}" + ewarn "" + fi + + if [ ${SHMMAX} -lt ${SHMMAX_MIN} ]; then + eerror "The current value of SHMMAX is too low for postgresql to run." + eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}." + eerror "" + eerror " kernel.shmmax = ${SHMMAX_MIN}" + eerror "" + + fi + einfo "" + einfo "You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl." + einfo "" + fi +} diff --git a/dev-db/postgresql/postgresql-8.1.4.ebuild b/dev-db/postgresql/postgresql-8.1.4.ebuild new file mode 100644 index 000000000000..103eb5aae605 --- /dev/null +++ b/dev-db/postgresql/postgresql-8.1.4.ebuild @@ -0,0 +1,234 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.1.4.ebuild,v 1.1 2006/05/31 17:41:47 voxus Exp $ + +inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs + +DESCRIPTION="sophisticated Object-Relational DBMS." +HOMEPAGE="http://www.postgresql.org/" +#P_HIERPG="hier-Pg8.0.1-0.5.4" +SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2 + mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2 + doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 )" +# pg-hier? ( http://gppl.moonbone.ru/${P_HIERPG}.diff.gz )" + +LICENSE="POSTGRESQL" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +#IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime pg-hier" +IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime threads" + +DEPEND="virtual/libc + =dev-db/libpq-8.1.4* + sys-devel/autoconf + >=sys-libs/ncurses-5.2 + >=sys-devel/bison-1.875 + zlib? ( >=sys-libs/zlib-1.1.3 ) + readline? ( >=sys-libs/readline-4.1 ) + tcltk? ( >=dev-lang/tcl-8 >=dev-lang/tk-8.3.3-r1 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + xml2? ( dev-libs/libxml2 dev-libs/libxslt dev-util/pkgconfig ) + nls? ( sys-devel/gettext ) + kerberos? ( virtual/krb5 )" +RDEPEND="virtual/libc + =dev-db/libpq-8.1.4* + zlib? ( >=sys-libs/zlib-1.1.3 ) + tcltk? ( >=dev-lang/tcl-8 ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 ) + selinux? ( sec-policy/selinux-postgresql ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + xml2? ( dev-libs/libxml2 dev-libs/libxslt ) + kerberos? ( virtual/krb5 )" + +PG_DIR="/var/lib/postgresql" + +# misc files +FILES_VER="8.1.3" + +pkg_setup() { + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + PG_MAJOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f1 -d.` + PG_MINOR=`cat ${PG_DIR}/data/PG_VERSION | cut -f2 -d.` + if [ ${PG_MAJOR} -lt 8 ] || [ ${PG_MAJOR} -eq 8 -a ${PG_MINOR} -lt 1 ] ; then + eerror "Postgres ${PV} cannot upgrade your existing databases, you must" + eerror "use pg_dump to export your existing databases to a file, and then" + eerror "pg_restore to import them when you have upgraded completely." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + fi + fi + enewgroup postgres 70 \ + || die "problem adding group postgres" + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres \ + || die "problem adding user postgres" +} + +src_unpack() { + unpack ${A} || die + cd ${S} +# use pg-hier && epatch ${WORKDIR}/${P_HIERPG}.diff + + epatch ${FILESDIR}/${PN}-${FILES_VER}-gentoo.patch + epatch ${FILESDIR}/${PN}-${FILES_VER}-sh.patch +} + +src_compile() { + filter-flags -ffast-math -feliminate-dwarf2-dups + + local myconf + use tcltk && myconf="--with-tcl" + use python && myconf="$myconf --with-python" + use perl && myconf="$myconf --with-perl" + use ssl && myconf="$myconf --with-openssl" + use nls && myconf="$myconf --enable-nls" + use libg++ && myconf="$myconf --with-CXX" + use pam && myconf="$myconf --with-pam" + use readline || myconf="$myconf --without-readline" + use zlib || myconf="$myconf --without-zlib" + use kerberos && myconf="$myconf --with-krb5" + use pg-intdatetime && myconf="$myconf --enable-integer-datetimes" + use threads && myconf="$myconf --enable-thread-safety" + + # these are the only working CFLAGS I could get on ppc, so locking them + # down, anything more aggressive fails (i.e. -mcpu or -Ox) + # Gerk - Nov 26, 2002 + use ppc && CFLAGS="-pipe -fsigned-char" + + # Detect mips systems properly + gnuconfig_update + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --host=${CHOST} \ + --with-docdir=/usr/share/doc/${PF} \ + --libdir=/usr/$(get_libdir) \ + --enable-depend \ + $myconf || die + + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + cd contrib + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + if use xml2; then + cd xml2 + make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die + fi +} + +src_install() { + if use perl; then + mv ${S}/src/pl/plperl/Makefile ${S}/src/pl/plperl/Makefile_orig + sed -e "s:(INST_DYNAMIC) /usr/lib:(INST_DYNAMIC) ${D}/usr/lib:" \ + ${S}/src/pl/plperl/Makefile_orig > ${S}/src/pl/plperl/Makefile + mv ${S}/src/pl/plperl/GNUmakefile ${S}/src/pl/plperl/GNUmakefile_orig + sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ + ${S}/src/pl/plperl/GNUmakefile_orig > ${S}/src/pl/plperl/GNUmakefile + fi + + make DESTDIR=${D} LIBDIR=${D}/usr/lib install || die +# make DESTDIR=${D} install-all-headers || die + cd ${S}/contrib + make DESTDIR=${D} LIBDIR=${D}/usr/lib install || die + if use xml2; then + cd ${S}/contrib/xml2 + make DESTDIR=${D} LIBDIR=${D}/usr/lib install || die + fi + cd ${S} + dodoc README HISTORY COPYRIGHT INSTALL + dodoc contrib/adddepend/* + + exeinto /usr/bin + + cd ${S}/doc + dodoc FAQ* README.* TODO bug.template + if use doc; then + cd ${S}/doc + docinto FAQ_html + dodoc src/FAQ/* + docinto sgml + dodoc src/sgml/*.{sgml,dsl} + docinto sgml/ref + dodoc src/sgml/ref/*.sgml + docinto TODO.detail + dodoc TODO.detail/* + fi + + cd ${S} + exeinto /etc/init.d/ + newexe ${FILESDIR}/postgresql.init-${FILES_VER} postgresql || die + + insinto /etc/conf.d/ + newins ${FILESDIR}/postgresql.conf-${FILES_VER} postgresql || die + + rm ${D}/usr/include/postgres_ext.h +} + +pkg_postinst() { + einfo "Make sure the postgres user in /etc/passwd has an account setup with /bin/bash as the shell" + + einfo "" + einfo "Execute the following command when you want to setup the initial database environment." + einfo "emerge --config =${PF}" + einfo "" + einfo "autovacuum function, which was in contrib, has moved to main PostgreSQL function from 8.1." + einfo "You can enable it in postgresql.conf." + einfo "" +} + +pkg_config() { + einfo "Creating the data directory ..." + mkdir -p ${PG_DIR}/data + chown -Rf postgres:postgres ${PG_DIR} + chmod 700 ${PG_DIR}/data + + einfo "Initializing the database ..." + if [ -f ${PG_DIR}/data/PG_VERSION ] ; then + eerror "Postgres ${PV} cannot upgrade your existing databases." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + exit 1 + else + if use kernel_linux; then + local SEM=`sysctl -n kernel.sem | cut -f-3` + local SEMMNI=`sysctl -n kernel.sem | cut -f4` + local SEMMNI_MIN=`expr \( ${MAX_CONNECTIONS} + 15 \) / 16` + local SHMMAX=`sysctl -n kernel.shmmax` + local SHMMAX_MIN=`expr 250000 + 8200 \* 1000 + 14200 \* 100` + + if [ ${SEMMNI} -lt ${SEMMNI_MIN} ]; then + eerror "The current value of SEMMNI is too low" + eerror "for postgresql to run ${MAX_CONNECTIONS} connections" + eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database." + echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem + fi + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + + if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then + echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem + ewarn "Restoring the SEMMNI value to the previous value" + ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf" + ewarn "and set it to at least ${SEMMNI_MIN}" + ewarn "" + ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}" + ewarn "" + fi + + if [ ${SHMMAX} -lt ${SHMMAX_MIN} ]; then + eerror "The current value of SHMMAX is too low for postgresql to run." + eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}." + eerror "" + eerror " kernel.shmmax = ${SHMMAX_MIN}" + eerror "" + fi + else + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + fi + + einfo "" + einfo "You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl." + einfo "" + fi +} |