2008-03-30 21:37:53 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
install.nsh
|
|
|
|
|
|
|
|
Installation of program files, dictionaries and external components
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#--------------------------------
|
|
|
|
# Program files
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
Var PythonCompileFile
|
|
|
|
Var PythonCompileReturn
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Section -ProgramFiles SecProgramFiles
|
|
|
|
|
|
|
|
# Install and register the core LyX files
|
2008-05-01 18:33:36 +00:00
|
|
|
|
|
|
|
# The macros are defined in filelists.nsh
|
|
|
|
# the parameters are COMMAND DIRECTORY that form command '${COMMAND} "${DIRECTORY}files"
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
|
|
|
|
# $PLUGINSDIR is automatically deleted when the installer exits.
|
|
|
|
InitPluginsDir
|
|
|
|
|
2009-08-21 22:35:41 +00:00
|
|
|
# Delete stuff from previous versions
|
2008-05-01 18:33:36 +00:00
|
|
|
Delete "$INSTDIR\bin\lyxc.exe"
|
2009-08-21 22:35:41 +00:00
|
|
|
RMDir /r "$INSTDIR\ghostscript\bin"
|
|
|
|
RMDir /r "$INSTDIR\ghostscript\lib"
|
|
|
|
RMDir /r "$INSTDIR\ghostscript\fonts"
|
|
|
|
RMDir /r "$INSTDIR\imagemagick"
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
# Binaries
|
2008-03-30 21:37:53 +00:00
|
|
|
SetOutPath "$INSTDIR\bin"
|
|
|
|
!insertmacro FileListLyXBin File "${FILES_LYX}\bin\"
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro FileListLyXLauncher File "${FILES_LAUNCHER}\"
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro FileListQtBin File "${FILES_QT}\bin\"
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro FileListDll File "${FILES_DEPS}\bin\"
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro FileListMSVCBin File "${FILES_MSVC}\"
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro FileListMSVCManifest File "..\"
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro FileListNetpbmBin File "${FILES_NETPBM}\"
|
|
|
|
!insertmacro FileListDTLBin File "${FILES_DTL}\"
|
2008-03-31 15:31:09 +00:00
|
|
|
!insertmacro FileListDvipostBin File "${FILES_DVIPOST}\"
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro FileListPDFViewBin File "${FILES_PDFVIEW}\"
|
|
|
|
!insertmacro FileListPDFToolsBin File "${FILES_PDFTOOLS}\"
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro FileListNSISPluginsStandard File "${NSISDIR}\Plugins\"
|
|
|
|
!insertmacro FileListNSISPlugins File "${FILES_NSISPLUGINS}\"
|
|
|
|
!insertmacro FileListMetaFile2EPS File "${FILES_METAFILE2EPS}\"
|
2008-03-30 21:37:53 +00:00
|
|
|
|
|
|
|
# Resources
|
|
|
|
SetOutPath "$INSTDIR"
|
|
|
|
# recursively copy all files under Resources
|
|
|
|
File /r "${FILES_LYX}\Resources"
|
|
|
|
|
|
|
|
# Components of Python
|
|
|
|
SetOutPath "$INSTDIR\python"
|
|
|
|
!insertmacro FileListPythonBin File "${FILES_PYTHON}\"
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro FileListMSVCBin File "${FILES_MSVC}\"
|
|
|
|
!insertmacro FileListMSVCManifest File "..\"
|
2008-03-30 21:37:53 +00:00
|
|
|
SetOutPath "$INSTDIR\python\Lib"
|
|
|
|
!insertmacro FileListPythonLib File "${FILES_PYTHON}\Lib\"
|
|
|
|
SetOutPath "$INSTDIR\python\Lib\encodings"
|
|
|
|
!insertmacro FileListPythonLibEncodings File "${FILES_PYTHON}\Lib\encodings\"
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
# Compile all Pyton files to byte-code
|
|
|
|
# The user using the scripts may not have write access
|
|
|
|
FileOpen $PythonCompileFile "$INSTDIR\compilepy.py" w
|
|
|
|
FileWrite $PythonCompileFile "import compileall$\r$\n"
|
|
|
|
FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\python\Lib')$\r$\n"
|
|
|
|
FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\Resources')$\r$\n"
|
|
|
|
FileClose $PythonCompileFile
|
|
|
|
DetailPrint $(TEXT_CONFIGURE_PYTHON)
|
|
|
|
nsExec::ExecToLog '"$INSTDIR\python\python.exe" "$INSTDIR\compilepy.py"'
|
|
|
|
Pop $PythonCompileReturn # Return value
|
|
|
|
Delete "$INSTDIR\compilepy.py"
|
|
|
|
|
|
|
|
!ifdef BUNDLE_IMAGEMAGICK
|
|
|
|
# Components of ImageMagick
|
|
|
|
SetOutPath "$INSTDIR\imagemagick"
|
|
|
|
!insertmacro FileListImageMagick File "${FILES_IMAGEMAGICK}\"
|
|
|
|
!insertmacro FileListMSVCBin File "${FILES_MSVC}\"
|
|
|
|
!insertmacro FileListMSVCManifest File "..\"
|
|
|
|
!endif
|
|
|
|
|
|
|
|
!ifdef BUNDLE_GHOSTSCRIPT
|
|
|
|
# Components of Ghostscript
|
|
|
|
SetOutPath "$INSTDIR\ghostscript"
|
2009-08-21 22:35:41 +00:00
|
|
|
!insertmacro FileListGhostscript File "${FILES_GHOSTSCRIPT}\"
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro FileListMSVCBin File "${FILES_MSVC}\"
|
2009-08-21 22:35:41 +00:00
|
|
|
!insertmacro FileListMSVCManifest File "..\"
|
2008-05-01 18:33:36 +00:00
|
|
|
|
|
|
|
!endif
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Aspell
|
|
|
|
|
|
|
|
# Copy installer to pluginsdir (a temp dir)
|
|
|
|
File /oname=$PLUGINSDIR\AspellData.exe "${FILES_ASPELLDATA}\AspellData.exe"
|
|
|
|
|
|
|
|
# Silently install AspellData.exe (/S option)
|
|
|
|
${If} $MultiUser.InstallMode == "CurrentUser"
|
|
|
|
ExecWait '"$PLUGINSDIR\AspellData.exe" /S /CurrentUser'
|
|
|
|
${Else}
|
|
|
|
ExecWait '"$PLUGINSDIR\AspellData.exe" /S /AllUsers'
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
# Remove the installer
|
|
|
|
Delete "$PLUGINSDIR\AspellData.exe"
|
|
|
|
|
|
|
|
# Aiksarus data
|
|
|
|
SetOutPath "$INSTDIR\aiksaurus"
|
|
|
|
!insertmacro FileListAiksaurusData File "${FILES_AIKSAURUS}\"
|
|
|
|
|
|
|
|
# Create uninstaller
|
|
|
|
WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
#--------------------------------
|
|
|
|
# Support code for file downloads
|
|
|
|
|
|
|
|
!macro DOWNLOAD_FILE RET ID FILENAME APPEND
|
|
|
|
|
2008-08-06 21:08:49 +00:00
|
|
|
# Downloads a file using the Inetc plug-in (HTTP or FTP)
|
2008-03-30 21:37:53 +00:00
|
|
|
|
|
|
|
# RET = Return value (OK if succesful)
|
|
|
|
# ID = Name of the download in settings.nsh
|
|
|
|
# FILENAME = Location to store file
|
|
|
|
# APPEND = Filename to append to server location in settings.nsh
|
|
|
|
|
2009-08-21 22:35:41 +00:00
|
|
|
# Try first time
|
2008-08-06 21:08:49 +00:00
|
|
|
Inetc::get "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
|
2008-03-30 21:37:53 +00:00
|
|
|
Pop ${RET} # Return value (OK if succesful)
|
|
|
|
|
|
|
|
${If} ${RET} != "OK"
|
2009-08-21 22:35:41 +00:00
|
|
|
# Download failed, try again (usally we get a different mirror)
|
|
|
|
Inetc::get "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}" /END
|
2008-03-30 21:37:53 +00:00
|
|
|
Pop ${RET}
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
#--------------------------------
|
|
|
|
# Aspell dictionaries
|
|
|
|
|
|
|
|
Var DictionaryFile
|
|
|
|
Var DictionaryLangName
|
|
|
|
Var DictionaryLangCode
|
|
|
|
Var DictionaryPath
|
|
|
|
|
|
|
|
Var AspellHive
|
|
|
|
Var AspellPath
|
|
|
|
|
|
|
|
Var DownloadResult
|
|
|
|
|
|
|
|
Section -AspellDicts
|
|
|
|
|
|
|
|
# Check whether the system or local version of Aspell should be used
|
|
|
|
# The patched Aspell uses the same logic
|
|
|
|
|
|
|
|
ReadRegStr $AspellPath HKCU "Software\Aspell" "Base Path"
|
|
|
|
|
|
|
|
${If} $AspellPath == ""
|
|
|
|
StrCpy $AspellHive HKLM
|
|
|
|
${Else}
|
|
|
|
StrCpy $AspellHive HKCU
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
!macro SECTION_DICT FILE LANGNAME LANGCODE SIZE
|
|
|
|
|
|
|
|
# One section for each dictionary
|
|
|
|
|
|
|
|
Section /o "${LANGNAME}"
|
|
|
|
|
|
|
|
AddSize ${SIZE}
|
|
|
|
|
|
|
|
StrCpy $DictionaryFile "${FILE}"
|
|
|
|
StrCpy $DictionaryLangName "${LANGNAME}"
|
|
|
|
StrCpy $DictionaryLangCode ${LANGCODE}
|
|
|
|
|
|
|
|
Call DownloadDictionary
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
# Include all sections
|
|
|
|
!insertmacro Dictionaries '!insertmacro SECTION_DICT'
|
|
|
|
|
|
|
|
Function DownloadDictionary
|
|
|
|
|
|
|
|
# Download and install a dictionary
|
|
|
|
|
|
|
|
dict_download:
|
|
|
|
|
|
|
|
!insertmacro DOWNLOAD_FILE $DownloadResult ASPELLDICTS aspell6-$DictionaryFile.exe /aspell6-$DictionaryFile.exe
|
|
|
|
|
|
|
|
${If} $DownloadResult != "OK"
|
|
|
|
# Download failed
|
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_DICT) ($DownloadResult)" IDYES dict_download
|
|
|
|
Goto dict_noinstall
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
install_dict:
|
|
|
|
|
|
|
|
ExecWait '"$PLUGINSDIR\aspell6-$DictionaryFile.exe" /NoDirChange /AutoClose'
|
|
|
|
|
|
|
|
${If} $AspellHive == HKLM
|
|
|
|
ReadRegStr $DictionaryPath HKLM "Software\Aspell\Dictionaries" $DictionaryLangCode
|
|
|
|
${Else}
|
|
|
|
ReadRegStr $DictionaryPath HKCU "Software\Aspell\Dictionaries" $DictionaryLangCode
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
${If} $DictionaryPath == ""
|
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_NOTINSTALLED_DICT)" IDYES install_dict
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
Delete "$PLUGINSDIR\aspell6-$DictionaryFile.exe"
|
|
|
|
|
|
|
|
dict_noinstall:
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
#--------------------------------
|
|
|
|
# Extenral components
|
|
|
|
|
|
|
|
Var PathAllUsers
|
|
|
|
Var PathCurrentUser
|
|
|
|
|
|
|
|
!macro EXTERNAL COMPONENT
|
|
|
|
|
|
|
|
# Download/Install the component
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
${If} $Setup${COMPONENT} == ${TRUE}
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
StrCpy $Path${COMPONENT} "" ;A new one will be installed
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!ifndef BUNDLESETUP_${COMPONENT}
|
|
|
|
!insertmacro EXTERNAL_DOWNLOAD ${COMPONENT}
|
2008-03-30 21:37:53 +00:00
|
|
|
!else
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro EXTERNAL_INSTALL ${COMPONENT}
|
2008-03-30 21:37:53 +00:00
|
|
|
!endif
|
|
|
|
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro EXTERNAL_RUNINSTALLER COMPONENT
|
|
|
|
|
|
|
|
# Run the installer application of the component that does the actual installation.
|
|
|
|
|
|
|
|
install_${COMPONENT}:
|
|
|
|
|
|
|
|
ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
|
|
|
|
|
|
|
|
# Updates the path environment variable of the instaler process to the latest system value
|
|
|
|
ReadRegStr $PathAllUsers HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path
|
|
|
|
ReadRegStr $PathCurrentUser HKCU "Environment" Path
|
|
|
|
System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$PathAllUsers;$PathCurrentUser").'
|
|
|
|
|
|
|
|
Call Search${COMPONENT}
|
|
|
|
|
|
|
|
${If} $Path${COMPONENT} == ""
|
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!macro EXTERNAL_DOWNLOAD COMPONENT
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
download_${COMPONENT}:
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro DOWNLOAD_FILE $DownloadResult "${COMPONENT}" "${COMPONENT}Setup.exe" ""
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
${If} $DownloadResult != "OK"
|
|
|
|
# Download failed
|
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($DownloadResult)" IDYES download_${COMPONENT}
|
|
|
|
Goto noinstall_${COMPONENT}
|
|
|
|
${EndIf}
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
noinstall_${COMPONENT}:
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!macroend
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!macro EXTERNAL_INSTALL COMPONENT
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
# Extract
|
|
|
|
File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}}
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!macroend
|
2008-03-30 21:37:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Sections for external components
|
|
|
|
|
|
|
|
Section -LaTeX ExternalLaTeX
|
|
|
|
!insertmacro EXTERNAL LaTeX
|
|
|
|
SectionEnd
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!ifndef BUNDLE_IMAGEMAGICK
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Section -ImageMagick ExternalImageMagick
|
|
|
|
!insertmacro EXTERNAL ImageMagick
|
|
|
|
SectionEnd
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!endif
|
|
|
|
|
|
|
|
!ifndef BUNDLE_GHOSTSCRIPT
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Section -Ghostscript ExternalGhostscript
|
|
|
|
!insertmacro EXTERNAL Ghostscript
|
|
|
|
SectionEnd
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
!endif
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Function InitExternal
|
|
|
|
|
|
|
|
# Get sizes of external component installers
|
|
|
|
|
|
|
|
SectionGetSize ${ExternalLaTeX} $SizeLaTeX
|
2008-05-01 18:33:36 +00:00
|
|
|
!ifndef BUNDLE_IMAGEMAGICK
|
|
|
|
SectionGetSize ${ExternalImageMagick} $SizeImageMagick
|
|
|
|
!endif
|
|
|
|
!ifndef BUNDLE_GHOSTSCRIPT
|
|
|
|
SectionGetSize ${ExternalGhostscript} $SizeGhostscript
|
|
|
|
!endif
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
# Add download size
|
|
|
|
|
|
|
|
!ifndef BUNDLESETUP_MIKTEX
|
2008-03-30 21:37:53 +00:00
|
|
|
IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}
|
2008-05-01 18:33:36 +00:00
|
|
|
!endif
|
|
|
|
!ifndef BUNDLE_IMAGEMAGICK & BUNDLESETUP_IMAGEMAGICK
|
2008-03-30 21:37:53 +00:00
|
|
|
IntOp $SizeImagemagick $SizeImagemagick + ${SIZE_DOWNLOAD_IMAGEMAGICK}
|
2008-05-01 18:33:36 +00:00
|
|
|
!endif
|
|
|
|
!ifndef BUNDLE_GHOSTSCRIPT & BUNDLESETUP_GHOSTSCRIPT
|
2008-03-30 21:37:53 +00:00
|
|
|
IntOp $SizeGhostscript $SizeGhostscript + ${SIZE_DOWNLOAD_GHOSTSCRIPT}
|
|
|
|
!endif
|
2008-05-01 18:33:36 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
FunctionEnd
|