LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File postgresql.spec of Package postgresql.33 (Project openSUSE:Evergreen:11.4)

#
# spec file for package postgresql
#
# Copyright (c) 2012 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:  gettext-devel
BuildRequires:  ncurses-devel
BuildRequires:  pam-devel
BuildRequires:  python-devel
BuildRequires:  readline-devel
BuildRequires:  tcl-devel
BuildRequires:  zlib-devel
%if 0%{?suse_version} >= 1110
BuildRequires:  fdupes
%else
%define fdupes #
%endif
%define _name postgresql
%define libpq libpq5
%define libecpg libecpg6
%define buildall 0
%if 0%{?suse_version} > 910
BuildRequires:  krb5-devel
BuildRequires:  libxslt-devel
%endif
BuildRequires:  openldap2-devel
BuildRequires:  openssl-devel
Summary:        Basic Clients and Utilities for PostgreSQL
License:        BSD-3-Clause
Group:          Productivity/Databases/Tools
Version:        9.0.11
Release:        0
%define pg_minor_version %(echo %version | sed -r 's/^([0-9]+\\.[0-9]+).*/\\1/')
Source0:        postgresql-%version.tar.bz2
Source1:        baselibs.conf
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
Source100:      pre_checkin.sh
Source101:      postgresql.spec.in
Patch1:         postgresql-conf.patch
Patch2:         postgresql-regress.patch
Patch3:         postgresql-sle10-timestamptz.patch
Patch4:         postgresql-plperl.patch
Url:            http://www.postgresql.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       postgresql = %pg_minor_version

%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.

%package -n %libpq
Summary:        Shared Libraries Required for PostgreSQL Clients
Group:          Productivity/Databases/Clients
Obsoletes:      postgresql-libs
# bug437293
%ifarch ppc64
Obsoletes:      postgresql-libs-64bit
%endif

%description -n %libpq
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 client library that most PostgreSQL client
program or language bindings are using.

%package -n %libecpg
Summary:        Shared Libraries Required for PostgreSQL Clients
Group:          Productivity/Databases/Clients
Obsoletes:      postgresql-libs
Provides:       postgresql-libs
# bug437293
%ifarch ppc64
Obsoletes:      postgresql-libs-64bit
%endif

%description -n %libecpg
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 runtime library of the embedded SQL C
preprocessor for PostgreSQL.

%package server
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
Summary:        HTML Documentation for PostgreSQL
Group:          Productivity/Databases/Tools
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%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.

%package contrib
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.

%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.

%package -n %_name-devel
Summary:        PostgreSQL development header files and libraries
Group:          Productivity/Databases/Tools
Requires:       %libecpg
Requires:       %libpq

%description -n %_name-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.

%package plperl
Summary:        The PL/Tcl, PL/Perl, and  PL/Python procedural languages for PostgreSQL
Group:          Productivity/Databases/Servers
Requires:       perl = %perl_version
Obsoletes:      postgresql-pl
Provides:       postgresql-pl:%_libdir/postgresql/plperl.so
Requires:       postgresql-server = %pg_minor_version

%description plperl
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 PL/Perl procedural language for PostgreSQL.
With this module one can use Perl to write stored procedures,
functions, and triggers.

%package plpython
Summary:        The PL/Python Procedural Languages for PostgreSQL
Group:          Productivity/Databases/Servers
Obsoletes:      postgresql-pl
Provides:       postgresql-pl:%_libdir/postgresql/plpython.so
Requires:       postgresql-server = %pg_minor_version
Requires:       python

%description plpython
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 PL/Python procedural language for PostgreSQL.
With this module one can use Python to write stored procedures,
functions, and triggers.

%package pltcl
Summary:        PL/Tcl Procedural Language for PostgreSQL
Group:          Productivity/Databases/Tools
Obsoletes:      postgresql-pl
Provides:       postgresql-pl:%_libdir/postgresql/pltcl.so
Requires:       postgresql-server = %pg_minor_version
Requires:       tcl

%description pltcl
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 PL/Tcl procedural language for PostgreSQL. 
With thie module one can use Tcl to write stored procedures, functions,
and triggers.

%prep
%setup -q -n %_name-%version
%patch1
%patch2
# apply the following patch only on SLE10
%if 0%{?suse_version} == 1010
%patch3 -p1
%endif
%patch4

%build
export CFLAGS="%optflags $SP"
# uncomment the following line to enable the stack protector
# CFLAGS="$CFLAGS -fstack-protector"
%configure \
	--includedir=%_includedir/pgsql \
	--datadir=%_datadir/postgresql \
	--docdir=%_docdir \
	--disable-rpath \
	--enable-nls \
	--enable-thread-safety \
	--enable-integer-datetimes \
        --with-python \
        --with-perl \
        --with-tcl \
        --with-tclconfig=%_libdir \
	--with-pam \
	--with-openssl \
	--with-ldap \
