diff --git a/Make.bat b/Make.bat index dfe77bbfb..f50bc986e 100644 --- a/Make.bat +++ b/Make.bat @@ -52,13 +52,13 @@ REM Main build sequence Ends :SET_ENVIRONMENT ECHO Configuring the environment... - IF "%PGADMIN_PYTHON_DIR%" == "" SET "PGADMIN_PYTHON_DIR=C:\Python38" + IF "%PGADMIN_PYTHON_DIR%" == "" SET "PGADMIN_PYTHON_DIR=C:\Python312" IF "%PGADMIN_KRB5_DIR%" == "" SET "PGADMIN_KRB5_DIR=C:\Program Files\MIT\Kerberos" - IF "%PGADMIN_POSTGRES_DIR%" == "" SET "PGADMIN_POSTGRES_DIR=C:\Program Files (x86)\PostgreSQL\12" + IF "%PGADMIN_POSTGRES_DIR%" == "" SET "PGADMIN_POSTGRES_DIR=C:\Program Files\PostgreSQL\17" IF "%PGADMIN_INNOTOOL_DIR%" == "" SET "PGADMIN_INNOTOOL_DIR=C:\Program Files (x86)\Inno Setup 6" - IF "%PGADMIN_VCREDIST_DIR%" == "" SET "PGADMIN_VCREDIST_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Redist\MSVC\14.16.27012" - IF "%PGADMIN_VCREDIST_FILE%" == "" SET "PGADMIN_VCREDIST_FILE=vcredist_x64.exe" - IF "%PGADMIN_SIGNTOOL_DIR%" == "" SET "PGADMIN_SIGNTOOL_DIR=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64" + IF "%PGADMIN_VCREDIST_DIR%" == "" SET "PGADMIN_VCREDIST_DIR=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807" + IF "%PGADMIN_VCREDIST_FILE%" == "" SET "PGADMIN_VCREDIST_FILE=vc_redist.x64.exe" + IF "%PGADMIN_SIGNTOOL_DIR%" == "" SET "PGADMIN_SIGNTOOL_DIR=C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64" REM Set additional variables we need FOR /F "tokens=3" %%a IN ('findstr /C:"APP_RELEASE =" %WD%\web\version.py') DO SET APP_MAJOR=%%a @@ -376,7 +376,7 @@ REM Main build sequence Ends :SIGN_INSTALLER ECHO Attempting to sign the installer... - CALL "%PGADMIN_SIGNTOOL_DIR%\signtool.exe" sign /tr http://timestamp.digicert.com "%DISTROOT%\%INSTALLERNAME%" + CALL "%PGADMIN_SIGNTOOL_DIR%\signtool.exe" sign /fd certHash /tr http://timestamp.digicert.com "%DISTROOT%\%INSTALLERNAME%" IF %ERRORLEVEL% NEQ 0 ( ECHO. ECHO ************************************************************ diff --git a/pkg/win32/README.md b/pkg/win32/README.md index e60e254e1..43791727d 100644 --- a/pkg/win32/README.md +++ b/pkg/win32/README.md @@ -6,30 +6,38 @@ builds may still work with suitable adjustments. ## Installing build requirements -1. Install Visual Studio 2017 Pro from https://my.visualstudio.com/Downloads?q=Visual%20Studio%202017. +1. Install Chocolatey from https://chocolatey.org/install#individual + + +2. Install Visual Studio 2017 Pro (PostgreSQL 16 and below) from + https://my.visualstudio.com/Downloads?q=Visual%20Studio%202017. Choose the Desktop development with C++ option, and ensure that you add the 'Visual C++ MFC for x86 and x64' option. -2. Install Chocolatey from https://chocolatey.org/install#individual -3. Install various command line tools: +3. Install Visual Studio (PostgreSQL 17 and above): + + choco install visualstudio2022community --add Microsoft.VisualStudio.Component.VC.ATLMFC;includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop;includeRecommended --add Microsoft.VisualStudio.Component.VC.CMake.Project;includeRecommended + +4. Install various command line tools: choco install -y awk bzip2 cmake diffutils dotnet3.5 gnuwin32-coreutils.install gzip git html-help-workshop meson innosetup ninja nodejs-lts python sed strawberryperl wget winflexbison3 yarn -4. Ensure the GNU CoreUtils and Microsoft HTML Help Workshop are in the system path - add: +5. Ensure the GNU CoreUtils and Microsoft HTML Help Workshop are in the system path - add: * C:\Program Files (x86)\GnuWin32\bin * C:\Program Files (x86)\HTML Help Workshop -5. Upgrade pip: + +6. Upgrade pip: python -m pip install --upgrade pip -6. Install virtualenv: +7. Install virtualenv: pip install virtualenv -## Building dependencies +## Building dependencies (PostgreSQL 16 and below) The following steps should be run from a Visual Studio 64bit command prompt. @@ -69,11 +77,12 @@ prompt. nmake install cd .. -Note that if you are not working in an administrative account, you may need to -create and give your regular account appropriate permissions to write/modify -files in *C:\Program Files\Common Files\SSL*. This is the default directory used -for the *OPENSSLDIR*, and should not be changed to a directory that un-privileged -users could potentially write to. + Note that if you are not working in an administrative account, you may need to + create and give your regular account appropriate permissions to write/modify + files in *C:\Program Files\Common Files\SSL*. This is the default directory used + for the *OPENSSLDIR*, and should not be changed to a directory that un-privileged + users could potentially write to. + 4. Download the MIT Kerberos source code, unpack and build it: @@ -100,7 +109,7 @@ users could potentially write to. nmake install NODEBUG=1 cd ..\.. -5. [PostgreSQL 16 and below]: Download the PostgreSQL source code, unpack and build it: +5. Download the PostgreSQL source code, unpack and build it: wget https://ftp.postgresql.org/pub/source/v13.3/postgresql-16.3.tar.gz tar -zxvf postgresql-16.3.tar.gz @@ -140,6 +149,26 @@ users could potentially write to. copy c:\build64\openssl\bin\libssl-3-x64.dll c:\build64\pgsql\bin\ copy c:\build64\openssl\bin\libcrypto-3-x64.dll c:\build64\pgsql\bin\ +## Building dependencies (PostgreSQL 17 and above) + +PostgreSQL 17 and later use Meson for generating project/build files, and +makes use of pkg-config to locate dependencies and configure the build +accordingly. Whilst this is arguably more reliably and flexible, it also +takes some effort to setup. + +It is therefore recommended that you simply download a pre-built set of +PostgreSQL binaries from the +[winpgbuild project](https://github.com/dpage/winpgbuild/actions/workflows/postgresql.yml). +Locate the binaries asset for the version of PostgreSQL you wish to use +in the most recent workflow run, and extract the contents to a suitable +directory such as `C:\Build64`. + +Repeat the process with the latest build of +[MIT Kerberos](https://github.com/dpage/winpgbuild/actions/workflows/krb5.yml), +merging the files into the same set of directories. This is required because +the PostgreSQL build doesn't include Kerberos (gssapi) support as it uses +native SSPI instead. + ## Setting up a dev environment This section describes the steps to setup and run pgAdmin for the first time in @@ -170,9 +199,9 @@ desktop runtime. ## Building an installer 1. Set the required environment variables, either system-wide, or in a Visual -Studio 2017 64bit command prompt. Note that the examples shown below are the -defaults for the build system, so if they match your requirements you don't -need to set them: +Studio 2017 (or 2022 with PostgreSQL 17+) 64bit command prompt. Note that the +examples shown below are the defaults for the build system, so if they match +your requirements you don't need to set them. For PostgreSQL 16 and below: SET "PGADMIN_POSTGRES_DIR=C:\build64\pgsql" SET "PGADMIN_PYTHON_DIR=C:\Python312" @@ -180,12 +209,24 @@ need to set them: SET "PGADMIN_INNOTOOL_DIR=C:\Program Files (x86)\Inno Setup 6" SET "PGADMIN_SIGNTOOL_DIR=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64" SET "PGADMIN_VCREDIST_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Redist\MSVC\14.16.27012" + SET "PGADMIN_VCREDIST_FILE=vcredist_x64.exe" + + For PostgreSQL 17 and later: + + SET "PGADMIN_POSTGRES_DIR=C:\build64" + SET "PGADMIN_PYTHON_DIR=C:\Python312" + SET "PGADMIN_KRB5_DIR=C:\build64" + SET "PGADMIN_INNOTOOL_DIR=C:\Program Files (x86)\Inno Setup 6" + SET "PGADMIN_SIGNTOOL_DIR=C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64" + SET "PGADMIN_VCREDIST_DIR=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807" + SET "PGADMIN_VCREDIST_FILE=vc_redist.x64.exe" 2. Run: make -If you have a code signing certificate, this will automatically be used if -found in the Windows Certificate Store to sign the installer. + If you have a code signing certificate, this will automatically be used if + found in the Windows Certificate Store to sign the installer. + 3. Find the completed installer in the dist/ subdirectory of your source tree.