>From 426bae1cff3f64e2f0ceee2865755f143bccd31d Mon Sep 17 00:00:00 2001
From: Craig Ringer <craig@2ndquadrant.com>
Date: Thu, 3 Jul 2014 13:56:44 +0800
Subject: [PATCH 3/6] Remove obsolete .bat installer creators

---
 installer/Make.bat    |  87 -------------------------
 installer/MakeX64.bat | 174 --------------------------------------------------
 installer/README.txt  |  42 +++++++++---
 3 files changed, 33 insertions(+), 270 deletions(-)
 delete mode 100755 installer/Make.bat
 delete mode 100755 installer/MakeX64.bat

diff --git a/installer/Make.bat b/installer/Make.bat
deleted file mode 100755
index 0bb5366..0000000
--- a/installer/Make.bat
+++ /dev/null
@@ -1,87 +0,0 @@
-@echo off
-
-:: Values to change include VERSION and SUBLOC, both below.
-
-setlocal
-SET X86PROGRAMFILES=%ProgramFiles%
-
-if "%PROCESSOR_ARCHITECTURE%" == "x86" GOTO SET_LINKFILES
-SET X86PROGRAMFILES=%ProgramFiles(x86)%
-
-:SET_LINKFILES
-:: echo X86PROGRAMFILES=%X86PROGRAMFILES%
-::
-:: When you reference PG server's libpq related dlls, set the
-:: version to the variable PGVERSION (default 9.3) and call
-:: this batch file.
-::
-if "%PGVERSION%" == "" SET PGVERSION=9.3
-::
-:: When you placed libpq related dlls in the folder other than
-:: the default one, set the folder name to the variable LIBPQBINDIR
-:: and call this batch file.
-::
-if "%LIBPQBINDIR%" == "" (
-	SET LINKFILES="%X86PROGRAMFILES%\PostgreSQL\%PGVERSION%\bin"
- ) else (
-	SET LINKFILES="%LIBPQBINDIR%"
- )
-
-if NOT "%1"=="" (
-       SET VERSION="%1"
-       GOTO GOT_VERSION
-)
-
-::
-::	The ProductCode History
-::	    ProductCode must be changed in case of major upgrade
-::
-SET PRODUCTID["09.02.0100"]="838E187D-8B7A-473d-B93C-C8E970B15D2B"
-SET PRODUCTID["09.03.0100"]="D3527FA5-9C2B-4550-A59B-9534A78950F4"
-SET PRODUCTID["09.03.0200"]="D3527FA5-9C2B-4550-A59B-9534A78950F4"
-SET PRODUCTID["09.03.0210"]="D3527FA5-9C2B-4550-A59B-9534A78950F4"
-SET PRODUCTID["09.03.0300"]="D3527FA5-9C2B-4550-A59B-9534A78950F4"
-
-:: The full version number of the build in XXXX.XX.XX format
-SET VERSION="09.03.0300"
-echo.
-echo Version not specified - defaulting to %VERSION%
-echo.
-
-:GOT_VERSION
-
-:: The subdirectory to install into
-SET SUBLOC=%VERSION:~1,2%%VERSION:~4,2%
-
-CALL SET PRODUCTCODE=%%PRODUCTID[%VERSION%]%%
-echo PRODUCTCODE=%PRODUCTCODE%
-
-echo.
-echo Building psqlODBC/%SUBLOC% merge module...
-
-candle -nologo -dPlatform="x86" -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dLIBPQBINDIR=%LINKFILES% -o psqlodbcm.wixobj psqlodbcm_cpu.wxs
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-light -nologo -out psqlodbc.msm psqlodbcm.wixobj
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-echo.
-echo Building psqlODBC installer database...
-
-candle -nologo -dPlatform="x86" -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dPRODUCTCODE="%PRODUCTCODE%" -o psqlodbc.wixobj psqlodbc_cpu.wxs
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-light -nologo -ext WixUIExtension -cultures:en-us psqlodbc.wixobj
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-echo.
-echo Done!
-GOTO EXIT
-
-:ERR_HANDLER
-echo.
-echo Aborting build!
-GOTO EXIT
-
-:EXIT
-endlocal
diff --git a/installer/MakeX64.bat b/installer/MakeX64.bat
deleted file mode 100755
index 960b13d..0000000
--- a/installer/MakeX64.bat
+++ /dev/null
@@ -1,174 +0,0 @@
-@echo off
-setlocal
-
-rem
-rem	The 64bit installer
-rem
-set CPUTYPE=x64
-
-rem
-rem	Set yes when clean operations are needed
-rem
-set CLEANUP=no
-rem
-rem	Set yes so as to build dlls before making the installer
-rem
-set DLLBUILD=no
-
-:getparam
-set para=%1
-echo para="%para%"
-if /i "%para:~1%" == "Drivers" (
-	if "%para:~0,1%" == "+" set DLLBUILD=yes
-	shift
-	goto getparam
-) else if /i "%para%" == "clean" (
-	set CLEANUP=yes
-	shift
-	goto getparam
-)
-
-if "%CLEANUP%" == "yes" GOTO CLEAN
-
-rem
-rem	psqlodbc dlls build options
-rem
-if "%USE_LIBPQ%" == "" (
-	SET USE_LIBPQ=yes
-)
-if "%USE_GSS%" == "" (
-	SET USE_GSS=no
-)
-if "%USE_SSPI%" == "" (
-	SET USE_SSPI=yes
-)
-
-::
-::	Please specify the foler name where you placed libpq related dlls.
-::	Currently not used.
-::
-if "%PGVERSION%" == "" SET PGVERSION=9.3
-if "%USE_LIBPQ%" == "yes" (
-	if "%LIBPQBINDIR%" == "" (
-		if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
-			SET LIBPQBINDIR="%ProgramFiles%\PostgreSQL\%PGVERSION%\bin"
-		) else (
-			echo You are setting USE_LIBPQ=%USE_LIBPQ%
-			echo Please specify LIBPQBINDIR variable
-			echo Press any key to exit ...
-			pause > nul
-			exit
-		)
-	)
-	echo LIBPQBINDIR=%LIBPQBINDIR%
-)
-
-rem
-rem	Please specify the foler name where you placed GSSAPI related dlls.
-rem
-if "%USE_GSS%" == "yes" (
-	if "%GSSBINDIR%" == "" (
-		echo You are setting USE_GSS=%USE_GSS%
-		echo Please specify GSSBINDIR variable
-		echo Press any key to exit ...
-		pause > nul
-		exit
-	)
-	echo GSSBINDIR=%GSSBINDIR%
-)
-
-rem
-rem	Build binaries if necessary
-rem
-set origdir=%CD%
-if "%DLLBUILD%" == "yes" (
-cd ..
-nmake /f win64.mak USE_LIBPQ=%USE_LIBPQ% USE_SSPI=%USE_SSPI% USE_GSS=%USE_GSS%
-nmake /f win64.mak ANSI_VERSION=yes USE_LIBPQ=%USE_LIBPQ% USE_SSPI=%USE_SSPI% USE_GSS=%USE_GSS%
-)
-cd %origdir%
-
-set wix_dir="%WIX%bin"
-echo wix_dir=%wix_dir%
-
-rem Values to change include VERSION and SUBLOC, both below.
-
-if NOT "%1"=="" SET VERSION="%1"
-if NOT "%1"=="" GOTO GOT_VERSION
-GOTO NORMAL_EXEC
-
-:CLEAN
-echo.
-echo cleaning derived files
-echo.
-del %CPUTYPE%\psqlodbc*.wix* %CPUTYPE%\psqlodbc*.ms*
-if "%DLLBUILD%" == "yes" (
-cd ..
-nmake /f win64.mak clean
-nmake /f win64.mak ANSI_VERSION=yes clean
-)
-GOTO EXIT
-
-:NORMAL_EXEC
-REM The full version number of the build in XXXX.XX.XX format
-SET VERSION="09.03.0300"
-
-echo.
-echo Version not specified - defaulting to %VERSION%
-echo.
-
-:GOT_VERSION
-
-if not exist %CPUTYPE%\ mkdir %CPUTYPE%
-
-:: The subdirectory to install into
-SET SUBLOC=%VERSION:~1,2%%VERSION:~4,2%
-
-::
-::	ProductCode History
-::	    ProductCode must be changed in case of major upgrade
-::
-SET PRODUCTID["09.02.0100"]="3E42F836-9204-4c42-B3C3-8680A0434875"
-SET PRODUCTID["09.03.0100"]="1F896F2F-5756-4d22-B5A3-040796C9B485"
-SET PRODUCTID["09.03.0200"]="1F896F2F-5756-4d22-B5A3-040796C9B485"
-SET PRODUCTID["09.03.0210"]="1F896F2F-5756-4d22-B5A3-040796C9B485"
-SET PRODUCTID["09.03.0300"]="1F896F2F-5756-4d22-B5A3-040796C9B485"
-
-CALL SET PRODUCTCODE=%%PRODUCTID[%VERSION%]%%
-
-echo.
-echo Building psqlODBC/%SUBLOC% merge module...
-
-%wix_dir%\candle.exe -nologo -dPlatform="%CPUTYPE%" -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dLIBPQBINDIR=%LIBPQBINDIR% -dGSSBINDIR=%GSSBINDIR% -o %CPUTYPE%\psqlodbcm.wixobj psqlodbcm_cpu.wxs
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-echo Linking psqlODBC merge module...
-%wix_dir%\light -nologo -o %CPUTYPE%\psqlodbc_%CPUTYPE%.msm %CPUTYPE%\psqlodbcm.wixobj
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-echo.
-echo Building psqlODBC installer database...
-
-%wix_dir%\candle.exe -nologo -dPlatform="%CPUTYPE%" -dVERSION=%VERSION% -dSUBLOC=%SUBLOC% -dPRODUCTCODE=%PRODUCTCODE% -o %CPUTYPE%\psqlodbc.wixobj psqlodbc_cpu.wxs
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-echo Linking psqlODBC installer database...
-%wix_dir%\light -nologo -ext WixUIExtension -cultures:en-us -o %CPUTYPE%\psqlodbc_%CPUTYPE%.msi %CPUTYPE%\psqlodbc.wixobj
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-echo.
-echo Modifying psqlODBC installer database...
-cscript modify_msi.vbs %CPUTYPE%\psqlodbc_%CPUTYPE%.msi
-IF ERRORLEVEL 1 GOTO ERR_HANDLER
-
-echo.
-echo Done!
-GOTO EXIT
-
-:ERR_HANDLER
-echo.
-echo Aborting build!
-GOTO EXIT
-
-:EXIT
-endlocal
diff --git a/installer/README.txt b/installer/README.txt
index 8c2854d..3c560ae 100644
--- a/installer/README.txt
+++ b/installer/README.txt
@@ -1,17 +1,41 @@
 This directory contains the psqlODBC installer for Windows. To build the
 installer, you will need a copy of WiX installed somewhere in your system