%if 0%{?suse_version} > 910
	--with-gssapi \
	--with-libxml \
	--with-libxslt \
	--with-krb5 \
%endif
	--with-system-tzdata=/usr/share/zoneinfo
make %{?jobs:-j%jobs} world
%ifnarch %arm
%if 0%{?suse_version} > 910

%check
#
# Run the regression tests.
#
make check || {
  for f in src/test/regress/log/* regression.diffs; do
    if test -f $f; then
	cat $f
    fi
  done
  exit 1
}
%endif
%endif

%install
make DESTDIR=%buildroot install install-docs
SUBINSTALL=uninstall
%if !%buildall
rm -f %buildroot%_mandir/*/ecpg*
rm -f %buildroot%_mandir/*/pg_config*
%endif
if test -n "$SUBINSTALL"; then
# Install them for postgresql-libs and uninstall them for postgresql
make -C src DESTDIR=%buildroot $SUBINSTALL-local
for dir in \
        config \
        src/bin/pg_config \
        src/interfaces \
        src/include \
        src/makefiles \
        src/port \
        src/test/regress
do
        make -C $dir DESTDIR=%buildroot $SUBINSTALL
done
fi
# Don't ship static libraries, libpgport.a is needed, though.
rm -f $(ls %buildroot/%_libdir/*.a | grep -F -v libpgport.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
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/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
for appname in pg_dump pgscripts psql;do
%find_lang $appname-%{pg_minor_version} %{name}.lang
done
%if %buildall
%find_lang libpq5-%{pg_minor_version} %libpq.lang
%find_lang ecpglib6-%{pg_minor_version} %libecpg.lang
%find_lang ecpg-%{pg_minor_version} %_name-devel.lang 
%find_lang pg_config-%{pg_minor_version} %_name-devel.lang 
%endif
for serverapp in initdb postgres pg_controldata pg_ctl pg_resetxlog plpgsql;do
%find_lang $serverapp-%{pg_minor_version}  %{name}-server.lang
done
for pl in plperl plpython pltcl; do
%find_lang $pl-%{pg_minor_version} $pl.lang
done
%fdupes %buildroot

%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 || :

%post -n %libpq -p /sbin/ldconfig
%postun -n %libpq -p /sbin/ldconfig
%post -n %libecpg -p /sbin/ldconfig
%postun -n %libecpg -p /sbin/ldconfig

%clean
rm -rf %buildroot
rm -f %my_provides

%files -f %{name}.lang
%defattr(-,root,root)
%doc %_mandir/man7/*
%docdir %_docdir/postgresql
%dir %_docdir/postgresql
%_docdir/postgresql/[[:upper:]]*
%_docdir/postgresql/bug.template
# 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)
%doc %_mandir/man3/*
%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 server -f %{name}-server.lang
%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
%exclude %_datadir/postgresql/tsearch_data/unaccent.rules
%exclude %_datadir/postgresql/tsearch_data/xsyn_sample.rules
%_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/*.*
%exclude %_datadir/postgresql/*.pltcl
%_libdir/postgresql/*_and_*.so
%_libdir/postgresql/euc2004_sjis2004.so
%_libdir/postgresql/libpqwalreceiver.so
%attr(750,postgres,postgres) %dir /var/lib/pgsql
%attr(700,postgres,postgres) %dir /var/lib/pgsql/data
%attr(640,postgres,postgres) %config(noreplace) /var/lib/pgsql/.bash_profile

%files pltcl -f pltcl.lang
%defattr(-,root,root)
%dir %_libdir/postgresql
%_libdir/postgresql/pltcl.so
%_datadir/postgresql/*.pltcl
%_bindir/pltcl*

%files plperl -f plperl.lang
%defattr(-,root,root)
%dir %_libdir/postgresql
%_libdir/postgresql/plperl.so

%files plpython -f plpython.lang
%defattr(-,root,root)
%dir %_libdir/postgresql
%_libdir/postgresql/plpython*.so

%if %buildall
%files -n %libpq -f %libpq.lang
%defattr(-,root,root)
%_libdir/libpq.so.*

%files -n %libecpg -f %libecpg.lang
%defattr(-,root,root)
%_libdir/libecpg*.so.*
%_libdir/libpgtypes.so.*

%files -n %_name-devel -f %_name-devel.lang
%defattr(-,root,root)
%doc %_mandir/man1/ecpg.1*
%_bindir/pg_config
%doc %_mandir/man1/pg_config.1*
%_bindir/ecpg
%_libdir/libpgport.a
%_libdir/lib*.so
%dir %_libdir/postgresql
%_libdir/postgresql/pgxs
%_includedir/pgsql
%dir %_datadir/postgresql
%_datadir/postgresql/pg_service.conf.sample

%endif

%changelog