dynare.nsi 5.8 KB
Newer Older
1 2
# Configuration file for building Dynare Windows Installer
# Uses "NullSoft Scriptable Installer System", aka NSIS (see http://nsis.sourceforge.net)
sebastien's avatar
v4:  
sebastien committed
3
# NSIS can be run from both Windows and Linux (see "nsis" package in Debian)
4

5
# How to build the installer:
6
# - build: the preprocessor, the MEX binaries (for MATLAB and for Octave), and the documentation (PDF files + HTML manual)
7
# - run "makensis dynare.nsi" to create the installer
8
# - if there is no failure, this will create a file "dynare-VERSION-win.exe" in the current directory
9

sebastien's avatar
sebastien committed
10
!include dynare-version.nsi
11

12 13
SetCompressor /SOLID lzma

14 15
Name "Dynare ${VERSION}"

16
OutFile "dynare-${VERSION}-win.exe"
17 18 19 20 21 22 23 24

InstallDir "c:\dynare\${VERSION}"

# Use the Modern User Interface (version 2)
!include MUI2.nsh

!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."
!insertmacro MUI_PAGE_WELCOME
25
!insertmacro MUI_PAGE_COMPONENTS
26 27 28 29
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_LINK_LOCATION http://www.dynare.org
!define MUI_FINISHPAGE_LINK "Go to Dynare homepage"
sebastien's avatar
v4:  
sebastien committed
30
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

!define REGLOC "Software\Microsoft\Windows\CurrentVersion\Uninstall\Dynare ${VERSION}"
!define SMLOC "$SMPROGRAMS\Dynare ${VERSION}"

!macro DETERMINE_CONTEXT
 # Determine if we are admin or not
 # This will change the start menu directory and the registry root key (HKLM or HKLU)
 UserInfo::getAccountType
 Pop $0
 StrCmp $0 "Admin" +3
 SetShellVarContext current
 Goto +2
 SetShellVarContext all
!macroend

53 54
Section "Dynare core (preprocessor and M-files)"
 SectionIn RO
55 56
!insertmacro DETERMINE_CONTEXT
 SetOutPath $INSTDIR
57
 File README.txt ..\NEWS mexopts-win32.bat mexopts-win64.bat ..\license.txt ..\VERSION
58 59

 SetOutPath $INSTDIR\matlab
sebastien's avatar
v4:  
sebastien committed
60
 File /r ..\matlab\*.m
61 62 63 64 65 66

 SetOutPath $INSTDIR\matlab\preprocessor32
 File ..\matlab\preprocessor32\dynare_m.exe

 SetOutPath $INSTDIR\matlab\preprocessor64
 File ..\matlab\preprocessor64\dynare_m.exe
67

68 69 70
 SetOutPath $INSTDIR\contrib
 File /r ..\contrib\*.m

71 72 73
 SetOutPath $INSTDIR\scripts
 File /r ..\scripts\*

74
 WriteUninstaller $INSTDIR\uninstall.exe
sebastien's avatar
v4:  
sebastien committed
75

76 77 78
 # Create start menu entries
 CreateDirectory "${SMLOC}"
 CreateShortcut "${SMLOC}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
79

80 81 82 83 84 85 86 87 88 89 90
 # Create entry in "Add/Remove programs"
 WriteRegStr SHELL_CONTEXT "${REGLOC}" "DisplayName" "Dynare ${VERSION}"
 WriteRegStr SHELL_CONTEXT "${REGLOC}" "DisplayVersion" "${VERSION}"
 WriteRegStr SHELL_CONTEXT "${REGLOC}" "InstallLocation" $INSTDIR
 WriteRegStr SHELL_CONTEXT "${REGLOC}" "UninstallString" "$INSTDIR\uninstall.exe"
 WriteRegDWORD SHELL_CONTEXT "${REGLOC}" "NoModify" 1
 WriteRegDWORD SHELL_CONTEXT "${REGLOC}" "NoRepair" 1
SectionEnd

SectionGroup "MEX files for MATLAB"

91 92 93
Section "MEX files for MATLAB 32-bit, version 7.5 to 8.6 (R2007b to R2015b)"
 SetOutPath $INSTDIR\mex\matlab\win32-7.5-8.6
 File ..\mex\matlab\win32-7.5-8.6\*.mexw32
94 95 96 97 98 99 100
SectionEnd