-path. The installer has been tested with WiX version 3.0.2420 only at the
-time writing. WiX may be downloaded from:
+path. The installer has been tested with WiX version 3.0.2420 and WiX 3.8 at
+the time writing.
+
+WiX may be downloaded from:
 
   http://wix.codeplex.com/
 
-In order to build the installer, first ensure that a suitable binary is in
-the $SRC\Release directory, then, from the $SRC\Installer directory run:
 
-C:\psqlODBC\Installer> make 09.02.0100
+Two parallel systems to build the installers are currently provided:
+
+POWERSHELL BASED
+----------
+
+Ensure that suitable binaries are in the parent directory Release build outputs
+(see ..\winbuild for that). 
+
+  .\BuildX64Installer.ps1
+
+  .\BuildX86Installer.ps1
+
+For help:
+
+  Get-Help .\BuildX64Installer.ps1
+
+If you get execution policy errors:
+
+  Set-ExecutionPolicy RemoteSigned
+
+and try again.
+
+Note that these installer generators use the configuration prepared by the
+PowerShell scripts in ..\winbuild, defaulting to ..\winbuild\configuration.xml,
+so you can't just mix them with SDK- or NMake based compilation.
 
-The version number will default to a value set in the Make.bat batch file if
-not specified on the command line. 2 files will be built:
+NMAKE BASED
+-----------
 
-psqlodbc.msm - A merge module for use in other projects.
-psqlodbc.msi - A Windows Installer package for standalone use.
+Use the top-level file (win64.mak), per the documentation in
+docs/win32-compilation.html, to build installers using NMake.
-- 
1.9.0

