<li> OpenSSL library and header files. Download the latest version from the
<a href="https://www.openssl.org/related/binaries.html">OpenSSL website</a>.
</li>
+<li> WiX Toolset. Required for building the installer. Download the latest
+ version from the <a href="http://wixtoolset.org/">WiX Toolset website</a>
</ul>
</p>
Use NMAKE.exe to build the driver for the currently active target:<br><br>
- <code>C:\psqlodbc\> nmake /f win64.mak CFG=Release ALL</code><br><br>
-
-Possible configurations are Release and Debug.<br>
-Possible build types are ALL or CLEAN.</li></ol>
+ <code>C:\psqlodbc\> nmake /f win64.mak <options></code><br><br>
<p>
Despite the name, win64.mak is used to build both 32-bit and 64-bit binaries.
With the Microsoft SDK scripts, you can switch between 32-bit and 64-bit
-target architectures with "setenv /x86" and "setenv /x64" commands. To build
-both versions, run the nmake command twice, switching the target inbetween.
+target architectures with "setenv /x86" and "setenv /x64" commands.
+</p>
+
+<p>
+To build the .msi installer file:<br><br>
+
+ <code>C:\psqlodbc\> nmake /f win64.mak installer</code><br><br>
+
+The resulting installer file goes to installer/x64 or installer/x86 directory.
</p>
+<p>
+To build both 32-bit and 64-bit versions in one command:<br><br>
+
+ <code>C:\psqlodbc\> nmake /f win64.mak world</code><br><br>
+</p>
+
+
<p>
The following build options may be used, either on the command line, or
by creating a file called "windows-local.mak".
--- /dev/null
+
+
+# All the driver files that will be included in the installer
+DRIVER_FILES = ../$(TARGET_CPU)_Unicode_$(CFG)/psqlodbc35w.dll \
+ ../$(TARGET_CPU)_Unicode_$(CFG)/pgxalib.dll \
+ ../$(TARGET_CPU)_Unicode_$(CFG)/pgenlist.dll \
+ ../$(TARGET_CPU)_ANSI_$(CFG)/psqlodbc30a.dll \
+ ../$(TARGET_CPU)_ANSI_$(CFG)/pgxalib.dll \
+ ../$(TARGET_CPU)_ANSI_$(CFG)/pgenlista.dll
+
+ALL: $(TARGET_CPU)\psqlodbc_$(TARGET_CPU).msm $(TARGET_CPU)\psqlodbc_$(TARGET_CPU).msi
+
+CANDLE="$(WIX)bin\candle.exe"
+LIGHT="$(WIX)bin\light"
+
+!INCLUDE ..\windows-defaults.mak
+!IF EXISTS(..\windows-local.mak)
+!INCLUDE ..\windows-local.mak
+!ENDIF
+
+!MESSAGE determining product code
+
+!INCLUDE productcodes.mak
+
+!MESSAGE Got product code $(PRODUCTCODE)
+
+MSM_OPTS = -dLIBPQBINDIR="$(LIBPQ_BIN)"
+!IF "$(USE_GSS)" == "yes"
+MSM_OPTS = $(MSM_OPTS) -dGSSBINDIR="$(GSSBINDIR)"
+!ENDIF
+
+
+# Merge module
+$(TARGET_CPU)\psqlodbc_$(TARGET_CPU).msm: psqlodbcm_cpu.wxs $(DRIVER_FILES)
+ echo Building Installer Merge Module
+ $(CANDLE) -nologo -dPlatform="$(TARGET_CPU)" -dVERSION=$(POSTGRESDRIVERVERSION) -dSUBLOC=$(SUBLOC) $(MSM_OPTS) -o $(TARGET_CPU)\psqlodbcm.wixobj psqlodbcm_cpu.wxs
+ $(LIGHT) -nologo -o $(TARGET_CPU)\psqlodbc_$(TARGET_CPU).msm $(TARGET_CPU)\psqlodbcm.wixobj
+
+$(TARGET_CPU)\psqlodbc_$(TARGET_CPU).msi: psqlodbc_cpu.wxs $(DRIVER_FILES)
+ echo Building Installer
+ $(CANDLE) -nologo -dPlatform="$(TARGET_CPU)" -dVERSION=$(POSTGRESDRIVERVERSION) -dSUBLOC=$(SUBLOC) -dPRODUCTCODE=$(PRODUCTCODE) -o $(TARGET_CPU)\psqlodbc.wixobj psqlodbc_cpu.wxs
+ $(LIGHT) -nologo -ext WixUIExtension -cultures:en-us -o $(TARGET_CPU)\psqlodbc_$(TARGET_CPU).msi $(TARGET_CPU)\psqlodbc.wixobj
+ cscript modify_msi.vbs $(TARGET_CPU)\psqlodbc_$(TARGET_CPU).msi
+
+clean:
+ -rd /Q /S x64 x86
--- /dev/null
+!IF "$(POSTGRESDRIVERVERSION)" == "09.02.0100"
+PRODUCTCODE="3E42F836-9204-4c42-B3C3-8680A0434875"
+SUBLOC=0902
+!ELSE IF "$(POSTGRESDRIVERVERSION)" == "09.03.0100"
+PRODUCTCODE="1F896F2F-5756-4d22-B5A3-040796C9B485"
+SUBLOC=0903
+!ELSE IF "$(POSTGRESDRIVERVERSION)" == "09.03.0200"
+PRODUCTCODE="1F896F2F-5756-4d22-B5A3-040796C9B485"
+SUBLOC=0903
+!ELSE IF "$(POSTGRESDRIVERVERSION)" == "09.03.0210"
+PRODUCTCODE="1F896F2F-5756-4d22-B5A3-040796C9B485"
+SUBLOC=0903
+!ELSE IF "$(POSTGRESDRIVERVERSION)" == "09.03.0300"
+PRODUCTCODE="1F896F2F-5756-4d22-B5A3-040796C9B485"
+SUBLOC=0903
+!ELSE
+!MESSAGE Driver version $(POSTGRESDRIVERVERSION) is not listed in productcodes.mak
+EXIT
+!ENDIF
<?if $(var.Platform) = x64 ?>
<?define PKGNAME = "psqlODBC_x64" ?>
- <?define MERGEM = "$(var.Platform)\psqlodbc_$(var.Platform).msm" ?>
<?define BIT64 = "yes" ?>
<?define PGFOLDER = "ProgramFiles64Folder" ?>
<?define PRODID = "3E42F836-9204-4c42-B3C3-8680A0434875" ?>
<?define ALLUSERS = "2" ?>
<?else?>
<?define PKGNAME = "psqlODBC" ?>
- <?define MERGEM = "psqlodbc.msm" ?>
<?define BIT64 = "no" ?>
<?define PGFOLDER = "ProgramFilesFolder" ?>
<?define PRODID = "838E187D-8B7A-473d-B93C-C8E970B15D2B" ?>
<?define ALLUSERS = "1" ?>
<?endif?>
+<?define MERGEM = "$(var.Platform)\psqlodbc_$(var.Platform).msm" ?>
+
<!-- Product details -->
<Product
"$(INTDIR)\psqlodbc.res" : $(SOURCE)
$(RSC) $(RSC_PROJ) $(RSC_DEFINES) $(SOURCE)
+
+
+
+####
+# Umbrella targets, for building the driver in multiple configurations
+
+unicode-driver:
+ $(MAKE) -f win64.mak ANSI_VERSION=no
+ansi-driver:
+ $(MAKE) -f win64.mak ANSI_VERSION=yes
+
+installer: unicode-driver ansi-driver
+ cd installer && $(MAKE) -f installer.mak CFG=$(CFG)
+
+# world target builds both 32-bit and 64-bit installers in one command.
+#
+# The "setenv" command, from Microsoft SDK, is used to switch the build
+# target. However, it only changes the environment for the current shell;
+# it is reset for the next command. So we cannot just call "setenv /x64"
+# here one one line and nmake one the next one. I also tried creating a .bat
+# file with the commands, but setenv contains a "EXIT /B" which stops the
+# script from executing. But we can launch a new cmd.exe and pass the
+# commands to it in stdin.
+world:
+ cmd < <<
+setenv /x64
+$(MAKE) -f win64.mak installer CFG=$(CFG)
+setenv /x86
+$(MAKE) -f win64.mak installer CFG=$(CFG)
+<<
+
+clean-world:
+ -rd /Q /S x64_ANSI_Release x64_ANSI_Debug
+ -rd /Q /S x64_Unicode_Release x64_Unicode_Debug
+ -rd /Q /S x86_ANSI_Release x86_ANSI_Debug
+ -rd /Q /S x86_Unicode_Release x86_Unicode_Debug
+ cd installer && $(MAKE) /f installer.mak CFG=$(CFG) clean