WindowsInstaller: multiple improvements and fixes

update artwork
adapt to conda builds
make msvc redist directory optional
automate version information definition
use relative directories for file locations definitions
improve/update readme
partially update Delete.bat for qt6 libpack
add .gitignore
update signing.bat and add hashing command
This commit is contained in:
Adrián Insaurralde Avalos
2025-05-13 19:17:27 -03:00
committed by Adrian Insaurralde Avalos
parent 7637a991a9
commit 0207f7716a
17 changed files with 96 additions and 115 deletions
+5
View File
@@ -0,0 +1,5 @@
*.exe
*-SHA256.txt
MSVCRedist
FreeCAD
version.nsh
Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

+28 -69
View File
@@ -14,75 +14,34 @@ del libGLESv2d.dll
del libssl-3d.dll
del linguist.exe
del qdoc.exe
del Qt53DAnimationd.dll
del Qt53DCored.dll
del Qt53DExtrasd.dll
del Qt53DInputd.dll
del Qt53DLogicd.dll
del Qt53DQuickAnimationd.dll
del Qt53DQuickd.dll
del Qt53DQuickExtrasd.dll
del Qt53DQuickInputd.dll
del Qt53DQuickRenderd.dll
del Qt53DQuickScene2Dd.dll
del Qt53DRenderd.dll
del Qt5Bluetoothd.dll
del Qt5Bodymovind.dll
del Qt5Chartsd.dll
del Qt5Concurrentd.dll
del Qt5Cored.dll
del Qt5DataVisualizationd.dll
del Qt5DBusd.dll
del Qt5DesignerComponentsd.dll
del Qt5Designerd.dll
del Qt5Gamepadd.dll
del Qt5Guid.dll
del Qt5Helpd.dll
del Qt5Locationd.dll
del Qt5Multimediad.dll
del Qt5MultimediaQuickd.dll
del Qt5MultimediaWidgetsd.dll
del Qt5NetworkAuthd.dll
del Qt5Networkd.dll
del Qt5Nfcd.dll
del Qt5OpenGLd.dll
del Qt5Pdfd.dll
del Qt5PdfWidgetsd.dll
del Qt5Positioningd.dll
del Qt5PositioningQuickd.dll
del Qt5PrintSupportd.dll
del Qt5Purchasingd.dll
del Qt5Qmld.dll
del Qt5QmlModelsd.dll
del Qt5QmlWorkerScriptd.dll
del Qt5Quick3DAssetImportd.dll
del Qt5Quick3Dd.dll
del Qt5Quick3DRenderd.dll
del Qt5Quick3DRuntimeRenderd.dll
del Qt5Quick3DUtilsd.dll
del Qt5QuickControls2d.dll
del Qt5Quickd.dll
del Qt5QuickParticlesd.dll
del Qt5QuickShapesd.dll
del Qt5QuickTemplates2d.dll
del Qt5QuickTestd.dll
del Qt5QuickWidgetsd.dll
del Qt5RemoteObjectsd.dll
del Qt5Scriptd.dll
del Qt5ScriptToolsd.dll
del Qt5Scxmld.dll
del Qt5Sensorsd.dll
del Qt5SerialBusd.dll
del Qt5SerialPortd.dll
del Qt5Sqld.dll
del Qt5Svgd.dll
del Qt5Testd.dll
del Qt5TextToSpeechd.dll
del Qt5VirtualKeyboardd.dll
del Qt5Widgetsd.dll
del Qt5WinExtrasd.dll
del Qt5Xmld.dll
del Qt5XmlPatternsd.dll
del Qt6Concurrentd.dll
del Qt6Cored.dll
del Qt6DBusd.dll
del Qt6DesignerComponentsd.dll
del Qt6Designerd.dll
del Qt6Guid.dll
del Qt6Helpd.dll
del Qt6LabsAnimationd.dll
del Qt6LabsFolderListModeld.dll
del Qt6LabsPlatformd.dll
del Qt6LabsSettingsd.dll
del Qt6LabsSharedImaged.dll
del Qt6LabsWavefrontMeshd.dll
del Qt6MultimediaWidgetsd.dll
del Qt6Multimediad.dll
del Qt6Networkd.dll
del Qt6OpenGLWidgetsd.dll
del Qt6OpenGLd.dll
del Qt6PrintSupportd.dll
del Qt6SpatialAudiod.dll
del Qt6Sqld.dll
del Qt6SvgWidgetsd.dll
del Qt6Svgd.dll
del Qt6Testd.dll
del Qt6UiToolsd.dll
del Qt6Widgetsd.dll
del Qt6Xmld.dll
del QtWebEngineProcessd.exe
del Quarter1d.dll
del xerces-c_3_2D.dll
del zlibd.dll
Binary file not shown.
+12 -10
View File
@@ -1,7 +1,7 @@
# Creating a Windows installer for FreeCAD
These are instructions for building an NSIS-based installer for FreeCAD. They were designed for FreeCAD 0.21 and later,
and presume that you have cloned a copy of FreeCAD's source code, and therefore have the directory *src/WindowsInstaller*.
and presume that you have cloned a copy of FreeCAD's source code, and therefore have the directory *src/tools/build/WindowsInstaller*.
## Install NSIS
To set up your system for building an NSIS installer:
@@ -15,16 +15,16 @@ To set up your system for building an NSIS installer:
4. Download and install the nsProcess plugin from https://nsis.sourceforge.io/NsProcess_plugin -- you will need the version that supports Unicode, so make sure to follow the appropriate instructions on their site to install that one (as of this writing it involves manually copying and renaming the plugin DLL file).
## Build the installer
Next, update the installer settings for the current version of FreeCAD. Starting from the *src/WindowsInstaller* folder in the FreeCAD source tree:
1. Set the appropriate version strings for the release you are creating. These are used to construct the filename of the installer, among other things. If you have to upload a new version of the installer for the exact same release of FreeCAD, increment `APP_VERSION BUILD` as needed.
```
Next, update the installer settings for the current version of FreeCAD. Starting from the *src/tools/build/WindowsInstaller* folder in the FreeCAD source tree:
1. The Set the appropriate version strings for the release you are creating. These are used to construct the filename of the installer, among other things. If you have to upload a new version of the installer for the exact same release of FreeCAD, increment `APP_VERSION BUILD` as needed.
```nsis
!define APP_VERSION_MAJOR 0
!define APP_VERSION_MINOR 21
!define APP_VERSION_REVISION 0
!define APP_VERSION_PATCH 0
!define APP_VERSION_EMERGENCY "RC1"
!define APP_VERSION_BUILD 1
```
2. Within the folder *src/WindowsInstaller*, create a new folder called MSVCRedist and copy the following files from your MSVC installation into it:
2. If the installer will be made from a LibPack build create a new folder called MSVCRedist within the folder *src/tools/build/WindowsInstaller* and copy the following files from your MSVC installation into it:
```
vcruntime140.dll
concrt140.dll
@@ -32,11 +32,13 @@ msvcp140.dll
vcamp140.dll
vccorlib140.dll
vcomp140.dll
```
3. Open the file *Settings.nsh* with a text editor (both jEdit and Visual Studio Code are good editors for NSIS files). Edit the following paths to correspond to your system: `FILES_FREECAD` corresponds to your installation directory (e.g. `CMAKE_INSTALL_PREFIX` if you self-compiled) and `FILES_DEPS` is the folder you created with the MSVC redistributable files in it.
```
!define FILES_FREECAD "C:\FreeCAD\Installer\FreeCAD"
!define FILES_DEPS "C:\FreeCAD\Installer\MSVCRedist"
3. If required open the file *Settings.nsh* with a text editor (both jEdit and Visual Studio Code are good editors for NSIS files). Edit the following paths to correspond to your system: `FILES_FREECAD` corresponds to your installation directory (e.g. `CMAKE_INSTALL_PREFIX` if you self-compiled), `FILES_THUMBS` is the directory where the thumbnailer dll is located and `FILES_DEPS` is the folder you created with the MSVC redistributable files in it. `FILES_DEPS` is not needed if the installer is created from a conda bundle so it is not set by default, it can be set via /D argument for `makensis.exe` or by uncommenting it's definition in *Settings.nsh*.
```nsis
!define FILES_FREECAD "${__FILEDIR__}\FreeCAD"
!define FILES_THUMBS "${__FILEDIR__}\thumbnail"
#!define FILES_THUMBS "${__FILEDIR__}\MSVC_Redist"
```
4. Ensure the FreeCAD files are in place. Here you have two options:
* If you are working from an already-compiled version of FreeCAD provided to you by an outside source: in this case, simply ensure that `FILES_FREECAD` is set to the directory containing those files.
+28 -16
View File
@@ -12,35 +12,47 @@ These typically need to be modified for each FreeCAD release
# So assure it is active for release builds!
SetCompressor /SOLID lzma
#--------------------------------
# File locations
# !!! you may need to adjust them to the folders in your Windows system !!!
!define FILES_FREECAD "${__FILEDIR__}\FreeCAD"
!define FILES_THUMBS "${__FILEDIR__}\thumbnail"
# msvc redistributables location is required for LibPack builds but not conda
# when using a LibPack build set the redistributables directory location here
# or with /D command line argument to makensis.exe
#!define FILES_DEPS "${__FILEDIR__}\MSVCRedist"
#--------------------------------
# Version number
!define APP_VERSION_MAJOR 0
!define APP_VERSION_MINOR 22
!define APP_VERSION_REVISION 0
!define APP_VERSION_EMERGENCY "beta" # use "1" for an emergency release of FreeCAD otherwise ""
!define COPYRIGHT_YEAR 2025
#!define APP_VERSION_MAJOR 1
#!define APP_VERSION_MINOR 0
#!define APP_VERSION_PATCH 0
# get version info from freecadcmd
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_MAJOR \$\"{App.Version()[0]}\$\"')$\">${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_MINOR \$\"{App.Version()[1]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_PATCH \$\"{App.Version()[2]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_REVISION \$\"{App.Version()[3].split()[0]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!include "${__FILEDIR__}\version.nsh"
!delfile "${__FILEDIR__}\version.nsh"
!define APP_VERSION_EMERGENCY "" # use "1" for an emergency release of FreeCAD otherwise ""
# alternatively you can use APP_VERSION_EMERGENCY for a custom suffix of the version number
!define APP_EMERGENCY_DOT "" # use "." for an emergency release of FreeCAD otherwise ""
!define APP_VERSION_BUILD 1 # Start with 1 for the installer releases of each version
!define APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}" # Version to display
!define COPYRIGHT_YEAR 2023
!define APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}" # Version to display
#--------------------------------
# Installer file name
# Typical names for the release are "FreeCAD-020-Installer-1.exe" etc.
!define ExeFile "${APP_NAME}-${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}-WIN-x64-installer-${APP_VERSION_BUILD}.exe"
!define ExeFile "${APP_NAME}_${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}${APP_VERSION_EMERGENCY}-conda-Windows-x86_64-installer-${APP_VERSION_BUILD}.exe"
#--------------------------------
# installer bit type - FreeCAD is only provided as 64bit build
!define MULTIUSER_USE_PROGRAMFILES64
#--------------------------------
# File locations
# !!! you need to adjust them to the folders in your Windows system !!!
!define FILES_FREECAD "G:\FreeCADInst\Installer\FreeCAD"
!define FILES_DEPS "G:\FreeCADInst\Installer\MSVCRedist"
!define FILES_THUMBS "G:\FreeCADInst\Installer\thumbnail"
+2 -1
View File
@@ -1 +1,2 @@
signtool.exe sign /f FCweborg.pfx /p FreeCADIsCool /fd sha512 /tr http://timestamp.digicert.com /td sha512 /v %1
signtool.exe sign /sha1 "1df70f0b16e019698bf6b38c8e66434fa96e6cf4" /tr http://time.certum.pl /td sha256 /fd sha256 /v %1
certutil -hashfile %1 SHA256 > %1-SHA256.txt
Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

