From a9ff4ac78d941dccba9a256fea9d904501e24103 Mon Sep 17 00:00:00 2001 From: Paul Reeves Date: Fri, 17 Jun 2022 18:06:34 +0200 Subject: [PATCH] Bring the windows packaging up-to-date (but still WIP) --- .../win32/BuildExecutableInstall.bat | 58 +++++++++---------- .../arch-specific/win32/FirebirdInstall.iss | 53 ++++++++++------- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/builds/install/arch-specific/win32/BuildExecutableInstall.bat b/builds/install/arch-specific/win32/BuildExecutableInstall.bat index 38dd0d9714..e66a307190 100644 --- a/builds/install/arch-specific/win32/BuildExecutableInstall.bat +++ b/builds/install/arch-specific/win32/BuildExecutableInstall.bat @@ -204,28 +204,24 @@ set SED_COMMAND=sed -e s/\$MAJOR/%FB_MAJOR_VER%/g ^ :: MSVC should be installed with redistributable packages. ::===================== -:: We are forced to set this because the runtime library now (MSVC15) -:: has a different version to the compiler. And sometimes they use 141 -:: and sometimes 140. -if %MSVC_VERSION% EQU 15 ( - @set MSVC_RUNTIME_MAJOR_VERSION=14 - @set MSVC_RUNTIME_MINOR_VERSION_0=0 - @set MSVC_RUNTIME_MINOR_VERSION_1=1 - -) else ( - @set MSVC_RUNTIME_VERSION=%MSVC_VERSION%0 -) - @echo Copying MSVC runtime libraries... @if not exist %FB_OUTPUT_DIR%\system32 ( @mkdir %FB_OUTPUT_DIR%\system32 ) -for %%f in ( msvcp%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_0%.dll vcruntime%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_0%.dll ) do ( - echo Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" - copy "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" %FB_OUTPUT_DIR%\ >nul +:: Note the confusion of RT library numbers here! These notes, as of time of +:: writing 2021-12-21, are accurate for current versions of Visual Studio +:: - 2017, 2019, 2022. Basic MS runtime version is v140. Except that is only +:: used in file names. In reality Visual Studio uses 141, 142 or 143 in +:: directory names and merge module names as well as producing file names with +:: these version numbers. %MSVC_RUNTIME_FILE_VERSION% should represent 140. +:: %MSVC_RUNTIME_LIBRARY_VERSION% is based on the Visual Studio version used. +:: These variables are set in setenvvar.bat. +for %%f in ( msvcp%MSVC_RUNTIME_FILE_VERSION%.dll vcruntime%MSVC_RUNTIME_FILE_VERSION%.dll ) do ( + echo Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_LIBRARY_VERSION%.CRT\%%f" + copy "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_LIBRARY_VERSION%.CRT\%%f" %FB_OUTPUT_DIR%\ >nul if %ERRORLEVEL% GEQ 1 ( - call :ERROR Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" failed with error %ERRORLEVEL% ) && (goto :EOF) + call :ERROR Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_LIBRARY_VERSION%.CRT\%%f" failed with error %ERRORLEVEL% ) && (goto :EOF) ) ) @@ -240,19 +236,17 @@ if "%VSCMD_ARG_TGT_ARCH%"=="x86" ( @if "%FBBUILD_SHIP_PDB%"=="ship_pdb" ( @echo Copying pdb files... @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fbserver\firebird.pdb %FB_OUTPUT_DIR%\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\burp\burp.pdb %FB_OUTPUT_DIR%\gbak.pdb > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\gfix\gfix.pdb %FB_OUTPUT_DIR%\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\isql\isql.pdb %FB_OUTPUT_DIR%\ > nul @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\yvalve\fbclient.pdb %FB_OUTPUT_DIR%\ > nul - @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\engine\engine*.pdb %FB_OUTPUT_DIR%\ > nul - @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fbtrace\fbtrace.pdb %FB_OUTPUT_DIR%\ > nul - @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\legacy_auth\legacy_auth.pdb %FB_OUTPUT_DIR%\ > nul - @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\legacy_usermanager\legacy_usermanager.pdb %FB_OUTPUT_DIR%\ > nul - @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\srp\srp.pdb %FB_OUTPUT_DIR%\ > nul - @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\udr_engine\udr_engine.pdb %FB_OUTPUT_DIR%\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\engine\engine*.pdb %FB_OUTPUT_DIR%\plugins\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fbtrace\fbtrace.pdb %FB_OUTPUT_DIR%\plugins\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\legacy_auth\legacy_auth.pdb %FB_OUTPUT_DIR%\plugins\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\legacy_usermanager\legacy_usermanager.pdb %FB_OUTPUT_DIR%\plugins\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\srp\srp.pdb %FB_OUTPUT_DIR%\plugins\ > nul + @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\udr_engine\udr_engine.pdb %FB_OUTPUT_DIR%\plugins\ > nul ) -:: Maybe include these and other executables, one day ? -:: @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\gbak\gbak.pdb %FB_OUTPUT_DIR%\ > nul -:: @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\gfix\gfix.pdb %FB_OUTPUT_DIR%\ > nul -:: @copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\isql\isql.pdb %FB_OUTPUT_DIR%\ > nul - @echo Started copying docs... @rmdir /S /Q %FB_OUTPUT_DIR%\doc 2>nul @@ -378,17 +372,17 @@ if %FB2_SNAPSHOT% EQU 1 ( :: Generate runtimes as an MSI file. :: This requires WiX 3.0 to be installed ::============ -if %MSVC_VERSION% EQU 15 ( - if not exist %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%_%FB_TARGET_PLATFORM%.msi ( +@if %MSVC_VERSION% EQU 15 ( + if not exist %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_LIBRARY_VERSION%_%FB_TARGET_PLATFORM%.msi ( "%WIX%\bin\candle.exe" -v -sw1091 %FB_ROOT_PATH%\builds\win32\msvc%MSVC_VERSION%\VCCRT_%FB_TARGET_PLATFORM%.wxs -out %FB_GEN_DIR%\vccrt_%FB_TARGET_PLATFORM%.wixobj @if %ERRORLEVEL% GEQ 1 ( ( call :ERROR Could not generate wixobj for MSVC Runtime MSI ) & (goto :EOF) ) else ( - "%WIX%\bin\light.exe" -sw1076 %FB_GEN_DIR%\vccrt_%FB_TARGET_PLATFORM%.wixobj -out %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%_%FB_TARGET_PLATFORM%.msi - @if %ERRORLEVEL% GEQ 1 ( (call :ERROR Could not generate MSVCC Runtime MSI ) & (goto :EOF)) + "%WIX%\bin\light.exe" -sw1076 %FB_GEN_DIR%\vccrt_%FB_TARGET_PLATFORM%.wixobj -out %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_LIBRARY_VERSION%_%FB_TARGET_PLATFORM%.msi + @if %ERRORLEVEL% GEQ 1 ( (call :ERROR Could not generate MSVCC Runtime MSI %MSVC_RUNTIME_LIBRARY_VERSION% ) & (goto :EOF)) ) ) else ( - @echo Using an existing build of %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%_%FB_TARGET_PLATFORM%.msi + @echo Using an existing build of %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_LIBRARY_VERSION%_%FB_TARGET_PLATFORM%.msi ) ) diff --git a/builds/install/arch-specific/win32/FirebirdInstall.iss b/builds/install/arch-specific/win32/FirebirdInstall.iss index a3ec4272c3..9c3f2ac709 100644 --- a/builds/install/arch-specific/win32/FirebirdInstall.iss +++ b/builds/install/arch-specific/win32/FirebirdInstall.iss @@ -163,24 +163,32 @@ #pragma warning "msvc runtime major version was not defined. Forcing default value." #endif -#if Len(GetEnv("MSVC_RUNTIME_MINOR_VERSION_0")) > 0 -#define msvc_runtime_minor_version_0 GetEnv("MSVC_RUNTIME_MINOR_VERSION_0") +#if Len(GetEnv("MSVC_RUNTIME_MINOR_VERSION")) > 0 +#define msvc_runtime_minor_version GetEnv("MSVC_RUNTIME_MINOR_VERSION") #else -#define msvc_runtime_minor_version_0 0 +#define msvc_runtime_minor_version 0 #pragma warning "msvc runtime minor version 0 was not defined. Forcing default value." #endif +#if Len(GetEnv("MSVC_RUNTIME_LIBRARY_VERSION")) > 0 +#define msvc_runtime_library_version GetEnv("MSVC_RUNTIME_LIBRARY_VERSION") +#endif + +#if Len(GetEnv("MSVC_RUNTIME_FILE_VERSION")) > 0 +#define msvc_runtime_file_version GetEnv("MSVC_RUNTIME_FILE_VERSION") +#endif + ;if we are running msvc15 then we sometimes need to look for 140 and sometimes for 141 ; the rule until MS changes it again is that 141 is always used, except for the filename ; of the vcruntime and msvcp dll's. -#if msvc_version = 15 -#if Len(GetEnv("MSVC_RUNTIME_MINOR_VERSION_1")) > 0 -#define msvc_runtime_minor_version_1 GetEnv("MSVC_RUNTIME_MINOR_VERSION_1") -#else -#define msvc_runtime_minor_version_1 1 -#pragma warning "msvc runtime minor version 1 was not defined. Forcing default value." -#endif -#endif +;#if msvc_version = 15 +;#if Len(GetEnv("MSVC_RUNTIME_MINOR_VERSION_2")) > 0 +;#define msvc_runtime_minor_version GetEnv("MSVC_RUNTIME_MINOR_VERSION_2") +;#else +;#define msvc_runtime_minor_version 2 +;#pragma warning "msvc runtime minor version 2 was not defined. Forcing default value." +;#endif +;#endif #if Int(msvc_version,15) < 15 #define msvcr_filename = "msvcr" @@ -377,9 +385,9 @@ Name: CopyFbClientAsGds32Task; Description: {cm:CopyFbClientAsGds32Task}; Compon [Run] ; due to the changes required to support MSVC15 support for earlier versions is now broken. #if Int(msvc_runtime_major_version,14) >= 14 -Filename: msiexec.exe; Parameters: "/qn /norestart /i ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi"" /L*v ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.log"" "; StatusMsg: "Installing MSVC 32-bit runtime libraries to system directory"; Check: HasWI30; Components: ClientComponent; +Filename: msiexec.exe; Parameters: "/qn /norestart /i ""{tmp}\vccrt{#msvc_runtime_library_version}_Win32.msi"" /L*v ""{tmp}\vccrt{#msvc_runtime_library_version}_Win32.log"" "; StatusMsg: "Installing MSVC 32-bit runtime libraries to system directory"; Check: HasWI30; Components: ClientComponent; #if PlatformTarget == "x64" -Filename: msiexec.exe; Parameters: "/qn /norestart /i ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.msi"" /L*v ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.log"" "; StatusMsg: "Installing MSVC 64-bit runtime libraries to system directory"; Check: HasWI30; Components: ClientComponent; +Filename: msiexec.exe; Parameters: "/qn /norestart /i ""{tmp}\vccrt{#msvc_runtime_library_version}_x64.msi"" /L*v ""{tmp}\vccrt{#msvc_runtime_library_version}_x64.log"" "; StatusMsg: "Installing MSVC 64-bit runtime libraries to system directory"; Check: HasWI30; Components: ClientComponent; #endif #endif @@ -511,12 +519,12 @@ Source: {#WOW64Dir}\zlib1.dll; DestDir: {app}\WOW64; Components: ClientComponent ;We just install the runtimes into the install dir. #if Int(msvc_runtime_major_version,14) >= 14 -Source: {#FilesDir}\{#msvcr_filename}{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile; -Source: {#FilesDir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile; +Source: {#FilesDir}\{#msvcr_filename}{#msvc_runtime_file_version}.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile; +Source: {#FilesDir}\msvcp{#msvc_runtime_file_version}.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile; #if PlatformTarget == "x64" ;If we are installing on x64 we need some 32-bit libraries for compatibility with 32-bit applications -Source: {#WOW64Dir}\{#msvcr_filename}{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile {#SkipFileIfDevStatus}; -Source: {#WOW64Dir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile {#SkipFileIfDevStatus}; +Source: {#WOW64Dir}\{#msvcr_filename}{#msvc_runtime_file_version}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile {#SkipFileIfDevStatus}; +Source: {#WOW64Dir}\msvcp{#msvc_runtime_file_version}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile {#SkipFileIfDevStatus}; #endif #endif /* #if Int(msvc_runtime_major_version,14) >= 10 */ @@ -524,10 +532,10 @@ Source: {#WOW64Dir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_versi #if PlatformTarget == "x64" ;MinVersion 0,5.0 means no version of Win9x and at least Win2k if NT O/S ;In addition, O/S must have Windows Installer 3.0. -Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} -Source: {#WOW64Dir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} +Source: {#FilesDir}\system32\vccrt{#msvc_runtime_library_version}_x64.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} +Source: {#WOW64Dir}\system32\vccrt{#msvc_runtime_library_version}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} #else -Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} +Source: {#FilesDir}\system32\vccrt{#msvc_runtime_library_version}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} #endif #endif @@ -575,7 +583,10 @@ Source: {#FilesDir}\examples\*.*; DestDir: {app}\examples; Components: DevAdminC #ifdef ship_pdb Source: {#FilesDir}\fbclient.pdb; DestDir: {app}; Components: ClientComponent; Source: {#FilesDir}\firebird.pdb; DestDir: {app}; Components: ServerComponent; -;Source: {#FilesDir}\fbembed.pdb; DestDir: {app}; Components: ClientComponent; +Source: {#FilesDir}\gbak.pdb; DestDir: {app}; Components: DevAdminComponent; +Source: {#FilesDir}\gfix.pdb; DestDir: {app}; Components: DevAdminComponent; +Source: {#FilesDir}\isql.pdb; DestDir: {app}; Components: ClientComponent; +Source: {#FilesDir}\plugins\*.pdb; DestDir: {app}\plugins; Components: ServerComponent; #if PlatformTarget == "x64" Source: {#WOW64Dir}\fbclient.pdb; DestDir: {app}\WOW64; Components: ClientComponent; #endif