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
56 # Variables used by all installer versions
57 !include "Variables.nsh"
59 #--------------------------------
60 # load some NSIS libraries
62 !include "LogicLib.nsh"
63 !include "FileFunc.nsh"
64 !include "StrFunc.nsh"
65 !include "TextFunc.nsh"
67 # Set of various macros and functions
68 !include "LyXUtils.nsh"
70 # Functions to check and configure the LaTeX-system
73 # Function to check if needed programs are missing or not
74 !include "MissingPrograms.nsh"
76 # Function for page to manually select LaTeX's installation folder
77 !include "LaTeXFolder.nsh"
79 # Functions for page to set installer language
80 # and LyX's menu language
81 !include "LanguageSettings.nsh"
83 # Function to configure LyX
84 !include "ConfigLyX.nsh"
86 # Function to configure needed third-party programs
87 !include "InstallThirdPartyProgs.nsh"
89 # Function for page to install Aspell dictionaries
92 #--------------------------------
93 # Remember the installer language
94 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
95 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
96 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
98 !define MUI_ABORTWARNING
99 !define MUI_HEADERIMAGE
100 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
101 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
102 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
103 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
106 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
107 !insertmacro MUI_PAGE_WELCOME
110 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
112 # Specify the installation directory.
113 !insertmacro MUI_PAGE_DIRECTORY
115 # Specify LyX's menu language.
116 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
118 # Define which components to install.
119 !insertmacro MUI_PAGE_COMPONENTS
121 # Specify where to install program shortcuts.
122 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
123 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
124 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
125 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
126 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
128 # Select latex.exe manually
129 Page custom LatexFolder LatexFolder_LeaveFunction
131 # Check for needed programs
132 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
134 # Watch the components being installed.
135 !insertmacro MUI_PAGE_INSTFILES
138 !define MUI_FINISHPAGE_RUN
139 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
140 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
141 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
142 !insertmacro MUI_PAGE_FINISH
145 !insertmacro MUI_UNPAGE_COMPONENTS
146 !insertmacro MUI_UNPAGE_INSTFILES
148 #--------------------------------
151 !insertmacro MUI_LANGUAGE "English" # first language is the default language
152 !insertmacro MUI_LANGUAGE "Czech"
153 !insertmacro MUI_LANGUAGE "Danish"
154 !insertmacro MUI_LANGUAGE "Dutch"
155 !insertmacro MUI_LANGUAGE "French"
156 !insertmacro MUI_LANGUAGE "German"
157 !insertmacro MUI_LANGUAGE "Galician"
158 !insertmacro MUI_LANGUAGE "Hungarian"
159 !insertmacro MUI_LANGUAGE "Italian"
160 !insertmacro MUI_LANGUAGE "Japanese"
161 !insertmacro MUI_LANGUAGE "Norwegian"
162 !insertmacro MUI_LANGUAGE "Polish"
163 !insertmacro MUI_LANGUAGE "Portuguese"
164 !insertmacro MUI_LANGUAGE "Romanian"
165 !insertmacro MUI_LANGUAGE "Slovak"
166 !insertmacro MUI_LANGUAGE "Spanish"
167 !insertmacro MUI_LANGUAGE "Swedish"
168 !insertmacro MUI_LANGUAGE "Turkish"
170 !include "lyx_languages\english.nsh"
171 !include "lyx_languages\czech.nsh"
172 !include "lyx_languages\danish.nsh"
173 !include "lyx_languages\dutch.nsh"
174 !include "lyx_languages\french.nsh"
175 !include "lyx_languages\german.nsh"
176 !include "lyx_languages\galician.nsh"
177 !include "lyx_languages\hungarian.nsh"
178 !include "lyx_languages\italian.nsh"
179 !include "lyx_languages\japanese.nsh"
180 !include "lyx_languages\norwegian.nsh"
181 !include "lyx_languages\polish.nsh"
182 !include "lyx_languages\portuguese.nsh"
183 !include "lyx_languages\romanian.nsh"
184 !include "lyx_languages\slovak.nsh"
185 !include "lyx_languages\spanish.nsh"
186 !include "lyx_languages\swedish.nsh"
187 !include "lyx_languages\turkish.nsh"
189 LicenseData "$(LyXLicenseData)"
191 #--------------------------------
194 # These files are inserted before other files in the data block
195 !insertmacro MUI_RESERVEFILE_LANGDLL
196 ReserveFile "io_ui_language.ini"
197 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
199 #--------------------------------
202 Section "!${PRODUCT_NAME}" SecCore
205 Section "$(SecAllUsersTitle)" SecAllUsers
206 SetShellVarContext all
207 StrCpy $ProductRootKey "HKLM"
209 Section "$(SecFileAssocTitle)" SecFileAssoc
210 StrCpy $CreateFileAssociations "true"
212 Section "$(SecDesktopTitle)" SecDesktop
213 StrCpy $CreateDesktopIcon "true"
216 # Section descriptions
217 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
218 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
219 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
220 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
221 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
222 !insertmacro MUI_FUNCTION_DESCRIPTION_END
224 # the installation section
225 !include "InstallActions-complete-small.nsh"
227 #--------------------------------
228 # This hook function is called internally by NSIS on installer startup
231 # set the installer language to the Windows locale language
232 System::Call "kernel32::GetUserDefaultLangID()i.a"
234 # check that the installer is not currently running
235 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
238 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
241 FindProcDLL::FindProc "${INSTALLER2_EXE}"
243 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
247 # check if LyX is already installed
248 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
250 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
255 # these can be reset to "all" in section SecAllUsers
256 SetShellVarContext current
257 StrCpy $ProductRootKey "HKCU"
259 # this can be reset to "true" in section SecDesktop
260 StrCpy $CreateDesktopIcon "false"
261 StrCpy $CreateFileAssociations "false"
263 # if the user does *not* have administrator privileges, abort
266 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
267 ${if} $Answer == "yes"
268 !define ENABLE 0x00000001
269 SectionGetFlags ${SecAllUsers} $0
270 IntOp $0 $0 | ${ENABLE}
271 SectionSetFlags ${SecAllUsers} $0
274 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
278 # check the LaTeX-system
279 Call LaTeXActions # Function from LaTeX.nsh
281 # check which programs are installed or not
282 Call MissingPrograms # function from MissingPrograms.nsh
284 # used later in the function LatexFolder
290 #--------------------------------
292 Function LaunchProduct
296 #--------------------------------
299 !include "Uninstall.nsh"