Section "MEX files for MATLAB 64-bit, version 7.5 to 7.7 (R2007b to R2008b)"
 SetOutPath $INSTDIR\mex\matlab\win64-7.5-7.7
 File ..\mex\matlab\win64-7.5-7.7\*.mexw64
SectionEnd

101 102 103
Section "MEX files for MATLAB 64-bit, version 7.8 to 9.3 (R2009a to R2017b)"
 SetOutPath $INSTDIR\mex\matlab\win64-7.8-9.3
 File ..\mex\matlab\win64-7.8-9.3\*.mexw64
104 105
SectionEnd

106 107 108 109 110
Section "MEX files for MATLAB 64-bit, version 9.4 (R2018a)"
 SetOutPath $INSTDIR\mex\matlab\win64-9.4
 File ..\mex\matlab\win64-9.4\*.mexw64
SectionEnd

111 112
SectionGroupEnd

113
SectionGroup "MEX files for Octave"
114

115
Section "MEX files for Octave 4.4.0 (MinGW, 64bit)"
116
 SetOutPath $INSTDIR\mex\octave
117
 File ..\mex\octave\*
118 119
SectionEnd

120
Section "MEX files for Octave 4.4.0 (MinGW, 32bit)"
121
 SetOutPath $INSTDIR\mex\octave32
122
 File ..\mex\octave32\*
123 124 125 126
SectionEnd

SectionGroupEnd

127 128
Section "Dynare++ (standalone executable)"
 SetOutPath $INSTDIR\dynare++
129
 File ..\dynare++\src\dynare++.exe ..\dynare++\extern\matlab\dynare_simul.m ..\dynare++\*.dll
130
SectionEnd
131

132
Section "Documentation and examples (Dynare and Dynare++)"
133
 SetOutPath $INSTDIR\doc
134
 File ..\doc\dynare.pdf ..\doc\guide.pdf ..\doc\bvar-a-la-sims.pdf ..\doc\dr.pdf ..\doc\macroprocessor\macroprocessor.pdf ..\doc\preprocessor\preprocessor.pdf ..\doc\parallel\parallel.pdf ..\doc\gsa\gsa.pdf ..\doc\dseries-and-reporting\dseriesReporting.pdf
135

136 137
 SetOutPath $INSTDIR\doc\dynare.html
 File ..\doc\dynare.html\*.html ..\doc\dynare.html\*.png
138

139
 SetOutPath $INSTDIR\doc\dynare++
140
 File ..\dynare++\doc\dynare++-tutorial.pdf ..\dynare++\doc\dynare++-ramsey.pdf ..\dynare++\sylv\sylvester.pdf ..\dynare++\tl\cc\tl.pdf ..\dynare++\integ\cc\integ.pdf ..\dynare++\kord\kord.pdf
141 142

 CreateShortcut "${SMLOC}\Documentation.lnk" "$INSTDIR\doc"
143 144

 SetOutPath $INSTDIR\examples
145 146 147 148
 File ..\examples\*.mod ..\examples\*.m

 SetOutPath $INSTDIR\examples\dynare++
 File ..\examples\dynare++\example1.mod ..\examples\dynare++\README.txt
149 150 151

 CreateShortcut "${SMLOC}\Examples.lnk" "$INSTDIR\examples"

152 153 154 155 156 157 158
SectionEnd

Section "Uninstall"
!insertmacro DETERMINE_CONTEXT

 # First delete the uninstaller
 Delete $INSTDIR\uninstall.exe
sebastien's avatar
v4:  
sebastien committed
159
 Delete $INSTDIR\README.txt
160
 Delete $INSTDIR\NEWS
161
 Delete $INSTDIR\license.txt
Sébastien Villemot's avatar
Sébastien Villemot committed
162 163
 Delete $INSTDIR\mexopts-win32.bat
 Delete $INSTDIR\mexopts-win64.bat
164
 Rmdir /r $INSTDIR\matlab
165
 Rmdir /r $INSTDIR\contrib
166
 Rmdir /r $INSTDIR\mex
167
 Rmdir /r $INSTDIR\dynare++
168
 Rmdir /r $INSTDIR\doc
169
 Rmdir /r $INSTDIR\examples
170
 Rmdir /r $INSTDIR\scripts
171 172 173 174 175 176 177 178 179
 # We don't force deletion of installation directory (with /r), to avoid deleting important files
 Rmdir $INSTDIR

 # Delete start menu entries
 Rmdir /r "${SMLOC}"

 # Delete entry in "Add/Remove programs"
 DeleteRegKey SHELL_CONTEXT "${REGLOC}"
SectionEnd