Sfoglia il codice sorgente

add optional Slony-I replication service

Ralf S. Engelschall 21 anni fa
parent
commit
859a245614
1 ha cambiato i file con 48 aggiunte e 3 eliminazioni
  1. 48 3
      postgresql/postgresql.spec

+ 48 - 3
postgresql/postgresql.spec

@@ -29,6 +29,7 @@
 %define       V_libpqxx         2.2.7
 %define       V_pgperl          2.0.2
 %define       V_psqlodbc        07.03.0200
+%define       V_slony1          1.0.1
 
 #   package information
 Name:         postgresql
@@ -41,7 +42,7 @@ Class:        BASE
 Group:        Database
 License:      GPL
 Version:      %{V_postgresql}
-Release:      20040703
+Release:      20040811
 
 #   package options
 %option       with_server   yes
@@ -50,6 +51,7 @@ Release:      20040703
 %option       with_odbc     no
 %option       with_compat   no
 %option       with_tcl      no
+%option       with_slony1   no
 
 #   list of sources
 Source0:      ftp://ftp.postgresql.org/pub/source/v%{V_postgresql}/postgresql-%{V_postgresql}.tar.bz2
@@ -57,8 +59,9 @@ Source1:      ftp://gborg.postgresql.org/pub/libpqpp/stable/libpq++-%{V_libpqpp}
 Source2:      ftp://gborg.postgresql.org/pub/libpqxx/stable/libpqxx-%{V_libpqxx}.tar.gz
 Source3:      ftp://gborg.postgresql.org/pub/pgperl/stable/pgperl-%{V_pgperl}.tar.gz
 Source4:      ftp://ftp.us.postgresql.org/odbc/versions/src/psqlodbc-%{V_psqlodbc}.tar.gz
-Source5:      rc.postgresql
-Source6:      pg_migrate
+Source5:      http://developer.postgresql.org/~wieck/slony1/download/slony1-%{V_slony1}.tar.gz
+Source6:      rc.postgresql
+Source7:      pg_migrate
 Patch0:       postgresql.patch
 
 #   build information
@@ -117,6 +120,11 @@ AutoReqProv:  no
         url       = ftp://ftp.postgresql.org/pub/odbc/versions/src/
         regex     = psqlodbc-(\d{2}\.\d{2}\.\d{4})\.tar\.gz
     }
+    prog postgresql:slony1 = {
+        version   = %{V_slony1}
+        url       = http://developer.postgresql.org/~wieck/slony1/download/
+        regex     = slony1-(__VER__)\.tar\.gz
+    }
 
 %prep
     %setup -q
@@ -131,6 +139,9 @@ AutoReqProv:  no
 %if "%{with_odbc}" == "yes"
     %setup -q -T -D -a 4
 %endif
+%if "%{with_slony1}" == "yes"
+    %setup -q -T -D -a 5
+%endif
 
     #   adjust source tree
     %{l_shtool} subst \
@@ -151,7 +162,11 @@ AutoReqProv:  no
 
     #   configure package
     CC="%{l_cc}" \
+%if "%{with_slony1}" == "yes"
+    CFLAGS="%{l_cflags -O} -pthread" \
+%else
     CFLAGS="%{l_cflags -O}" \
+%endif
 %if "%{with_tcl}" == "yes"
     CPPFLAGS="%{l_cppflags tcl} -DOPENSSL_DISABLE_OLD_DES_SUPPORT" \
     LDFLAGS="%{l_ldflags} -L`%{l_prefix}/etc/rc --query x11_libdir`" \
@@ -171,6 +186,9 @@ AutoReqProv:  no
         --with-tcl \
         --with-tclconfig="%{l_prefix}/lib" \
         --with-tkconfig="%{l_prefix}/lib" \
+%endif
+%if "%{with_slony1}" == "yes"
+        --enable-thread-safety \
 %endif
         --disable-syslog \
         --disable-shared
@@ -254,6 +272,22 @@ AutoReqProv:  no
     ) || exit $?
 %endif
 
+    #   build Slony-1 replication engine
+%if "%{with_slony1}" == "yes"
+    ( cd slony1-%{V_slony1}
+      %{l_shtool} subst \
+          -e 's;-lpq;-lpq -lssl -lcrypto -lcrypt;' \
+          src/slon/Makefile src/slonik/Makefile
+      export CC="%{l_cc}"
+      export CFLAGS="%{l_cflags -O}"
+      export CPPFLAGS="%{l_cppflags}"
+      ./configure \
+          --prefix=%{l_prefix} \
+          --with-pgsourcetree=`pwd`/..
+      %{l_make} %{l_mflags -O}
+    ) || exit $?
+%endif
+
 %install
     rm -rf $RPM_BUILD_ROOT
 
@@ -349,6 +383,17 @@ AutoReqProv:  no
     ) || exit $?
 %endif
 
+    #   install Slony-1 replication engine
+%if "%{with_slony1}" == "yes"
+    ( cd slony1-%{V_slony1}
+      %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
+      rm -f $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/slony1*v7[34].sql
+      rm -f $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.v73.sql
+      mv $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.v74.sql \
+         $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.sql
+    ) || exit $?
+%endif
+
     #   install run-command script
     %{l_shtool} mkdir -f -p -m 755 \
         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d