%define beta 0
%define rel 1
%define non6xpamdeps 0

%{?beta:%define __os_install_post /usr/lib/rpm/brp-compress}

%define tcl 1
%define tkpkg 0
%define jdbc 1
%define test 0
%define python 1
%define pltcl 1
%define plperl 1
%define pls 1
%define ssl 1
%define kerberos 0
%define nls 1
%define pam 1

# Python major version.
%{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
%{expand: %%define pynextver %(python -c 'import sys;print(float(sys.version[0:3])+0.1)')}


Summary: PostgreSQL client programs and libraries.
Summary(ja): PostgreSQL のクライアントプログラム群およびライブラリ
Name: postgresql7
Version: 7.4.7

# Conventions for PostgreSQL Global Development Group RPM releases:

# Official PostgreSQL Development Group RPMS have a PGDG after the release number.
# Integer releases are stable -- 0.1.x releases are Pre-releases, and x.y are
# test releases.

# Pre-releases are those that are built from CVS snapshots or pre-release
# tarballs from postgresql.org.  Official beta releases are not 
# considered pre-releases, nor are release candidates, as their beta or
# release candidate status is reflected in the version of the tarball. Pre-
# releases' versions do not change -- the pre-release tarball of 7.0.3, for
# example, has the same tarball version as the final official release of 7.0.3:
# but the tarball is different.

# Test releases are where PostgreSQL itself is not in beta, but certain parts of
# the RPM packaging (such as the spec file, the initscript, etc) are in beta.

# Pre-release RPM's should not be put up on the public ftp.postgresql.org server
# -- only test releases or full releases should be.

Release: %{rel}%{?_dist_release}
License: BSD
Group: Applications/Databases
Source0: ftp://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2
Source3: postgresql.init
Source5: ftp://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2.md5
Source6: README.rpm-dist
Source10: http://siisise.net/softlib/postgresql745.jar
Source15: postgresql-bashprofile
Source20: PyGreSQL-3.4.tgz
Patch1: rpm-pgsql-7.4.patch
Patch2: postgresql-7.4.7-nls-psql-patch
Patch3: postgresql-7.4-ecpg-patch
Patch4: PyGreSQL-3.4-setup-2.patch
# Patch6: postgresql-7.4.5-tempfile.patch
Buildrequires: perl build-essential
Prereq: /sbin/ldconfig initscripts
%if %python
BuildPrereq: python python-devel
%endif
%if %tcl
BuildPrereq: tcl
%endif
%if %tkpkg
BuildPrereq: tk
%endif
BuildPrereq: readline-devel
BuildPrereq: zlib-devel >= 1.0.4
%if %ssl
BuildPrereq: openssl-devel
%endif
%if %kerberos
BuildPrereq: krb5-devel
%endif
%if %nls
BuildPrereq: gettext >= 0.10.35
%endif

%if %pam
%if %non6xpamdeps
BuildPrereq: pam-devel
%endif
%endif

BuildRequires: bison, flex, pam-devel

Url: http://www.postgresql.org/ 
Buildroot: %{_tmppath}/%{name}-%{version}-root
Obsoletes: postgresql-clients

# This is the PostgreSQL Global Development Group Official RPMset spec file,
# or a derivative thereof.
# Copyright 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
# and others listed.

# Major Contributors:
# ---------------
# Lamar Owen
# Trond Eivind Glomsrd <teg@redhat.com>
# Thomas Lockhart
# Reinhard Max
# Karl DeBisschop
# Peter Eisentraut
# Joe Conway
# and others in the Changelog....

# This spec file and ancilliary files are licensed in accordance with 
# The PostgreSQL license.

# On top of this file you can find the default build package list macros.  These can be overridden by defining
# on the rpm command line:
# rpm --define 'packagename 1' .... to force the package to build.
# rpm --define 'packagename 0' .... to force the package NOT to build.
# The base package, the lib package, the devel package, and the server package always get built.


%description
PostgreSQL is an advanced Object-Relational database management system
(DBMS) that supports almost all SQL constructs (including
transactions, subselects and user-defined types and functions). The
postgresql package includes the client programs and libraries that
you'll need to access a PostgreSQL DBMS server.  These PostgreSQL
client programs are programs that directly manipulate the internal
structure of PostgreSQL databases on a PostgreSQL server. These client
programs can be located on the same machine with the PostgreSQL
server, or may be on a remote machine which accesses a PostgreSQL
server over a network connection. This package contains the docs
in HTML for the whole package, as well as command-line utilities for
managing PostgreSQL databases on a PostgreSQL server. 

If you want to manipulate a PostgreSQL database on a remote PostgreSQL
server, you need this package. You also need to install this package
if you're installing the postgresql-server package.

%description -l ja
PostgreSQLはSQLの構成要素(トランザクション、副問い合わせおよびユーザ
定義型やユーザ定義関数など)のほとんどすべてをサポートした、先進的なオブ
ジェクト指向のデータベース管理システム(DBMS)です。postgresqlのパッケー
ジにはPostgreSQL DBMS サーバにアクセスするために必要なクライアントプロ
グラムおよびライブラリを収録しています。PostgreSQLクライアントプログラ
ムは、PostgreSQLサーバ上のPostgreSQLデータベースの内部構造を直接操作す
るためのプログラムです。これらのクライアントプログラムは、PostgreSQLサ
ーバと同じマシン上で動いていてもよいですし、ネットワークコネクションの
向こう側にあるリモートマシン上にあっても構いません。このパッケージには
PostgreSQLサーバ上のPostgreSQLデータベースを管理するためのユーティリテ
ィに加え、全パッケージのドキュメントがHTML形式で収録されています。

リモートにあるPostgreSQLサーバ上のPostgreSQLデータベースを操作する場合
はこのパッケージが必要です。またpostgresql-serverパッケージをインスト
ールする場合にも、このパッケージをインストールする必要があります。

%package libs
Summary: The shared libraries required for any PostgreSQL clients.
Summary(ja): PostgreSQL クライアントに必要な共有ライブラリ
Group: Applications/Databases
Provides: libpq.so.3 libpq.so.3.0 libpq.so

%description libs
The postgresql-libs package provides the essential shared libraries for any 
PostgreSQL client program or interface. You will need to install this package
to use any other PostgreSQL package or any clients that need to connect to a
PostgreSQL server.

%description -l ja libs
postgresql-libs パッケージは、すべての PostgreSQL クライアントプログラ
ムやインターフェースのための中核的な共有ライブラリを提供します。
PostgreSQL サーバに接続する必要のある、PostgreSQL パッケージやクライア
ントを使う場合には、このパッケージをインストールする必要があります。

%package server
Summary: The programs needed to create and run a PostgreSQL server.
Summary(ja): PostgreSQL サーバを構築・実行するのに必要なプログラム
Group: Applications/Databases
Prereq: /usr/sbin/useradd /sbin/chkconfig 
Requires: postgresql7 = %{version} libpq.so

%description server
The postgresql-server package includes the programs needed to create
and run a PostgreSQL server, which will in turn allow you to create
and maintain PostgreSQL databases.  PostgreSQL is an advanced
Object-Relational database management system (DBMS) that supports
almost all SQL constructs (including transactions, subselects and
user-defined types and functions). You should install
postgresql-server if you want to create and maintain your own
PostgreSQL databases and/or your own PostgreSQL server. You also need
to install the postgresql package.

%description -l ja server
postgresql-server パッケージには、PostgreSQL サーバを生成して実行する
ために必要なプログラムが含まれています。これらにより、PostgreSQL のデ
ータベースを新規に作成したり、メンテナンスしたりできるようになります。
PostgreSQL は先進的でオブジェクト指向的なデータベース管理システム(DBMS)
であり、(トランザクション、副問い合わせ、ユーザ定義型および関数といっ
た)ほとんどすべての SQL 構造をサポートしています。自分自身の PostgreSQL
サーバを動かして、自分自身の PostgreSQL データベースを作成したりメン
テナンスしたりしたい場合は postgresql-server をインストールする必要が
あります。さらに postgresql パッケージもインストールしてください。

%package docs
Summary: Extra documentation for PostgreSQL
Summary(ja): PostgreSQL に関するその他の文書
Group: Applications/Databases

%description docs
The postgresql-docs package includes the SGML source for the documentation
as well as the documentation in other formats, and some extra documentation.
Install this package if you want to help with the PostgreSQL documentation
project, or if you want to generate printed documentation.

%package contrib
Summary: Contributed source and binaries distributed with PostgreSQL
Summary(ja): PostgreSQL と一緒に配布される、寄贈されたソースとバイナリ
Group: Applications/Databases
Requires: postgresql7 = %{version}

%description contrib
The postgresql-contrib package contains contributed packages that are
included in the PostgreSQL distribution.


%package devel
Summary: PostgreSQL development header files and libraries.
Summary(ja): PostgreSQL の開発用ヘッダファイルとライブラリ群
Group: Development/Libraries
Requires: postgresql7-libs = %{version}

%description devel
The postgresql-devel package contains the header files and libraries
needed to compile C or C++ applications which will directly interact
with a PostgreSQL database management server and the ecpg Embedded C
Postgres preprocessor. You need to install this package if you want to
develop applications which will interact with a PostgreSQL server. If
you're installing postgresql-server, you need to install this
package.

%description -l ja devel
postgresql-devel パッケージには、PostgreSQL データベースと直接に会話
するための C / C++ アプリケーションをコンパイルするのに必要なヘッダフ
ァイルとライブラリ、および C 言語埋め込み型の PostgreSQL プリプロセサ
が含まれています。PostgreSQL サーバと会話するアプリケーションを開発
したい場合にはこのパッケージをインストールしてください。また、
postgresql-server をインストールする場合、このパッケージもいっしょに
インストールする必要があります。

#------------
%if %pls
%package pl
Summary: The PL procedural languages for PostgreSQL.
Summary(ja): PostgreSQL 用の手続き言語 PL
Group: Applications/Databases
Requires: postgresql7 = %{version}

%description pl
PostgreSQL is an advanced Object-Relational database management
system.  The postgresql-pl package contains the the PL/Perl, PL/Tcl, and PL/Python
procedural languages for the backend.  PL/Pgsql is part of the core server package.
%endif

#------------
%if %tcl
%package tcl
Summary: A Tcl client library for PostgreSQL.
Summary(ja): PostgreSQL の Tcl クライアントライブラリ
Group: Applications/Databases
Requires: tcl >= 8.0

%description tcl
PostgreSQL is an advanced Object-Relational database management
system.  The postgresql-tcl package contains the libpgtcl client library,
the pg-enhanced pgtclsh,and the pg-enhanced tksh, if so configured at buildtime.
%endif

#------------
%if %python
%package python
Summary: Development module for Python code to access a PostgreSQL DB.
Summary(ja): PostgreSQL DB にアクセスするための Python コード用開発モジュール
Group: Applications/Databases
Requires: python
Conflicts: python < %pyver, python >= %pynextver


%description python
PostgreSQL is an advanced Object-Relational database management
system.  The postgresql-python package includes a module for
developers to use when writing Python code for accessing a PostgreSQL
database.
%endif

#----------
%if %jdbc
%package jdbc
Summary: Files needed for Java programs to access a PostgreSQL database.
Summary(ja): PostgreSQL データベースにアクセスする Java プログラムのために必要なファイル群
Group: Applications/Databases

%description jdbc
PostgreSQL is an advanced Object-Relational database management
system. The postgresql-jdbc package includes the .jar file needed for
Java programs to access a PostgreSQL database.
%endif

#------------
%if %test
%package test
Summary: The test suite distributed with PostgreSQL.
Summary(ja): PostgreSQL と共に配布されるテストスート
Group: Applications/Databases
Requires: postgresql7 = %{version}

%description test
PostgreSQL is an advanced Object-Relational database management
system. The postgresql-test package includes the sources and pre-built
binaries of various tests for the PostgreSQL database management
system, including regression tests and benchmarks.
%endif

%prep
%setup -q -a 20 -n postgresql-%{version}

%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p0
# %patch6 -p1 -b .tempfile-security

%build

CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS

# Strip out -ffast-math from CFLAGS....

CFLAGS=`echo $CFLAGS|xargs -n 1|grep -v ffast-math|xargs -n 100`

./configure --prefix=/usr --disable-rpath\
%if %beta
	--enable-debug \
	--enable-cassert \
%endif
%if %plperl
	--with-perl \
%endif
%if %tcl
	--with-tcl \
%endif
%if %tkpkg
%else
	--without-tk \
%endif
%if %python
	--with-python \
%endif
%if %ssl
	--with-openssl \
%endif
%if %pam
	--with-pam \
%endif
%if %kerberos
	--with-krb5=/usr/kerberos \
%endif
%if %nls
	--enable-nls \
%endif
	--sysconfdir=/etc/sysconfig/pgsql \
	--mandir=%{_mandir} \
	--docdir=%{_docdir} \
	--includedir=%{_includedir}/pgsql \
	--datadir=/usr/share/pgsql

make all
make -C contrib all

%if %test
	pushd src/test
	make all
	popd
%endif

## PyGreSQL-3.4 (2004/04/10 added by Shu KONNO)
%if %python
pushd PyGreSQL-3.4
python setup.py build --build-lib lib
popd
%endif

%install
rm -rf $RPM_BUILD_ROOT

make DESTDIR=$RPM_BUILD_ROOT install
make -C contrib DESTDIR=$RPM_BUILD_ROOT install

# install dev headers.

make DESTDIR=$RPM_BUILD_ROOT install-all-headers

# copy over Makefile.global to the include dir....
#install -m755 src/Makefile.global $RPM_BUILD_ROOT/usr/include/pgsql
#install -m755 src/Makefile.shlib $RPM_BUILD_ROOT/usr/include/pgsql
install -m644 src/Makefile.global $RPM_BUILD_ROOT/usr/include/pgsql
install -m644 src/Makefile.shlib $RPM_BUILD_ROOT/usr/include/pgsql

%if %jdbc
	# Java/JDBC
	# The user will have to set a CLASSPATH to find it here, but not sure where else to put it...

	# JDBC jars 
	install -m 755 %{SOURCE10} $RPM_BUILD_ROOT/usr/share/pgsql

%endif

if [ -d /etc/rc.d/init.d ]
then
	install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
	install -m 755 %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/postgresql
fi


# PGDATA needs removal of group and world permissions due to pg_pwd hole.
install -d -m 700 $RPM_BUILD_ROOT/var/lib/pgsql/data

# backups of data go here...
install -d -m 700 $RPM_BUILD_ROOT/var/lib/pgsql/backups

# postgres' .bash_profile
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT/var/lib/pgsql/.bash_profile

# Create the multiple postmaster startup directory
install -d -m 700 $RPM_BUILD_ROOT/etc/sysconfig/pgsql


%if %test
	# tests. There are many files included here that are unnecessary, but include
	# them anyway for completeness.
	mkdir -p $RPM_BUILD_ROOT/usr/lib/pgsql/test
	cp -a src/test/regress $RPM_BUILD_ROOT/usr/lib/pgsql/test
	install -m 0755 contrib/spi/refint.so $RPM_BUILD_ROOT/usr/lib/pgsql/test/regress
	install -m 0755 contrib/spi/autoinc.so $RPM_BUILD_ROOT/usr/lib/pgsql/test/regress
	pushd  $RPM_BUILD_ROOT/usr/lib/pgsql/test/regress/
	strip *.so
	popd
%endif

# Fix some more documentation
# gzip doc/internals.ps
cp %{SOURCE6} README.rpm-dist
mv $RPM_BUILD_ROOT%{_docdir}/postgresql/html doc

%find_lang libpq
%find_lang pg_dump
%find_lang postgres
%find_lang psql
%find_lang pg_resetxlog
%find_lang pg_controldata

cat libpq.lang > libpq.lst
cat psql.lang pg_dump.lang > main.lst
cat postgres.lang pg_resetxlog.lang pg_controldata.lang > server.lst

%if %python
install -d $RPM_BUILD_ROOT/usr/lib/python%{pyver}/site-packages/
install -m 755 PyGreSQL-3.4/lib/_pg.so \
	$RPM_BUILD_ROOT/usr/lib/python%{pyver}/site-packages/
install -m 644 PyGreSQL-3.4/lib/*.py* \
	$RPM_BUILD_ROOT/usr/lib/python%{pyver}/site-packages/
%endif

%post libs -p /sbin/ldconfig 
%postun libs -p /sbin/ldconfig 

%pre server
groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
useradd -M -n -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
	-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
touch /var/log/pgsql
chown postgres.postgres /var/log/pgsql
chmod 0700 /var/log/pgsql


%post server
chkconfig --add postgresql
/sbin/ldconfig

%preun server
if [ $1 = 0 ] ; then
	chkconfig --del postgresql
fi

%postun server
/sbin/ldconfig 
if [ $1 -ge 1 ]; then
  /sbin/service postgresql condrestart >/dev/null 2>&1
fi
if [ $1 = 0 ] ; then
    if [ ! -x /usr/bin/postgres ] ; then
	    userdel postgres >/dev/null 2>&1 || :
	    groupdel postgres >/dev/null 2>&1 || : 
    fi 
fi

%if %tcl
%post -p /sbin/ldconfig   tcl
%postun -p /sbin/ldconfig   tcl
%endif

%if %pls
%post -p /sbin/ldconfig   pl
%postun -p /sbin/ldconfig   pl
%endif

%if %test
%post test
chown -R postgres.postgres /usr/share/pgsql/test >/dev/null 2>&1 || :
%endif


%clean
rm -rf $RPM_BUILD_ROOT

# FILES section.

%files -f main.lst
%defattr(-,root,root)
%doc doc/FAQ doc/KNOWN_BUGS doc/MISSING_FEATURES doc/README* 
%doc COPYRIGHT README HISTORY doc/bug.template
%doc README.rpm-dist
%doc doc/html
/usr/bin/clusterdb
/usr/bin/createdb
/usr/bin/createlang
/usr/bin/createuser
/usr/bin/dropdb
/usr/bin/droplang
/usr/bin/dropuser
/usr/bin/pg_dump
/usr/bin/pg_dumpall
/usr/bin/pg_encoding
/usr/bin/pg_id
/usr/bin/pg_restore
/usr/bin/psql
/usr/bin/vacuumdb
%{_mandir}/man1/clusterdb.*
%{_mandir}/man1/createdb.*
%{_mandir}/man1/createlang.*
%{_mandir}/man1/createuser.*
%{_mandir}/man1/dropdb.*
%{_mandir}/man1/droplang.*
%{_mandir}/man1/dropuser.*
%{_mandir}/man1/pg_dump.*
%{_mandir}/man1/pg_dumpall.*
%{_mandir}/man1/pg_restore.*
%{_mandir}/man1/psql.*
%{_mandir}/man1/vacuumdb.*
%{_mandir}/man7/*

%files docs
%defattr(-,root,root)
%doc doc/src/*

%files contrib
%defattr(-,root,root)
/usr/lib/pgsql/_int.so
/usr/lib/pgsql/autoinc.so
/usr/lib/pgsql/btree_gist.so
/usr/lib/pgsql/chkpass.so
/usr/lib/pgsql/cube.so
/usr/lib/pgsql/dblink.so
/usr/lib/pgsql/dbsize.so
/usr/lib/pgsql/earthdistance.so
/usr/lib/pgsql/fti.so
/usr/lib/pgsql/fuzzystrmatch.so
/usr/lib/pgsql/insert_username.so
/usr/lib/pgsql/int_aggregate.so
/usr/lib/pgsql/isbn_issn.so
/usr/lib/pgsql/lo.so
/usr/lib/pgsql/ltree.so
/usr/lib/pgsql/misc_utils.so
/usr/lib/pgsql/moddatetime.so
/usr/lib/pgsql/noup.so
/usr/lib/pgsql/pending.so
/usr/lib/pgsql/pgcrypto.so
/usr/lib/pgsql/pgstattuple.so
/usr/lib/pgsql/refint.so
/usr/lib/pgsql/rserv.so
/usr/lib/pgsql/rtree_gist.so
/usr/lib/pgsql/seg.so
/usr/lib/pgsql/string_io.so
/usr/lib/pgsql/tablefunc.so
/usr/lib/pgsql/timetravel.so
/usr/lib/pgsql/tsearch.so
/usr/lib/pgsql/user_locks.so
/usr/share/pgsql/contrib/
/usr/bin/dbf2pg
/usr/bin/findoidjoins
/usr/bin/make_oidjoins_check
/usr/bin/fti.pl
/usr/bin/oid2name
/usr/bin/pg_dumplo
/usr/bin/pg_logger
/usr/bin/pgbench
/usr/bin/RservTest
/usr/bin/MasterInit
/usr/bin/MasterAddTable
/usr/bin/Replicate
/usr/bin/MasterSync
/usr/bin/CleanLog
/usr/bin/SlaveInit
/usr/bin/SlaveAddTable
/usr/bin/GetSyncID
/usr/bin/PrepareSnapshot
/usr/bin/ApplySnapshot
/usr/bin/InitRservTest
/usr/bin/vacuumlo
%doc contrib/*/README.* contrib/spi/*.example

%files libs -f libpq.lang
%defattr(-,root,root)
/usr/lib/libpq.so.*
/usr/lib/libecpg.so.*
/usr/lib/libpgtypes.so.*

%files server -f server.lst
%defattr(-,root,root)
/etc/rc.d/init.d/postgresql
%dir /etc/sysconfig/pgsql
/usr/bin/initdb
/usr/bin/initlocation
/usr/bin/ipcclean
/usr/bin/pg_controldata
/usr/bin/pg_ctl
/usr/bin/pg_resetxlog
/usr/bin/postgres
/usr/bin/postmaster
%{_mandir}/man1/initdb.*
%{_mandir}/man1/initlocation.*
%{_mandir}/man1/ipcclean.*
%{_mandir}/man1/pg_controldata.*
%{_mandir}/man1/pg_ctl.*
%{_mandir}/man1/pg_resetxlog.*
%{_mandir}/man1/postgres.*
%{_mandir}/man1/postmaster.*
/usr/share/pgsql/postgres.bki
/usr/share/pgsql/postgres.description
/usr/share/pgsql/*.sample
/usr/share/pgsql/information_schema.sql
/usr/share/pgsql/sql_features.txt
/usr/lib/pgsql/plpgsql.so
%if %python
/usr/lib/pgsql/plpython.so
%endif
%dir /usr/lib/pgsql
%dir /usr/share/pgsql
%attr(700,postgres,postgres) %dir /var/lib/pgsql
%attr(700,postgres,postgres) %dir /var/lib/pgsql/data
%attr(700,postgres,postgres) %dir /var/lib/pgsql/backups
%attr(644,postgres,postgres) %config(noreplace) /var/lib/pgsql/.bash_profile
/usr/lib/pgsql/*_and_*.so
/usr/share/pgsql/conversion_create.sql

%files devel
%defattr(-,root,root)
/usr/include/*
/usr/bin/ecpg
/usr/bin/pg_config
/usr/lib/libpq.so
/usr/lib/libecpg.so
/usr/lib/libpq.a
/usr/lib/libecpg.a
%if %tcl
/usr/lib/libpgtcl.a
%endif
%{_mandir}/man1/ecpg.*
%{_mandir}/man1/pg_config.*

%if %tcl
%files tcl
%defattr(-,root,root)
%attr(755,root,root) /usr/lib/libpgtcl.so.*
# libpgtcl.so is not in devel because Tcl scripts may load it by that name.
/usr/lib/libpgtcl.so
/usr/bin/pgtclsh
%{_mandir}/man1/pgtclsh.*
/usr/lib/pgsql/pltcl.so
%if %tkpkg
/usr/bin/pgtksh
%{_mandir}/man1/pgtksh.*
%endif
%endif

%if %pls
%files pl
%defattr(-,root,root)
%if %plperl
/usr/lib/pgsql/plperl.so
%endif
%if %pltcl
/usr/lib/pgsql/pltcl.so
/usr/bin/pltcl_delmod
/usr/bin/pltcl_listmod
/usr/bin/pltcl_loadmod
/usr/share/pgsql/unknown.pltcl
%endif
%if %python
/usr/lib/pgsql/plpython.so
%endif
%endif

%if %python
%files python
%defattr(-,root,root)
#%doc src/interfaces/python/README src/interfaces/python/tutorial
#/usr/lib/python%{pyver}/site-packages/_pgmodule.so
/usr/lib/python?.?/site-packages/_pg.so
/usr/lib/python?.?/site-packages/*.py
%endif

%if %jdbc
%files jdbc
%defattr(-,root,root)
/usr/share/pgsql/postgresql745.jar
%endif

%if %test
%files test
%defattr(-,postgres,postgres)
%attr(-,postgres,postgres) /usr/lib/pgsql/test/*
%attr(-,postgres,postgres) %dir /usr/lib/pgsql/test
%endif

%changelog
* Sun Oct 12 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 7.4.7-1
- new versioning policy; spec in UTF-8
- rebuild against readline-5.2

* Fri Feb 18 2005 HOTTA Michihide <hotta@net-newbie.com> 7.4.7-0vl1
- change package name to postgresql7 for VineSeed-Plus
- modify %postun not to delete postgres account on upgrade

* Sun Feb 13 2005 HOTTA Michihide <hotta@net-newbie.com> 7.4.7-0vl1
- upstream release
- add Conflicts: postgresql8
- update postgresql-7.4.7-nls-psql-patch

* Fri Dec 04 2004 HOTTA Michihide <hotta@net-newbie.com> 7.4.6-0vl2
- upstream release
- new JDBC driver
- add BuildRequires: bison, flex, pam-devel
- drop postgresql-7.4.5-tempfile.patch (repaired)

* Thu Nov 18 2004 IKEDA Katsumi <ikeda@webmasters.gr.jp> 7.4.5-0vl2
- Added a security fix patch postgresql-7.4.5-tempfile.patch
  from Gentoo Linux (CAN-2004-0977).
- Changed Patch4:
  from PyGreSQL-3.4-setup-2.patch into PyGreSQL-3.4-setup-2.patch
  It is possible to compile this package without pre-installed postgresql.
- Removed Patch5 because Patch4 was changed.

* Tue Aug 24 2004 HOTTA Michihide <hotta@net-newbie.com> 7.4.5-0vl1
- upstream release

* Mon Jun 21 2004 HOTTA Michihide <hotta@net-newbie.com> 7.4.3-0vl1
- upstream release
- new jdbc driver 

* Sat Apr 17 2004 Shu KONNO <owa@bg.wakwak.com> 7.4.2-0vl3
- rebuild with python-2.3.3-0vl1

* Tue Apr 13 2004 Shu KONNO <owa@bg.wakwak.com> 7.4.2-0vl2.3
- changed mode to 644 at Makefile.global, Makefile.shlib

* Mon Apr 12 2004 Shu KONNO <owa@bg.wakwak.com> 7.4.2-0vl2.2
- updated python install section

* Sat Apr 10 2004 Shu KONNO <owa@bg.wakwak.com> 7.4.2-0vl2.1
- added PyGreSQL-3.4.tgz and set python flag
- added PyGreSQL-3.4-setup.patch
- added PyGreSQL-3.4-pgmodule.patch
- rebuilded with python-2.3.3-0vl0.3 (for TestPkg)

* Sun Mar 28 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 7.4.2-0vl2
- rebuild with new openssl

* Wed Mar 17 2004 HOTTA Michihide <hotta@net-newbie.com> 7.4.2-0vl1
- upstream release
- change all of %{?foo:%define foo 0} -like descriptions to simple 
  %define format for latest rpm to build.

* Sat Feb 14 2004 HOTTA Michihide <hotta@net-newbie.com> 7.4.1-0vl3
- rebuild on latest tcl package environment.

* Wed Feb 11 2004 HOTTA Michihide <hotta@net-newbie.com> 7.4.1-0vl2
- fixed lacking files at server's %files

* Fri Dec 05 2003 HOTTA Michihide <hotta@net-newbie.com> 7.4-0vl2
- include JDBC driver for 7.4
- fix typo in postgresql-7.4-psql-patch

* Thu Nov 20 2003 HOTTA Michihide <hotta@net-newbie.com> 7.4-0vl1
- upstream release
- change '--includedir=' option to avoid conflicting with unixODBC
- add postgresql-7.4-ecpg-patch

* Wed Sep 10 2003 HOTTA Michihide <hotta@net-newbie.com> 7.3.4-0vl1
- upstream release

* Wed Jul 23 2003 HOTTA Michihide <hotta@net-newbie.com> 7.3.3-0vl2
- drop previous version of libpq's trash

* Wed May 28 2003 HOTTA Michihide <hotta@net-newbie.com> 7.3.3-0vl1
- upstream release with new nls patch
- fix postgresql-bashprofile (value of PGDATA)
- fix postgresql-init for Japanese-specific use (-E EUC_JP --no-locale)

* Wed Apr 02 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 7.3.2-0vl2
- rebuild with tcltk8.4 and readline-4.3

* Fri Mar 07 2003 HOTTA Michihide <hotta@net-newbie.com> 7.3.2-0vl1
- upstream release

* Wed Dec 25 2002 HOTTA Michihide <hotta@net-newbie.com> 7.3.1-0vl1
- upstream release
- remove garbage changelog

* Mon Dec 23 2002 HOTTA Michihide <hotta@net-newbie.com> 7.3-0vl1
- upstream release based on 7.3-2PGDG
- add nls patch

* Thu Dec 05 2002 Lamar Owen <lamar.owen@ramifordistat.net>
- 7.3-2PGDG
- Fix typo in initscript.  Argh!!

* Wed Dec 04 2002 Lamar Owen <lamar.owen@ramifordistat.net>
- 7.3-0.5PGDG
- Jerk out all perl client stuff and kludgage
- Rename plperl subpackage to a pl subpackage containing all but PL/Pgsql PL's
- Eliminate locale and multibyte explicit enables -- they are both defaults now
- Eliminate pgaccess code; it's not a part of the main tarball anymore
- Eliminate ODBC stuff -- it's also separate now.  Use unixODBC instead.
- Eliminated separate tk client package -- rolled the tk client into the tcl client.
- Moved pltcl into the pl subpackage.
- Added plpython to the pl subpackage.
- /etc/sysconfig/pgsql is sysconfdir for multiple postmaster startup.

* Mon Dec 02 2002 Lamar Owen <lamar.owen@ramifordistat.net>
- 7.3-0.1PGDG (not released)
- Integrate 7.3 jar's courtesy Joe Conway
- Integrate multi-postmaster initscript courtesy Karl DeBisschop
- Some renames and restructures.
- Stripped out the last dregs of the postgresql-dump migration script.
- Conflicts with less than 7.3.

- (See below for old changelogs from VineSeed) 

* Wed Oct 04 2002 HOTTA Michihide <hotta@net-newbie.com> 7.2.3-0vl1
- updated to 7.2.3.

* Wed Sep 10 2002 HOTTA Michihide <hotta@net-newbie.com> 7.2.2-0vl3
- absorbed previous patch8 into original nlspatch
- fixed configure options (--enable-nls and --enable-locale to be antinomy)

* Tue Aug 30 2002 Shoji Matsumoto <shom@vinelinux.org> 7.2.2-0vl2
- add patch8 (ja.po for psql was invalid)

* Wed Aug 29 2002 HOTTA Michihide <hotta@net-newbie.com> 7.2.2-0vl1
- updated to 7.2.2.
- improved nlspatch to enable japanese SQL help in psql.

* Wed Jul 06 2002 HOTTA Michihide <hotta@net-newbie.com> 7.2.1-5vl3
- fixed garbage chars in description(ja).

* Wed Jul 03 2002 HOTTA Michihide <hotta@net-newbie.com> 7.2.1-5vl2
- imported & replaced changelog (following VineSeed's).
  add some stuff to '%%files'.

* Wed Jul 03 2002 HOTTA Michihide <hotta@net-newbie.com> 7.2.1-5vl1
- Modified for Vine Linux 2.5. Originaly from RHL 7.2.1-5, adding
  nls patch, pg_dump patch, date_part patch by Jun Kuwamura

* Thu May 23 2002 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net>
- replace nls patch.
- add *.mo to '%%files'.

* Mon Mar 04 2002 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net>
- fix initscript

* Sun Mar 03 2002 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net>
- add /usr/bin/pg_id to the package (fix)

* Sat Mar 01 2002 Satoshi MACHINO <machino@vinelinux.org> 7.2-0vl1
- updated 7.2
- added nls.patch
- fixed spec file
- added New JDBC
-- pgjdbc1.jar(for JDK1.1.x), pgjdbc2(for Java2)

* Sat Sep 22 2001 Satoshi MACHINO <machino@vinelinux.org> 7.1.3-4vl1
- updated 7.1.3

* Tue Aug 21 2001 Hisao SHIBUYA <shibuya@alpha.or.jp>
- 7.1.2-7vl3
- merge 7.1.2-7vl2 and 7.1.2-7

* Sun Aug 19 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 7.1.2-7vl2
- fixed spec typo (%%{_includesir} -> %%{_includedir})

* Tue Aug 14 2001 Satoshi MACHINO <machino@vinelinux.org> 7.1.2-7vl1
- updated 7.1.2 (used postgresql-7.1.2-7)
- used psqlj patch for 7.1.2
- used jumbo-20010801.patch.gz

* Mon Aug  6 2001 Trond Eivind Glomsr <teg@redhat.com> 7.1.2-7
- Add patches from 7.1-stable branch. This should fix #50799 and #50797
- Enable kerberos authentication (#50644)
- handle stop with stale pid file (#50499)
- make the test subpackage (not built by default) own /usr/lib/pgsql/test

* Mon Jul  9 2001 Trond Eivind Glomsr <teg@redhat.com>
- Make the -devel subpackage depend on -libs, not the main package

* Tue Jun 19 2001 Trond Eivind Glomsr <teg@redhat.com>
- Make sure the python subpackage depends on mx - otherwise, you'd get an error when importing

* Mon Jun 18 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- add changes for s390x

* Fri Jun 15 2001 Trond Eivind Glomsr <teg@redhat.com>
- Many path fixes for contrib packages
- Newer intarray
- Don't use nested ifs for tkpkg/pgaccess
- Turn off test package for Red Hat Linux - it makes most sense just to use 
  this during development
- One "pgacess" -> "pgaccess"

* Wed Jun 13 2001 Lamar Owen <lamar.owen@wgcr.org> <lamar@postgresql.org>
- -4PGDG
- patchset update for pg_regress.sh
- can the dot in the release -- confused too many people and some programs.
- -3.PGDG
- updated README.rpm-dist
- updated patch to 7.1.2, fixing some places where /usr/share/pgsql 
  was still being used where /usr/lib/pgsql was intended.
- PGLIB now set to /usr/lib/pgsql -- initdb doesn't use it to find the bki's.

* Tue Jun 12 2001 Trond Eivind Glomsr <teg@redhat.com>
- sync
- Run chkconfig --add on server install
- Move the prereqs on useradd on chkconfig to the server package
- don't disable the %%clean section

* Sat Jun 09 2001 Lamar Owen <lamar.owen@wgcr.org>
- Sync up with Trond Eivind's set.

* Thu Jun  7 2001 Trond Eivind Glomsr <teg@redhat.com>
- Don't create postgres' .bashrc from the server post script: include it instead
- Move the test packages from /usr/share/pgsql to /usr/lib/pgsql
- Move the symlinks libpq.so, libecpg.so, libpq++.so and libpgeasy.so to the devel subpackage from 
  libs
- Source the i18n data from the .bashrc instead of in the initscript

* Mon May 28 2001 Trond Eivind Glomsr <teg@redhat.com>
- Handle i18n for database startup - backend needs to have the same locale everytime, 
  but this certainly can't be hardcoded to C either
- Fix stop, restart in initscript (#42217)
- Make database init _much_ less verbose
- other minor fixes to the initscript

* Fri May 25 2001 Trond Eivind Glomsr <teg@redhat.com>
- 7.1.2

* Thu May 24 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- 7.1.2-0.1.1.PGDG PRERELEASE
- Changed versioning and release numbering a little for better flexibility,
-- particularly for distribution packagers.
- Release numbering comment at top of spec, where it's more useful.
- Trimmed changelog to 7.1.x. See the last 7.0.3's specfile for the 7.0
  changlog, and the last 6.5.3's specfile for the changelog prior to
  7.0.

* Sun May 20 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- 7.1.1-4.PGDG
- _really_ got Python version agnosticism working.

* Sat May 19 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- 7.1.1-3.PGDG Release
- Python version agnosticism.....

* Tue May 15 2001 Trond Eivind Glomsr <teg@redhat.com>
- Use openssl
- Make it obsolete subpackages if they aren't built

* Mon May 14 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- 7.1.1-2.PGDG Release.
- Appended .PGDG to release string to differentiate our RPM set from the others.
- /bin/sh fix in initscript
- README.rpm-dist updates.

* Mon May 14 2001 Bernhard Rosenkraenzer <bero@redhat.com> 7.1.1-0.7
- Rebuild with new readline

* Thu May 10 2001 Trond Eivind Glomsr <teg@redhat.com>
- Initial 7.1.1

* Mon May  7 2001 Trond Eivind Glomsr <teg@redhat.com>
- Specify shell when running commands through su in the initscript, to avoid problems 
  when people switch the postgres user to use tcsh

* Thu Apr 19 2001 Trond Eivind Glomsr <teg@redhat.com>
- JDBC driver for Postgresql 7.1

* Sun Apr 15 2001 Trond Eivind Glomsr <teg@redhat.com>
- slightly different versioning scheming, will go back to the official
  later when I'm sure the package is ready to use

* Fri Apr 13 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- 7.1 RELEASE
- 7.1-1 RPM RELEASE
- Change to COPTS -- strip out -ffastmath -- Considered Harmful.
- Back to old versioning scheme, kept teg's other fixes.
- README.rpm-dist updated.
- PGVERSION updated all-around (hopefully!)
- Couple of fixes from Peter E.
- Rearrange dependencies -- only the -libs subpackage is required for most stuff
- Removed broken and confusing logrotate script.

* Mon Apr  9 2001 Trond Eivind Glomsr <teg@redhat.com>
- chown considered harmful - removed
- fix dangling symlimks (pg_crc.c)
- libpq.so changes for maximum compatiblity
- different versioning scheme, to avoid trouble later
- remove temporary perl file from the file list
- fix spelling error in tcl description
- mark odbcinst.ini as a config file
- use %%defattr on packages which didn't have it

* Sat Apr 07 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- Integrated the PL/Perl stuff from Karl DeBisschop --conditional.
- Packaging reorg: added contrib and docs subpackages.
- Removed sgml source docs from main package --> docs subpackage.
- Removed contrib tree from main package --> contrib subpackage.
- Contrib tree is now prebuilt -- HOWEVER, very little install work is
  currently done with this. 

* Fri Apr 06 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- Quickie RC3.  There will be a 7.1RC3-2 shortly with other stuff.

* Tue Apr 03 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- RC2
- eliminate versioning information for ancilliary files in prep for CVS.
- Fix docs mixup.

* Tue Mar 27 2001 Lamar Owen <lamar@postgresql.org> <lamar.owen@wgcr.org>
- RC1 quickie.

* Tue Mar 20 2001 Lamar Owen <lamar@postgresql.org>
- Beta 6 initial build.
- Use make install-all-headers instead of cpio hack for devel headers.
- Split out the libs into the libs subpackage.
- Updated initscript to use pg_ctl to stop
- Updated initscript to initdb and start postmaster with LC_ALL=C to 
  prevent index corruption.


* Sun Jan 28 2001 Lamar Owen <lamar@postgresql.org>
- Beta4
- Return to 'pgsql' directories instead of 'postgresql'
- Better perl patches.

* Mon Jan 15 2001 Lamar Owen <lamar@postgresql.org>
- Edit patches to get rid of some cruft.
- Eliminate some more pre-7.1 specfile baggage that is no longer necessary.
- Moved pg_id to server
- added Makefile.global and pg_config to devel
- Corrected /usr/include/pgsql to /usr/include/postgresql
- Fixed some configure options.  Will be trying the configure macro next release
- Since it is terminally ill in this version pg_upgrade is _gone_.
- Thanks to Peter E for a good review.

* Sun Jan 14 2001 Lamar Owen <lamar@postgresql.org>
- Running regression. 1 on the release-o-meter.
- Minor patches to get regression running right.  
- Initscript tweaking -- the old test for a database structure fails with 7.1's new structure.

* Sat Jan 13 2001 Lamar Owen <lamar@postgresql.org>
- Perl 5 needs to be built with PREFIX set on the Makefile, not GNUmakefile....
- The 7.1 build is different from the 7.0 build -- see the configure line.
- NOTE: many files that used to be in /usr/share/postgresql are now in /usr/share/postgresql!
- by request, conditional packages are now supported. See the top of the spec.
- Fixed the server postinstall problems.

* Mon Jan 08 2001 Lamar Owen <lamar@postgresql.org>
- First 7.1 beta test-build

