5 Installation of program files, dictionaries and external components
9 #--------------------------------
12 Section -ProgramFiles SecProgramFiles
14 # Install and register the core LyX files
15 # Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
16 # $PLUGINSDIR is automatically deleted when the installer exits.
21 SetOutPath "$INSTDIR\bin"
23 # launcher becomes lyx.exe while the real lyx.exe is renamed to lyxc.exe
24 File "${FILES_LAUNCHER}\lyx.exe"
25 File /oname=lyxc.exe "${FILES_LYX}\bin\lyx.exe"
27 # The macros are defined in filelists.nsh
28 # the parameters are COMMAND DIRECTORY that form command '${COMMAND} "${DIRECTORY}files"
29 !insertmacro FileListLyXBin File "${FILES_LYX}\bin\"
30 !insertmacro FileListQtBin File "${FILES_QT}\bin\"
32 !insertmacro FileListDllMSVCBin File "${FILES_DEPS}\bin\"
33 !insertmacro FileListMSVCBin File "${FILES_MSVC}\"
34 !insertmacro FileListMSVCManifest File "..\"
36 !insertmacro FileListNetpbmBin File "${FILES_NETPBM}\"
37 !insertmacro FileListDTLBin File "${FILES_DTL}\"
38 !insertmacro FileListDvipostBin File "${FILES_DVIPOST}\"
39 !insertmacro FileListPDFViewBin File "${FILES_PDFVIEW}\"
40 !insertmacro FileListPDFToolsBin File "${FILES_PDFTOOLS}\"
44 SetOutPath "$INSTDIR\bin"
45 !insertmacro FileListLyXIcons File "${FILES_ICONS}\"
50 # recursively copy all files under Resources
51 File /r "${FILES_LYX}\Resources"
53 # Components of Python
55 SetOutPath "$INSTDIR\python"
56 !insertmacro FileListPythonBin File "${FILES_PYTHON}\"
57 !insertmacro FileListPythonDll File "$%SystemRoot%\System32\"
58 !insertmacro FileListUnicodeDll File "${FILES_PYTHON}\DLLs\"
59 SetOutPath "$INSTDIR\python\Lib"
60 !insertmacro FileListPythonLib File "${FILES_PYTHON}\Lib\"
61 SetOutPath "$INSTDIR\python\Lib\encodings"
62 !insertmacro FileListPythonLibEncodings File "${FILES_PYTHON}\Lib\encodings\"
66 # Copy installer to pluginsdir (a temp dir)
67 File /oname=$PLUGINSDIR\AspellData.exe "${FILES_ASPELLDATA}\AspellData.exe"
69 # Silently install AspellData.exe (/S option)
70 ${If} $MultiUser.InstallMode == "CurrentUser"
71 ExecWait '"$PLUGINSDIR\AspellData.exe" /S /CurrentUser'
73 ExecWait '"$PLUGINSDIR\AspellData.exe" /S /AllUsers'
76 # Remove the installer
77 Delete "$PLUGINSDIR\AspellData.exe"
81 SetOutPath "$INSTDIR\aiksaurus"
82 !insertmacro FileListAiksaurusData File "${FILES_AIKSAURUS}\"
84 # Helper DLLs for NSIS-based tools
86 SetOutPath "$INSTDIR\bin"
87 !insertmacro FileListNSISPluginsStandard File "${NSISDIR}\Plugins\"
88 !insertmacro FileListNSISPlugins File "${FILES_NSISPLUGINS}\"
91 WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
95 #--------------------------------
96 # Support code for file downloads
98 !macro DOWNLOAD_FILE RET ID FILENAME APPEND
100 # Downloads a file using the InetLoad plug-in (HTTP or FTP)
102 # RET = Return value (OK if succesful)
103 # ID = Name of the download in settings.nsh
104 # FILENAME = Location to store file
105 # APPEND = Filename to append to server location in settings.nsh
107 # Try first mirror server
108 InetLoad::load "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
109 Pop ${RET} # Return value (OK if succesful)
112 # Download failed, try second mirror server
113 InetLoad::load "${DOWNLOADALT_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
119 #--------------------------------
120 # Aspell dictionaries
123 Var DictionaryLangName
124 Var DictionaryLangCode
134 # Check whether the system or local version of Aspell should be used
135 # The patched Aspell uses the same logic
137 ReadRegStr $AspellPath HKCU "Software\Aspell" "Base Path"
139 ${If} $AspellPath == ""
140 StrCpy $AspellHive HKLM
142 StrCpy $AspellHive HKCU
147 !macro SECTION_DICT FILE LANGNAME LANGCODE SIZE
149 # One section for each dictionary
151 Section /o "${LANGNAME}"
155 StrCpy $DictionaryFile "${FILE}"
156 StrCpy $DictionaryLangName "${LANGNAME}"
157 StrCpy $DictionaryLangCode ${LANGCODE}
159 Call DownloadDictionary
165 # Include all sections
166 !insertmacro Dictionaries '!insertmacro SECTION_DICT'
168 Function DownloadDictionary
170 # Download and install a dictionary
174 !insertmacro DOWNLOAD_FILE $DownloadResult ASPELLDICTS aspell6-$DictionaryFile.exe /aspell6-$DictionaryFile.exe
176 ${If} $DownloadResult != "OK"
178 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_DICT) ($DownloadResult)" IDYES dict_download
184 ExecWait '"$PLUGINSDIR\aspell6-$DictionaryFile.exe" /NoDirChange /AutoClose'
186 ${If} $AspellHive == HKLM
187 ReadRegStr $DictionaryPath HKLM "Software\Aspell\Dictionaries" $DictionaryLangCode
189 ReadRegStr $DictionaryPath HKCU "Software\Aspell\Dictionaries" $DictionaryLangCode
192 ${If} $DictionaryPath == ""
193 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_NOTINSTALLED_DICT)" IDYES install_dict
196 Delete "$PLUGINSDIR\aspell6-$DictionaryFile.exe"
202 #--------------------------------
203 # Extenral components
208 !macro EXTERNAL COMPONENT
210 # Download/Install the component
212 ${If} $Setup${component} == ${TRUE}
214 StrCpy $Path${component} "" ;A new one will be installed
216 !ifndef SETUPTYPE_BUNDLE
217 !insertmacro EXTERNAL_DOWNLOAD ${component}
219 !insertmacro EXTERNAL_INSTALL ${component}
226 !macro EXTERNAL_RUNINSTALLER COMPONENT
228 # Run the installer application of the component that does the actual installation.
230 install_${COMPONENT}:
232 ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
234 # Updates the path environment variable of the instaler process to the latest system value
235 ReadRegStr $PathAllUsers HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path
236 ReadRegStr $PathCurrentUser HKCU "Environment" Path
237 System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$PathAllUsers;$PathCurrentUser").'
239 Call Search${COMPONENT}
241 ${If} $Path${COMPONENT} == ""
242 MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
245 Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
249 !ifndef SETUPTYPE_BUNDLE
251 !macro EXTERNAL_DOWNLOAD COMPONENT
253 download_${COMPONENT}:
255 !insertmacro DOWNLOAD_FILE $DownloadResult "${COMPONENT}" "${COMPONENT}Setup.exe" ""
257 ${If} $DownloadResult != "OK"
259 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($DownloadResult)" IDYES download_${COMPONENT}
260 Goto noinstall_${COMPONENT}
263 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
265 noinstall_${COMPONENT}:
271 !macro EXTERNAL_INSTALL COMPONENT
274 File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}}
276 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
282 # Sections for external components
284 Section -LaTeX ExternalLaTeX
285 !insertmacro EXTERNAL LaTeX
288 Section -ImageMagick ExternalImageMagick
289 !insertmacro EXTERNAL ImageMagick
292 Section -Ghostscript ExternalGhostscript
293 !insertmacro EXTERNAL Ghostscript
296 Function InitExternal
298 # Get sizes of external component installers
300 SectionGetSize ${ExternalLaTeX} $SizeLaTeX
301 SectionGetSize ${ExternalImageMagick} $SizeImageMagick
302 SectionGetSize ${ExternalGhostscript} $SizeGhostscript
304 !ifndef SETUPTYPE_BUNDLE
306 IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}
307 IntOp $SizeImagemagick $SizeImagemagick + ${SIZE_DOWNLOAD_IMAGEMAGICK}
308 IntOp $SizeGhostscript $SizeGhostscript + ${SIZE_DOWNLOAD_GHOSTSCRIPT}