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 FileListPDFViewBin File "${FILES_PDFVIEW}\"
39 !insertmacro FileListPDFToolsBin File "${FILES_PDFTOOLS}\"
43 SetOutPath "$INSTDIR\bin"
44 !insertmacro FileListLyXIcons File "${FILES_ICONS}\"
49 # recursively copy all files under Resources
50 File /r "${FILES_LYX}\Resources"
52 # Components of Python
54 SetOutPath "$INSTDIR\python"
55 !insertmacro FileListPythonBin File "${FILES_PYTHON}\"
56 !insertmacro FileListPythonDll File "$%SystemRoot%\System32\"
57 !insertmacro FileListUnicodeDll File "${FILES_PYTHON}\DLLs\"
58 SetOutPath "$INSTDIR\python\Lib"
59 !insertmacro FileListPythonLib File "${FILES_PYTHON}\Lib\"
60 SetOutPath "$INSTDIR\python\Lib\encodings"
61 !insertmacro FileListPythonLibEncodings File "${FILES_PYTHON}\Lib\encodings\"
65 # Copy installer to pluginsdir (a temp dir)
66 File /oname=$PLUGINSDIR\AspellData.exe "${FILES_ASPELLDATA}\AspellData.exe"
68 # Silently install AspellData.exe (/S option)
69 ${If} $MultiUser.InstallMode == "CurrentUser"
70 ExecWait '"$PLUGINSDIR\AspellData.exe" /S /CurrentUser'
72 ExecWait '"$PLUGINSDIR\AspellData.exe" /S /AllUsers'
75 # Remove the installer
76 Delete "$PLUGINSDIR\AspellData.exe"
80 SetOutPath "$INSTDIR\aiksaurus"
81 !insertmacro FileListAiksaurusData File "${FILES_AIKSAURUS}\"
83 # Helper DLLs for NSIS-based tools
85 SetOutPath "$INSTDIR\bin"
86 !insertmacro FileListNSISPluginsStandard File "${NSISDIR}\Plugins\"
87 !insertmacro FileListNSISPlugins File "${FILES_NSISPLUGINS}\"
90 WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
94 #--------------------------------
95 # Support code for file downloads
97 !macro DOWNLOAD_FILE RET ID FILENAME APPEND
99 # Downloads a file using the InetLoad plug-in (HTTP or FTP)
101 # RET = Return value (OK if succesful)
102 # ID = Name of the download in settings.nsh
103 # FILENAME = Location to store file
104 # APPEND = Filename to append to server location in settings.nsh
106 # Try first mirror server
107 InetLoad::load "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
108 Pop ${RET} # Return value (OK if succesful)
111 # Download failed, try second mirror server
112 InetLoad::load "${DOWNLOADALT_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
118 #--------------------------------
119 # Aspell dictionaries
122 Var DictionaryLangName
123 Var DictionaryLangCode
133 # Check whether the system or local version of Aspell should be used
134 # The patched Aspell uses the same logic
136 ReadRegStr $AspellPath HKCU "Software\Aspell" "Base Path"
138 ${If} $AspellPath == ""
139 StrCpy $AspellHive HKLM
141 StrCpy $AspellHive HKCU
146 !macro SECTION_DICT FILE LANGNAME LANGCODE SIZE
148 # One section for each dictionary
150 Section /o "${LANGNAME}"
154 StrCpy $DictionaryFile "${FILE}"
155 StrCpy $DictionaryLangName "${LANGNAME}"
156 StrCpy $DictionaryLangCode ${LANGCODE}
158 Call DownloadDictionary
164 # Include all sections
165 !insertmacro Dictionaries '!insertmacro SECTION_DICT'
167 Function DownloadDictionary
169 # Download and install a dictionary
173 !insertmacro DOWNLOAD_FILE $DownloadResult ASPELLDICTS aspell6-$DictionaryFile.exe /aspell6-$DictionaryFile.exe
175 ${If} $DownloadResult != "OK"
177 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_DICT) ($DownloadResult)" IDYES dict_download
183 ExecWait '"$PLUGINSDIR\aspell6-$DictionaryFile.exe" /NoDirChange /AutoClose'
185 ${If} $AspellHive == HKLM
186 ReadRegStr $DictionaryPath HKLM "Software\Aspell\Dictionaries" $DictionaryLangCode
188 ReadRegStr $DictionaryPath HKCU "Software\Aspell\Dictionaries" $DictionaryLangCode
191 ${If} $DictionaryPath == ""
192 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_NOTINSTALLED_DICT)" IDYES install_dict
195 Delete "$PLUGINSDIR\aspell6-$DictionaryFile.exe"
201 #--------------------------------
202 # Extenral components
207 !macro EXTERNAL COMPONENT
209 # Download/Install the component
211 ${If} $Setup${component} == ${TRUE}
213 StrCpy $Path${component} "" ;A new one will be installed
215 !ifndef SETUPTYPE_BUNDLE
216 !insertmacro EXTERNAL_DOWNLOAD ${component}
218 !insertmacro EXTERNAL_INSTALL ${component}
225 !macro EXTERNAL_RUNINSTALLER COMPONENT
227 # Run the installer application of the component that does the actual installation.
229 install_${COMPONENT}:
231 ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
233 # Updates the path environment variable of the instaler process to the latest system value
234 ReadRegStr $PathAllUsers HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path
235 ReadRegStr $PathCurrentUser HKCU "Environment" Path
236 System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$PathAllUsers;$PathCurrentUser").'
238 Call Search${COMPONENT}
240 ${If} $Path${COMPONENT} == ""
241 MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
244 Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
248 !ifndef SETUPTYPE_BUNDLE
250 !macro EXTERNAL_DOWNLOAD COMPONENT
252 download_${COMPONENT}:
254 !insertmacro DOWNLOAD_FILE $DownloadResult "${COMPONENT}" "${COMPONENT}Setup.exe" ""
256 ${If} $DownloadResult != "OK"
258 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($DownloadResult)" IDYES download_${COMPONENT}
259 Goto noinstall_${COMPONENT}
262 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
264 noinstall_${COMPONENT}:
270 !macro EXTERNAL_INSTALL COMPONENT
273 File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}}
275 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
281 # Sections for external components
283 Section -LaTeX ExternalLaTeX
284 !insertmacro EXTERNAL LaTeX
287 Section -ImageMagick ExternalImageMagick
288 !insertmacro EXTERNAL ImageMagick
291 Section -Ghostscript ExternalGhostscript
292 !insertmacro EXTERNAL Ghostscript
295 Function InitExternal
297 # Get sizes of external component installers
299 SectionGetSize ${ExternalLaTeX} $SizeLaTeX
300 SectionGetSize ${ExternalImageMagick} $SizeImageMagick
301 SectionGetSize ${ExternalGhostscript} $SizeGhostscript
303 !ifndef SETUPTYPE_BUNDLE
305 IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}
306 IntOp $SizeImagemagick $SizeImagemagick + ${SIZE_DOWNLOAD_IMAGEMAGICK}
307 IntOp $SizeGhostscript $SizeGhostscript + ${SIZE_DOWNLOAD_GHOSTSCRIPT}