postgresql/postgresql.spec

468 lines
14 KiB
RPMSpec
Raw Normal View History

#
# spec file for package postgresql (Version 8.4.0)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: postgresql
BuildRequires: bison flex gettext-devel krb5-devel libxslt-devel
BuildRequires: openldap2-devel openssl-devel pam-devel readline-devel zlib-devel
BuildRequires: ncurses-devel
Summary: Basic Clients and Utilities for PostgreSQL
Version: 8.4.0
Release: 1
%define pg_minor_version %(echo %version | cut -f1-2 -d.)
License: BSD 3-clause (or similar)
Group: Productivity/Databases/Tools
Source0: postgresql-%version.tar.bz2
Source2: postgresql-README.SuSE.de
Source3: postgresql-README.SuSE.en
Source8: postgresql-sysconfig
Source9: postgresql-init
Source15: postgresql-bashprofile
Source16: postgresql-firewall
Source17: postgresql-rpmlintrc
Source99: postgresql-pl.spec
Patch1: postgresql-8.3-conf.patch
Patch2: postgresql-regress.patch
Patch3: postgresql-8.4.0-sle10-timestamptz.patch
PreReq: postgresql-libs = %pg_minor_version
Url: http://www.postgresql.org/
Provides: postgresql = %pg_minor_version
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the basic utility and client programs necessary
to maintain and work with local or remote PostgreSQL databases as well
as manual pages for the SQL commands that PostgreSQL supports. Full
HTML documentation for PostgreSQL can be found in the postgresql-docs
package.
Authors:
--------
Marc G. Fournier <scrappy@hub.org>
Tom Lane <tgl@sss.pgh.pa.us>
Vadim B. Mikheev <vadim4o@yahoo.com>
Bruce Momjian <pgman@candle.pha.pa.us>
Jan Wieck <JanWieck@Yahoo.com>
%package libs
License: BSD 3-clause (or similar)
Summary: Shared Libraries Required for PostgreSQL Clients
Group: Productivity/Databases/Clients
# bug437293
%ifarch ppc64
Obsoletes: postgresql-libs-64bit
%endif
#
Provides: postgresql-libs = %pg_minor_version
PreReq: sh-utils fileutils
%description libs
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, user-defined types
and functions.
This package provides the essential shared libraries for (almost) any
PostgreSQL client program or interface. You will need to install this
package in order to use any other PostgreSQL package or any clients
that need to connect to a PostgreSQL server.
Authors:
--------
Marc G. Fournier <scrappy@hub.org>
Tom Lane <tgl@sss.pgh.pa.us>
Vadim B. Mikheev <vadim4o@yahoo.com>
Bruce Momjian <pgman@candle.pha.pa.us>
Jan Wieck <JanWieck@Yahoo.com>
%package server
License: BSD 3-clause (or similar)
Summary: The Programs Needed to Create and Run a PostgreSQL Server
Group: Productivity/Databases/Servers
PreReq: %insserv_prereq %fillup_prereq
PreReq: /usr/sbin/useradd /usr/sbin/groupadd /sbin/chkconfig
PreReq: /usr/bin/strings /bin/sed
PreReq: postgresql = %pg_minor_version
Requires: glibc-locale
Provides: postgresql-server = %pg_minor_version
%package docs
License: BSD 3-clause (or similar)
Summary: HTML Documentation for PostgreSQL
Group: Productivity/Databases/Tools
%description docs
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the HTML documentation for PostgreSQL. The start
page is: file:///usr/share/doc/packages/postgresql/html/index.html .
Manual pages for the PostgreSQL SQL statements can be found in the
postgresql package.
Authors:
--------
Marc G. Fournier <scrappy@hub.org>
Tom Lane <tgl@sss.pgh.pa.us>
Vadim B. Mikheev <vadim4o@yahoo.com>
Bruce Momjian <pgman@candle.pha.pa.us>
Jan Wieck <JanWieck@Yahoo.com>
%package contrib
License: BSD 3-clause (or similar)
Summary: Contributed Extensions and Additions to PostgreSQL
Group: Productivity/Databases/Tools
Requires: postgresql-server = %pg_minor_version
%description contrib
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
The postgresql-contrib package includes extensions and additions that
are distributed along with the PostgreSQL sources, but are not (yet)
officially part of the PostgreSQL core.
Documentation for the modules contained in this package can be found in
/usr/share/doc/packages/postgresql/contrib.
Authors:
--------
Marc G. Fournier <scrappy@hub.org>
Tom Lane <tgl@sss.pgh.pa.us>
Vadim B. Mikheev <vadim4o@yahoo.com>
Bruce Momjian <pgman@candle.pha.pa.us>
Jan Wieck <JanWieck@Yahoo.com>
%description server
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, sub-queries, triggers, and user-defined
types and functions.
This package includes the programs needed to create and run a
PostgreSQL server, which will in turn allow you to create and maintain
PostgreSQL databases.
Authors:
--------
Marc G. Fournier <scrappy@hub.org>
Tom Lane <tgl@sss.pgh.pa.us>
Vadim B. Mikheev <vadim4o@yahoo.com>
Bruce Momjian <pgman@candle.pha.pa.us>
Jan Wieck <JanWieck@Yahoo.com>
%package devel
License: BSD 3-clause (or similar)
Summary: PostgreSQL development header files and libraries
Group: Productivity/Databases/Tools
Requires: postgresql-libs = %pg_minor_version
%description devel
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, and user-defined
types and functions.
This package contains the header files and libraries needed to compile
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 in C
which will interact with a PostgreSQL server.
Authors:
--------
Marc G. Fournier <scrappy@hub.org>
Tom Lane <tgl@sss.pgh.pa.us>
Vadim B. Mikheev <vadim4o@yahoo.com>
Bruce Momjian <pgman@candle.pha.pa.us>
Jan Wieck <JanWieck@Yahoo.com>
%prep
%setup -q
%patch1
%patch2
# apply the following patch only on SLE10
%if %suse_version == 1010
%patch3 -p1
%endif
%build
export CFLAGS="%optflags $SP"
# uncomment the following line to enable the stack protector
# CFLAGS="$CFLAGS -fstack-protector"
./configure \
--prefix=%_prefix \
--libdir=%_libdir \
--bindir=%_bindir \
--includedir=%_includedir/pgsql \
--datadir=%_datadir/postgresql \
--mandir=%_mandir \
--docdir=%_docdir \
--disable-rpath \
--enable-nls \
--enable-thread-safety \
--enable-integer-datetimes \
--without-python \
--without-perl \
--without-tcl \
--with-openssl \
--with-pam \
--with-krb5 \
--with-gssapi \
--with-ldap \
--with-libxml \
--with-libxslt \
--with-system-tzdata=/usr/share/zoneinfo
make %{?jobs:-j%jobs} all
make %{?jobs:-j%jobs} -C contrib all
#
%ifnarch %arm
%check
#
# Run the regression tests.
#
make check || {
for f in log/* regression.diffs; do
if test -f $f; then
echo ==== $f ====================
fi
done
echo ==============================
exit 1
}
%endif
%install
make DESTDIR=%buildroot install
# Don't ship static libraries, libpgport.a is needed, though.
rm %buildroot/%_libdir/{libecpg,libecpg_compat,libpgtypes,libpq}.a
#
# Install and collect the contrib stuff
#
touch flag; sleep 1 # otherwise we have installed files that are not newer than flag
make DESTDIR=%buildroot -C contrib install
find %buildroot -type f -cnewer flag -printf "/%%P\n" |
grep -v %_docdir > files.contrib
rm flag
for f in /etc/init.d /var/adm/fillup-templates /usr/sbin \
/etc/sysconfig/SuSEfirewall2.d/services
do
install -d %buildroot/$f
done
install -m 755 %{SOURCE9} %buildroot/etc/init.d/postgresql
install -m 644 %{SOURCE8} %buildroot/var/adm/fillup-templates/sysconfig.postgresql
%if 0%suse_version > 1020
install -m 644 %SOURCE16 %buildroot/etc/sysconfig/SuSEfirewall2.d/services/postgresql
%endif
ln -s ../../etc/init.d/postgresql %buildroot/usr/sbin/rcpostgresql
install -d -m 750 %buildroot/var/lib/pgsql
install -d -m 700 %buildroot/var/lib/pgsql/data
install -d -m 700 %buildroot/var/lib/pgsql/backups
sed 's,@LIBDIR@,%_libdir,g' %{SOURCE15} > \
%buildroot/var/lib/pgsql/.bash_profile
# Backup directory for old version binaries
install -d %buildroot%_libdir/postgresql/backup
cp doc/FAQ* doc/KNOWN_BUGS doc/MISSING_FEATURES doc/README* COPYRIGHT \
README HISTORY doc/bug.template %buildroot%_docdir/postgresql
cp -a %SOURCE2 %buildroot%_docdir/postgresql/README.SuSE.de
cp -a %SOURCE3 %buildroot%_docdir/postgresql/README.SuSE.en
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%post server
%fillup_and_insserv
%postun server
%restart_on_update postgresql
%insserv_cleanup
exit 0
%preun server
%stop_on_removal postgresql
exit 0
%pre server
groupadd -g 26 -o -r postgres >/dev/null 2>/dev/null || :
useradd -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
-c "PostgreSQL Server" -u 26 postgres 2>/dev/null || :
# Need to make a backup of the server binary if this is an upgrade.
# It will be needed to do a dump of the old version's database.
# All output redirected to /dev/null.
umask 022
if [ -f usr/bin/postgres ]
then
OLD_VERSION=$(strings usr/bin/postgres |
/bin/sed -n '/postmaster (PostgreSQL)/s/.* \([0-9]\+\.[0-9]\+\).*/\1/p')
if [ "$OLD_VERSION" = "" ]
then
OLD_VERSION=$(strings usr/bin/postgres |
/bin/sed -n 's/^PostgreSQL \([0-9]\+\.[0-9]\+\).*/\1/p')
fi
MINOR_VERSION=$(echo %version | sed 's/^\([0-9]\+\.[0-9]\+\).*/\1/')
BACKUP_DIR=usr/%_lib/postgresql/backup/$OLD_VERSION
if [ "$OLD_VERSION" != "$MINOR_VERSION" -a ! -f "$BACKUP_DIR" ]
then
mkdir -p $BACKUP_DIR
for f in usr/bin/{postmaster,postgres}; do
test -f $f && cp -a $f $BACKUP_DIR
done
fi
fi
%clean
rm -rf %buildroot
rm -f %my_provides
%files
%defattr(-,root,root)
%doc %_mandir/man7/*
%docdir %_docdir/postgresql
%dir %_docdir/postgresql
%_docdir/postgresql/[[:upper:]]*
%_docdir/postgresql/bug.template
%_datadir/locale/*/*/pg_dump-*.mo
%_datadir/locale/*/*/pgscripts-*.mo
%_datadir/locale/*/*/psql-*.mo
# command line tools
%_bindir/createdb
%doc %_mandir/man1/createdb.1*
%_bindir/clusterdb
%doc %_mandir/man1/clusterdb.1*
%_bindir/createlang
%doc %_mandir/man1/createlang.1*
%_bindir/createuser
%doc %_mandir/man1/createuser.1*
%_bindir/dropdb
%doc %_mandir/man1/dropdb.1*
%_bindir/droplang
%doc %_mandir/man1/droplang.1*
%_bindir/dropuser
%doc %_mandir/man1/dropuser.1*
%_bindir/pg_dump
%doc %_mandir/man1/pg_dump.1*
%_bindir/pg_dumpall
%doc %_mandir/man1/pg_dumpall.1*
%_bindir/pg_restore
%doc %_mandir/man1/pg_restore.1*
%_bindir/psql
%doc %_mandir/man1/psql.1*
%_bindir/vacuumdb
%doc %_mandir/man1/vacuumdb.1*
%_bindir/reindexdb
%doc %_mandir/man1/reindexdb.1.*
%files docs
%defattr(-,root,root)
%docdir %_docdir/postgresql
%dir %_docdir/postgresql
%_docdir/postgresql/html
%files contrib -f files.contrib
%defattr(-,root,root)
%docdir %_docdir/postgresql
%dir %_docdir/postgresql
%_docdir/postgresql/contrib
%dir %_libdir/postgresql
%dir %_datadir/postgresql
%dir %_datadir/postgresql/contrib
%files libs
%defattr(-,root,root)
%_libdir/lib*.so.*
%_datadir/locale/*/*/libpq*.mo
%_datadir/locale/*/*/ecpglib*-*.mo
%files server
%defattr(-,root,root)
%config /etc/init.d/postgresql
%config /var/adm/fillup-templates/sysconfig.postgresql
%if 0%suse_version > 1020
%config /etc/sysconfig/SuSEfirewall2.d/services/postgresql
%endif
%_sbindir/rcpostgresql
%dir %_libdir/postgresql
%_libdir/postgresql/backup
%_libdir/postgresql/plpgsql.so
%_libdir/postgresql/dict_snowball.so
%_datadir/postgresql/tsearch_data
%_bindir/initdb
%doc %_mandir/man1/initdb.1*
%_bindir/pg_ctl
%doc %_mandir/man1/pg_ctl.1*
%_bindir/pg_controldata
%doc %_mandir/man1/pg_controldata.1*
%_bindir/pg_resetxlog
%doc %_mandir/man1/pg_resetxlog.1*
%_bindir/postgres
%doc %_mandir/man1/postgres.1*
%_bindir/postmaster
%doc %_mandir/man1/postmaster.1*
%dir %_datadir/postgresql
%_datadir/postgresql/timezone*
%_datadir/postgresql/*.*
%_datadir/locale/*/*/initdb-*.mo
%_datadir/locale/*/*/postgres-*.mo
%_datadir/locale/*/*/pg_controldata-*.mo
%_datadir/locale/*/*/pg_ctl-*.mo
%_datadir/locale/*/*/pg_resetxlog-*.mo
%_datadir/locale/*/*/plpgsql-*.mo
%_libdir/postgresql/*_and_*.so
%attr(750,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(640,postgres,postgres) %config(noreplace) /var/lib/pgsql/.bash_profile
%files devel
%defattr(-,root,root)
%_includedir/pgsql
%_bindir/ecpg
%_bindir/pg_config
%_libdir/lib*.so
%_libdir/libpgport.a
%_libdir/postgresql/pgxs
%_datadir/locale/*/*/pg_config-*.mo
%_datadir/locale/*/*/ecpg-*.mo
%doc %_mandir/man1/ecpg.1*
%doc %_mandir/man1/pg_config.1*
%changelog