new Windows installer for FC

This commit is contained in:
donovaly
2019-04-02 01:20:04 +02:00
committed by wmayer
parent ff1fb11af1
commit 5ccae96920
58 changed files with 5034 additions and 784 deletions

View File

@@ -0,0 +1,103 @@
/*
configure.nsh
Write registry information and configure FreeCAD
*/
#!define SHORTCUT '${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"'
#--------------------------------
# Registry information
Section -InstallData
# Registry information
WriteRegStr SHCTX ${APP_REGKEY} "" $INSTDIR
WriteRegStr SHCTX ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}"
# Start Menu shortcut
SetOutPath "$INSTDIR\bin" # this is the folder in which the shortcut is executed
# we must assure that the folder is not empty (happens on silent install and can accidentally happen)
${if} $StartmenuFolder == ""
StrCpy $StartmenuFolder "${APP_DIR}"
${endif}
CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
# Link to website and Wiki
WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WEBPAGE_INFO}.url" "InternetShortcut" "URL" "${APP_WEBPAGE}"
WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WIKI_INFO}.url" "InternetShortcut" "URL" "${APP_WIKI}"
# create desktop icon
${if} $CreateDesktopIcon == "true"
SetOutPath "$INSTDIR\bin"
CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
${endif}
# Uninstaller information
${If} $MultiUser.InstallMode == "CurrentUser"
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION} $(TEXT_INSTALL_CURRENTUSER)"
${Else}
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION}"
${EndIf}
WriteRegStr SHCTX ${APP_UNINST_KEY} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\FreeCAD.exe"
WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}"
WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "https://www.freecadweb.org/"
WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "${APP_NAME} Team"
WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "https://forum.freecadweb.org/"
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
# if we install over an older existing version, remove the old uninstaller information
${if} $OldVersionNumber < ${APP_SERIES_KEY}
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
# also delete in the case of an emergency release
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber1"
${endif}
SectionEnd
#--------------------------------
# Write FreeCAD file associations
Section -Configure
# Associate .FCStd files with FreeCAD for current user or all users
${if} $CreateFileAssociations == "true"
WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
${endif}
${if} $CreateFileAssociations == "true"
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
# we need to update also the automatically created entry about the FreeCAD.exe
# otherwise .FCStd-files will could be opened with an older FreeCAD version
ReadRegStr $0 SHCTX "Software\Classes\Applications\${BIN_FREECAD}\shell\open\command" ""
${if} $0 != "" # if something was found
WriteRegStr SHCTX "Software\Classes\Applications\${BIN_FREECAD}\shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
${endif}
# .FCStd
WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
# FIXME: what about .FCMat and .FCMacro?
# Refresh shell
${RefreshShellIcons}
${endif}
SectionEnd
#--------------------------------
#
Function StartFreeCAD
Exec "$INSTDIR\${APP_RUN}"
FunctionEnd

View File

@@ -0,0 +1,50 @@
/*
install.nsh
Installation of program files, dictionaries and external components
*/
#--------------------------------
# Program files
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 "FreeCAD"
Call StrPoint # function from Utils.nsh
${if} $Pointer == "-1"
StrCpy $INSTDIR "$INSTDIR\${APP_DIR}"
${endif}
# Install and register the core FreeCAD files
# Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
# $PLUGINSDIR is automatically deleted when the installer exits.
InitPluginsDir
# Binaries
SetOutPath "$INSTDIR"
# recursively copy all files under bin
File /r "${FILES_FREECAD}\bin"
# MSVC redistributable DLLs
SetOutPath "$INSTDIR\bin"
File "${FILES_DEPS}\*.*"
# Others
SetOutPath "$INSTDIR"
File /r "${FILES_FREECAD}\data"
File /r "${FILES_FREECAD}\doc"
File /r "${FILES_FREECAD}\Ext"
File /r "${FILES_FREECAD}\lib"
File /r "${FILES_FREECAD}\Mod"
# Create uninstaller
WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
SectionEnd

View File

@@ -0,0 +1,82 @@
/*
uninstall.nsh
Uninstall
*/
Var FileAssociation
# ----------------------------------
Section "un.FreeCAD" un.SecUnProgramFiles
SectionIn RO
# delete start menu folder
ReadRegStr $0 SHCTX "${APP_UNINST_KEY}" "StartMenu"
RMDir /r "$0"
# delete desktop icon
Delete "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
# remove file extension .FCStd
ReadRegStr $R0 SHCTX "Software\Classes\${APP_EXT}" ""
${if} $R0 == "${APP_REGNAME_DOC}"
DeleteRegKey SHCTX "Software\Classes\${APP_EXT}"
#DeleteRegKey SHCTX "Software\Classes\${APP_REGNAME_DOC}"
${endif}
${if} $MultiUser.Privileges == "Admin"
DeleteRegKey HKCR "${APP_NAME}.Document"
${endif}
# Uninstaller itself
Delete "$INSTDIR\${SETUP_UNINSTALLER}"
# Application folder
SetOutPath "$TEMP"
RMDir /r "$INSTDIR"
# Registry keys and values
DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
DeleteRegKey SHCTX "${APP_REGKEY}"
DeleteRegKey SHCTX "${APP_UNINST_KEY}"
DeleteRegKey HKCR "Applications\${BIN_FREECAD}"
DeleteRegValue HKCR "${APP_NAME}.Document\Shell\open\command" ""
DeleteRegValue HKCR "${APP_NAME}.Document\DefaultIcon" ""
# File associations
ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
${If} $FileAssociation == "${APP_REGNAME_DOC}"
DeleteRegKey SHELL_CONTEXT "Software\Classes\${APP_EXT}"
${EndIf}
# clean other registry entries
DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
DeleteRegKey SHCTX "SOFTWARE\${APP_REGKEY}"
SectionEnd
#---------------------------------
# user preferences
Section /o "un.$(UnFreeCADPreferencesTitle)" un.SecUnPreferences
# issue a warning dialog
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION $(DialogUnPreferences) /SD IDYES IDYES +2 # continue if yes
Goto NotPreferences
# remove FreeCAD's config files
StrCpy $AppSubfolder ${APP_DIR_USERDATA}
Call un.DelAppPathSub # function from Utils.nsh
NotPreferences:
# remove registry settings
DeleteRegKey HKCU "Software\${APP_NAME}\${APP_NAME}${APP_SERIES_NAME}"
SectionEnd
#---------------------------------
# Section descriptions
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
!insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END