1 # Lyx for Windows, NSIS v2 series installer script
3 # File LyXInstaller-complete.nsi
4 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING or copy at
7 # http://www.lyx.org/about/license.php3
9 # Author Uwe Stöhr based on the work of Angus Leeming and Joost Verburg
10 # Full author contact details are available in file CREDITS or copy at
11 # http://www.lyx.org/about/credits.php
13 # This script requires NSIS 2.25 and newer
14 # http://nsis.sourceforge.net/
15 #--------------------------------
17 # Do a Cyclic Redundancy Check to make sure the installer
18 # was not corrupted by the download.
21 # Make the installer as small as possible.
24 #--------------------------------
25 # You should need to change only these macros...
27 !define INSTALLER_VERSION "Complete"
28 !define INSTALLER2_VERSION "Small"
29 !define INSTALLER3_VERSION "Update"
30 !define INSTALLER_TYPE "NotUpdate"
33 !include "Settings.nsh"
35 #--------------------------------
36 # variables only used in this installer version
56 # Variables used by all installer versions
72 Var CreateFileAssociations
91 #--------------------------------
92 # load some NSIS libraries
94 !include "LogicLib.nsh"
95 !include "FileFunc.nsh"
96 !include "StrFunc.nsh"
98 # Set of various macros and functions
99 !include "LyXUtils.nsh"
101 # Functions to check and configure the LaTeX-system
104 # Function to check if needed programs are missing or not
105 !include "MissingPrograms.nsh"
107 # Functions for page to set installer language
108 # and LyX's menu language
109 !include "LanguageSettings.nsh"
111 # Function to configure LyX
112 !include "ConfigLyX.nsh"
114 # Function for page to install Aspell dictionaries
115 !include "Aspell.nsh"
117 #--------------------------------
118 # Remember the installer language
119 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
120 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
121 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
123 !define MUI_ABORTWARNING
124 !define MUI_HEADERIMAGE
125 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
126 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
127 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
128 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
131 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
132 !insertmacro MUI_PAGE_WELCOME
135 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
137 # Specify the installation directory.
138 !insertmacro MUI_PAGE_DIRECTORY
140 # Specify LyX's menu language.
141 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
143 # Define which components to install.
144 !insertmacro MUI_PAGE_COMPONENTS
146 # Specify where to install program shortcuts.
147 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
148 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
149 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
150 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
151 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
153 # Check for needed programs
154 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
156 # Watch the components being installed.
157 !insertmacro MUI_PAGE_INSTFILES
160 !define MUI_FINISHPAGE_RUN
161 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
162 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
163 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
164 !insertmacro MUI_PAGE_FINISH
167 !insertmacro MUI_UNPAGE_COMPONENTS
168 !insertmacro MUI_UNPAGE_INSTFILES
170 #--------------------------------
173 !insertmacro MUI_LANGUAGE "English" # first language is the default language
174 !insertmacro MUI_LANGUAGE "Danish"
175 !insertmacro MUI_LANGUAGE "Dutch"
176 !insertmacro MUI_LANGUAGE "French"
177 !insertmacro MUI_LANGUAGE "German"
178 !insertmacro MUI_LANGUAGE "Galician"
179 !insertmacro MUI_LANGUAGE "Hungarian"
180 !insertmacro MUI_LANGUAGE "Italian"
181 !insertmacro MUI_LANGUAGE "Norwegian"
182 !insertmacro MUI_LANGUAGE "Polish"
183 !insertmacro MUI_LANGUAGE "Portuguese"
184 !insertmacro MUI_LANGUAGE "Slovak"
185 !insertmacro MUI_LANGUAGE "Spanish"
186 !insertmacro MUI_LANGUAGE "Swedish"
187 !insertmacro MUI_LANGUAGE "Turkish"
189 !include "lyx_languages\english.nsh"
190 !include "lyx_languages\danish.nsh"
191 !include "lyx_languages\dutch.nsh"
192 !include "lyx_languages\french.nsh"
193 !include "lyx_languages\german.nsh"
194 !include "lyx_languages\galician.nsh"
195 !include "lyx_languages\hungarian.nsh"
196 !include "lyx_languages\italian.nsh"
197 !include "lyx_languages\norwegian.nsh"
198 !include "lyx_languages\polish.nsh"
199 !include "lyx_languages\portuguese.nsh"
200 !include "lyx_languages\slovak.nsh"
201 !include "lyx_languages\spanish.nsh"
202 !include "lyx_languages\swedish.nsh"
203 !include "lyx_languages\turkish.nsh"
205 LicenseData "$(LyXLicenseData)"
207 #--------------------------------
210 # These files are inserted before other files in the data block
211 !insertmacro MUI_RESERVEFILE_LANGDLL
212 ReserveFile "io_ui_language.ini"
213 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
215 #--------------------------------
218 Section "!${PRODUCT_NAME}" SecCore
221 Section "$(SecAllUsersTitle)" SecAllUsers
222 SetShellVarContext all
223 StrCpy $ProductRootKey "HKLM"
225 Section "$(SecFileAssocTitle)" SecFileAssoc
226 StrCpy $CreateFileAssociations "true"
228 Section "$(SecDesktopTitle)" SecDesktop
229 StrCpy $CreateDesktopIcon "true"
231 Section /o "$(SecInstGSviewTitle)" SecInstGSview
233 StrCpy $InstallGSview "true"
235 Section /o "$(SecInstJabRefTitle)" SecInstJabRef
237 StrCpy $InstallJabRef "true"
240 # Section descriptions
241 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
242 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
243 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
244 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
245 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
246 !insertmacro MUI_DESCRIPTION_TEXT ${SecInstGSview} "$(SecInstGSviewDescription)"
247 !insertmacro MUI_DESCRIPTION_TEXT ${SecInstJabRef} "$(SecInstJabRefDescription)"
248 !insertmacro MUI_FUNCTION_DESCRIPTION_END
250 # the installation section
251 !include "InstallActions-complete.nsh"
253 #--------------------------------
254 # This hook function is called internally by NSIS on installer startup
257 # set the installer language to the Windows locale language
258 System::Call "kernel32::GetUserDefaultLangID()i.a"
260 # check that the installer is not currently running
261 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
264 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
267 FindProcDLL::FindProc "${INSTALLER2_EXE}"
269 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
273 # check if LyX is already installed
274 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
276 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
281 # these can be reset to "all" in section SecAllUsers
282 SetShellVarContext current
283 StrCpy $ProductRootKey "HKCU"
285 # this can be reset to "true" in section SecDesktop
286 StrCpy $CreateDesktopIcon "false"
287 StrCpy $CreateFileAssociations "false"
289 # if the user does *not* have administrator privileges, abort
292 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
293 ${if} $Answer == "yes"
294 !define ENABLE 0x00000001
295 SectionGetFlags ${SecAllUsers} $0
296 IntOp $0 $0 | ${ENABLE}
297 SectionSetFlags ${SecAllUsers} $0
300 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
304 # check the LaTeX-system
305 Call LaTeXActions # Function from LaTeX.nsh
307 # check which programs are installed or not
308 Call MissingPrograms # function from MissingPrograms.nsh
310 # don't let the installer sections appear when the programs are already installed
312 SectionSetText 4 "" # hides the corresponding uninstaller section, ${SecInstGSview}
314 ${if} $BibTeXEditorPath != ""
315 SectionSetText 5 "" # hides the corresponding uninstaller section, ${SecInstJabRef}
321 #--------------------------------
323 Function LaunchProduct
327 #--------------------------------
330 !include "Uninstall.nsh"