-
Notifications
You must be signed in to change notification settings - Fork 4
/
quickstart-fortran-installer.nsi
167 lines (105 loc) · 4.59 KB
/
quickstart-fortran-installer.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
; NSIS Installer script for the Quickstart Fortran Command Line
; ---------------- Properties ----------------
; Name used in installer GUI
Name "Quickstart Fortran"
; Name for folder location and reg key
!define INSTALL_NAME "quickstart_fortran"
; Name of Start Menu group folder
!define SM_FOLDER "Quickstart Fortran"
; Installer icon
!define MUI_ICON "fortran-lang.ico"
; Compress installer
SetCompress auto
; Always produce unicode installer
Unicode true
; ---------------- Setup ----------------
; Use EnVar plugin (https://nsis.sourceforge.io/EnVar_plug-in)
!addplugindir ".\nsis-plugins\EnVar_plugin\Plugins\x86-unicode"
; Use the 'Modern' Installer UI macros
!include "MUI2.nsh"
; Default installation folder (local)
InstallDir "$LOCALAPPDATA\${INSTALL_NAME}"
; Get installation folder from registry if available
InstallDirRegKey HKCU "Software\${INSTALL_NAME}" ""
; Request application privileges
RequestExecutionLevel user
; ---------------- Installer Pages ----------------
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; ---------------- Uninstaller Pages ----------------
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; MUI Language
!insertmacro MUI_LANGUAGE "English"
; ---------------- Component: Core Installation ----------------
Section "-Quickstart Fortran" SecCore
SetOutPath "$INSTDIR"
File "quickstart_cmd.bat"
File "init.bat"
File /r "utils"
File "fortran-lang.ico"
; The output directory will be the shortcut working directory
SetOutPath "$DOCUMENTS"
CreateDirectory "$SMPROGRAMS\${SM_FOLDER}"
CreateShortcut "$SMPROGRAMS\${SM_FOLDER}\Launch Command Line.lnk" "$INSTDIR\quickstart_cmd.bat" "" "$INSTDIR\fortran-lang.ico"
CreateShortcut "$SMPROGRAMS\${SM_FOLDER}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
; Store installation folder
WriteRegStr HKCU "Software\${INSTALL_NAME}" "" $INSTDIR
; Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
; ---------------- Component: Mingw64 ----------------
Section "GFortran Compiler" SecGFortran
SetOutPath "$INSTDIR"
File /r "mingw64"
SectionEnd
; ---------------- Component: fpm ----------------
Section "FPM" SecFPM
SetOutPath "$INSTDIR"
File /r "fpm"
SectionEnd
; ---------------- Component: Git ----------------
Section "Git for Windows" SecGit
SetOutPath "$INSTDIR"
File /r "MinGit"
SectionEnd
; ---------------- Component: Desktop Shortcut ----------------
Section "Desktop Shortcut" SecDesktopShortcut
; The output directory will be the shortcut working directory
SetOutPath "$DOCUMENTS"
CreateShortcut "$DESKTOP\QuickStart Fortran Command Line.lnk" "$INSTDIR\quickstart_cmd.bat" "" "$INSTDIR\fortran-lang.ico"
SectionEnd
; ---------------- Component: Add to PATH ----------------
Section "Add to path" SecPath
EnVar::SetHKCU
EnVar::AddValue "PATH" "$INSTDIR\mingw64\bin"
EnVar::AddValue "PATH" "$INSTDIR\fpm"
EnVar::AddValue "PATH" "$INSTDIR\MinGit\mingw64\bin"
EnVar::AddValue "PATH" "$INSTDIR\utils"
SectionEnd
; ---------------- Uninstaller ----------------
Section "Uninstall"
Delete "$DESKTOP\QuickStart Fortran Command Line.lnk"
RMDir /r "$INSTDIR"
RMDir /r "$SMPROGRAMS\${SM_FOLDER}"
DeleteRegKey /ifempty HKCU "Software\${INSTALL_NAME}"
EnVar::SetHKCU
EnVar::DeleteValue "PATH" "$INSTDIR\mingw64\bin"
EnVar::DeleteValue "PATH" "$INSTDIR\fpm"
EnVar::DeleteValue "PATH" "$INSTDIR\MinGit\mingw64\bin"
EnVar::DeleteValue "PATH" "$INSTDIR\utils"
SectionEnd
; ---------------- Component description Strings (EN) ----------------
LangString DESC_SecGFortran ${LANG_ENGLISH} "The open source GCC GFortran compiler for Windows (MinGW-w64-msvcrt, winlibs.com)"
LangString DESC_SecFPM ${LANG_ENGLISH} "The Fortran Package Manager"
LangString DESC_SecGit ${LANG_ENGLISH} "Git version control (required for FPM)"
LangString DESC_SecDesktopShortcut ${LANG_ENGLISH} "Desktop shortcut to command line launcher"
LangString DESC_SecPath ${LANG_ENGLISH} "Add new installation to user PATH variable"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecGFortran} $(DESC_SecGFortran)
!insertmacro MUI_DESCRIPTION_TEXT ${SecFPM} $(DESC_SecFPM)
!insertmacro MUI_DESCRIPTION_TEXT ${SecGit} $(DESC_SecGit)
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} $(DESC_SecDesktopShortcut)
!insertmacro MUI_DESCRIPTION_TEXT ${SecPath} $(DESC_SecPath)
!insertmacro MUI_FUNCTION_DESCRIPTION_END