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 # abort the installation if no LaTeX was found but should be used
28 ${if} $PathLaTeX == ""
29 ${andif} $State == "0"
30 SetOutPath $TEMP # to be able to delete the $INSTDIR
35 # Install and register the core LyX files
37 # The macros are defined in filelists.nsh
38 # the parameters are COMMAND DIRECTORY that form command '${COMMAND} "${DIRECTORY}files"
40 # Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
41 # $PLUGINSDIR is automatically deleted when the installer exits.
45 SetOutPath "$INSTDIR\bin"
46 !insertmacro FileListLyXBin File "${FILES_LYX}\bin\"
47 # The 2.3.0 and early 2.3.1 installers used a version suffix
48 # We need to remove the old binaries if we're installing into the same directory
49 Delete "$INSTDIR\bin\LyX2.3.exe"
50 Delete "$INSTDIR\bin\tex2lyx2.3.exe"
51 !insertmacro FileListQtBin File "${FILES_QT}\bin\"
52 !insertmacro FileListMinGW File "${FILES_LYX}\bin\"
53 !insertmacro FileListNetpbmBin File "${FILES_NETPBM}\"
54 !insertmacro FileListDTLBin File "${FILES_DTL}\"
55 !insertmacro FileListRsvg File "${FILES_RSVG}\"
56 !insertmacro FileListDvipostBin File "${FILES_DVIPOST}\"
57 !insertmacro FileListPDFViewBin File "${FILES_PDFVIEW}\"
60 SetOutPath "$INSTDIR\bin\imageformats"
61 !insertmacro FileListQtImageformats File "${FILES_QT}\bin\imageformats\"
62 SetOutPath "$INSTDIR\bin\iconengines"
63 !insertmacro FileListQtIconengines File "${FILES_QT}\bin\iconengines\"
64 SetOutPath "$INSTDIR\bin\platforms"
65 !insertmacro FileListQtPlatforms File "${FILES_QT}\bin\platforms\"
66 SetOutPath "$INSTDIR\bin\styles"
67 !insertmacro FileListQtStyles File "${FILES_QT}\bin\styles\"
71 # recursively copy all files under Resources
72 File /r "${FILES_LYX}\Resources"
73 File /r "${FILES_DEPS}\Resources"
77 # recursively copy all files under Python
78 File /r "${FILES_PYTHON}"
79 #FIXME We probably should not do this, as dicussed on the list.
80 # register .py files if necessary
81 ReadRegStr $0 SHCTX "Software\Classes\Python.File\shell\open\command" ""
82 ${if} $0 == "" # if nothing was found
83 WriteRegStr SHCTX "Software\Classes\Python.File\shell\open\command" "" '"$INSTDIR\Python\python.exe" "%1" %*'
84 WriteRegStr SHCTX "Software\Classes\Python.File\DefaultIcon" "" "$INSTDIR\Python\DLLs\py.ico"
85 WriteRegStr SHCTX "Software\Classes\.py" "" "Python.File"
86 WriteRegStr SHCTX "Software\Classes\Python.File" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
89 # Compile all Python files to byte-code
90 # The user using the scripts may not have write access
91 FileOpen $PythonCompileFile "$INSTDIR\compilepy.py" w
92 FileWrite $PythonCompileFile "import compileall$\r$\n"
93 FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\python\Lib')$\r$\n"
94 FileWrite $PythonCompileFile "compileall.compile_dir('$INSTDIR\Resources')$\r$\n"
95 FileClose $PythonCompileFile
96 DetailPrint $(TEXT_CONFIGURE_PYTHON)
97 nsExec::ExecToLog '"$INSTDIR\python\python.exe" "$INSTDIR\compilepy.py"'
98 Pop $PythonCompileReturn # Return value
99 Delete "$INSTDIR\compilepy.py"
101 # Components of ImageMagick
102 SetOutPath "$INSTDIR\imagemagick"
103 File /r "${FILES_IMAGEMAGICK}\"
104 !insertmacro FileListMSVC File "${FILES_MSVC}\"
105 # register ImageMagick
106 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "BinPath" "$INSTDIR\imagemagick"
107 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "CoderModulesPath" "$INSTDIR\imagemagick\modules\coders"
108 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "ConfigurePath" "$INSTDIR\imagemagick"
109 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "FilterModulesPath" "$INSTDIR\imagemagick\modules\filters"
110 WriteRegStr SHCTX "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "LibPath" "$INSTDIR\imagemagick"
111 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "BinPath" "$INSTDIR\imagemagick"
112 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "CoderModulesPath" "$INSTDIR\imagemagick\modules\coders"
113 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "ConfigurePath" "$INSTDIR\imagemagick"
114 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "FilterModulesPath" "$INSTDIR\imagemagick\modules\filters"
115 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "LibPath" "$INSTDIR\imagemagick"
116 WriteRegDWORD SHCTX "SOFTWARE\ImageMagick\Current" "QuantumDepth" 0x00000010
117 WriteRegStr SHCTX "SOFTWARE\ImageMagick\Current" "Version" "${ImageMagickVersion}"
118 WriteRegStr SHCTX "SOFTWARE\ImageMagick" "OnlyWithLyX" "Yes${APP_SERIES_KEY}"
120 # Components of Ghostscript
121 ${if} $GhostscriptPath == ""
122 SetOutPath "$INSTDIR\ghostscript"
123 File /r "${FILES_GHOSTSCRIPT}\"
124 !insertmacro FileListMSVC File "${FILES_MSVC}\"
125 StrCpy $GhostscriptPath "$INSTDIR\ghostscript\bin"
129 SetOutPath "$INSTDIR\Python\Lib"
130 !insertmacro FileListUnoConv File "${FILES_UNOCONV}\"
132 # install the LaTeX class files that are delivered with LyX to MiKTeX
133 ${if} $LaTeXInstalled == "MiKTeX"
134 Call ConfigureMiKTeX # Function from LaTeX.nsh
136 # install the LaTeX class files that are delivered with LyX to TeXLive
137 ${if} $LaTeXInstalled == "TeXLive"
138 Call ConfigureTeXLive # Function from LaTeX.nsh
141 # download dictionaries and thesaurus
142 ${if} $DictCodes != ""
143 Call InstallHunspellDictionaries # Function from dictionaries.nsh
145 ${if} $ThesCodes != ""
146 Call InstallThesaurusDictionaries # Function from dictionaries.nsh
148 # finally delete the list of mirrors
149 Delete "$INSTDIR\Resources\DictionaryMirrors.txt"
152 WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"