5 Installation of program files, dictionaries and external components
9 #--------------------------------
13 Var PythonCompileReturn
16 Section -ProgramFiles SecProgramFiles
18 # Install and register the core LyX files
20 # The macros are defined in filelists.nsh
21 # the parameters are COMMAND DIRECTORY that form command '${COMMAND} "${DIRECTORY}files"
23 # Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
24 # $PLUGINSDIR is automatically deleted when the installer exits.
28 SetOutPath "$INSTDIR\bin"
29 !insertmacro FileListLyXBin File "${FILES_LYX}\bin\"
30 !insertmacro FileListLyXLauncher File "${FILES_LYX}\bin\"
31 !insertmacro FileListQtBin File "${FILES_QT}\bin\"
32 !insertmacro FileListDll File "${FILES_DEPS}\bin\"
33 !insertmacro FileListMSVC File "${FILES_MSVC}\"
34 !insertmacro FileListNetpbmBin File "${FILES_NETPBM}\"
35 !insertmacro FileListDTLBin File "${FILES_DTL}\"
36 !insertmacro FileListDvipostBin File "${FILES_DVIPOST}\"
37 !insertmacro FileListPDFViewBin File "${FILES_PDFVIEW}\"
38 !insertmacro FileListPDFToolsBin File "${FILES_PDFTOOLS}\"
39 !insertmacro FileListMetaFile2EPS File "${FILES_METAFILE2EPS}\"
43 # recursively copy all files under Resources
44 File /r "${FILES_LYX}\Resources"
48 # recursively copy all files under Python
49 File /r "${FILES_PYTHON}"
51 #SetOutPath "$INSTDIR\python"
52 #!insertmacro FileListMSVC File "${FILES_MSVC}\"
55 # Compile all Pyton files to byte-code
56 # The user using the scripts may not have write access
57 FileOpen $PythonCompileFile "$INSTDIR\compilepy.py" w
58 FileWrite $PythonCompileFile "import compileall$\r$\n"
59 FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\python\Lib')$\r$\n"
60 FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\Resources')$\r$\n"
61 FileClose $PythonCompileFile
62 DetailPrint $(TEXT_CONFIGURE_PYTHON)
63 nsExec::ExecToLog '"$INSTDIR\python\python.exe" "$INSTDIR\compilepy.py"'
64 Pop $PythonCompileReturn # Return value
65 Delete "$INSTDIR\compilepy.py"
67 # Components of ImageMagick
68 SetOutPath "$INSTDIR\imagemagick"
69 File /r "${FILES_IMAGEMAGICK}\"
70 !insertmacro FileListMSVC File "${FILES_MSVC}\"
72 # Components of Ghostscript
73 SetOutPath "$INSTDIR\ghostscript"
74 File /r "${FILES_GHOSTSCRIPT}\"
75 !insertmacro FileListMSVC File "${FILES_MSVC}\"
77 !if ${SETUPTYPE} == BUNDLE
79 # extract the GSview, Jabref and MiKTeX installer
80 File /r "${FILES_LYX}\external"
82 # install MiKTeX if not already installed
83 Call InstallMiKTeX # function from LaTeX.nsh
85 # install JabRef if not already installed and the user selected it
86 # if no BibTeX editor is installed
87 ${if} $PathBibTeXEditor == ""
88 ${if} $InstallJabRef == "true"
90 MessageBox MB_OK|MB_ICONINFORMATION "$(JabRefInfo)"
91 ExecWait "$INSTDIR\${JabRefInstall}"
92 # test if JabRef is now installed
93 StrCpy $PathBibTeXEditor ""
94 ReadRegStr $PathBibTeXEditor HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "UninstallString"
95 ${if} $PathBibTeXEditor == ""
96 MessageBox MB_OK|MB_ICONEXCLAMATION "$(JabRefError)"
98 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to tell the uninstaller that it was installed with LyX
104 # install eLyXer as Python module
105 ExecWait '"$INSTDIR\python\python.exe" "$INSTDIR\python\setup.py" install'
107 # install the LaTeX class files that are delivered with LyX
108 # and enable MiKTeX's automatic package installation
109 ${if} $LaTeXInstalled == "MiKTeX"
110 Call ConfigureMiKTeX # Function from LaTeX.nsh
114 WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
118 #--------------------------------
119 # Support code for file downloads
121 !macro DOWNLOAD_FILE RET ID FILENAME APPEND
125 # RET = Return value (OK if succesful)
126 # ID = Name of the download in settings.nsh
127 # FILENAME = Location to store file
128 # APPEND = Filename to append to server location in settings.nsh
131 NSISdl::download "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}"
132 Pop ${RET} # Return value (OK if succesful)
135 # Download failed, try again (usally we get a different mirror)
136 NSISdl::download "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}"
142 #--------------------------------
143 # Extenral components
148 !macro EXTERNAL COMPONENT
150 # Download/Install the component
152 ${If} $Setup${COMPONENT} == ${TRUE}
154 StrCpy $Path${COMPONENT} "" ;A new one will be installed
156 !ifndef BUNDLESETUP_${COMPONENT}
157 !insertmacro EXTERNAL_DOWNLOAD ${COMPONENT}
159 !insertmacro EXTERNAL_INSTALL ${COMPONENT}
166 !macro EXTERNAL_RUNINSTALLER COMPONENT
168 # Run the installer application of the component that does the actual installation.
170 install_${COMPONENT}:
172 ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
174 # Updates the path environment variable of the instaler process to the latest system value
175 ReadRegStr $PathAllUsers HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path
176 ReadRegStr $PathCurrentUser HKCU "Environment" Path
177 System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$PathAllUsers;$PathCurrentUser").'
179 Call Search${COMPONENT}
181 ${If} $Path${COMPONENT} == ""
182 MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
185 Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
189 !macro EXTERNAL_DOWNLOAD COMPONENT
191 download_${COMPONENT}:
193 !insertmacro DOWNLOAD_FILE $DownloadResult "${COMPONENT}" "${COMPONENT}Setup.exe" ""
195 ${If} $DownloadResult != "OK"
197 MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($DownloadResult)" IDYES download_${COMPONENT}
198 Goto noinstall_${COMPONENT}
201 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
203 noinstall_${COMPONENT}:
207 !macro EXTERNAL_INSTALL COMPONENT
210 File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}}
212 !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
217 # Sections for external components
219 #Section -LaTeX ExternalLaTeX
220 # !insertmacro EXTERNAL LaTeX
223 /*Function InitExternal
225 # Get sizes of external component installers
227 #SectionGetSize ${ExternalLaTeX} $SizeLaTeX
231 !ifndef BUNDLESETUP_MIKTEX
232 IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}