1 # Lyx for Windows, NSIS v2 series installer script
3 # File LyXInstaller-small.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 ideas of 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.30 or 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 "Small"
28 !define INSTALLER2_VERSION "Complete"
29 !define INSTALLER3_VERSION "Update"
30 !define INSTALLER_TYPE "NotUpdate"
33 !include "Settings.nsh"
35 #--------------------------------
36 # variables only used in this installer version
57 # Variables used by all installer versions
58 !include "Variables.nsh"
60 #--------------------------------
61 # load some NSIS libraries
63 !include "LogicLib.nsh"
64 !include "FileFunc.nsh"
65 !include "StrFunc.nsh"
66 !include "TextFunc.nsh"
68 # Set of various macros and functions
69 !include "LyXUtils.nsh"
71 # Functions to check and configure the LaTeX-system
74 # Function to check if needed programs are missing or not
75 !include "MissingPrograms.nsh"
77 # Function for page to manually select LaTeX's installation folder
78 !include "LaTeXFolder.nsh"
80 # Functions for page to set installer language
81 # and LyX's menu language
82 !include "LanguageSettings.nsh"
84 # Function to configure LyX
85 !include "ConfigLyX.nsh"
87 # Function to configure needed third-party programs
88 !include "InstallThirdPartyProgs.nsh"
90 # Function for page to install Aspell dictionaries
93 #--------------------------------
94 # Remember the installer language
95 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
96 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
97 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
99 !define MUI_ABORTWARNING
100 !define MUI_HEADERIMAGE
101 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
102 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
103 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
104 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
107 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
108 !insertmacro MUI_PAGE_WELCOME
111 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
113 # Specify the installation directory.
114 !insertmacro MUI_PAGE_DIRECTORY
116 # Specify LyX's menu language.
117 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
119 # Define which components to install.
120 !insertmacro MUI_PAGE_COMPONENTS
122 # Specify where to install program shortcuts.
123 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
124 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
125 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
126 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
127 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
129 # Select latex.exe manually
130 Page custom LatexFolder LatexFolder_LeaveFunction
132 # Check for needed programs
133 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
135 # Watch the components being installed.
136 !insertmacro MUI_PAGE_INSTFILES
139 !define MUI_FINISHPAGE_RUN
140 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
141 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
142 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
143 !insertmacro MUI_PAGE_FINISH
146 !insertmacro MUI_UNPAGE_COMPONENTS
147 !insertmacro MUI_UNPAGE_INSTFILES
149 #--------------------------------
152 !insertmacro MUI_LANGUAGE "English" # first language is the default language
153 !insertmacro MUI_LANGUAGE "Czech"
154 !insertmacro MUI_LANGUAGE "Danish"
155 !insertmacro MUI_LANGUAGE "Dutch"
156 !insertmacro MUI_LANGUAGE "French"
157 !insertmacro MUI_LANGUAGE "German"
158 !insertmacro MUI_LANGUAGE "Galician"
159 !insertmacro MUI_LANGUAGE "Hungarian"
160 !insertmacro MUI_LANGUAGE "Italian"
161 !insertmacro MUI_LANGUAGE "Japanese"
162 !insertmacro MUI_LANGUAGE "Norwegian"
163 !insertmacro MUI_LANGUAGE "Polish"
164 !insertmacro MUI_LANGUAGE "Portuguese"
165 !insertmacro MUI_LANGUAGE "Romanian"
166 !insertmacro MUI_LANGUAGE "Slovak"
167 !insertmacro MUI_LANGUAGE "Spanish"
168 !insertmacro MUI_LANGUAGE "Swedish"
169 !insertmacro MUI_LANGUAGE "Turkish"
171 !include "lyx_languages\english.nsh"
172 !include "lyx_languages\czech.nsh"
173 !include "lyx_languages\danish.nsh"
174 !include "lyx_languages\dutch.nsh"
175 !include "lyx_languages\french.nsh"
176 !include "lyx_languages\german.nsh"
177 !include "lyx_languages\galician.nsh"
178 !include "lyx_languages\hungarian.nsh"
179 !include "lyx_languages\italian.nsh"
180 !include "lyx_languages\japanese.nsh"
181 !include "lyx_languages\norwegian.nsh"
182 !include "lyx_languages\polish.nsh"
183 !include "lyx_languages\portuguese.nsh"
184 !include "lyx_languages\romanian.nsh"
185 !include "lyx_languages\slovak.nsh"
186 !include "lyx_languages\spanish.nsh"
187 !include "lyx_languages\swedish.nsh"
188 !include "lyx_languages\turkish.nsh"
190 LicenseData "$(LyXLicenseData)"
192 #--------------------------------
195 # These files are inserted before other files in the data block
196 !insertmacro MUI_RESERVEFILE_LANGDLL
197 ReserveFile "io_ui_language.ini"
198 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
200 #--------------------------------
203 Section "!${PRODUCT_NAME}" SecCore
206 Section "$(SecAllUsersTitle)" SecAllUsers
207 SetShellVarContext all
208 StrCpy $ProductRootKey "HKLM"
210 Section "$(SecFileAssocTitle)" SecFileAssoc
211 StrCpy $CreateFileAssociations "true"
213 Section "$(SecDesktopTitle)" SecDesktop
214 StrCpy $CreateDesktopIcon "true"
217 # Section descriptions
218 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
219 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
220 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
221 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
222 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
223 !insertmacro MUI_FUNCTION_DESCRIPTION_END
225 # the installation section
226 !include "InstallActions-complete-small.nsh"
228 #--------------------------------
229 # This hook function is called internally by NSIS on installer startup
232 # set the installer language to the Windows locale language
233 System::Call "kernel32::GetUserDefaultLangID()i.a"
235 # check that the installer is not currently running
236 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
239 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
242 FindProcDLL::FindProc "${INSTALLER2_EXE}"
244 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
248 # check if LyX is already installed
249 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
251 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
256 # these can be reset to "all" in section SecAllUsers
257 SetShellVarContext current
258 StrCpy $ProductRootKey "HKCU"
260 # this can be reset to "true" in section SecDesktop
261 StrCpy $CreateDesktopIcon "false"
262 StrCpy $CreateFileAssociations "false"
264 # if the user does *not* have administrator privileges, abort
267 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
268 ${if} $Answer == "yes"
269 !define ENABLE 0x00000001
270 SectionGetFlags ${SecAllUsers} $0
271 IntOp $0 $0 | ${ENABLE}
272 SectionSetFlags ${SecAllUsers} $0
275 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
279 # check the LaTeX-system
280 Call LaTeXActions # Function from LaTeX.nsh
282 # check which programs are installed or not
283 Call MissingPrograms # function from MissingPrograms.nsh
285 # used later in the function LatexFolder
291 #--------------------------------
293 Function LaunchProduct
297 #--------------------------------
300 !include "Uninstall.nsh"