5 Installation of program files, dictionaries and external components
9 #--------------------------------
13 Var PythonCompileReturn
15 Section -ProgramFiles SecProgramFiles
17 # if the $INSTDIR does not contain "LyX" we must add a subfolder to avoid that LyX will e.g.
18 # be installed directly to C:\programs - the uninstaller will then delete the whole
19 # C:\programs directory
20 StrCpy $String $INSTDIR
22 Call StrPoint # function from LyXUtils.nsh
23 ${if} $Pointer == "-1"
24 StrCpy $INSTDIR "$INSTDIR\${APP_DIR}"
27 !if ${SETUPTYPE} != BUNDLE
28 # abort the installation if no LaTeX was found but should be used
29 ${if} $PathLaTeX == ""
30 ${andif} $State == "0"
31 SetOutPath $TEMP # to be able to delete the $INSTDIR
35 !endif # end if != BUNDLE
37 # Install and register the core LyX files
39 # The macros are defined in filelists.nsh
40 # the parameters are COMMAND DIRECTORY that form command '${COMMAND} "${DIRECTORY}files"
42 # Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
43 # $PLUGINSDIR is automatically deleted when the installer exits.
47 SetOutPath "$INSTDIR\bin"
48 !insertmacro FileListLyXBin File "${FILES_LYX}\bin\"
49 # The 2.3.0 and early 2.3.1 installers used a version suffix
50 # We need to remove the old binaries if we're installing into the same directory
51 Delete "$INSTDIR\bin\LyX2.3.exe"
52 Delete "$INSTDIR\bin\tex2lyx2.3.exe"
53 !insertmacro FileListQtBin File "${FILES_QT}\bin\"
54 !insertmacro FileListMSVC File "${FILES_MSVC}\"
55 !insertmacro FileListNetpbmBin File "${FILES_NETPBM}\"
56 !insertmacro FileListDTLBin File "${FILES_DTL}\"
57 !insertmacro FileListRsvg File "${FILES_RSVG}\"
58 !insertmacro FileListDvipostBin File "${FILES_DVIPOST}\"
59 !insertmacro FileListPDFViewBin File "${FILES_PDFVIEW}\"
62 SetOutPath "$INSTDIR\bin\imageformats"
63 !insertmacro FileListQtImageformats File "${FILES_QT}\plugins\imageformats\"
64 SetOutPath "$INSTDIR\bin\iconengines"
65 !insertmacro FileListQtIconengines File "${FILES_QT}\plugins\iconengines\"
66 SetOutPath "$INSTDIR\bin\platforms"
67 !insertmacro FileListQtPlatforms File "${FILES_QT}\plugins\platforms\"
71 # recursively copy all files under Resources
72 File /r "${FILES_LYX}\Resources"
74 !if ${SETUPTYPE} == BUNDLE
76 # extract the MiKTeX installer
77 File /r "${FILES_LYX}\external"
79 # install MiKTeX if not already installed
80 Call InstallMiKTeX # function from LaTeX.nsh
82 !endif # end if BUNDLE
86 # recursively copy all files under Python
87 File /r "${FILES_PYTHON}"
88 # register .py files if necessary
89 ReadRegStr $0 SHCTX "Software\Classes\Python.File\shell\open\command" ""
90 ${if} $0 == "" # if nothing was found
91 WriteRegStr SHCTX "Software\Classes\Python.File\shell\open\command" "" '"$INSTDIR\Python\python.exe" "%1" %*'
92 WriteRegStr SHCTX "Software\Classes\Python.File\DefaultIcon" "" "$INSTDIR\Python\DLLs\py.ico"
93 WriteRegStr SHCTX "Software\Classes\.py" "" "Python.File"
94 WriteRegStr SHCTX "Software\Classes\Python.File" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
97 # Compile all Pyton files to byte-code
98 # The user using the scripts may not have write access
99 FileOpen $PythonCompileFile "$INSTDIR\compilepy.py" w
100 FileWrite $PythonCompileFile "import compileall$\r$\n"
101 FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\python\Lib')$\r$\n"
102 FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\Resources')$\r$\n"
103 FileClose $PythonCompileFile
104 DetailPrint $(TEXT_CONFIGURE_PYTHON)
105 nsExec::ExecToLog '"$INSTDIR\python\python.exe" "$INSTDIR\compilepy.py"'
106 Pop $PythonCompileReturn # Return value
107 Delete "$INSTDIR\compilepy.py"
109 # Components of ImageMagick
110 SetOutPath "$INSTDIR\imagemagick"
111 File /r "${FILES_IMAGEMAGICK}\"
112 !insertmacro FileListMSVC File "${FILES_MSVC}\"
113 # register ImageMagick
114 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "BinPath" "$INSTDIR\imagemagick"
115 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "CoderModulesPath" "$INSTDIR\imagemagick\modules\coders"
116 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "ConfigurePath" "$INSTDIR\imagemagick"
117 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "FilterModulesPath" "$INSTDIR\imagemagick\modules\filters"
118 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "LibPath" "$INSTDIR\imagemagick"
119 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "BinPath" "$INSTDIR\imagemagick"
120 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "CoderModulesPath" "$INSTDIR\imagemagick\modules\coders"
121 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "ConfigurePath" "$INSTDIR\imagemagick"
122 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "FilterModulesPath" "$INSTDIR\imagemagick\modules\filters"
123 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "LibPath" "$INSTDIR\imagemagick"
124 WriteRegDWORD SHCTX "SOFTWARE\ImageMagick\Current" "QuantumDepth" 0x00000010
125 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "Version" "${ImageMagickVersion}"
126 WriteRegStr SHCTX "SOFTWARE\ImageMagick" "OnlyWithLyX" "Yes${APP_SERIES_KEY}"
128 # Components of Ghostscript
129 ${if} $GhostscriptPath == ""
130 SetOutPath "$INSTDIR\ghostscript"
131 File /r "${FILES_GHOSTSCRIPT}\"
132 !insertmacro FileListMSVC File "${FILES_MSVC}\"
133 StrCpy $GhostscriptPath "$INSTDIR\ghostscript\bin"
137 SetOutPath "$INSTDIR\Python\Lib"
138 !insertmacro FileListeLyXer File "${FILES_ELYXER}\"
141 SetOutPath "$INSTDIR\Python\Lib"
142 !insertmacro FileListUnoConv File "${FILES_UNOCONV}\"
144 # install the LaTeX class files that are delivered with LyX to MiKTeX
145 ${if} $LaTeXInstalled == "MiKTeX"
146 Call ConfigureMiKTeX # Function from LaTeX.nsh
148 # install the LaTeX class files that are delivered with LyX to TeXLive
149 ${if} $LaTeXInstalled == "TeXLive"
150 Call ConfigureTeXLive # Function from LaTeX.nsh
153 # download dictionaries and thesaurus
154 ${if} $DictCodes != ""
155 Call InstallHunspellDictionaries # Function from dictionaries.nsh
157 ${if} $ThesCodes != ""
158 Call InstallThesaurusDictionaries # Function from dictionaries.nsh
160 # finally delete the list of mirrors
161 Delete "$INSTDIR\Resources\DictionaryMirrors.txt"
164 WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"