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}\"
45 # recursively copy all files under Resources
46 File /r "${FILES_LYX}\Resources"
48 # Components of Python
50 SetOutPath "$INSTDIR\python"
51 !insertmacro FileListPythonBin File "${FILES_PYTHON}\"
52 !insertmacro FileListPythonDll File "$%SystemRoot%\System32\"
53 !insertmacro FileListUnicodeDll File "${FILES_PYTHON}\DLLs\"
54 SetOutPath "$INSTDIR\python\Lib"
55 !insertmacro FileListPythonLib File "${FILES_PYTHON}\Lib\"
56 SetOutPath "$INSTDIR\python\Lib\encodings"
57 !insertmacro FileListPythonLibEncodings File "${FILES_PYTHON}\Lib\encodings\"
61 # Copy installer to pluginsdir (a temp dir)
62 File /oname=$PLUGINSDIR\AspellData.exe "${FILES_ASPELLDATA}\AspellData.exe"
64 # Silently install AspellData.exe (/S option)
65 ${If} $MultiUser.InstallMode == "CurrentUser"
66 ExecWait '"$PLUGINSDIR\AspellData.exe" /S /CurrentUser'
68 ExecWait '"$PLUGINSDIR\AspellData.exe" /S /AllUsers'
71 # Remove the installer
72 Delete "$PLUGINSDIR\AspellData.exe"
76 SetOutPath "$INSTDIR\aiksaurus"
77 !insertmacro FileListAiksaurusData File "${FILES_AIKSAURUS}\"
79 # Helper DLLs for NSIS-based tools
81 SetOutPath "$INSTDIR\bin"
82 !insertmacro FileListNSISPluginsStandard File "${NSISDIR}\Plugins\"
83 !insertmacro FileListNSISPlugins File "${FILES_NSISPLUGINS}\"
85 # Metafile to EPS Converter
86 SetOutPath "$INSTDIR\bin"
87 !insertmacro FileListMetaFile2EPS File "${FILES_METAFILE2EPS}\"
89 # Postscript printer for metafile to EPS converter
90 SetOutPath "$INSTDIR\PSPrinter"
91 !insertmacro FileListPSPrinter File "${FILES_PSPRINTER}\"
94 WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
98 #--------------------------------
99 # Support code for file downloads
101 !macro DOWNLOAD_FILE RET ID FILENAME APPEND
103 # Downloads a file using the InetLoad plug-in (HTTP or FTP)
105 # RET = Return value (OK if succesful)
106 # ID = Name of the download in settings.nsh
107 # FILENAME = Location to store file
108 # APPEND = Filename to append to server location in settings.nsh
110 # Try first mirror server
111 InetLoad::load "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
112 Pop ${RET} # Return value (OK if succesful)
115 # Download failed, try second mirror server
116 InetLoad::load "${DOWNLOADALT_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
122 #--------------------------------
123 # Aspell dictionaries
126 Var DictionaryLangName
127 Var DictionaryLangCode
137 # Check whether the system or local version of Aspell should be used
138 # The patched Aspell uses the same logic
140 ReadRegStr $AspellPath HKCU "Software\Aspell" "Base Path"
142 ${If} $AspellPath == ""
143 StrCpy $AspellHive HKLM
145 StrCpy $AspellHive HKCU
150 !macro SECTION_DICT FILE LANGNAME LANGCODE SIZE
152 # One section for each dictionary
154 Section /o "${LANGNAME}"
158 StrCpy $DictionaryFile "${FILE}"
159 StrCpy $DictionaryLangName "${LANGNAME}"
160 StrCpy $DictionaryLangCode ${LANGCODE}
162 Call DownloadDictionary
168 # Include all sections
169 !insertmacro Dictionaries '!insertmacro SECTION_DICT'
171 Function DownloadDictionary
173 # Download and install a dictionary
177 !insertmacro DOWNLOAD_FILE $DownloadResult ASPELLDICTS aspell6-$DictionaryFile.exe /aspell6-$DictionaryFile.exe
179 ${If} $DownloadResult != "OK"
181 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_DICT) ($DownloadResult)" IDYES dict_download
187 ExecWait '"$PLUGINSDIR\aspell6-$DictionaryFile.exe" /NoDirChange /AutoClose'
189 ${If} $AspellHive == HKLM
190 ReadRegStr $DictionaryPath HKLM "Software\Aspell\Dictionaries" $DictionaryLangCode
192 ReadRegStr $DictionaryPath HKCU "Software\Aspell\Dictionaries" $DictionaryLangCode
195 ${If} $DictionaryPath == ""
196 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_NOTINSTALLED_DICT)" IDYES install_dict
199 Delete "$PLUGINSDIR\aspell6-$DictionaryFile.exe"
205 #--------------------------------
206 # Extenral components
211 !macro EXTERNAL COMPONENT
213 # Download/Install the component
215 ${If} $Setup${component} == ${TRUE}
217 StrCpy $Path${component} "" ;A new one will be installed
219 !ifndef SETUPTYPE_BUNDLE
220 !insertmacro EXTERNAL_DOWNLOAD ${component}
222 !insertmacro EXTERNAL_INSTALL ${component}
229 !macro EXTERNAL_RUNINSTALLER COMPONENT
231 # Run the installer application of the component that does the actual installation.
233 install_${COMPONENT}:
235 ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
237 # Updates the path environment variable of the instaler process to the latest system value
238 ReadRegStr $PathAllUsers HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path
239 ReadRegStr $PathCurrentUser HKCU "Environment" Path
240 System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$PathAllUsers;$PathCurrentUser").'
242 Call Search${COMPONENT}
244 ${If} $Path${COMPONENT} == ""
245 MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
248 Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
252 !ifndef SETUPTYPE_BUNDLE
254 !macro EXTERNAL_DOWNLOAD COMPONENT
256 download_${COMPONENT}:
258 !insertmacro DOWNLOAD_FILE $DownloadResult "${COMPONENT}" "${COMPONENT}Setup.exe" ""
260 ${If} $DownloadResult != "OK"
262 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($DownloadResult)" IDYES download_${COMPONENT}
263 Goto noinstall_${COMPONENT}
266 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
268 noinstall_${COMPONENT}:
274 !macro EXTERNAL_INSTALL COMPONENT
277 File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}}
279 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
285 # Sections for external components
287 Section -LaTeX ExternalLaTeX
288 !insertmacro EXTERNAL LaTeX
291 Section -ImageMagick ExternalImageMagick
292 !insertmacro EXTERNAL ImageMagick
295 Section -Ghostscript ExternalGhostscript
296 !insertmacro EXTERNAL Ghostscript
299 Function InitExternal
301 # Get sizes of external component installers
303 SectionGetSize ${ExternalLaTeX} $SizeLaTeX
304 SectionGetSize ${ExternalImageMagick} $SizeImageMagick
305 SectionGetSize ${ExternalGhostscript} $SizeGhostscript
307 !ifndef SETUPTYPE_BUNDLE
309 IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}
310 IntOp $SizeImagemagick $SizeImagemagick + ${SIZE_DOWNLOAD_IMAGEMAGICK}
311 IntOp $SizeGhostscript $SizeGhostscript + ${SIZE_DOWNLOAD_GHOSTSCRIPT}