| 1 |
# Configuration file for building Dynare Windows Installer |
| 2 |
# Uses "NullSoft Scriptable Installer System", aka NSIS (see http://nsis.sourceforge.net) |
| 3 |
# NSIS can be run from both Windows and Linux (see "nsis" package in Debian) |
| 4 |
|
| 5 |
SetCompressor /SOLID lzma |
| 6 |
|
| 7 |
ManifestDPIAware true |
| 8 |
|
| 9 |
Name "Dynare ${VERSION}" |
| 10 |
|
| 11 |
OutFile "dynare-${VERSION}-win.exe" |
| 12 |
|
| 13 |
InstallDir "c:\dynare\${VERSION}" |
| 14 |
|
| 15 |
# Use the Modern User Interface (version 2) |
| 16 |
!include MUI2.nsh |
| 17 |
|
| 18 |
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Dynare ${VERSION}.$\n$\nDynare is distributed under the GNU General Public License (GPL) version 3.$\n$\nIf you accept the license, click Next button to continue the installation." |
| 19 |
!insertmacro MUI_PAGE_WELCOME |
| 20 |
!define MUI_COMPONENTSPAGE_NODESC |
| 21 |
!insertmacro MUI_PAGE_COMPONENTS |
| 22 |
!insertmacro MUI_PAGE_DIRECTORY |
| 23 |
!insertmacro MUI_PAGE_INSTFILES |
| 24 |
!define MUI_FINISHPAGE_LINK_LOCATION https://www.dynare.org |
| 25 |
!define MUI_FINISHPAGE_LINK "Go to Dynare homepage" |
| 26 |
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt |
| 27 |
!insertmacro MUI_PAGE_FINISH |
| 28 |
|
| 29 |
!insertmacro MUI_UNPAGE_WELCOME |
| 30 |
!insertmacro MUI_UNPAGE_INSTFILES |
| 31 |
!insertmacro MUI_UNPAGE_FINISH |
| 32 |
|
| 33 |
!insertmacro MUI_LANGUAGE "English" |
| 34 |
|
| 35 |
!define REGLOC "Software\Microsoft\Windows\CurrentVersion\Uninstall\Dynare ${VERSION}" |
| 36 |
!define SMLOC "$SMPROGRAMS\Dynare ${VERSION}" |
| 37 |
|
| 38 |
!macro DETERMINE_CONTEXT |
| 39 |
# Determine if we are admin or not |
| 40 |
# This will change the start menu directory and the registry root key (HKLM or HKLU) |
| 41 |
UserInfo::getAccountType |
| 42 |
Pop $0 |
| 43 |
StrCmp $0 "Admin" +3 |
| 44 |
SetShellVarContext current |
| 45 |
Goto +2 |
| 46 |
SetShellVarContext all |
| 47 |
!macroend |
| 48 |
|
| 49 |
|
| 50 |
Section "Dynare core (preprocessor and M-files)" |
| 51 |
SectionIn RO |
| 52 |
!insertmacro DETERMINE_CONTEXT |
| 53 |
SetOutPath $INSTDIR |
| 54 |
File README.txt ..\NEWS.md ..\license.txt |
| 55 |
|
| 56 |
SetOutPath $INSTDIR\matlab |
| 57 |
File /r ..\matlab\*.m ..\matlab\*.json ..\build-win-matlab\dynare_version.m |
| 58 |
|
| 59 |
SetOutPath $INSTDIR\preprocessor |
| 60 |
File ..\build-win-matlab\preprocessor\src\dynare-preprocessor.exe |
| 61 |
|
| 62 |
SetOutPath $INSTDIR\matlab\preprocessor64 |
| 63 |
File ..\matlab\preprocessor64\dynare_m.exe |
| 64 |
|
| 65 |
SetOutPath $INSTDIR\matlab\dseries\externals\x13\windows\64 |
| 66 |
File deps\x13as\x13as.exe |
| 67 |
|
| 68 |
SetOutPath $INSTDIR\contrib |
| 69 |
File /r ..\contrib\*.m |
| 70 |
|
| 71 |
SetOutPath $INSTDIR\scripts |
| 72 |
File ..\scripts\dynare.el |
| 73 |
|
| 74 |
WriteUninstaller $INSTDIR\uninstall.exe |
| 75 |
|
| 76 |
# Create entry in "Add/Remove programs" |
| 77 |
WriteRegStr SHELL_CONTEXT "${REGLOC}" "DisplayName" "Dynare ${VERSION}" |
| 78 |
WriteRegStr SHELL_CONTEXT "${REGLOC}" "DisplayVersion" "${VERSION}" |
| 79 |
WriteRegStr SHELL_CONTEXT "${REGLOC}" "InstallLocation" $INSTDIR |
| 80 |
WriteRegStr SHELL_CONTEXT "${REGLOC}" "UninstallString" "$INSTDIR\uninstall.exe" |
| 81 |
WriteRegDWORD SHELL_CONTEXT "${REGLOC}" "NoModify" 1 |
| 82 |
WriteRegDWORD SHELL_CONTEXT "${REGLOC}" "NoRepair" 1 |
| 83 |
|
| 84 |
# Remove "Modify" permission to "Authenticated Users". |
| 85 |
# This permission is inherited by default, since we're writing to "c:\dynare\"; |
| 86 |
# it implies that anybody on the system can modify Dynare installation files, |
| 87 |
# which is a security issue. |
| 88 |
# Intigriti reference: DYNARE-7TULYVR8 |
| 89 |
# On icacls, see e.g.: https://4sysops.com/archives/icacls-list-set-grant-remove-and-deny-permissions/#inheriting-permissions |
| 90 |
nsExec::Exec 'icacls "$INSTDIR" /inheritance:d' |
| 91 |
nsExec::Exec 'icacls "$INSTDIR" /remove:g "NT AUTHORITY\Authenticated Users"' |
| 92 |
SectionEnd |
| 93 |
|
| 94 |
|
| 95 |
Section "MEX files for MATLAB 64-bit, version 9.8 to 26.1 (R2020a to R2026a)" |
| 96 |
SetOutPath $INSTDIR\mex\matlab\win64-9.8-26.1 |
| 97 |
File ..\build-win-matlab\*.mexw64 |
| 98 |
SectionEnd |
| 99 |
|
| 100 |
Section "MinGW compiler for MATLAB 64-bit" |
| 101 |
SetOutPath $INSTDIR\ucrt64 |
| 102 |
File /r deps\gcc\ucrt64\* |
| 103 |
SectionEnd |
| 104 |
|
| 105 |
Section "MEX files for Octave 11.1.0 (64-bit)" |
| 106 |
SetOutPath $INSTDIR\mex\octave\win64 |
| 107 |
File ..\build-win-octave\*.mex |
| 108 |
SectionEnd |
| 109 |
|
| 110 |
Section "Documentation and examples" |
| 111 |
SetOutPath $INSTDIR\doc |
| 112 |
File ..\build-doc\dynare-manual.pdf ..\build-doc\guide.pdf ..\build-doc\bvar-a-la-sims.pdf ..\build-doc\dr.pdf ..\build-doc\sylvester.pdf ..\build-doc\tl.pdf ..\build-doc\preprocessor\doc\macroprocessor.pdf ..\build-doc\preprocessor\doc\preprocessor.pdf ..\build-doc\parallel.pdf ..\build-doc\gsa.pdf ..\build-doc\dseriesReporting.pdf |
| 113 |
|
| 114 |
SetOutPath $INSTDIR\doc\dynare-manual.html |
| 115 |
File /r ..\build-doc\dynare-manual.html\* |
| 116 |
|
| 117 |
SetOutPath $INSTDIR\examples |
| 118 |
File /r ..\examples\* |
| 119 |
|
| 120 |
# Create start menu entries |
| 121 |
CreateDirectory "${SMLOC}" |
| 122 |
CreateShortcut "${SMLOC}\Documentation.lnk" "$INSTDIR\doc" |
| 123 |
CreateShortcut "${SMLOC}\Examples.lnk" "$INSTDIR\examples" |
| 124 |
SectionEnd |
| 125 |
|
| 126 |
|
| 127 |
Section "Uninstall" |
| 128 |
!insertmacro DETERMINE_CONTEXT |
| 129 |
|
| 130 |
# First delete the uninstaller |
| 131 |
Delete $INSTDIR\uninstall.exe |
| 132 |
Delete $INSTDIR\README.txt |
| 133 |
Delete $INSTDIR\NEWS.md |
| 134 |
Delete $INSTDIR\license.txt |
| 135 |
Delete $INSTDIR\VERSION |
| 136 |
Rmdir /r $INSTDIR\matlab |
| 137 |
Rmdir /r $INSTDIR\preprocessor |
| 138 |
Rmdir /r $INSTDIR\contrib |
| 139 |
Rmdir /r $INSTDIR\mex |
| 140 |
Rmdir /r $INSTDIR\doc |
| 141 |
Rmdir /r $INSTDIR\examples |
| 142 |
Rmdir /r $INSTDIR\scripts |
| 143 |
Rmdir /r $INSTDIR\ucrt64 |
| 144 |
# We don't force deletion of installation directory (with /r), to avoid deleting important files |
| 145 |
Rmdir $INSTDIR |
| 146 |
|
| 147 |
# Delete start menu entries |
| 148 |
Rmdir /r "${SMLOC}" |
| 149 |
|
| 150 |
# Delete entry in "Add/Remove programs" |
| 151 |
DeleteRegKey SHELL_CONTEXT "${REGLOC}" |
| 152 |
SectionEnd |