From 57b0e11ad4970e666a91eb4b34a06ebdf2417f31 Mon Sep 17 00:00:00 2001 From: Manika SInghal <69899716+Manika-EDB@users.noreply.github.com> Date: Fri, 26 Jul 2024 07:53:16 +0100 Subject: [PATCH] Make changes to windows build environment to support GitHub Actions Historically, the build-windows-x64.sh script was responsible to prepare the build environment, to compile the source code and to generate the BitRock based installer. This is now changed to using GitHub Actions based workflow and the supporting powershell scripts. The workflow resides in a separate repository whereas the build scripts and installer code resides in this repository. Summary of the Changes: - remove build-windows-x64.sh as it is no more needed, instead add new scripts compile.ps1, prepare-staging, compile-system-stats - packages-win64.txt contains 3rd party libs name and versions. - version.txt contains versions of PG, LP, stackbuilder and pgAdmin4 - update the project files to suite the newer Visual Studio - additional fixes required in installer XML DBP-858, Manika Singhal, --Tested by Manika Singhal --Reviewed by Sandeep Thakkar, Srinu Perabattula and Kritika Agarwal --- server/build-windows-x64.sh | 784 ------------------ server/generate-sources.sh | 14 + server/installer.xml.in | 32 +- server/license.sh | 112 +++ server/packages-win64.txt | 13 + server/scripts/windows/build-pgadmin.bat.in | 176 ---- .../scripts/windows/compile-system_stats.ps1 | 13 + server/scripts/windows/compile.ps1 | 323 ++++++++ .../windows/createuser/createuser.vcproj | 353 -------- .../windows/createuser/createuser.vcxproj | 179 ++++ .../createuser/createuser.vcxproj.filters | 22 + .../createuser/createuser.vcxproj.user | 4 + .../windows/getlocales/getlocales.vcproj | 349 -------- .../windows/getlocales/getlocales.vcxproj | 175 ++++ .../getlocales/getlocales.vcxproj.filters | 22 + .../getlocales/getlocales.vcxproj.user | 4 + .../windows/prepare-staging-directory.sh | 103 +++ .../windows/validateuser/validateuser.vcproj | 349 -------- .../windows/validateuser/validateuser.vcxproj | 175 ++++ .../validateuser/validateuser.vcxproj.filters | 22 + .../validateuser/validateuser.vcxproj.user | 4 + server/scripts/windows/vc-build-x64.bat | 18 + server/version.txt | 6 + 23 files changed, 1239 insertions(+), 2013 deletions(-) delete mode 100755 server/build-windows-x64.sh create mode 100755 server/generate-sources.sh create mode 100644 server/license.sh create mode 100644 server/packages-win64.txt delete mode 100644 server/scripts/windows/build-pgadmin.bat.in create mode 100644 server/scripts/windows/compile-system_stats.ps1 create mode 100644 server/scripts/windows/compile.ps1 delete mode 100755 server/scripts/windows/createuser/createuser.vcproj create mode 100755 server/scripts/windows/createuser/createuser.vcxproj create mode 100755 server/scripts/windows/createuser/createuser.vcxproj.filters create mode 100755 server/scripts/windows/createuser/createuser.vcxproj.user delete mode 100755 server/scripts/windows/getlocales/getlocales.vcproj create mode 100755 server/scripts/windows/getlocales/getlocales.vcxproj create mode 100755 server/scripts/windows/getlocales/getlocales.vcxproj.filters create mode 100755 server/scripts/windows/getlocales/getlocales.vcxproj.user create mode 100644 server/scripts/windows/prepare-staging-directory.sh delete mode 100755 server/scripts/windows/validateuser/validateuser.vcproj create mode 100755 server/scripts/windows/validateuser/validateuser.vcxproj create mode 100755 server/scripts/windows/validateuser/validateuser.vcxproj.filters create mode 100755 server/scripts/windows/validateuser/validateuser.vcxproj.user create mode 100644 server/scripts/windows/vc-build-x64.bat create mode 100644 server/version.txt diff --git a/server/build-windows-x64.sh b/server/build-windows-x64.sh deleted file mode 100755 index ae079ca98..000000000 --- a/server/build-windows-x64.sh +++ /dev/null @@ -1,784 +0,0 @@ -#!/bin/bash - - -################################################################################ -# Build preparation -################################################################################ - -_prep_server_windows_x64() { - # Following echo statement for Jenkins Console Section output - echo "BEGIN PREP Server Windows-x64" - - # Enter the source directory and cleanup if required - cd $WD/server/source - - if [ -e postgres.windows-x64 ]; - then - echo "Removing existing postgres.windows-x64 source directory" - rm -rf postgres.windows-x64 || _die "Couldn't remove the existing postgres.windows-x64 source directory (source/postgres.windows-x64)" - fi - if [ -e pgadmin.windows-x64 ]; - then - echo "Removing existing pgadmin.windows-x64 source directory" - rm -rf pgadmin.windows-x64 || _die "Couldn't remove the existing pgadmin.windows-x64 source directory (source/pgadmin.windows-x64)" - fi - if [ -e stackbuilder.windows-x64 ]; - then - echo "Removing existing stackbuilder.windows-x64 source directory" - rm -rf stackbuilder.windows-x64 || _die "Couldn't remove the existing stackbuilder.windows-x64 source directory (source/stackbuilder.windows-x64)" - fi - if [ -e system_stats.windows-x64 ]; - then - echo "Removing existing system_stats.windows-x64 source directory" - rm -rf system_stats.windows-x64 || _die "Couldn't remove the existing system_stats.windows-x64 source directory (source/system_stats.windows-x64)" - fi - - # Remove any existing zip files - if [ -f $WD/server/source/postgres-win64.zip ]; - then - echo "Removing existing source archive" - rm -rf $WD/server/source/postgres-win64.zip || _die "Couldn't remove the existing source archive" - fi - if [ -f $WD/server/source/pgadmin-win64.zip ]; - then - echo "Removing existing pgadmin archive" - rm -rf $WD/server/source/pgadmin-win64.zip || _die "Couldn't remove the existing pgadmin archive" - fi - if [ -f $WD/server/source/stackbuilder-win64.zip ]; - then - echo "Removing existing stackbuilder archive" - rm -rf $WD/server/source/stackbuilder-win64.zip || _die "Couldn't remove the existing stackbuilder archive" - fi - if [ -f $WD/server/source/system_stats-win64.zip ]; - then - echo "Removing existing system_stats archive" - rm -rf $WD/server/source/system_stats-win64.zip || _die "Couldn't remove the existing system_stats archive" - fi - if [ -f $WD/server/scripts/windows/scripts.zip ]; - then - echo "Removing existing scripts archive" - rm -rf $WD/server/scripts/windows/scripts.zip || _die "Couldn't remove the existing scripts archive" - fi - if [ -f $WD/server/staging/windows-x64/output.zip ]; - then - echo "Removing existing output archive" - rm -rf $WD/server/staging/windows-x64/output.zip || _die "Couldn't remove the existing output archive" - fi - - # Cleanup the build host - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q postgres-win64.zip" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q pgadmin-win64.zip" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q stackbuilder-win64.zip" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q system_stats-win64.zip" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q scripts.zip" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; rm -rf output.zip" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q vc-build-x64.bat" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q vc-build.bat" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q vc-build-doc.bat" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q build-pgadmin4.bat" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c del /S /Q vc-build-sys-stat.bat" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; rm -rf output.build" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c rd /S /Q postgres.windows-x64" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; rm -rf pgadmin.windows-x64" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c rd /S /Q stackbuilder.windows-x64" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c rd /S /Q system_stats.windows-x64" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c rd /S /Q createuser" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c rd /S /Q getlocales" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c rd /S /Q validateuser" - - # Cleanup local files - if [ -f $WD/server/scripts/windows/vc-build.bat ]; - then - echo "Removing existing vc-build script" - rm -rf $WD/server/scripts/windows/vc-build.bat || _die "Couldn't remove the existing vc-build script" - fi - - if [ -f $WD/server/scripts/windows/vc-build-x64.bat ]; - then - echo "Removing existing vc-build-x64 script" - rm -rf $WD/server/scripts/windows/vc-build-x64.bat || _die "Couldn't remove the existing vc-build-x64 script" - fi - - if [ -f $WD/server/scripts/windows/vc-build-doc.bat ]; - then - echo "Removing existing vc-build-doc script" - rm -rf $WD/server/scripts/windows/vc-build-doc.bat || _die "Couldn't remove the existing vc-build-doc script" - fi - - if [ -f $WD/server/scripts/windows/vc-build-sys-stat.bat ]; - then - echo "Removing existing vc-build-sys-stat.bat script" - rm -rf $WD/server/scripts/windows/vc-build-sys-stat.bat || _die "Couldn't remove the existing vc-build-sys-stat.bat script" - fi - # Grab a copy of the source tree - cp -R postgresql-$PG_TARBALL_POSTGRESQL postgres.windows-x64 || _die "Failed to copy the source code (source/postgres.windows-x64)" - - cp -R pgadmin4-$PG_TARBALL_PGADMIN pgadmin.windows-x64 || _die "Failed to copy the source code (source/pgadmin.windows-x64)" - - cd $WD/server/source - cp -R stackbuilder stackbuilder.windows-x64 || _die "Failed to copy the source code (source/stackbuilder.windows-x64)" - - cd stackbuilder.windows-x64 - patch -p1 < $WD/../patches/sb_patch_for_pg.patch - cd $WD/server/source - - cp -R system_stats system_stats.windows-x64 || _die "Failed to copy the source code (source/system_stats.windows-x64)" - - # Remove any existing staging directory that might exist, and create a clean one - if [ -e $WD/server/staging_cache/windows-x64 ]; - then - echo "Removing existing staging_cache directory" - rm -rf $WD/server/staging_cache/windows-x64 || _die "Couldn't remove the existing staging_cache directory" - fi - - echo "Creating staging_cache directory ($WD/server/staging_cache/windows-x64)" - mkdir -p $WD/server/staging_cache/windows-x64 || _die "Couldn't create the staging_cache directory" - - if [ -e $WD/server/staging/windows-x64 ]; - then - echo "Removing existing staging directory" - rm -rf $WD/server/staging/windows-x64 || _die "Couldn't remove the existing staging directory" - fi - - echo "Creating staging directory ($WD/server/staging/windows-x64_restructured)" - mkdir -p $WD/server/staging/windows-x64 || _die "Couldn't create the staging directory" - - echo "END PREP Server Windows-x64" -} - -################################################################################ -# Build -################################################################################ - -_build_server_windows_x64() { - echo "BEGIN BUILD Server Windows-x64" - - # Create a build script for VC++ - cd $WD/server/scripts/windows - cat < "vc-build.bat" -REM Setting Visual Studio Environment -CALL "$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Auxiliary\Build\vcvarsall.bat" x86 - -@SET PGBUILD=$PG_PGBUILD_WINDOWS -@SET OPENSSL=$PG_PGBUILD_WINDOWS -@SET WXWIN=$PG_WXWIN_WINDOWS -@SET INCLUDE=$PG_PGBUILD_WINDOWS\\include;%INCLUDE% -@SET LIB=$PG_PGBUILD_WINDOWS\\lib;%LIB% -@SET PGDIR=$PG_PATH_WINDOWS\\output.build -@SET SPHINXBUILD=$PG_PYTHON_WINDOWS_X64\\Scripts\\sphinx-build.exe - -IF "%2" == "UPGRADE" GOTO upgrade - -msbuild %1 /p:Configuration=%2 %3 -GOTO end - -:upgrade -devenv /upgrade %1 - -:end - -EOT - - cat < "vc-build-x64.bat" -REM Setting Visual Studio Environment -CALL "$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 - -@SET PGBUILD=$PG_PGBUILD_WINDOWS_X64 -@SET OPENSSL=$PG_PGBUILD_WINDOWS_X64 -@SET WXWIN=$PG_WXWIN_WINDOWS_X64 -@SET INCLUDE=$PG_PGBUILD_WINDOWS_X64\\include;%INCLUDE% -@SET LIB=$PG_PGBUILD_WINDOWS_X64\\lib;%LIB% -@SET PGDIR=$PG_PATH_WINDOWS_X64\\output.build -@SET SPHINXBUILD=$PG_PYTHON_WINDOWS_X64\\Scripts\\sphinx-build.exe - -REM batch file splits single argument containing "=" sign into two -REM Following code handles this scenario - -IF "%2" == "UPGRADE" GOTO upgrade -IF "%~3" == "" ( SET VAR3="" -) ELSE ( -SET VAR3="%3=%4" -) -msbuild %1 /p:Configuration=%2 %VAR3% -GOTO end - -:upgrade -devenv /upgrade %1 - -:end - -EOT - -cat < "vc-build-doc.bat" -REM Setting Visual Studio Environment -CALL "$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Auxiliary\Build\vcvarsall.bat" x86 - -@SET PGBUILD=$PG_PGBUILD_WINDOWS_X64 -@SET OPENSSL=$PG_PGBUILD_WINDOWS_X64 -@SET WXWIN=$PG_WXWIN_WINDOWS_X64 -@SET INCLUDE=$PG_PGBUILD_WINDOWS_X64\\include;%INCLUDE% -@SET LIB=$PG_PGBUILD_WINDOWS_X64\\lib;%LIB% -@SET PGDIR=$PG_PATH_WINDOWS_X64\\output.build -@SET SPHINXBUILD=$PG_PYTHON_WINDOWS_X64\\Scripts\\sphinx-build.exe - -REM batch file splits single argument containing "=" sign into two -REM Following code handles this scenario - -IF "%2" == "UPGRADE" GOTO upgrade -IF "%~3" == "" ( SET VAR3="" -) ELSE ( -SET VAR3="%3=%4" -) -msbuild %1 /p:Configuration=%2 %VAR3% -GOTO end - -:upgrade -devenv /upgrade %1 - -:end - -EOT - -cat < "vc-build-sys-stat.bat" -REM Setting Visual Studio Environment -CALL "$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 -REM CALL "$PG_VSINSTALLDIR_WINDOWS_X64\VC\vcvarsall.bat" amd64 -@SET PG_INCLUDE_DIR=$PG_PGBUILD_WINDOWS_X64\\include;$PG_PATH_WINDOWS_X64\\postgres.windows-x64\src\include -@SET PG_LIB_DIR=$PG_PATH_WINDOWS_X64\postgres.windows-x64\Release\postgres - -REM batch file splits single argument containing "=" sign into two -REM Following code handles this scenario - -IF "%2" == "UPGRADE" GOTO upgrade -IF "%~3" == "" ( SET VAR3="" -) ELSE ( -SET VAR3="%3=%4" -) -msbuild %1 /p:Configuration=%2 %VAR3% -GOTO end - -:upgrade -devenv /upgrade %1 - -:end - -EOT - - # Copy in an appropriate config.pl and buildenv.pl - cd $WD/server/source/ - cat < "postgres.windows-x64/src/tools/msvc/config.pl" -# Configuration arguments for vcbuild. -use strict; -use warnings; - -our \$config = { - asserts=>0, # --enable-cassert - nls=>'$PG_PGBUILD_GETTEXT_WINDOWS_X64', # --enable-nls= - perl=>'$PG_PERL_WINDOWS_X64', # --with-perl - python=>'$PG_PYTHON_WINDOWS_X64', # --with-python= - tcl=>'$PG_TCL_WINDOWS_X64', # --with-tls= - ldap=>1, # --with-ldap - openssl=>'$PG_PGBUILD_WINDOWS_X64', # --with-ssl= - xml=>'$PG_PGBUILD_WINDOWS_X64', - xslt=>'$PG_PGBUILD_WINDOWS_X64', - iconv=>'$PG_PGBUILD_GETTEXT_WINDOWS_X64', - zlib=>'$PG_PGBUILD_WINDOWS_X64', # --with-zlib= - icu=>'$PG_PGBUILD_WINDOWS_X64', # --with-icu= - uuid=>'$PG_PGBUILD_WINDOWS_X64', # --with-uuid-ossp - lz4=>'$PG_PGBUILD_WINDOWS_X64', # --with-lz4= - zstd=>'$PG_PGBUILD_WINDOWS_X64' # --with-zstd= -}; - -1; -EOT - - cat < "postgres.windows-x64/src/tools/msvc/buildenv.pl" -use strict; -use warnings; - -\$ENV{VSINSTALLDIR} = '$PG_VSINSTALLDIR_WINDOWS_X64'; -\$ENV{VCINSTALLDIR} = '$PG_VSINSTALLDIR_WINDOWS_X64\VC'; -\$ENV{DevEnvDir} = '$PG_DEVENVDIR_WINDOWS_X64'; -\$ENV{M4} = '$PG_PGBUILD_WINDOWS_X64\bin\m4.exe'; -\$ENV{CONFIG} = 'Release $PLATFORM_TOOLSET'; - -\$ENV{PATH} = join -( - ';' , - '$PG_MSBUILDDIR_WINDOWS_X64\bin', - '$PG_DEVENVDIR_WINDOWS_X64', - '$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64', - '$PG_PGBUILD_GETTEXT_WINDOWS_X64\bin', - '$PG_PGBUILD_WINDOWS_X64\bin', - '$PG_PERL_WINDOWS_X64\bin', - '$PG_PYTHON_WINDOWS_X64', - '$PG_TCL_WINDOWS_X64\bin', - \$ENV{PATH} -); - -\$ENV{INCLUDE} = join -( - ';', - '$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Tools\MSVC\14.14.26428\ATLMFC\INCLUDE', - '$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Tools\MSVC\14.14.26428\INCLUDE', - '$PG_PGBUILD_GETTEXT_WINDOWS_X64\include', - '$PG_PGBUILD_WINDOWS_X64\include', - \$ENV{INCLUDE} -); - -\$ENV{LIB} = join -( - ';', - '$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Tools\MSVC\14.14.26428\ATLMFC\LIB', - '$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Tools\MSVC\14.14.26428\LIB\onecore\x64', - '$PG_PGBUILD_GETTEXT_WINDOWS_X64\lib', - '$PG_PGBUILD_WINDOWS_X64\lib', - \$ENV{LIB} -); - -\$ENV{LIBPATH} = join -( - ';', - '$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Tools\MSVC\14.14.26428\ATLMFC\LIB' -); - -1; -EOT - - # Create a config file for the debugger - cat < "postgres.windows-x64/contrib/pldebugger/settings.projinc" - - - - - - - 0 - - - x64 - - - ..\..\ - - - $PG_PGBUILD_WINDOWS_X64 - - - $PG_PGBUILD_WINDOWS_X64 - - - -EOT - - # create pgAdmin script and replace place holder - if [ -f $WD/server/scripts/windows/build-pgadmin.bat ]; then - rm -f $WD/server/scripts/windows/build-pgadmin.bat - fi - echo "CALL \"$PG_VSINSTALLDIR_WINDOWS_X64\Professional\VC\Auxiliary\Build\vcvarsall.bat\" amd64" > $WD/server/scripts/windows/build-pgadmin.bat - cat $WD/server/scripts/windows/build-pgadmin.bat.in >> $WD/server/scripts/windows/build-pgadmin.bat - _replace PGADMIN_SRC_DIR= "PGADMIN_SRC_DIR=${PG_PATH_WINDOWS_X64}\\\\pgadmin.windows-x64" $WD/server/scripts/windows/build-pgadmin.bat || _die "Failed to replace PGADMIN_SRC_DIR in build-pgadmin.bat" - _replace PGADMIN_PYTHON_DIR= "PGADMIN_PYTHON_DIR=${PGADMIN_PYTHON_WINDOWS_X64}" $WD/server/scripts/windows/build-pgadmin.bat || _die "Failed to replace PGADMIN_PYTHON_WINDOWS_X64 in build-pgadmin.bat" - _replace PGBUILD= "PGBUILD=${PG_PGBUILD_WINDOWS_X64}" $WD/server/scripts/windows/build-pgadmin.bat $WD/server/scripts/windows/build-pgadmin.bat || _die "Failed to replace PGBUILD in build-pgadmin.bat" - _replace PGADMIN_KRB5_DIR= "PGADMIN_KRB5_DIR=${PGADMIN_KRB5_DIR}" $WD/server/scripts/windows/build-pgadmin.bat || _die "Failed to replace PGADMIN_KRB5_DIR in build-pgadmin.bat" - _replace YARN_HOME= "YARN_HOME=${YARN_HOME}" $WD/server/scripts/windows/build-pgadmin.bat || _die "Failed to replace YARN_HOME in build-pgadmin.bat" - _replace NODEJS_HOME= "NODEJS_HOME=${NODEJS_HOME}" $WD/server/scripts/windows/build-pgadmin.bat || _die "Failed to replace NODEJS_HOME in build-pgadmin.bat" - _replace PGADMIN_POSTGRES_DIR= "PGADMIN_POSTGRES_DIR=${PG_PATH_WINDOWS_X64}\\\\output" $WD/server/scripts/windows/build-pgadmin.bat || _die "Failed to replace NODEJS_HOME in build-pgadmin.bat" - - # Zip up the scripts directories and copy them to the build host, then unzip - cd $WD/server/scripts/windows/ - echo "Copying scripts source tree to Windows build VM" - zip -r scripts.zip vc-build.bat build-pgadmin.bat vc-build-x64.bat vc-build-doc.bat vc-build-sys-stat.bat createuser getlocales validateuser || _die "Failed to pack the scripts source tree (ms-build.bat vc-build-x64.bat vc-build-x64.bat,vc-build-sys-stat.bat, createuser, getlocales, validateuser)" - - rsync -av scripts.zip $PG_SSH_WINDOWS_X64:$PG_CYGWIN_PATH_WINDOWS_X64 || _die "Failed to copy the scripts source tree to the windows-x64 build host (scripts.zip)" - ssh -v $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; unzip -o scripts.zip" || _die "Failed to unpack the scripts source tree on the windows-x64 build host (scripts.zip)" - - # Build the code and install into a temporary directory - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\createuser; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat createuser.vcproj UPGRADE" || _die "Failed to build createuser on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\createuser; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat createuser.vcxproj Release $PLATFORM_TOOLSET" || _die "Failed to build createuser on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\getlocales; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat getlocales.vcproj UPGRADE" || _die "Failed to build getlocales on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\getlocales; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat getlocales.vcxproj Release $PLATFORM_TOOLSET" || _die "Failed to build getlocales on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\validateuser; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat validateuser.vcproj UPGRADE" || _die "Failed to build validateuser on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\validateuser; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat validateuser.vcxproj Release $PLATFORM_TOOLSET" || _die "Failed to build validateuser on the windows-x64 build host" - - # Move the resulting binaries into place - ssh $PG_SSH_WINDOWS_X64 "cmd /c mkdir $PG_PATH_WINDOWS_X64\\\\output.build\\\\installer\\\\server" || _die "Failed to create the server directory on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\createuser\\\\x64\\\\release\\\\createuser.exe $PG_PATH_WINDOWS_X64\\\\output.build\\\\installer\\\\server" || _die "Failed to copy the createuser proglet on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\getlocales\\\\x64\\\\release\\\\getlocales.exe $PG_PATH_WINDOWS_X64\\\\output.build\\\\installer\\\\server" || _die "Failed to copy the getlocales proglet on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\validateuser\\\\x64\\\\release\\\\validateuser.exe $PG_PATH_WINDOWS_X64\\\\output.build\\\\installer\\\\server" || _die "Failed to copy the validateuser proglet on the windows-x64 build host" - - # Zip up the source directory and copy it to the build host, then unzip - cd $WD/server/source/ - chmod +x postgres.windows-x64/src/tools/msvc/install.bat - echo "Copying source tree to Windows build VM" - rm postgres.windows-x64/contrib/pldebugger/Makefile # Remove the unix makefile so that the build scripts don't try to parse it - we have our own. - zip -r postgres-win64.zip postgres.windows-x64 || _die "Failed to pack the source tree (postgres.windows-x64)" - rsync -av postgres-win64.zip $PG_SSH_WINDOWS_X64:$PG_CYGWIN_PATH_WINDOWS_X64 || _die "Failed to copy the source tree to the windows-x64 build host (postgres-win64.zip)" - ssh -v $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c unzip -o postgres-win64.zip" || _die "Failed to unpack the source tree on the windows-x64 build host (postgres-win64.zip)" - - PG_CYGWIN_PERL_WINDOWS_X64=`echo $PG_PERL_WINDOWS_X64 | sed -e 's;:;;g' | sed -e 's:\\\\:/:g' | sed -e 's:^:/cygdrive/:g'` - PG_CYGWIN_PERL24_WINDOWS_X64=`echo $PG_PERL24_WINDOWS_X64 | sed -e 's;:;;g' | sed -e 's:\\\\:/:g' | sed -e 's:^:/cygdrive/:g'` - PG_CYGWIN_PYTHON_WINDOWS_X64=`echo $PG_PYTHON_WINDOWS_X64 | sed -e 's;:;;g' | sed -e 's:\\\\:/:g' | sed -e 's:^:/cygdrive/:g'` - PG_CYGWIN_TCL_WINDOWS_X64=`echo $PG_TCL_WINDOWS_X64 | sed -e 's;:;;g' | sed -e 's:\\\\:/:g' | sed -e 's:^:/cygdrive/:g'` - PG_CYGWIN_PGBUILD_WINDOWS_X64=`echo $PG_PGBUILD_WINDOWS_X64 | sed -e 's;:;;g' | sed -e 's:\\\\:/:g' | sed -e 's:^:/cygdrive/:g'` - - - # Build the code and install into a temporary directory - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64/postgres.windows-x64/src/tools/msvc; export PATH=\$PATH:$PG_CYGWIN_PERL24_WINDOWS_X64/bin:$PG_CYGWIN_PYTHON_WINDOWS_X64:$PG_CYGWIN_TCL_WINDOWS_X64/bin:$PG_CYGWIN_PGBUILD_WINDOWS_X64/bin; export M4=$PG_CYGWIN_PGBUILD_WINDOWS_X64/bin/m4.exe; export VisualStudioVersion=15.0; ./build.bat RELEASE" || _die "Failed to build postgres on the windows-x64 build host" - - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64/postgres.windows-x64/src/tools/msvc; export PATH=\$PATH:$PG_CYGWIN_PERL24_WINDOWS_X64/bin:$PG_CYGWIN_PYTHON_WINDOWS_X64:$PG_CYGWIN_TCL_WINDOWS_X64/bin; ./install.bat $PG_PATH_WINDOWS_X64\\\\output.build" || _die "Failed to install postgres on the windows-x64 build host" - - # Build the debugger plugins - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64/postgres.windows-x64/contrib/pldebugger; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat pldebugger.proj" || _die "Failed to build the pldebugger plugin" - - # Copy the debugger plugins into place - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\postgres.windows-x64\\\\contrib\\\\pldebugger\\\\plugin_debugger.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy the debugger plugin on the windows-x64 build host" - - # Copy the various support files into place - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\vcredist\\\\vcredist_x64.exe $PG_PATH_WINDOWS_X64\\\\output.build\\\\installer" || _die "Failed to copy the VC++ runtimes on the windows build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\vcredist\\\\vcredist_x86.exe $PG_PATH_WINDOWS_X64\\\\output.build\\\\installer" || _die "Failed to copy the VC++ runtimes on the windows build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\libssl-*-x64.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\libcrypto-*-x64.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_GETTEXT_WINDOWS_X64\\\\bin\\\\libiconv-2.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_GETTEXT_WINDOWS_X64\\\\bin\\\\libintl-9.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_GETTEXT_WINDOWS_X64\\\\bin\\\\libwinpthread-1.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\libxml2.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\libxslt.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\zlib1.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\libcurl.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\icu*.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\liblz4.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\libzstd.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\lib\\\\liblz4.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\lib\\\\libssl.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\lib\\\\libcrypto.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_GETTEXT_WINDOWS_X64\\\\lib\\\\iconv.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_GETTEXT_WINDOWS_X64\\\\lib\\\\libintl.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\lib\\\\libxml2.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\lib\\\\libxslt.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\bin\\\\zlib.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\lib\\\\libcurl.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\lib\\\\libzstd.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - - # Copy the third party headers except GPL license headers - mkdir $WD/server/staging_cache/windows-x64/3rdinclude/ - scp $PG_SSH_WINDOWS_X64:$PG_PGBUILD_WINDOWS_X64/include/*.h $WD/server/staging_cache/windows-x64/3rdinclude/ || _die "Failed to copy the third party headers to $WD/server/staging_cache/windows-x64/3rdinclude/ )" - find $WD/server/staging_cache/windows-x64/3rdinclude/ -name "*.h" -exec grep -rwl "GNU General Public License" {} \; -exec rm {} \; || _die "Failed to remove the GPL license header files." - scp -r $WD/server/staging_cache/windows-x64/3rdinclude/* $PG_SSH_WINDOWS_X64:$PG_PATH_WINDOWS_X64\\\\output.build\\\\include || _die "Failed to copy the third party headers to ($PG_SSH_WINDOWS_X64:$PG_PATH_WINDOWS_X64/output.build/include)" - rm -rf $WD/server/staging_cache/windows-x64/3rdinclude || _die "Failed to remove the third party headers directory" - - ssh $PG_SSH_WINDOWS_X64 "cmd /c mkdir \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\openssl\"" || _die "Failed to create openssl directory" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\include\\\\openssl\\\\*.h $PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\openssl" || _die "Failed to copy third party headers on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c mkdir \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\libxml\"" || _die "Failed to create libxml directory" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\include\\\\libxml\\\\*.h $PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\libxml" || _die "Failed to copy third party headers on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c mkdir \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\libxslt\"" || _die "Failed to create libxslt directory" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\include\\\\libxslt\\\\*.h $PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\libxslt" || _die "Failed to copy third party headers on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\include\\\\lz4*.h $PG_PATH_WINDOWS_X64\\\\output.build\\\\include" || _die "Failed to copy third party headers on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\include\\\\zstd.h $PG_PATH_WINDOWS_X64\\\\output.build\\\\include" || _die "Failed to copy third party headers on the windows-x64 build host" - - ssh $PG_SSH_WINDOWS_X64 "cmd /c mkdir \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\unicode\"" || _die "Failed to create unicode directory" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_WINDOWS_X64\\\\include\\\\unicode\\\\*.h $PG_PATH_WINDOWS_X64\\\\output.build\\\\include\\\\unicode" || _die "Failed to copy third party headers on the windows-x64 build host" - - # Copy the wxWidgets libraries - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxbase324u_net_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxbase324u_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxbase324u_xml_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw324u_adv_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw324u_aui_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw324u_core_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw324u_html_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - #ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw324u_stc_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw324u_xrc_vc_x64_custom.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to copy a dependency DLL on the windows-x64 build host" - - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxbase32u_net.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxbase32u.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxbase32u_xml.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw32u_adv.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw32u_aui.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw32u_core.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw32u_html.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - #ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw32u_stc.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw32u_xrc.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_WXWIN_WINDOWS_X64\\\\lib\\\\vc_x64_dll\\\\wxmsw32u_adv.lib $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy a dependency lib on the windows-x64 build host" - ##################### - # pgAdmin - ##################### - echo "Copying pgAdmin source tree to Windows build VM" - zip -r pgadmin-win64.zip pgadmin.windows-x64 || _die "Failed to pack the source tree (pgadmin.windows-x64)" - rsync -av pgadmin-win64.zip $PG_SSH_WINDOWS_X64:$PG_CYGWIN_PATH_WINDOWS_X64 || _die "Failed to copy the source tree to the windows-x64 build host (pgadmin-win64.zip)" - ssh -v $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c unzip -o pgadmin-win64.zip" || _die "Failed to unpack the source tree on the windows-x64 build host (pgadmin-win64.zip)" - - - #Create pgAdmin4 folder inside the output.build - ssh $PG_SSH_WINDOWS_X64 "mkdir \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\"" || _die "Failed to create a pgAdmin 4 directory on the windows build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64/pgadmin.windows-x64; cmd /c $PG_PATH_WINDOWS_X64\\\\build-pgadmin.bat" || _die "Failed to build pgadmin" - ssh $PG_SSH_WINDOWS_X64 "cp -R $PG_PATH_WINDOWS_X64\\\\pgadmin.windows-x64\\\\win-build\\\\docs \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\docs\"" || _die "Failed to copy pgAdmin doc" - ssh $PG_SSH_WINDOWS_X64 "cp -R $PG_PATH_WINDOWS_X64\\\\pgadmin.windows-x64\\\\win-build\\\\python \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\python\"" || _die "Failed to copy pgAdmin python" - ssh $PG_SSH_WINDOWS_X64 "cp -R $PG_PATH_WINDOWS_X64\\\\pgadmin.windows-x64\\\\win-build\\\\runtime \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy pgAdmin runtime" - ssh $PG_SSH_WINDOWS_X64 "cp -R $PG_PATH_WINDOWS_X64\\\\pgadmin.windows-x64\\\\win-build\\\\web \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\web\"" || _die "Failed to copy pgAdmin web" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_GETTEXT_WINDOWS_X64\\\\bin\\\\libiconv-2.dll \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy libiconv-2.dll" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PGBUILD_GETTEXT_WINDOWS_X64\\\\bin\\\\libintl-9.dll \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy libintl-9.dll" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\libpq.dll \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy libpq.dll" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\pg_dump.exe \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy pg_dump.exe" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\pg_dumpall.exe \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy pg_dumpall.exe" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\pg_restore.exe \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy pg_restore.exe" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\psql.exe \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy psql.exe" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\libwinpthread-1.dll \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy libwinpthread-1.dll" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\zlib1.dll \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy zlib1.dll" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\libssl-*-x64.dll \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy libssl-*-x64.dll" - ssh $PG_SSH_WINDOWS_X64 "cmd /c copy $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin\\\\libcrypto-*-x64.dll \"$PG_PATH_WINDOWS_X64\\\\output.build\\\\pgAdmin 4\\\\runtime\"" || _die "Failed to copy libcrypto-*-x64.dll" - - - ################################## - # Build the system_stats extension - ################################## - cd $WD/server/source/ - echo "Copying StackBuilder source tree to Windows build VM" - zip -r system_stats-win64.zip system_stats.windows-x64 || _die "Failed to pack the source tree (system_stats.windows-x64)" - rsync -av system_stats-win64.zip $PG_SSH_WINDOWS_X64:$PG_CYGWIN_PATH_WINDOWS_X64 || _die "Failed to copy the source tree to the windows-x64 build host (system_stats-win64.zip)" - ssh -v $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c unzip -o system_stats-win64.zip" || _die "Failed to unpack the source tree on the windows-x64 build host (system_stats-win64.zip)" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\system_stats.windows-x64; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-sys-stat.bat system_stats.vcxproj Release $PLATFORM_TOOLSET" || _die "Failed to build system_stats on the build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\system_stats.windows-x64; cmd /c copy system_stats--*.sql $PG_PATH_WINDOWS_X64\\\\output.build\\\\share\\\\extension" || _die "Failed to copy system_stats--*.sql in output.build/share/extension" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\system_stats.windows-x64; cmd /c copy system_stats.control $PG_PATH_WINDOWS_X64\\\\output.build\\\\share\\\\extension" || _die "Failed to copy system_stats.control in output.build/share/extension" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\system_stats.windows-x64\\\\x64\\\\Release; cmd /c copy system_stats.dll $PG_PATH_WINDOWS_X64\\\\output.build\\\\lib" || _die "Failed to copy system_stats.dll output.build/lib" - - ##################### - # StackBuilder - ##################### - cd $WD/server/source/ - echo "Copying StackBuilder source tree to Windows build VM" - zip -r stackbuilder-win64.zip stackbuilder.windows-x64 || _die "Failed to pack the source tree (stackbuilder.windows-x64)" - rsync -av stackbuilder-win64.zip $PG_SSH_WINDOWS_X64:$PG_CYGWIN_PATH_WINDOWS_X64 || _die "Failed to copy the source tree to the windows-x64 build host (stackbuilder-win64.zip)" - ssh -v $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c unzip -o stackbuilder-win64.zip" || _die "Failed to unpack the source tree on the windows-x64 build host (stackbuilder-win64.zip)" - - # Build the code - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64/stackbuilder.windows-x64; cmd /c $PG_CMAKE_WINDOWS_X64/bin/cmake -G \"$CMAKE_BUILD_GENERATOR_WINDOWS_X64 Win64\" -D MS_VS_10=1 -D CURL_ROOT:PATH=$PG_PGBUILD_WINDOWS_X64 -D WX_ROOT_DIR=$PG_WXWIN_WINDOWS_X64 -D WX_VERSION="3.2" -D WX_STATIC=NO -D MSGFMT_EXECUTABLE=$PG_PGBUILD_WINDOWS_X64\\\\bin\\\\msgfmt -D CMAKE_INSTALL_PREFIX=$PG_PATH_WINDOWS_X64\\\\output.build\\\\StackBuilder -D CMAKE_CXX_FLAGS=\"/D _UNICODE /EHsc\" ." || _die "Failed to configure stackbuilder on the build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64/stackbuilder.windows-x64; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat stackbuilder.vcxproj Release $PLATFORM_TOOLSET" || _die "Failed to build stackbuilder on the build host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64/stackbuilder.windows-x64; cmd /c $PG_PATH_WINDOWS_X64\\\\vc-build-x64.bat INSTALL.vcxproj Release $PLATFORM_TOOLSET" || _die "Failed to install stackbuilder on the build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c mv $PG_PATH_WINDOWS_X64\\\\output.build\\\\StackBuilder\\\\bin\\\\stackbuilder.exe $PG_PATH_WINDOWS_X64\\\\output.build\\\\bin" || _die "Failed to relocate the stackbuilder executable on the build host" - ssh $PG_SSH_WINDOWS_X64 "cmd /c rd $PG_PATH_WINDOWS_X64\\\\output.build\\\\StackBuilder\\\\bin" || _die "Failed to remove the stackbuilder bin directory on the build host" - - echo "Removing last successful staging directory ($PG_PATH_WINDOWS_X64\\\\output)" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; rm -rf output" || _die "Couldn't remove the last successful staging directory directory" - ssh $PG_SSH_WINDOWS_X64 "cmd /c mkdir $PG_PATH_WINDOWS_X64\\\\output" || _die "Couldn't create the last successful staging directory" - - echo "Copying the complete build to the successful staging directory" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cp -r output.build/* output" || _die "Couldn't copy the existing staging directory" - - ssh $PG_SSH_WINDOWS_X64 "cmd /c echo PG_MAJOR_VERSION=$PG_MAJOR_VERSION > $PG_PATH_WINDOWS_X64\\\\output/versions-windows-x64.sh" || _die "Failed to write server version number into versions-windows-x64.sh" - ssh $PG_SSH_WINDOWS_X64 "cmd /c echo PG_MINOR_VERSION=$PG_MINOR_VERSION >> $PG_PATH_WINDOWS_X64\\\\output/versions-windows-x64.sh" || _die "Failed to write server build number into versions-windows-x64.sh" - ssh $PG_SSH_WINDOWS_X64 "cmd /c echo PG_PACKAGE_VERSION=$PG_PACKAGE_VERSION >> $PG_PATH_WINDOWS_X64\\\\output/versions-windows-x64.sh" || _die "Failed to write server build number into versions-windows-x64.sh" - - cd $WD - echo "END BUILD Server Windows-x64" -} - - -################################################################################ -# Post process -################################################################################ - -_postprocess_server_windows_x64() { - echo "BEGIN POST Server Windows-x64" - - # Remove any existing staging directory that might exist, and create a clean one - if [ -e $WD/server/staging/windows-x64 ]; - then - echo "Removing existing staging directory" - rm -rf $WD/server/staging/windows-x64 || _die "Couldn't remove the existing staging directory" - fi - echo "Creating staging directory ($WD/server/staging/windows-x64)" - mkdir -p $WD/server/staging/windows-x64 || _die "Couldn't create the staging directory" - - # Zip up the installed code, copy it back here, and unpack. - echo "Copying built tree to Unix host" - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c if EXIST output.zip del /S /Q output.zip" || _die "Couldn't remove the $PG_PATH_WINDOWS_X64\\output.zip on Windows VM" - ssh -v $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64\\\\output; zip -r ..\\\\output.zip *" || _die "Failed to pack the built source tree ($PG_SSH_WINDOWS_X64:$PG_PATH_WINDOWS_X64/output)" - rsync -av $PG_SSH_WINDOWS_X64:$PG_CYGWIN_PATH_WINDOWS_X64/output.zip $WD/server/staging_cache/windows-x64 || _die "Failed to copy the built source tree ($PG_SSH_WINDOWS_X64:$PG_PATH_WINDOWS_X64/output.zip)" - unzip -o $WD/server/staging_cache/windows-x64/output.zip -d $WD/server/staging_cache/windows-x64/ || _die "Failed to unpack the built source tree ($WD/staging_cache/windows-x64/output.zip)" - rm $WD/server/staging_cache/windows-x64/output.zip - - dos2unix $WD/server/staging_cache/windows-x64/versions-windows-x64.sh || _die "Failed to convert format of versions-windows-x64.sh from dos to unix" - source $WD/server/staging_cache/windows-x64/versions-windows-x64.sh - PG_BUILD_SERVER=$(expr $PG_BUILD_SERVER + $SKIPBUILD) - - # fixes #35408. In 9.5, some modules were moved from contrib to src/test/modules. They are meant for server testing - # and should not be packaged for distribution. On Unix, the top level make does not build these, but on windows it does. - # Hence, removing the files of these modules from the staging_cache - find $WD/server/staging_cache/windows-x64/ -type f \( -name "test_parser*" -o -name "test_shm_mq*" -o -name "test_ddl_deparse*" \ - -o -name "test_rls_hooks*" -o -name "worker_spi*" -o -name "dummy_seclabel*" \) -exec rm {} \; - - win32_sign "stackbuilder.exe" "$WD/server/staging_cache/windows-x64/bin" - - # Install the PostgreSQL docs - mkdir -p $WD/server/staging_cache/windows-x64/doc/postgresql/html || _die "Failed to create the doc directory" - cd $WD/server/staging_cache/windows-x64/doc/postgresql/html || _die "Failed to change to the doc directory" - cp -R $WD/server/source/postgres.windows-x64/doc/src/sgml/html/* . || _die "Failed to copy the PostgreSQL documentation" - - # Copy in the plDebugger docs & SQL script - cp $WD/server/source/postgresql-$PG_TARBALL_POSTGRESQL/contrib/pldebugger/README.pldebugger $WD/server/staging_cache/windows-x64/doc - cp $WD/server/source/postgresql-$PG_TARBALL_POSTGRESQL/contrib/pldebugger/pldbgapi*.sql $WD/server/staging_cache/windows-x64/share/extension - cp $WD/server/source/postgresql-$PG_TARBALL_POSTGRESQL/contrib/pldebugger/pldbgapi.control $WD/server/staging_cache/windows-x64/share/extension - - cd $WD/server - # Copy debug symbols to output/symbols directory - if [ -e "$WD/output/symbols/windows-x64/server" ]; - then - echo "Removing the exsisting symbol directory" - rm -rf $WD/output/symbols/windows-x64/server || _die "Failed to clean the symbols directory" - fi - mkdir -p $WD/output/symbols/windows-x64/server || _die "Failed to create $WD/output/symbols/windows-x64 directory" - cp -r staging_cache/windows-x64/symbols/* $WD/output/symbols/windows-x64/server || _die "Failed to copy symbols to $WD/output/symbols/windows-x64/server directory" - - #Restructuring staging - echo "Restructuring staging as per components" - mkdir -p $PGSERVER_STAGING_WINDOWS_X64 || _die "Couldn't create the staging directory $PGSERVER_STAGING_WINDOWS_X64" - mkdir -p $PGADMIN_STAGING_WINDOWS_X64 || _die "Couldn't create the staging directory $PGADMIN_STAGING_WINDOWS_X64" - mkdir -p $SB_STAGING_WINDOWS_X64 || _die "Couldn't create the staging directory $SB_STAGING_WINDOWS_X64" - mkdir -p $CLT_STAGING_WINDOWS_X64 || _die "Couldn't create the staging directory $CLT_STAGING_WINDOWS_X64" - chmod ugo+w $PGSERVER_STAGING_WINDOWS_X64 $PGADMIN_STAGING_WINDOWS_X64 $SB_STAGING_WINDOWS_X64 $CLT_STAGING_WINDOWS_X64 || _die "Couldn't set the permissions on the staging directory" - - echo "Restructuring Server" - cp -r $WD/server/staging_cache/windows-x64/include $PGSERVER_STAGING_WINDOWS_X64 || _die "Failed to copy include" - cp -r $WD/server/staging_cache/windows-x64/share $PGSERVER_STAGING_WINDOWS_X64 || _die "Failed to copy share" - cp -r $WD/server/staging_cache/windows-x64/bin $PGSERVER_STAGING_WINDOWS_X64 || _die "Failed to copy bin" - cp -r $WD/server/staging_cache/windows-x64/installer $PGSERVER_STAGING_WINDOWS_X64 || _die "Failed to copy installer" - cp -r $WD/server/staging_cache/windows-x64/installer $CLT_STAGING_WINDOWS_X64 || _die "Failed to copy installer" - - echo "Restructuring commandlinetools" - mkdir -p $CLT_STAGING_WINDOWS_X64/bin || _die "Couldn't create the staging directory $CLT_STAGING_WINDOWS_X64/bin" - cp -r $WD/server/staging_cache/windows-x64/lib $CLT_STAGING_WINDOWS_X64 || _die "Failed to move lib" - - mv $PGSERVER_STAGING_WINDOWS_X64/bin/zlib1.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move zlib1.dll" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/libwinpthread-1.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move libwinpthread-1.dll" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/psql.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move psql.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/libpq* $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move bin/libpq" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/pg_basebackup.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move pg_basebackup" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/pg_dump* $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move pg_dump and pg_dumpall" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/pg_restore.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move pg_restore.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/createdb.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move createdb.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/clusterdb.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move clusterdb.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/createuser.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move createuser" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/dropdb.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move dropdb.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/dropuser.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move dropuser.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/pg_isready.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move pg_isready.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/vacuumdb.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move vacuumdb.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/reindexdb.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move reindexdb.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/pgbench.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move pgbench.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/vacuumlo.exe $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move vacuumlo.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/liblz4.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move liblz4.dll" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/libzstd.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move libzstd.dll" - mkdir -p $CLT_STAGING_WINDOWS_X64/scripts/images || _die "Couldn't create the staging directory $CLT_STAGING_WINDOWS_X64/scripts/images" - cp $WD/server/resources/pg-psql.ico $CLT_STAGING_WINDOWS_X64/scripts/images/ || _die "Failed to move scripts/images/pg-psql.ico" - cp $WD/server/scripts/windows/runpsql.bat $CLT_STAGING_WINDOWS_X64/scripts/ || _die "Failed to move runpsql.bat" - - echo "Restructuring pgAdmin4" - cp -r $WD/server/staging_cache/windows-x64/pgAdmin\ 4/ $PGADMIN_STAGING_WINDOWS_X64 || _die "Failed to copy pgAdmin\ 4/ directory to staging directory $PGADMIN_STAGING_WINDOWS_X64" - - echo "Restructuring Stackbuilder" - mkdir -p $SB_STAGING_WINDOWS_X64/bin || _die "Couldn't create the staging directory $CLT_STAGING_WINDOWS/scripts/images" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/stackbuilder.exe $SB_STAGING_WINDOWS_X64/bin || _die "Failed to move stackbuilder.exe" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/wx*.dll $SB_STAGING_WINDOWS_X64/bin || _die "Failed to move wx*dlls" - mv $PGSERVER_STAGING_WINDOWS_X64/bin/libcurl.dll $SB_STAGING_WINDOWS_X64/bin || _die "Failed to move libcurl.dll" - cp -r $WD/server/staging_cache/windows-x64/StackBuilder/share $SB_STAGING_WINDOWS_X64/ || _die "Failed to copy $WD/server/staging_cache/windows-x64/stackbuilder/share" - cp $PGSERVER_STAGING_WINDOWS_X64/bin/libssl-*-x64.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move libssl-*-x64.dll" - cp $PGSERVER_STAGING_WINDOWS_X64/bin/libcrypto-*-x64.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move libcrypto-*-x64.dll" - cp $PGSERVER_STAGING_WINDOWS_X64/bin/libiconv-2.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move libiconv-2.dll" - cp $PGSERVER_STAGING_WINDOWS_X64/bin/libintl-9.dll $CLT_STAGING_WINDOWS_X64/bin || _die "Failed to move libintl-9.dll" - - - cd $WD/server - - #generate commandlinetools license file - pushd $CLT_STAGING_WINDOWS_X64 - generate_3rd_party_license "commandlinetools" - popd - - #generate pgAdmin4 license file - pushd $PGADMIN_STAGING_WINDOWS_X64 - generate_3rd_party_license "pgAdmin" - popd - - #generate StackBuilder license file - pushd $SB_STAGING_WINDOWS_X64 - generate_3rd_party_license "StackBuilder" - popd - - # Welcome doc - cp "$WD/server/resources/installation-notes.html" "$WD/server/staging_cache/windows-x64/doc/" || _die "Failed to install the welcome document" - cp "$WD/server/resources/edblogo.png" "$WD/server/staging_cache/windows-x64/doc/" || _die "Failed to install the welcome logo" - - #Creating a archive of the binaries - mkdir -p $WD/server/staging_cache/windows-x64/pgsql || _die "Failed to create the directory for binaries " - cd $WD/server/staging_cache/windows-x64 - cp -R bin doc include lib pgAdmin* share StackBuilder symbols pgsql/ || _die "Failed to copy the binaries to the pgsql directory" - - zip -rq postgresql-$PG_PACKAGE_VERSION-windows-x64-binaries.zip pgsql || _die "Failed to archive the postgresql binaries" - mv postgresql-$PG_PACKAGE_VERSION-windows-x64-binaries.zip $WD/output/ || _die "Failed to move the archive to output folder" - - rm -rf pgsql || _die "Failed to remove the binaries directory" - - #Updating the docs in restructured staging - cp -r $WD/server/staging_cache/windows-x64/doc $PGSERVER_STAGING_WINDOWS_X64 || _die "Failed to copy documentation" - cp $WD/resources/license.txt $PGSERVER_STAGING_WINDOWS_X64/server_license.txt - cp $WD/server/source/pgadmin.windows-x64/LICENSE $PGADMIN_STAGING_WINDOWS_X64/pgAdmin_license.txt - - - #Copy the symbols to staging directory - mkdir -p $PGSERVER_STAGING_WINDOWS_X64/debug_symbols - cp -r $WD/output/symbols/windows-x64/server/* $PGSERVER_STAGING_WINDOWS_X64/debug_symbols - - cd $WD/server - - # Setup the installer scripts. - mkdir -p $PGSERVER_STAGING_WINDOWS_X64/installer/server || _die "Failed to create a directory for the install scripts" - cp scripts/windows/prerun_checks.vbs $PGSERVER_STAGING_WINDOWS_X64/installer/prerun_checks.vbs || _die "Failed to copy the prerun_checks.vbs script ($WD/scripts/windows-x64/prerun_checks.vbs)" - cp scripts/windows/initcluster.vbs $PGSERVER_STAGING_WINDOWS_X64/installer/server/initcluster.vbs || _die "Failed to copy the loadmodules script (scripts/windows/initcluster.vbs)" - cp scripts/windows/startupcfg.vbs $PGSERVER_STAGING_WINDOWS_X64/installer/server/startupcfg.vbs || _die "Failed to copy the startupcfg script (scripts/windows/startupcfg.vbs)" - cp scripts/windows/createshortcuts_server.vbs $PGSERVER_STAGING_WINDOWS_X64/installer/server/createshortcuts_server.vbs || _die "Failed to copy the createshortcuts script (scripts/windows/createshortcuts_server.vbs)" - cp scripts/windows/createshortcuts_clt.vbs $CLT_STAGING_WINDOWS_X64/installer/server/createshortcuts_clt.vbs || _die "Failed to copy the createshortcuts script (scripts/windows/createshortcuts_clt.vbs)" - cp scripts/windows/startserver.vbs $PGSERVER_STAGING_WINDOWS_X64/installer/server/startserver.vbs || _die "Failed to copy the startserver script (scripts/windows/startserver.vbs)" - cp scripts/windows/loadmodules.vbs $PGSERVER_STAGING_WINDOWS_X64/installer/server/loadmodules.vbs || _die "Failed to copy the loadmodules script (scripts/windows/loadmodules.vbs)" - - # Copy in the menu pick images and XDG items - mkdir -p $PGSERVER_STAGING_WINDOWS_X64/scripts/images || _die "Failed to create a directory for the menu pick images" - cp resources/pg-help.ico $PGSERVER_STAGING_WINDOWS_X64/scripts/images || _die "Failed to copy the menu pick images (resources/pg-help.ico)" - cp resources/pg-reload.ico $PGSERVER_STAGING_WINDOWS_X64/scripts/images || _die "Failed to copy the menu pick images (resources/pg-reload.ico)" - - # Copy in the menu pick images and XDG items - mkdir -p $PGADMIN_STAGING_WINDOWS_X64/scripts/images || _die "Failed to create a directory for the menu pick images" - cp resources/pg-help.ico $PGADMIN_STAGING_WINDOWS_X64/scripts/images/pgadmin-help.ico || _die "Failed to copy the menu pick images (resources/pg-help.ico)" - cp $WD/server/source/pgadmin.windows-x64/pkg/win32/Resources/pgAdmin4.ico $PGADMIN_STAGING_WINDOWS_X64/scripts/images/ || _die "Failed to copy the pgAdmin4.ico file" - - # Copy the launch scripts - cp scripts/windows/serverctl.vbs $PGSERVER_STAGING_WINDOWS_X64/scripts/serverctl.vbs || _die "Failed to copy the serverctl script (scripts/windows/serverctl.vbs)" - cp scripts/windows/runpsql.bat $PGSERVER_STAGING_WINDOWS_X64/scripts/runpsql.bat || _die "Failed to copy the runpsql script (scripts/windows/runpsql.bat)" - # Prepare the installer XML file - _prepare_server_xml "windows-x64" - - # Build the installer - "$PG_INSTALLBUILDER_BIN" build installer-windows-x64.xml windows || _die "Failed to build the installer" - - # If build passed empty this variable - BUILD_FAILED="build_failed-" - if [ $PG_BUILD_SERVER -gt 0 ]; - then - BUILD_FAILED="" - fi - - # Rename the installer - mv $WD/output/postgresql-$PG_MAJOR_VERSION-windows-installer.exe $WD/output/postgresql-$PG_PACKAGE_VERSION-${BUILD_FAILED}windows-x64.exe || _die "Failed to rename the installer" - - # Sign the installer - win32_sign "postgresql-$PG_PACKAGE_VERSION-${BUILD_FAILED}windows-x64.exe" - - # Copy installer onto the build system - ssh $PG_SSH_WINDOWS_X64 "cd $PG_PATH_WINDOWS_X64; cmd /c rd /S /Q component_installers" - ssh $PG_SSH_WINDOWS_X64 "cmd /c mkdir $PG_PATH_WINDOWS_X64\\\\component_installers" || _die "Failed to create the component_installers directory on the windows-x64 build host" - rsync -av $WD/output/postgresql-$PG_PACKAGE_VERSION-${BUILD_FAILED}windows-x64.exe $PG_SSH_WINDOWS_X64:$PG_CYGWIN_PATH_WINDOWS_X64/component_installers || _die "Unable to copy installers at windows-x64 build machine." - - cd $WD - echo "END POST Server Windows-x64" -} - diff --git a/server/generate-sources.sh b/server/generate-sources.sh new file mode 100755 index 000000000..3820a8d76 --- /dev/null +++ b/server/generate-sources.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +set -xeu + +NAME=postgresql + +: ${VERSION:?The VERSION environment variable is required} + +WORKDIR=$(pwd)/src +cd ${WORKDIR} +TARNAME="${NAME}-${VERSION}.${EXTRA_VERSION:-}" +wget ${URL} +md5sum "${TARNAME}.tar.bz2" > "${TARNAME}.tar.bz2.md5" +mv ${TARNAME}.tar.bz2 ../ diff --git a/server/installer.xml.in b/server/installer.xml.in index 687ca6733..56a98fa1a 100755 --- a/server/installer.xml.in +++ b/server/installer.xml.in @@ -1266,12 +1266,16 @@ EOF - + - + + + + + @@ -1822,6 +1826,30 @@ EOF + + + + + HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} 16.1 + 0 + 0 + + + HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} 16.2 + 0 + 0 + + + + + equals + ${platform_name} + windows + + + + + diff --git a/server/license.sh b/server/license.sh new file mode 100644 index 000000000..8b38fbdb4 --- /dev/null +++ b/server/license.sh @@ -0,0 +1,112 @@ +WD="$(dirname "$PWD")" + +# $1 - Component Name +generate_3rd_party_license() +{ + export ComponentName="$1" + export ListGeneratorScriptFileWin="$WD/list-libs-windows.sh" + export ListGeneratorScriptFileJar="$WD/list-jars.sh" + export ListPipModules="$WD/list_pip_libs.sh" + export ListJSScripts="$WD/list_js_libs.sh" + export ListpgAdminFiles="$WD/list_pgadmin_files.sh" + export blnIsWindows=false + export LibListDir="3rd_party_libraries_list" + export CurrentDir="$PWD" + export ComponentFile="$PWD/${ComponentName}_3rd_party_licenses.txt" + export LicenseTypePath="$WD/resources/3rd_party_license_types" + export LIBPQPattern="libpq" + + echo "[$FUNCNAME] Component Name: $ComponentName" + echo "[$FUNCNAME] Library List File: $Lib_List_File" + + echo "[$FUNCNAME] Component File: $ComponentFile" + + + mkdir -p "$WD/output/$LibListDir" + + blnIsWindows=true + ListGeneratorScriptFile="$ListGeneratorScriptFileWin" + CurrentPlatform="windows" + + export Lib_List_File="$WD/output/$LibListDir/${ComponentName}_${CurrentPlatform}_libs.txt" + + if [[ $ComponentName != "server" || $ComponentName != "commandlinetools" ]]; + then + LIBPQPattern=xyz${LIBPQPattern}abc + fi + + TempFile=$(mktemp) + $ListGeneratorScriptFile >> $TempFile + $ListGeneratorScriptFileJar >> $TempFile + $ListJSScripts >> $TempFile + + cat $TempFile | xargs -I{} grep -w {} $WD/resources/files_to_project_map.txt | sort -u | cut -f1 | grep -v $LIBPQPattern | xargs -I{} echo "awk '/\<{}\>/ {print \$1\" {}\"}' $WD/resources/license_to_project_map.txt" | sh | sort -u > $Lib_List_File + + awk '\ + BEGIN \ + { \ + prevLicenseName=""; \ + listProject=""; \ + system("rm -f "ENVIRON["ComponentFile"]); \ + } \ + { \ + gsub(/^project_/, "", $2); \ + \ + if ( $1 == prevLicenseName ) \ + { \ + listProject=listProject", "$2; \ + } \ + else \ + { \ + if ( listProject != "" ) \ + { \ + system("echo -e \"==================\n"listProject" license\n==================\" >> "ENVIRON["ComponentFile"]); \ + system("cat "ENVIRON["LicenseTypePath"]"/"prevLicenseName" >> "ENVIRON["ComponentFile"]); \ + system("echo >> "ENVIRON["ComponentFile"]); \ + } \ + listProject=$2; \ + prevLicenseName=$1; \ + } \ + } \ + END \ + { \ + if ( listProject != "" ) \ + { \ + system("echo -e \"==================\n"listProject" license\n==================\" >> "ENVIRON["ComponentFile"]); \ + system("cat "ENVIRON["LicenseTypePath"]"/"prevLicenseName" >> "ENVIRON["ComponentFile"]); \ + system("echo >> "ENVIRON["ComponentFile"]); \ + } \ + }' $Lib_List_File + + if [[ ! -s $ComponentFile ]]; + then + rm -f $ComponentFile + fi + + echo "cat componentfile" + cat $ComponentFile + + if [[ -f $ComponentFile ]]; + then + if [[ $blnIsWindows == true ]]; + then + unix2dos $ComponentFile || _die "Unable to convert 3rd party license file [$ComponentFile] to dos format." + else + dos2unix $ComponentFile || _die "Unable to convert 3rd party license file [$ComponentFile] to unix format." + fi + + chmod 444 $ComponentFile + fi +} + +pushd ../installer/server/staging/windows-x64/commandlinetools +generate_3rd_party_license "commandlinetools" +popd + +pushd ../installer/server/staging/windows-x64/stackbuilder +generate_3rd_party_license "StackBuilder" +popd + +pushd ../installer/server/staging/windows-x64/pgadmin4 +generate_3rd_party_license "pgAdmin" +popd \ No newline at end of file diff --git a/server/packages-win64.txt b/server/packages-win64.txt new file mode 100644 index 000000000..2038192f8 --- /dev/null +++ b/server/packages-win64.txt @@ -0,0 +1,13 @@ +curl-8.8.0-windows-x64.tar.bz2 +zstd-1.5.6-windows-x64.tar.bz2 +lz4-1.9.4-windows-x64.tar.bz2 +libxml2-2.11.8-windows-x64.tar.bz2 +libxslt-1.1.39-windows-x64.tar.bz2 +iconv-1.17-windows-x64.tar.bz2 +zlib-1.3.1-windows-x64.tar.bz2 +icu-67-1-windows-x64.tar.bz2 +uuid-1.6.2-windows-x64.tar.bz2 +wxwidgets-3.2.4-windows-x64.tar.bz2 +gettext-0.19.8-windows-x64.tar.bz2 +openssl-3.0.14-windows-x64.tar.bz2 +libwinpthread-1.0.0-windows-x64.tar.bz2 diff --git a/server/scripts/windows/build-pgadmin.bat.in b/server/scripts/windows/build-pgadmin.bat.in deleted file mode 100644 index 5721ccbf5..000000000 --- a/server/scripts/windows/build-pgadmin.bat.in +++ /dev/null @@ -1,176 +0,0 @@ -CALL "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 -ECHO Setting variables -@SET PGADMIN_SRC_DIR= -@SET PGADMIN_PYTHON_DIR= -@SET PGBUILD= -@SET PGADMIN_POSTGRES_DIR= -@SET PGADMIN_KRB5_DIR= -@SET YARN_HOME= -@SET NODEJS_HOME= -@SET BUILDROOT=%PGADMIN_SRC_DIR%\win-build -@SET TMPDIR=%PGADMIN_SRC_DIR%\win-temp -@SET PATH=%YARN_HOME%\\\\bin;%NODEJS_HOME%;%PGBUILD%\\\\bin;%PGADMIN_POSTGRES_DIR%\\\\bin;%PATH%; - -REM get Python version for the runtime build ex. 3.8.1 will be 38 -FOR /f "tokens=1 DELims=." %%G IN ('%PGADMIN_PYTHON_DIR%/python.exe -c "import sys; print(sys.version.split(' ')[0])"') DO SET PYTHON_MAJOR=%%G -FOR /f "tokens=2 DELims=." %%G IN ('%PGADMIN_PYTHON_DIR%/python.exe -c "import sys; print(sys.version.split(' ')[0])"') DO SET PYTHON_MINOR=%%G - -REM Main build sequence -CALL :CLEAN || EXIT /B 1 -CALL :CREATE_VIRTUAL_ENV || EXIT /B 1 -CALL :CREATE_PYTHON_ENV || EXIT /B 1 -CALL :CREATE_RUNTIME_ENV || EXIT /B 1 - -EXIT /B %ERRORLEVEL% -REM Main build sequence Ends - - -:CLEAN - ECHO Removing build directory... - IF EXIST "%BUILDROOT%" RD "%BUILDROOT%" /S /Q > nul || EXIT /B 1 - - ECHO Removing tmp directory... - IF EXIST "%TMPDIR%" RD "%TMPDIR%" /S /Q > nul || EXIT /B 1 - EXIT /B 0 - -:CREATE_VIRTUAL_ENV - ECHO Create Virtual enviroment - IF NOT EXIST "%TMPDIR%" MKDIR "%TMPDIR%" - - CD "%TMPDIR%" - REM Note that we must use virtualenv.exe here, as the venv module doesn't allow python.exe to relocate. - "%PGADMIN_PYTHON_DIR%\Scripts\virtualenv.exe" venv - - XCOPY /S /I /E /H /Y "%PGADMIN_PYTHON_DIR%\DLLs" "%TMPDIR%\venv\DLLs" > nul || EXIT /B 1 - XCOPY /S /I /E /H /Y "%PGADMIN_PYTHON_DIR%\Lib" "%TMPDIR%\venv\Lib" > nul || EXIT /B 1 - - ECHO Activating virtual environment - %TMPDIR%\venv... - CALL "%TMPDIR%\venv\Scripts\activate" || EXIT /B 1 - - ECHO Installing dependencies... - CALL python -m pip install --upgrade pip || EXIT /B 1 - CALL pip install --only-binary=cryptography -r "%PGADMIN_SRC_DIR%\requirements.txt" || EXIT /B 1 - - CD %WD% - EXIT /B 0 - -:CREATE_PYTHON_ENV - ECHO Create python enviroment - - ECHO Staging Python... - MKDIR "%BUILDROOT%\python\Lib" || EXIT /B 1 - - ECHO Downloading embedded Python... - REM Get the python embeddable and extract it to %BUILDROOT%\python - CD "%TMPDIR% - %PGADMIN_PYTHON_DIR%\python -c "import sys; from urllib.request import urlretrieve; urlretrieve('https://www.python.org/ftp/python/' + sys.version.split(' ')[0] + '/python-' + sys.version.split(' ')[0] + '-embed-amd64.zip', 'python-embedded.zip')" || EXIT /B 1 - %PGADMIN_PYTHON_DIR%\python -c "import zipfile; z = zipfile.ZipFile('python-embedded.zip', 'r'); z.extractall('../win-build/python/')" || EXIT /B 1 - - ECHO Copying site-packages... - XCOPY /S /I /E /H /Y "%TMPDIR%\venv\Lib\site-packages" "%BUILDROOT%\python\Lib\site-packages" > nul || EXIT /B 1 - - REM NOTE: There is intentionally no space after "site" in the line below, to prevent Python barfing if there's one in the file - ECHO import site>> "%BUILDROOT%\python\python%PYTHON_MAJOR%%PYTHON_MINOR%._pth" - - ECHO Staging Kerberos components... - COPY "%PGADMIN_KRB5_DIR%\\\\bin\\\\kinit.exe" "%BUILDROOT%\python" || EXIT /B 1 - COPY "%PGADMIN_KRB5_DIR%\\\\bin\\\\krb5_64.dll" "%BUILDROOT%\python" || EXIT /B 1 - COPY "%PGADMIN_KRB5_DIR%\\\\bin\\\\comerr64.dll" "%BUILDROOT%\python" || EXIT /B 1 - COPY "%PGADMIN_KRB5_DIR%\\\\bin\\\\k5sprt64.dll" "%BUILDROOT%\python" || EXIT /B 1 - COPY "%PGADMIN_KRB5_DIR%\\\\bin\\\\gssapi64.dll" "%BUILDROOT%\python" || EXIT /B 1 - - ECHO Cleaning up unnecessary .pyc and .pyo files... - FOR /R "%BUILDROOT%\python" %%f in (*.pyc *.pyo) do DEL /q "%%f" > nul - ECHO Removing tests... - FOR /R "%BUILDROOT%\python\Lib" %%f in (test tests) do RD /Q /S "%%f" > nul 2>&1 - - CD %WD% - EXIT /B 0 - -:CREATE_RUNTIME_ENV - ECHO Create Runtime enviroment - - IF NOT EXIST "%BUILDROOT%" MKDIR "%BUILDROOT%" - MKDIR "%BUILDROOT%\runtime" - - ECHO Removing webpack caches... - RD /Q /S "%PGADMIN_SRC_DIR%\web\pgadmin\static\js\generated\.cache" 1> nul 2>&1 - - ECHO Copying web directory... - XCOPY /S /I /E /H /Y "%PGADMIN_SRC_DIR%\web" "%BUILDROOT%\web" > nul || EXIT /B 1 - - ECHO Installing javascript dependencies... - CD "%BUILDROOT%\web" - CALL yarn install - CALL yarn run bundle - - ECHO Cleaning up unnecessary .pyc and .pyo files... - FOR /R "%BUILDROOT%\web" %%f in (*.pyc *.pyo) do DEL /q "%%f" 1> nul 2>&1 - ECHO Removing tests, Python caches and node modules... - FOR /R "%BUILDROOT%\web" %%f in (tests feature_tests __pycache__ node_modules) do RD /Q /S "%%f" 1> nul 2>&1 - ECHO Removing the test framework... - RD /Q /S "%BUILDROOT%\web\regression" 1> nul 2>&1 - ECHO Removing tools... - RD /Q /S "%BUILDROOT%\web\tools" 1> nul 2>&1 - ECHO Removing any existing configurations... - DEL /q "%BUILDROOT%\web\pgadmin4.db" 1> nul 2>&1 - DEL /q "%BUILDROOT%\web\config_local.py" 1> nul 2>&1 - - ECHO Staging license files... - COPY "%PGADMIN_SRC_DIR%\LICENSE" "%BUILDROOT%\" > nul || EXIT /B 1 - COPY "%PGADMIN_SRC_DIR%\DEPENDENCIES" "%BUILDROOT%\" > nul || EXIT /B 1 - - ECHO Creating config_distro.py - ECHO SERVER_MODE = False > "%BUILDROOT%\web\config_distro.py" - ECHO HELP_PATH = '../../../docs/en_US/html/' >> "%BUILDROOT%\web\config_distro.py" - ECHO DEFAULT_BINARY_PATHS = { >> "%BUILDROOT%\web\config_distro.py" - ECHO 'pg': '$DIR/../runtime', >> "%BUILDROOT%\web\config_distro.py" - ECHO 'ppas': '' >> "%BUILDROOT%\web\config_distro.py" - ECHO } >> "%BUILDROOT%\web\config_distro.py" - ECHO UPGRADE_CHECK_KEY = 'edb-pgadmin4' >> "%BUILDROOT%\web\config_distro.py" - - ECHO Building docs... - CALL pip install sphinx || EXIT /B 1 - CALL pip install sphinxcontrib-youtube || EXIT /B 1 - - MKDIR "%BUILDROOT%\docs\en_US\html" - CD "%PGADMIN_SRC_DIR%\docs\en_US" - CALL "%TMPDIR%\venv\Scripts\python.exe" build_code_snippet.py || EXIT /B 1 - CALL "%TMPDIR%\venv\Scripts\sphinx-build.exe" "%PGADMIN_SRC_DIR%\docs\en_US" "%BUILDROOT%\docs\en_US\html" || EXIT /B 1 - - REM Remove unnecessary doc files - DEL /q "%BUILDROOT%\docs\en_US\html\_static\*.png" 1> nul 2>&1 - RD /Q /S "%BUILDROOT%\docs\en_US\html\_sources" 1> nul 2>&1 - - ECHO Staging runtime components... - XCOPY /S /I /E /H /Y "%PGADMIN_SRC_DIR%\runtime\assets" "%BUILDROOT%\runtime\assets" > nul || EXIT /B 1 - XCOPY /S /I /E /H /Y "%PGADMIN_SRC_DIR%\runtime\src" "%BUILDROOT%\runtime\src" > nul || EXIT /B 1 - COPY "%PGADMIN_SRC_DIR%\runtime\package.json" "%BUILDROOT%\runtime\" > nul || EXIT /B 1 - - CD "%BUILDROOT%\runtime\" - CALL yarn install --production=true - - ECHO Downloading NWjs to %TMPDIR%... - REM Get a fresh copy of nwjs. - REM NOTE: The nw download servers seem to be very unreliable, so at the moment we're using wget which retries - - REM WGET - FOR /f "tokens=2 delims='" %%i IN ('yarn info nw ^| findstr "latest: "') DO SET "NW_VERSION=%%i" - :GET_NW - SET "NW_VERSION=0.77.0" - wget https://dl.nwjs.io/v%NW_VERSION%/nwjs-v%NW_VERSION%-win-x64.zip -O "%TMPDIR%\nwjs-v%NW_VERSION%-win-x64.zip" - IF %ERRORLEVEL% NEQ 0 GOTO GET_NW - - unzip -d "%TMPDIR%" "%TMPDIR%\nwjs-v%NW_VERSION%-win-x64.zip" > nul || EXIT /B 1 - REM WGET END - - XCOPY /S /I /E /H /Y "%TMPDIR%\nwjs-v%NW_VERSION%-win-x64\*" "%BUILDROOT%\runtime" > nul || EXIT /B 1 - - MOVE "%BUILDROOT%\runtime\nw.exe" "%BUILDROOT%\runtime\pgAdmin4.exe" - - ECHO Replacing executable icon... - CALL yarn --cwd "%TMPDIR%" add winresourcer || EXIT /B - "%TMPDIR%\node_modules\winresourcer\bin\Resourcer.exe" -op:upd -src:"%BUILDROOT%\runtime\pgAdmin4.exe" -type:Icongroup -name:IDR_MAINFRAME -file:"%PGADMIN_SRC_DIR%\pkg\win32\Resources\pgAdmin4.ico" - - CD %WD% - EXIT /B 0 diff --git a/server/scripts/windows/compile-system_stats.ps1 b/server/scripts/windows/compile-system_stats.ps1 new file mode 100644 index 000000000..cf23a7562 --- /dev/null +++ b/server/scripts/windows/compile-system_stats.ps1 @@ -0,0 +1,13 @@ +# Powershell script to compile system_stats + +# Setting variables +$vc_bat_file="$(pwd)\packaging-config\server\scripts\windows\vc-build-x64.bat" +$project_file="$(pwd)\system_stats\system_stats.vcxproj" +$out_dir="$(pwd)\system_stats\x64\Release\" + +# Compilation +Invoke-Expression -Command "$vc_bat_file $project_file Release x64 $out_dir v143" || exit 1 + +# Copy system-stats dlls to correct place +Copy-Item "$(pwd)\system_stats\x64\Release\system_stats.dll" "$(pwd)\binaries-archive\pgsql\lib" +Copy-Item "$(pwd)\system_stats\x64\Release\system_stats.dll" "$(pwd)\packaging-config\server" diff --git a/server/scripts/windows/compile.ps1 b/server/scripts/windows/compile.ps1 new file mode 100644 index 000000000..ba8db73c7 --- /dev/null +++ b/server/scripts/windows/compile.ps1 @@ -0,0 +1,323 @@ +# Powershell script to compile PostgreSQL + +param([string]$source_directory, + [string]$xml_directory, + [string]$xslt_directory, + [string]$openssl_directory, + [string]$python_directory, + [string]$zlib_directory, + [string]$uuid_directory, + [string]$perl_directory, + [string]$lz4_directory, + [string]$zstd_directory, + [string]$icu_directory, + [string]$gettext_directory, + [string]$tcl_directory, + [string]$wxwidgets_directory + ) + +if (-Not $source_directory) { + Write-Host "Missing source directory parameter" + exit 1 +} + +$installation_directory = "pgsql" +$temporary_data_location = "temp_pgdata" + +# Check for source parameters +if (-Not $source_directory) { + Write-Host "Missing source directory parameter" + exit 1 +} + +if (-Not $xml_directory) { + Write-Host "Missing XML directory parameter" + exit 1 +} + +if (-Not $xslt_directory) { + Write-Host "Missing XSLT directory parameter" + exit 1 +} + +if (-Not $openssl_directory) { + Write-Host "Missing OpenSSL directory parameter" + exit 1 +} + +if (-Not $python_directory) { + Write-Host "Missing Python directory parameter" + exit 1 +} + +if (-Not $zlib_directory) { + Write-Host "Missing zlib directory parameter" + exit 1 +} + +if (-Not $uuid_directory) { + Write-Host "Missing UUID directory parameter" + exit 1 +} + +if (-Not $perl_directory) { + Write-Host "Missing perl directory parameter" + exit 1 +} + +if (-Not $lz4_directory) { + Write-Host "Missing lz4 directory parameter" + exit 1 +} + +if (-Not $zstd_directory) { + Write-Host "Missing zstd directory parameter" + exit 1 +} + +if (-Not $icu_directory) { + Write-Host "Missing icu directory parameter" + exit 1 +} + +# Check for MSVC compiler +if ((Get-Command "cl.exe" -ErrorAction SilentlyContinue) -eq $null) { + Write-Host "This script requires the MSVC environment variables" + exit 1 +} + +# Check for packages +if (-Not (Test-Path $source_directory -PathType Container)) { + Write-Host "Input directory ($source_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $xml_directory -PathType Container)) { + Write-Host "libxml distribution ($xml_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $xml_directory/include/libxml -PathType Container)) { + # PostgreSQL build system is expecting to find libxml headers in a folder named + # "libxml", while the libxml build system writes them in "libxml2". + Copy-Item $xml_directory/include/libxml2/libxml $xml_directory/include/libxml -Recurse +} + +if (-Not (Test-Path $xslt_directory -PathType Container)) { + Write-Host "libxslt distribution ($xslt_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $openssl_directory -PathType Container)) { + Write-Host "OpenSSL distribution ($openssl_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $python_directory -PathType Container)) { + Write-Host "Python distribution ($python_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $zlib_directory -PathType Container)) { + Write-Host "zlib distribution ($zlib_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $perl_directory -PathType Container)) { + Write-Host "perl distribution ($perl_directory) doesn't exist or isn't a directory" + exit 1 +} +if (-Not (Test-Path $lz4_directory -PathType Container)) { + Write-Host "zstd distribution ($lz4_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $zstd_directory -PathType Container)) { + Write-Host "zstd distribution ($zstd_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $icu_directory -PathType Container)) { + Write-Host "icu distribution ($icu_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $gettext_directory -PathType Container)) { + Write-Host "gettext distribution ($gettext_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $tcl_directory -PathType Container)) { + Write-Host "tcl distribution ($tcl_directory) doesn't exist or isn't a directory" + exit 1 +} + +if (-Not (Test-Path $wxwidgets_directory -PathType Container)) { + Write-Host "wxwidgets distribution ($wxwidgets_directory) doesn't exist or isn't a directory" + exit 1 +} + +# Let's put these directory in absolute form +$source_directory = ([IO.Path]::GetFullPath($source_directory)) +$python_directory = ([IO.Path]::GetFullPath($python_directory)) +$openssl_directory = ([IO.Path]::GetFullPath($openssl_directory)) +$xml_directory = ([IO.Path]::GetFullPath($xml_directory)) +$xslt_directory = ([IO.Path]::GetFullPath($xslt_directory)) +$zlib_directory = ([IO.Path]::GetFullPath($zlib_directory)) +$installation_directory = ([IO.Path]::GetFullPath($installation_directory)) +$uuid_directory = ([IO.Path]::GetFullPath($uuid_directory)) +$perl_directory = ([IO.Path]::GetFullPath($perl_directory)) +$lz4_directory = ([IO.Path]::GetFullPath($lz4_directory)) +$zstd_directory = ([IO.Path]::GetFullPath($zstd_directory)) +$icu_directory = ([IO.Path]::GetFullPath($icu_directory)) +$gettext_directory = ([IO.Path]::GetFullPath($gettext_directory)) +$tcl_directory = ([IO.Path]::GetFullPath($tcl_directory)) +$wxwidgets_directory = ([IO.Path]::GetFullPath($wxwidgets_directory)) +$temporary_data_location = ([IO.Path]::GetFullPath($temporary_data_location)) +$definition_directory = ([IO.Path]::GetFullPath(".")) + +# Clean the installation directory +if (Test-Path $installation_directory -PathType Container) { + Remove-Item $installation_directory -Recurse +} +mkdir $installation_directory + +if (Test-Path $temporary_data_location -PathType Container) { + Remove-Item $temporary_data_location -Recurse +} +mkdir $temporary_data_location + +$Acl = Get-ACL $temporary_data_location +$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl","ContainerInherit,Objectinherit","none","Allow") +$Acl.AddAccessRule($AccessRule) +Set-Acl $temporary_data_location $Acl + + +# So far, so good. Let's start compiling +# Perl needs to be in the Path +$env:Path = "$perl_directory\bin;$env:Path" +$env:Path = "$python_directory\bin;$openssl_directory\bin;$xml_directory\bin;$xslt_directory\bin;$uuid_directory\bin;$zlib_directory\bin;$lz4_directory\bin;$zstd_directory\bin;$icu_directory\bin;$gettext_directory\bin;$tcl_directory\bin;$env:Path" +$env:Path = "$python_directory\lib;$openssl_directory\lib;$xml_directory\lib;$xslt_directory\lib;$uuid_directory\lib;$zlib_directory\lib;$lz4_directory\lib;$zstd_directory\lib;$gettext_directory\lib;$tcl_directory\lib;$env:Path" +$env:Path = "$python_directory\include;$openssl_directory\include;$xml_directory\include;$xslt_directory\include;$uuid_directory\include;$zlib_directory\include;$lz4_directory\include;$zstd_directory\include;$gettext_directory\include;$tcl_directory\include;$env:Path" +# Let's create an appropriate configuration file +$configuration = (Get-Content $source_directory/src/tools/msvc/config_default.pl) +$configuration = $configuration -replace 'icu => undef', "icu => '$icu_directory'" +$configuration = $configuration -replace 'lz4 => undef', "lz4 => '$lz4_directory'" +$configuration = $configuration -replace 'zstd => undef', "zstd => '$zstd_directory'" +$configuration = $configuration -replace 'nls => undef', "nls => '$gettext_directory'" +$configuration = $configuration -replace 'tcl => undef', "tcl => '$tcl_directory'" +$configuration = $configuration -replace 'perl => undef', "perl => '$perl_directory'" +$configuration = $configuration -replace 'python => undef', "python => '$python_directory'" +$configuration = $configuration -replace 'openssl => undef', "openssl => '$openssl_directory'" +$configuration = $configuration -replace 'uuid => undef', "uuid => '$uuid_directory'" +$configuration = $configuration -replace 'xml => undef', "xml => '$xml_directory'" +$configuration = $configuration -replace 'xslt => undef', "xslt => '$xslt_directory'" +$configuration = $configuration -replace 'zlib => undef', "zlib => '$zlib_directory'" +Set-Content $source_directory/src/tools/msvc/config.pl $configuration + +Write-Host "src/tools/msvc/config.pl" +Get-Content $source_directory/src/tools/msvc/config.pl + +Push-Location $source_directory/src/tools/msvc +.\clean.bat +Write-Host "Build is beginning" +.\build.bat release +Write-Host "Build is done" + + +Write-Host "Installation is beginning" +.\install.bat $installation_directory +Write-Host "Installation is done" + +# Manually copy plpgsql.lib from the PostgreSQL +# build directory to the installation directory, since +# this file is needed to compile plpgsql_check +Copy-Item $source_directory/Release/plpgsql/plpgsql.lib $installation_directory/lib +Copy-Item $gettext_directory/bin/libintl-9.dll $installation_directory\bin +Copy-Item $icu_directory/bin/*.dll $installation_directory\bin +Copy-Item $openssl_directory/bin/*.dll $installation_directory\bin +Copy-Item $xml_directory/bin/*.dll $installation_directory\bin +Copy-Item $xslt_directory/bin/libxslt.dll $installation_directory\bin +Copy-Item $gettext_directory/bin/libiconv-2.dll $installation_directory\bin +Copy-Item $gettext_directory/bin/libwinpthread-1.dll $installation_directory\bin +Copy-Item $zlib_directory/bin/*.dll $installation_directory\bin +Copy-Item $zstd_directory/bin/*.dll $installation_directory\bin +Copy-Item $lz4_directory/bin/*.dll $installation_directory\bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxbase324u_net_vc_x64_custom.dll $installation_directory/bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxbase324u_vc_x64_custom.dll $installation_directory/bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxbase324u_xml_vc_x64_custom.dll $installation_directory/bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw324u_adv_vc_x64_custom.dll $installation_directory/bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw324u_aui_vc_x64_custom.dll $installation_directory/bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw324u_core_vc_x64_custom.dll $installation_directory/bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw324u_html_vc_x64_custom.dll $installation_directory/bin +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw324u_xrc_vc_x64_custom.dll $installation_directory/bin + +# Manually copy some libraries to the installation directory +Copy-Item $lz4_directory/lib/liblz4.lib $installation_directory\lib +Copy-Item $openssl_directory/lib/libssl.lib $installation_directory\lib +Copy-Item $openssl_directory/lib/libcrypto.lib $installation_directory\lib +Copy-Item $gettext_directory/lib/iconv.lib $installation_directory\lib +Copy-Item $gettext_directory/lib/libintl.lib $installation_directory\lib +Copy-Item $xml_directory/lib/libxml2.lib $installation_directory\lib +Copy-Item $xslt_directory/lib/libxslt.lib $installation_directory\lib +Copy-Item $zlib_directory/bin/zlib.lib $installation_directory\lib +Copy-Item $zstd_directory/lib/* $installation_directory/lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxbase32u_net.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxbase32u.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxbase32u_xml.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw32u_adv.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw32u_aui.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw32u_core.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw32u_html.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw32u_xrc.lib $installation_directory\lib +Copy-Item $wxwidgets_directory/lib/vc_x64_dll/wxmsw32u_adv.lib $installation_directory\lib + +Copy-Item $lz4_directory/include/*.h $installation_directory/include +Copy-Item -Path $openssl_directory/include/* -Destination $installation_directory/include -Recurse +Copy-Item -Path $xml_directory/include/libxml -Destination $installation_directory/include -Recurse +Copy-Item -Path $xslt_directory/include/libxslt -Destination $installation_directory/include -Recurse +Copy-Item $gettext_directory/include/*.h $installation_directory/include +Copy-Item -Path $icu_directory/include/* -Destination $installation_directory/include -Recurse +Copy-Item $uuid_directory/include/*.h $installation_directory/include +Copy-Item $zlib_directory/include/*.h $installation_directory/include +Copy-Item $zstd_directory/include/*.h $installation_directory/include + + + +mkdir $installation_directory/doc/postgresql/html +Copy-Item $source_directory/doc/src/sgml/html/* $installation_directory/doc/postgresql/html + +Write-Host "vcregress is beginning" +# To run the integration tests, the Path needs to be adjusted +# to correctly find the required DLLs. +.\vcregress.bat check serial +.\vcregress.bat check parallel +Pop-Location +Write-Host "vcregress is done" + +# Now we need to start a temporary instance, to run the contrib tests +Push-Location $installation_directory\bin +Write-Host "initdb is beginning" +.\initdb.exe -D $temporary_data_location --data-checksums -U postgres +Write-Host "initdb instance is done" +Write-Host "pg_ctl instance is beginning" +.\pg_ctl.exe -l $temporary_data_location/logfile -D $temporary_data_location -U postgres start +Write-Host "pg_ctl instance is done" +Pop-Location +Write-Host "start a temporary instance is done" + +# Let's start the contrib tests +Push-Location $source_directory/src/tools/msvc +Write-Host "contribcheck serial is beginning" +.\vcregress.bat contribcheck serial +Write-Host "contribcheck serial is done" +Write-Host "contribcheck parallel is beginning" +.\vcregress.bat contribcheck parallel +Write-Host "contribcheck parallel is done" +Pop-Location +Write-Host "start a temporary instance is done" + +Push-Location $installation_directory\bin +.\pg_ctl.exe -D $temporary_data_location stop +#Remove-Item $temporary_data_location -Recurse +Pop-Location diff --git a/server/scripts/windows/createuser/createuser.vcproj b/server/scripts/windows/createuser/createuser.vcproj deleted file mode 100755 index be132c78b..000000000 --- a/server/scripts/windows/createuser/createuser.vcproj +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/scripts/windows/createuser/createuser.vcxproj b/server/scripts/windows/createuser/createuser.vcxproj new file mode 100755 index 000000000..8e97192ef --- /dev/null +++ b/server/scripts/windows/createuser/createuser.vcxproj @@ -0,0 +1,179 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 17.0 + {6690A32E-7546-4C9C-9368-FF1DA20B4E51} + createuser + Win32Proj + + + + Application + v143 + NotSet + true + + + Application + v143 + NotSet + + + Application + v143 + NotSet + true + + + Application + v143 + NotSet + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.33103.201 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + EditAndContinue + + + netapi32.lib;%(AdditionalDependencies) + true + Console + false + + MachineX86 + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + + + + netapi32.lib;%(AdditionalDependencies) + true + Console + true + true + false + + MachineX86 + + + + + X64 + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + + + netapi32.lib;%(AdditionalDependencies) + true + Console + false + + MachineX64 + + + + + X64 + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + + + + netapi32.lib;%(AdditionalDependencies) + true + Console + true + true + false + + MachineX64 + + + + + + + + + \ No newline at end of file diff --git a/server/scripts/windows/createuser/createuser.vcxproj.filters b/server/scripts/windows/createuser/createuser.vcxproj.filters new file mode 100755 index 000000000..d341fa14d --- /dev/null +++ b/server/scripts/windows/createuser/createuser.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + \ No newline at end of file diff --git a/server/scripts/windows/createuser/createuser.vcxproj.user b/server/scripts/windows/createuser/createuser.vcxproj.user new file mode 100755 index 000000000..0f14913f3 --- /dev/null +++ b/server/scripts/windows/createuser/createuser.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/server/scripts/windows/getlocales/getlocales.vcproj b/server/scripts/windows/getlocales/getlocales.vcproj deleted file mode 100755 index 0c91bb43c..000000000 --- a/server/scripts/windows/getlocales/getlocales.vcproj +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/scripts/windows/getlocales/getlocales.vcxproj b/server/scripts/windows/getlocales/getlocales.vcxproj new file mode 100755 index 000000000..8b7949b20 --- /dev/null +++ b/server/scripts/windows/getlocales/getlocales.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 17.0 + {6690A32E-7546-4C9C-9368-FF1DA20B4E51} + getlocales + Win32Proj + + + + Application + v143 + NotSet + true + + + Application + v143 + NotSet + + + Application + v143 + NotSet + true + + + Application + v143 + NotSet + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.33103.201 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + EditAndContinue + + + true + Console + false + + MachineX86 + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + + + + true + Console + true + true + false + + MachineX86 + + + + + X64 + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + + + true + Console + false + + MachineX64 + + + + + X64 + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + + + + true + Console + true + true + false + + MachineX64 + + + + + + + + + \ No newline at end of file diff --git a/server/scripts/windows/getlocales/getlocales.vcxproj.filters b/server/scripts/windows/getlocales/getlocales.vcxproj.filters new file mode 100755 index 000000000..b6a4a8ee8 --- /dev/null +++ b/server/scripts/windows/getlocales/getlocales.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + \ No newline at end of file diff --git a/server/scripts/windows/getlocales/getlocales.vcxproj.user b/server/scripts/windows/getlocales/getlocales.vcxproj.user new file mode 100755 index 000000000..0f14913f3 --- /dev/null +++ b/server/scripts/windows/getlocales/getlocales.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/server/scripts/windows/prepare-staging-directory.sh b/server/scripts/windows/prepare-staging-directory.sh new file mode 100644 index 000000000..43e4dbdbf --- /dev/null +++ b/server/scripts/windows/prepare-staging-directory.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +# set -xeu + +mkdir -p packaging-config/installer/server/staging/windows-x64/server +mkdir -p packaging-config/installer/server/staging/windows-x64/server/bin +mkdir -p packaging-config/installer/server/staging/windows-x64/server/lib +mkdir -p packaging-config/installer/server/staging/windows-x64/server/share/extension +mkdir -p packaging-config/installer/server/staging/windows-x64/server/debug_symbols +mkdir -p packaging-config/installer/server/staging/windows-x64/scripts +mkdir -p packaging-config/installer/server/staging/windows-x64/resources +cp -R packaging-config/resources/license.txt packaging-config/installer/server/staging/windows-x64/server/server_license.txt + +# server +cp -r pgsql/bin/* packaging-config/installer/server/staging/windows-x64/server/bin + +cp -r ./curl/bin/libcurl.dll packaging-config/installer/server/staging/windows-x64/server/bin +cp -r ./curl/lib/libcurl.lib packaging-config/installer/server/staging/windows-x64/server/bin + +cp -r ./gettext/share/locale packaging-config/installer/server/staging/windows-x64/server/share + +mkdir 3rdinclude +cp -r pgsql/include/* 3rdinclude +find 3rdinclude/ -name "*.h" -exec grep -rwl "GNU General Public License" {} \; -exec rm {} \; +mkdir packaging-config/installer/server/staging/windows-x64/server/include +cp -r 3rdinclude/* packaging-config/installer/server/staging/windows-x64/server/include +rm -rf 3rdinclude + +cp -r pgsql/lib/* packaging-config/installer/server/staging/windows-x64/server/lib + +#system_stats +cp -r pgsql/share packaging-config/installer/server/staging/windows-x64/server +cp -r packaging-config/server/i18n packaging-config/installer/server/staging/windows-x64/server/share +cp -r $(PWD)/system_stats/system_stats--*.sql packaging-config/installer/server/staging/windows-x64/server/share/extension +cp -r $(PWD)/system_stats/system_stats.control packaging-config/installer/server/staging/windows-x64/server/share/extension + +cp -r packaging-config/server/i18n packaging-config/installer/server/staging/windows-x64/ + +mkdir -p packaging-config/installer/server/staging/windows-x64/server/installer/server +cp -r packaging-config/server/scripts/windows/prerun_checks.vbs packaging-config/installer/server/staging/windows-x64/server/installer/prerun_checks.vbs +cp -r packaging-config/server/scripts/windows/initcluster.vbs packaging-config/installer/server/staging/windows-x64/server/installer/server/initcluster.vbs +cp -r packaging-config/server/scripts/windows/startupcfg.vbs packaging-config/installer/server/staging/windows-x64/server/installer/server/startupcfg.vbs +cp -R "$VCToolsRedistDir"vc_redist.x86.exe packaging-config/installer/server/staging/windows-x64/server/installer/vcredist_x86.exe +cp -R "$VCToolsRedistDir"vc_redist.x64.exe packaging-config/installer/server/staging/windows-x64/server/installer/vcredist_x64.exe + +cp -R pgsql/doc packaging-config/installer/server/staging/windows-x64/server +cp -R packaging-config/server/resources/installation-notes.html packaging-config/installer/server/staging/windows-x64/server/doc + +cp -r pgsql/symbols/* packaging-config/installer/server/staging/windows-x64/server/debug_symbols +cp -r packaging-config/server/scripts/windows/getlocales/x64/Release/getlocales.exe packaging-config/installer/server/staging/windows-x64/server/installer/server/getlocales.exe +cp -r packaging-config/server/scripts/windows/validateuser/x64/Release/validateuser.exe packaging-config/installer/server/staging/windows-x64/server/installer/server/validateuser.exe +cp -r packaging-config/server/scripts/windows/createuser/x64/Release/createuser.exe packaging-config/installer/server/staging/windows-x64/server/installer/server/createuser.exe +# Copy the launch scripts +mkdir -p packaging-config/installer/server/staging/windows-x64/server/scripts/images +cp packaging-config/server/scripts/windows/serverctl.vbs packaging-config/installer/server/staging/windows-x64/server/scripts/serverctl.vbs +cp packaging-config/server/scripts/windows/runpsql.bat packaging-config/installer/server/staging/windows-x64/server/scripts/runpsql.bat +cp packaging-config/server/resources/pg-help.ico packaging-config/installer/server/staging/windows-x64/server/scripts/images +cp packaging-config/server/resources/pg-reload.ico packaging-config/installer/server/staging/windows-x64/server/scripts/images + +cp packaging-config/scripts/determineLinuxInitSystem.xml packaging-config/installer/server/staging/windows-x64/scripts/determineLinuxInitSystem.xml +cp packaging-config/scripts/linuxServiceAction.xml packaging-config/installer/server/staging/windows-x64/scripts/linuxServiceAction.xml + +# commanlinetools +mkdir -p packaging-config/installer/server/staging/windows-x64/commandlinetools/installer/server + +mkdir -p packaging-config/installer/server/staging/windows-x64/commandlinetools/bin +cp -R zlib/bin/zlib1.dll packaging-config/installer/server/staging/windows-x64/commandlinetools/bin +cp -R ./gettext/bin/libwinpthread-1.dll $(PWD)/packaging-config/installer/server/staging/windows-x64/commandlinetools/bin +cp -R "$VCToolsRedistDir"vc_redist.x86.exe packaging-config/installer/server/staging/windows-x64/commandlinetools/installer/vcredist_x86.exe +cp -R "$VCToolsRedistDir"vc_redist.x64.exe packaging-config/installer/server/staging/windows-x64/server/installer/vcredist_x64.exe +cp pgsql/bin/createuser.exe packaging-config/installer/server/staging/windows-x64/commandlinetools/installer/server +cp -R pgsql/bin/* packaging-config/installer/server/staging/windows-x64/commandlinetools/bin +mkdir -p packaging-config/installer/server/staging/windows-x64/commandlinetools/lib + +cp -r pgsql/lib/* packaging-config/installer/server/staging/windows-x64/commandlinetools/lib +cp -r packaging-config/server/system_stats.dll packaging-config/installer/server/staging/windows-x64/commandlinetools/lib/system_stats.dll + +mkdir -p packaging-config/installer/server/staging/windows-x64/commandlinetools/scripts/images +cp packaging-config/server/resources/pg-psql.ico packaging-config/installer/server/staging/windows-x64/commandlinetools/scripts/images/ +cp packaging-config/server/scripts/windows/runpsql.bat packaging-config/installer/server/staging/windows-x64/commandlinetools/scripts/ +cp packaging-config/resources/edb-side.png packaging-config/installer/server/staging/windows-x64/resources +cp packaging-config/resources/pg-splash.png packaging-config/installer/server/staging/windows-x64/resources +cp packaging-config/resources/pg-side.png packaging-config/installer/server/staging/windows-x64/resources + +cp packaging-config/server/installer.xml.in packaging-config/installer/server/staging/windows-x64/installer.xml +cp packaging-config/server/commandlinetools.xml.in packaging-config/installer/server/staging/windows-x64/commandlinetools-windows-x64.xml +cp packaging-config/server/pgserver.xml.in packaging-config/installer/server/staging/windows-x64/pgserver-windows-x64.xml +cp packaging-config/server/stackbuilder.xml.in packaging-config/installer/server/staging/windows-x64/stackbuilder-windows-x64.xml +cp packaging-config/server/pgadmin.xml.in packaging-config/installer/server/staging/windows-x64/pgadmin-windows-x64.xml + +# stackbuilder +mkdir -p packaging-config/installer/server/staging/windows-x64/stackbuilder/bin +cp -r $(PWD)/stackbuilder*.exe packaging-config/installer/server/staging/windows-x64/stackbuilder/bin/stackbuilder.exe +cp -r packaging-config/installer/server/staging/windows-x64/server/bin/wx*.dll packaging-config/installer/server/staging/windows-x64/stackbuilder/bin +cp -r ./curl/bin/libcurl.dll packaging-config/installer/server/staging/windows-x64/stackbuilder/bin +cp -r $(PWD)/SB/share packaging-config/installer/server/staging/windows-x64/stackbuilder + +#pgAdmin4 +mkdir -p "packaging-config/installer/server/staging/windows-x64/pgadmin4/pgAdmin 4" +mv $(PWD)/pgAdmin4-binaries/pgAdmin_license.txt packaging-config/installer/server/staging/windows-x64/pgadmin4/ +mv $(PWD)/pgAdmin4-binaries/scripts packaging-config/installer/server/staging/windows-x64/pgadmin4/ +cp packaging-config/server/resources/pg-help.ico packaging-config/installer/server/staging/windows-x64/pgadmin4/scripts/images/pgadmin-help.ico +cp -r $(PWD)/pgAdmin4-binaries/* "packaging-config/installer/server/staging/windows-x64/pgadmin4/pgAdmin 4/" \ No newline at end of file diff --git a/server/scripts/windows/validateuser/validateuser.vcproj b/server/scripts/windows/validateuser/validateuser.vcproj deleted file mode 100755 index 4e5cd8ce3..000000000 --- a/server/scripts/windows/validateuser/validateuser.vcproj +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/scripts/windows/validateuser/validateuser.vcxproj b/server/scripts/windows/validateuser/validateuser.vcxproj new file mode 100755 index 000000000..dec459cfa --- /dev/null +++ b/server/scripts/windows/validateuser/validateuser.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 17.0 + {6690A32E-7546-4C9C-9368-FF1DA20B4E51} + validateuser + Win32Proj + + + + Application + v143 + NotSet + true + + + Application + v143 + NotSet + + + Application + v143 + NotSet + true + + + Application + v143 + NotSet + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.33103.201 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + EditAndContinue + + + true + Console + false + + MachineX86 + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + + + + true + Console + true + true + false + + MachineX86 + + + + + X64 + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + + + true + Console + false + + MachineX64 + + + + + X64 + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + + + + true + Console + true + true + false + + MachineX64 + + + + + + + + + \ No newline at end of file diff --git a/server/scripts/windows/validateuser/validateuser.vcxproj.filters b/server/scripts/windows/validateuser/validateuser.vcxproj.filters new file mode 100755 index 000000000..e7045a88e --- /dev/null +++ b/server/scripts/windows/validateuser/validateuser.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + \ No newline at end of file diff --git a/server/scripts/windows/validateuser/validateuser.vcxproj.user b/server/scripts/windows/validateuser/validateuser.vcxproj.user new file mode 100755 index 000000000..0f14913f3 --- /dev/null +++ b/server/scripts/windows/validateuser/validateuser.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/server/scripts/windows/vc-build-x64.bat b/server/scripts/windows/vc-build-x64.bat new file mode 100644 index 000000000..2fd2fc473 --- /dev/null +++ b/server/scripts/windows/vc-build-x64.bat @@ -0,0 +1,18 @@ +setlocal enabledelayedexpansion +ECHO Setting variables + +rem Set fixed parameters from the command line arguments +@SET PROJECT_FILE=%1 +@SET CONFIGURATION=%2 +@SET PLATFORM=%3 +@SET OUTDIR=%4 +@SET TOOLSET=%5 + +rem Run msbuild with all parameters and additional options +msbuild %PROJECT_FILE% /p:Configuration=%CONFIGURATION% /p:Platform=%PLATFORM% /p:OutDir=%OUTDIR% /p:PlatformToolset=%TOOLSET% %~6 || EXIT /B 1 +GOTO end + +:upgrade +devenv /upgrade %PROJECT_FILE% + +:end \ No newline at end of file diff --git a/server/version.txt b/server/version.txt new file mode 100644 index 000000000..1ce0fb452 --- /dev/null +++ b/server/version.txt @@ -0,0 +1,6 @@ +pg_major_version=16 +pg_minor_version=3 +package_revision=2 +pgadmin4=8.7 +languagepack=4.3-1 +stackbuilder=4.2.1