pgpool.spec 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ##
  2. ## pgpool.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package versions
  24. %define V_openpkg 2.3.3
  25. %define V_pgpool 2.3.3
  26. %define V_pgpool_dir 2664
  27. # package information
  28. Name: pgpool
  29. Summary: PostgreSQL Connection Pooling
  30. URL: http://pgpool.projects.postgresql.org/
  31. Vendor: Tatsuo Ishii
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: PLUS
  35. Group: Database
  36. License: GPL
  37. Version: %{V_openpkg}
  38. Release: 20100423
  39. # list of sources
  40. Source0: http://pgfoundry.org/frs/download.php/%{V_pgpool_dir}/pgpool-II-%{V_pgpool}.tar.gz
  41. Source1: rc.pgpool
  42. Patch0: pgpool.patch
  43. # build information
  44. BuildPreReq: OpenPKG, openpkg >= 20100101, make
  45. PreReq: OpenPKG, openpkg >= 20100101
  46. BuildPreReq: postgresql, openssl, getopt
  47. PreReq: postgresql, openssl, getopt
  48. %description
  49. PGPool is a connection pool server for PostgreSQL. PGPool runs
  50. between PostgreSQL's clients (front ends) and servers (back ends).
  51. A PostgreSQL client can connect to PGPool as if it were a standard
  52. PostgreSQL server. PGPool caches the connection to the PostgreSQL
  53. server to reduce the overhead to establish the connection to it.
  54. Also, PGPool could use two PostgreSQL servers for fail over. If the
  55. first server goes down, PGPool will automatically switch to the
  56. secondary server. Moreover, PGPool supports scheduled switch over.
  57. %track
  58. prog pgpool = {
  59. version = %{V_pgpool_dir}-%{V_pgpool}
  60. url = http://pgfoundry.org/frs/?group_id=1000055
  61. regex = /(\d+/pgpool-II-__VER__)\.tar\.gz
  62. transform = "s/^(\\d+)\/pgpool-II-(\d+(\.\d+)+)/$1-$2/; $_"
  63. }
  64. %prep
  65. %setup -q -n pgpool-II-%{V_pgpool}
  66. %patch -p0
  67. %build
  68. # configure program
  69. CC="%{l_cc}" \
  70. CFLAGS="%{l_cflags -O} %{l_cppflags}" \
  71. CPPFLAGS="%{l_cppflags}" \
  72. LDFLAGS="%{l_ldflags}" \
  73. LIBS="-lgetopt -lssl -lcrypto -lcrypt" \
  74. ./configure \
  75. --prefix=%{l_prefix} \
  76. --mandir=%{l_prefix}/man \
  77. --sysconfdir=%{l_prefix}/etc/pgpool \
  78. --with-pgsrc=/dummy \
  79. --disable-shared
  80. # build program
  81. %{l_make} %{l_mflags -O}
  82. %install
  83. # install program
  84. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  85. # install default configuration
  86. mv $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pcp.conf.sample \
  87. $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pcp.conf
  88. mv $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pgpool.conf.sample \
  89. $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pgpool.conf
  90. mv $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pool_hba.conf.sample \
  91. $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pool_hba.conf
  92. %{l_shtool} subst \
  93. -e 's;\(logdir = .\).*\(.\)$;\1%{l_prefix}/var/pgpool\2;' \
  94. -e 's;\(socket_dir = .\).*\(.\)$;\1%{l_prefix}/var/pgpool\2;' \
  95. -e 's;\(backend_socket_dir = .\).*\(.\)$;\1%{l_prefix}/var/postgresql/run\2;' \
  96. $RPM_BUILD_ROOT%{l_prefix}/etc/pgpool/pgpool.conf
  97. # install run-command script
  98. %{l_shtool} mkdir -f -p -m 755 \
  99. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  100. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  101. %{SOURCE rc.pgpool} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  102. # create run-time directory
  103. %{l_shtool} mkdir -f -p -m 755 \
  104. $RPM_BUILD_ROOT%{l_prefix}/var/pgpool
  105. # determine installation files
  106. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  107. %{l_files_std} \
  108. '%config %{l_prefix}/etc/pgpool/*' \
  109. '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/pgpool'
  110. %files -f files
  111. %clean