Permalink
Browse files

Win32 related fixes.

-Replacing references to outdated win32 slony sites.
 EnterpriseDB is much more current with respect to building slony
 binaries than the other sites.
-Adding section on building win32.
-Misc cleanups related to the windows build
  • Loading branch information...
1 parent 468932f commit d811894694a6c26a2fff73fa1dd4838efeacc4b4 @ssinger ssinger committed May 6, 2011
@@ -7,9 +7,9 @@
<note> <para>For &windows; users: Unless you are planning on hacking
the &slony1; code, it is highly recommended that you download and
install a prebuilt binary distribution and jump straight to the
-configuration section below. There are likely to be links and/or
-binaries at <ulink url="http://pgfoundry.org/projects/slony1/">
-pgFoundry &slony1; site </ulink>.
+configuration section below. Prebuilt binaries are available
+from the StackBuilder application included in the <ulink url="http://www.enterprisedb.com/downloads/postgres-postgresql-downloads"> EnterpriseDB
+PostgreSQL installer</ulink>
<para> There are also RPM binaries available at that site for recent
versions of &slony1; for recent versions of &postgres;.
@@ -210,6 +210,58 @@ is, for versions of &slony1; </para>
</sect2>
+<sect2 id="buildingwin32"><title>Building on Win32</title>
+<para>
+Building &slony1; on Win32 with the Microsoft SDK (Visual Studio) is
+different than building &slony1; on other platforms. Visual Studio
+builds can be done with out involving configure or gmake.
+
+To build &slony1 you need
+</para>
+<itemizedlist>
+<listitem><para>The &slony1; source for a source distribution tar
+(The distribution tar files contain pre-built copies of the parser and
+scanner generated files. The Win32 make files do not currently support
+building these).</para></listitem>
+<listitem><para>&postgres; binaries installed along with include files
+and libraries</para></listitem>
+<listitem><para> <ulink url="http://sources.redhat.com/pthreads-win32">pthreads for win32</ulink></para></listitem>
+<listitem><para>The Microsoft SDK 6.1 or Visual Studio 2008 (other versions
+might work)</para></listitem>
+</itemizedlist>
+
+<para>
+To compile the &slony1; binaries you will need to
+<itemizedlist>
+<listitem><para>Edit src\slon\win32.mak, src\slonik\win32.mak,
+src\backend\win32.mak and set
+ <itemizedlist><listitem><para>PGHOME directory to the top level
+directory of your &postgres; installation.</para></listitem>
+ <listitem><para>PTHREADS_INC, and PTHREADS_LIB to where your
+ pthreads-win32 package library and headers were installed to
+ </para></listitem>
+ <listitem><para>GETTEXT_LIB to where the gettext library was installed to
+ </para></listitem>
+ </itemizedlist>
+ </para></listitem>
+</itemizedlist>
+</para>
+<para>
+From the Visual Studio or Microsoft Windows SDK command prompt run
+<programlisting>
+cd src\backend
+nmake /f win32.mak slony1_funcs.dll
+cd ..\slon
+nmake /f win32.mak slon.exe
+cd ..\slonik
+nmake /f win32.mak slonik.exe
+</programlisting>
+
+<para>
+src\backend\slony1_funcs.dll and any of the .sql files in
+src\backend need to be installed in your postgresql $share directory.
+</sect2>
+
<sect2 id="buildingdocs"> <title> Building Documentation: Admin Guide </title>
<indexterm><primary> building &slony1; documentation </primary></indexterm>
@@ -309,10 +361,6 @@ to see the following URLs: </para>
url="http://developer.pgadmin.org/~hiroshi/Slony-I/"> Slony-I Windows
installer sample </ulink> </para> </listitem>
-<listitem><para> <ulink url=
-"http://people.planetpostgresql.org/xzilla/index.php?/archives/200-Alpha-testing-Slony-on-win32-Crib-Notes.html">
-xzilla's Alpha testing Slony on win32 Crib Notes </ulink> </para> </listitem>
-
</itemizedlist>
</sect2>
@@ -1,13 +1,13 @@
CPP=cl.exe
LINK32=link.exe
-
-PGSHARE=\"c:\\postgresql\\9.0\\share\"
+PGHOME=c:\postgresql\9.0
+PGSHARE=$(PGHOME)\share
PTHREADS_INC=C:\pthreads-win32\include
PTHREADS_LIB=c:\pthreads-win32\lib
-LINK32_FLAGS= /PDB:slony1_funcs.pdb /DEBUG /DEF:slony1_funcs.def /DLL c:\Postgresql\9.0\lib\postgres.lib
+LINK32_FLAGS= /PDB:slony1_funcs.pdb /DEBUG /DEF:slony1_funcs.def /DLL $(PGHOME)\lib\postgres.lib
OBJS = slony1_funcs.obj \
-CPP_FLAGS=/c /D MSVC /D WIN32 /D PGSHARE=$(PGSHARE) /I..\misc /I..\..\ /Ic:\Postgresql\9.0\include /Ic:\Postgresql\9.0\include/server /Ic:\Postgresql\9.0\include/server/port/win32_msvc /Ic:\Postgresql\9.0\include/server/port/win32 /D HAVE_LONG_INT_64 /D HAVE_GETACTIVESNAPSHOT /LD /Gd /Tc
+CPP_FLAGS=/c /D MSVC /D WIN32 /D PGSHARE=$(PGSHARE) /I..\misc /I..\..\ /I$(PGHOME)\include /I$(PGHOME)\include\server /I$(PGHOME)\include\server\port\win32_msvc /I$(PGHOME)\include\server\port\win32 /D HAVE_LONG_INT_64 /D HAVE_GETACTIVESNAPSHOT /LD /Gd /Tc
slony1_funcs.obj: slony1_funcs.c
$(CPP) $(CPP_FLAGS) slony1_funcs.c
View
@@ -22,9 +22,10 @@
#ifndef WIN32
#include <sys/time.h>
#include <unistd.h>
+#include <sys/wait.h>
#endif
#include <sys/types.h>
-#include <sys/wait.h>
+
#ifdef WIN32
View
@@ -633,6 +633,7 @@ extern int slon_log_level;
#define snprintf pg_snprintf
#endif
+
#endif /* SLON_H_INCLUDED */
View
@@ -1,10 +1,11 @@
CPP=cl.exe
LINK32=link.exe
-
-PGSHARE=\"c:\\postgresql\\9.0\\share\"
+PGHOME=c:\postgresql\9.0
+PGSHARE=$(PGHOME)\share
PTHREADS_INC=C:\pthreads-win32\include
-PTHREADS_LIB=c:\pthreads-win32\lib
-LINK32_FLAGS=/libpath:c:\postgresql\9.0\lib libpq.lib libpgport.lib /libpath:$(PTHREADS_LIB) pthreadVC2.lib wsock32.lib kernel32.lib user32.lib advapi32.lib /libpath:c:\gettext\lib intl.lib /NODEFAULTLIB:MSVCRT
+PTHREADS_LIB="c:\pthreads-win32\lib"
+GETTEXT_LIB=c:\gettext\lib
+LINK32_FLAGS=/libpath:$(PGHOME)\lib libpq.lib libpgport.lib /libpath:$(PTHREADS_LIB) pthreadVC2.lib wsock32.lib kernel32.lib user32.lib advapi32.lib /libpath:$(GETTEXT_LIB) intl.lib /NODEFAULTLIB:MSVCRT
OBJS = slon.obj \
runtime_config.obj \
local_listen.obj \
@@ -21,10 +22,10 @@ OBJS = slon.obj \
../parsestatements/scanner.obj \
port\win32service.obj \
port\pipe.obj \
-
-CPP_FLAGS=/c /D MSVC /D WIN32 /D PGSHARE=$(PGSHARE) /D YY_NO_UNISTD_H /I..\..\ /Ic:\Postgresql\9.0\include /Ic:\Postgresql\9.0\include/server /Ic:\Postgresql\9.0\include/server/port/win32 /I$(PTHREADS_INC) /MD /Zi
+
+CPP_FLAGS=/c /D MSVC /D WIN32 /D PGSHARE=$(PGSHARE) /D YY_NO_UNISTD_H /I..\..\ /I$(PGHOME)\include /I$(PGHOME)\include/server /I$(PGHOME)\include/server/port/win32 /I$(PTHREADS_INC) /MD /Zi
slon.obj: slon.c
$(CPP) $(CPP_FLAGS) slon.c
View
@@ -14,19 +14,21 @@
#ifndef WIN32
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#endif
-#include "libpq-fe.h"
+
+#include <stdarg.h>
+#include <string.h>
#ifdef WIN32
#include "config_msvc.h"
#else
#include "config.h"
#endif
#include "types.h"
+#include "libpq-fe.h"
#include "slonik.h"
/*
View
@@ -11,7 +11,7 @@
*-------------------------------------------------------------------------
*/
-#include "postgres_fe.h"
+#include "types.h"
#include "libpq-fe.h"
#include "slonik.h"
#include "scan.h"
View
@@ -38,7 +38,6 @@ extern char * current_file;
%{
-#include "postgres_fe.h"
#include "libpq-fe.h"
#include "slonik.h"
#include "y.tab.h"
View
@@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#else
+#include <windows.h>
#define sleep(x) Sleep(x*1000)
#endif
@@ -40,6 +41,8 @@
#include "../parsestatements/scanner.h"
extern int STMTS[MAXSTATEMENTS];
+#define MAXPGPATH 256
+
/*
* Global data
*/
@@ -5235,7 +5238,8 @@ static int slonik_submitEvent(SlonikStmt * stmt,
if ( last_event_node >= 0 &&
last_event_node != adminfo->no_id
&& ! suppress_wait_for )
- {
+ {
+ SlonikStmt_wait_event wait_event;
/**
* the last event node is not the current event node.
* time to wait.
@@ -5253,7 +5257,6 @@ static int slonik_submitEvent(SlonikStmt * stmt,
* for now we generate a 'fake' Slonik_wait_event structure
*
*/
- SlonikStmt_wait_event wait_event;
wait_event.hdr=*stmt;
wait_event.wait_origin=last_event_node;
wait_event.wait_on=last_event_node;
@@ -5412,12 +5415,12 @@ static int slonik_wait_config_caughtup(SlonikAdmInfo * adminfo1,
for( curAdmInfo = stmt->script->adminfo_list;
curAdmInfo != NULL; curAdmInfo = curAdmInfo->next)
{
+ char seqno[64];
if(curAdmInfo->last_event < 0 ||
curAdmInfo->no_id==adminfo1->no_id ||
curAdmInfo->no_id == ignore_node )
continue;
- char seqno[64];
sprintf(seqno,INT64_FORMAT,curAdmInfo->last_event);
slon_appendquery(&event_list,
"%s (node_list.no_id=%d)"
@@ -1,15 +1,16 @@
CPP=cl.exe
LINK32=link.exe
-LINK32_FLAGS=/libpath:c:\postgresql\9.0\lib libpq.lib libpgport.lib /NODEFAULTLIB:MSVCRT
+PGHOME=c:\\postgresql\\9.0
+LINK32_FLAGS=/libpath:$(PGHOME)\lib libpq.lib libpgport.lib kernel32.lib /NODEFAULTLIB:MSVCRT
OBJS = slonik.obj \
dbutil.obj \
parser.obj \
..\parsestatements\scanner.obj \
scan.obj \
-PGSHARE=\"c:\\postgresql\\9.0\\share\"
-CPP_FLAGS=/c /D MSVC /D WIN32 /D PGSHARE=$(PGSHARE) /D YY_NO_UNISTD_H /I..\..\ /Ic:\Postgresql\9.0\include /Ic:\Postgresql\9.0\include/server /Ic:\Postgresql\9.0\include/server/port/win32 /MD
+
+CPP_FLAGS=/c /D MSVC /D WIN32 /D PGSHARE=\"$(PGHOME)/share\" /D YY_NO_UNISTD_H /I..\..\ /I$(PGHOME)\include /MD
slonik.obj: slonik.c
$(CPP)$(CPP_FLAGS) slonik.c

0 comments on commit d811894

Please sign in to comment.