@@ -13,13 +13,13 @@ Configuration and variables of FreeCAD installer
# Names and version
!define APP_NAME "FreeCAD"
!define APP_VERSION_NUMBER "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}.${APP_VERSION_BUILD}"
!define APP_VERSION_NUMBER "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}.${APP_VERSION_BUILD}"
# For the proposed install folder we use the scheme "FreeCAD 0.18"
# however for the Registry, we need the scheme "FreeCAD 0.18.x" in order
# to check if it is exactly this version (to support side-by-side installations)
!define APP_SERIES_NAME "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}"
!define APP_SERIES_KEY "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}"
!define APP_SERIES_KEY2 "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}"
!define APP_SERIES_KEY "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_PATCH}${APP_VERSION_EMERGENCY}"
!define APP_SERIES_KEY2 "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}"
!define APP_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
!define APP_DIR "${APP_NAME} ${APP_SERIES_NAME}"
# Fixme: FC should use different preferences folder for every release
@@ -60,7 +60,7 @@ Configuration and variables of FreeCAD installer
!define SETUP_ICON "icons\FreeCAD.ico"
!define SETUP_HEADERIMAGE "graphics\header.bmp"
!define SETUP_WIZARDIMAGE "graphics\orange.bmp"
!define SETUP_WIZARDIMAGE "graphics\banner.bmp"
!define SETUP_UNINSTALLER "Uninstall-${APP_NAME}.exe"
!define SETUP_UNINSTALLER_KEY "${APP_NAME}${APP_SERIES_KEY}"
+2 -2
View File
@@ -58,7 +58,7 @@ BrandingText " "
!insertmacro MUI_PAGE_INSTFILES
# The option to run FreeCAD from the finish page is currently disabled because
# it may run with Administrator priviledges, therefore causing a different
# it may run with Administrator privileges, therefore causing a different
# user directory to be used. This could be fixed by creating a separate
# process without UAC elevation.
#!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
@@ -92,7 +92,7 @@ BrandingText " "
VIProductVersion "${APP_VERSION_NUMBER}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${APP_DIR}.${APP_VERSION_REVISION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${APP_DIR}.${APP_VERSION_PATCH}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APP_INFO}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${APP_COPYRIGHT}"
@@ -28,7 +28,7 @@ Function PostMultiUserPageInit
# check if this FreeCAD version is already installed
ReadRegStr $0 SHCTX "${APP_UNINST_KEY}" "UninstallString"
${if} $0 != ""
# check if the uninstaller was acidentally deleted
# check if the uninstaller was accidentally deleted
# if so, don't bother the user if they really want to install a new FreeCAD over an existing one
# because they won't have a chance to deny this
@@ -50,7 +50,7 @@ Function PostMultiUserPageInit
# check if there is an existing FreeCAD installation of the same FreeCAD series
# we usually don't release more than 10 versions so with 20 we are safe to check if a newer version is installed
IntOp $4 ${APP_VERSION_REVISION} + 20
IntOp $4 ${APP_VERSION_PATCH} + 20
${for} $5 0 $4
ReadRegStr $0 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
# also check for an emergency release
@@ -138,7 +138,7 @@ Function .onInit
StrCpy $CreateFileAssociations "false"
${IfNot} ${Silent}
# Show banner while installer is intializating
# Show banner while installer is initializing
Banner::show /NOUNLOAD "Checking system"
Banner::destroy
${EndIf}
@@ -18,8 +18,8 @@
# and returns the number of the character in the FindStr where the SearchStr was found (Pointer)
# if nothing was found or the search is impossible the Pointer is set to -1
StrLen $R2 ${SearchStr}
StrLen $R4 ${FindStr}
StrLen $R2 "${SearchStr}"
StrLen $R4 "${FindStr}"
StrCpy $R5 0
${if} $R2 == 0
${orif} $R4 == 0
@@ -27,8 +27,8 @@
${endif}
IntCmp $R4 $R2 loopA NotFound
loopA:
StrCpy $R3 ${FindStr} $R2 $R5
StrCmp $R3 ${SearchStr} Found
StrCpy $R3 "${FindStr}" $R2 $R5
StrCmp $R3 "${SearchStr}" Found
IntOp $R5 $R5 + 1
IntCmp $R4 $R5 loopA NotFound
Goto loopA
@@ -8,14 +8,15 @@ Installation of program files, dictionaries and external components
#--------------------------------
# Program files
!include LogicLib.nsh
Section -ProgramFiles SecProgramFiles
# if the $INSTDIR does not contain "FreeCAD" we must add a subfolder to avoid that FreeCAD will e.g.
# be installed directly to C:\programs - the uninstaller will then delete the whole
# C:\programs directory
StrCpy $String $INSTDIR
StrCpy $Search ${APP_NAME}
StrCpy $String "$INSTDIR"
StrCpy $Search "${APP_NAME}"
Call StrPoint # function from Utils.nsh
${if} $Pointer == "-1"
StrCpy $INSTDIR "$INSTDIR\${APP_DIR}"
@@ -38,8 +39,11 @@ Section -ProgramFiles SecProgramFiles
File /r "${FILES_FREECAD}\bin\*.*"
# MSVC redistributable DLLs
SetOutPath "$INSTDIR\bin"
File "${FILES_DEPS}\*.*"
!ifdef FILES_DEPS
!echo "Including MSVC Redist files from ${FILES_DEPS}"
SetOutPath "$INSTDIR\bin"
File "${FILES_DEPS}\*.*"
!endif
# Others
SetOutPath "$INSTDIR\data"
@@ -52,8 +56,6 @@ Section -ProgramFiles SecProgramFiles
File /r "${FILES_FREECAD}\lib\*.*"
SetOutPath "$INSTDIR\Mod"
File /r "${FILES_FREECAD}\Mod\*.*"
SetOutPath "$INSTDIR\resources"
File /r "${FILES_FREECAD}\resources\*.*"
SetOutPath "$INSTDIR\translations"
File /r "${FILES_FREECAD}\translations\*.*"
SetOutPath "$INSTDIR"