##
## pgpool.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2006 OpenPKG Foundation e.V.
## Copyright (c) 2000-2006 Ralf S. Engelschall
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package versions
%define V_pgpool 3.0.1
%define V_subdir 3.0.1
%define V_download 733
# package information
Name: pgpool
Summary: PostgreSQL Connection Pooling
URL: http://pgpool.projects.postgresql.org/
Vendor: Tatsuo Ishii
Packager: OpenPKG
Distribution: OpenPKG
Class: PLUS
Group: Database
License: GPL
Version: %{V_pgpool}
Release: 20060219
# list of sources
Source0: http://pgfoundry.org/frs/download.php/%{V_download}/pgpool-%{version}.tar.gz
Source1: rc.pgpool
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130
PreReq: OpenPKG, openpkg >= 20040130
BuildPreReq: getopt
PreReq: getopt
AutoReq: no
AutoReqProv: no
%description
PGPool is a connection pool server for PostgreSQL. PGPool runs
between PostgreSQL's clients (front ends) and servers (back ends).
A PostgreSQL client can connect to PGPool as if it were a standard
PostgreSQL server. PGPool caches the connection to the PostgreSQL
server to reduce the overhead to establish the connection to it.
Also, PGPool could use two PostgreSQL servers for fail over. If the
first server goes down, PGPool will automatically switch to the
secondary server. Moreover, PGPool supports scheduled switch over.
%track
prog pgpool = {
version = %{V_pgpool}
url = http://pgpool.projects.postgresql.org/
regex = /\d+/pgpool-(__VER__)\.tar\.gz
}
prog pgpool:download = {
version = %{V_download}
url = http://pgpool.projects.postgresql.org/
regex = /(__VER__)/pgpool-([\d\.]+)\.tar\.gz
}
%prep
%setup -q -n pgpool-%{V_subdir}
%build
# configure program
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O} %{l_cppflags}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags}" \
LIBS="-lgetopt" \
./configure \
--prefix=%{l_prefix} \
--sysconfdir=%{l_prefix}/etc/pgpool \
--with-pgsrc=/dummy
# build program
%{l_make} %{l_mflags -O}
%install
# create installation hierarchy
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/pgpool \
$RPM_BUILD_ROOT%{l_prefix}/var/pgpool \
$RPM_BUILD_ROOT%{l_prefix}/man/cat8
# install program
%{l_shtool} install -c -s -m 755 \
pgpool $RPM_BUILD_ROOT%{l_prefix}/sbin/
# install documentation
%{l_shtool} install -c -m 644 \
README $RPM_BUILD_ROOT%{l_prefix}/man/cat8/pgpool.8
# install default configuration
%{l_shtool} install -c -m 644 \
-e 's;\(logdir = .\).*\(.\)$;\1%{l_prefix}/var/pgpool\2;' \
-e 's;\(socket_dir = .\).*\(.\)$;\1%{l_prefix}/var/pgpool\2;' \
-e 's;\(backend_socket_dir = .\).*\(.\)$;\1%{l_prefix}/var/postgresql/run\2;' \
pgpool.conf.sample $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pgpool.conf
# install run-command script
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE rc.pgpool} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/pgpool/*' \
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/pgpool'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT