]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/setup/install.nsh
Build 2.3.2 for Windows.
[lyx.git] / development / Win32 / packaging / installer / setup / install.nsh
1 /*
2
3 install.nsh
4
5 Installation of program files, dictionaries and external components
6
7 */
8
9 #--------------------------------
10 # Program files
11
12 Var PythonCompileFile
13 Var PythonCompileReturn
14
15 Section -ProgramFiles SecProgramFiles
16
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
21   StrCpy $Search "LyX"
22   Call StrPoint # function from LyXUtils.nsh
23   ${if} $Pointer == "-1"
24    StrCpy $INSTDIR "$INSTDIR\${APP_DIR}"
25   ${endif}
26
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
31   RMDir /r $INSTDIR
32   Abort
33  ${endif}
34
35   # Install and register the core LyX files
36   
37   # The macros are defined in filelists.nsh
38   # the parameters are COMMAND DIRECTORY that form command '${COMMAND} "${DIRECTORY}files"  
39   
40   # Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
41   # $PLUGINSDIR is automatically deleted when the installer exits.
42   InitPluginsDir
43   
44   # Binaries
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}\"
58   
59   # Qt plugin DLLs
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\"
68   
69   # Resources
70   SetOutPath "$INSTDIR"
71   # recursively copy all files under Resources
72   File /r "${FILES_LYX}\Resources"
73   File /r "${FILES_DEPS}\Resources"
74   
75   # Python
76   SetOutPath "$INSTDIR"
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
87   ${endif}
88   
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"
100   
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}"
119   
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"
126   ${endif}
127   
128   # install unoconv
129   SetOutPath "$INSTDIR\Python\Lib"
130   !insertmacro FileListUnoConv File "${FILES_UNOCONV}\"
131
132   # install the LaTeX class files that are delivered with LyX to MiKTeX
133   ${if} $LaTeXInstalled == "MiKTeX"
134    Call ConfigureMiKTeX # Function from LaTeX.nsh
135   ${endif}
136   # install the LaTeX class files that are delivered with LyX to TeXLive
137   ${if} $LaTeXInstalled == "TeXLive"
138    Call ConfigureTeXLive # Function from LaTeX.nsh
139   ${endif}
140   
141   # download dictionaries and thesaurus
142   ${if} $DictCodes != ""
143    Call InstallHunspellDictionaries # Function from dictionaries.nsh
144   ${endif}
145   ${if} $ThesCodes != ""
146    Call InstallThesaurusDictionaries # Function from dictionaries.nsh
147   ${endif}
148   # finally delete the list of mirrors
149   Delete "$INSTDIR\Resources\DictionaryMirrors.txt"
150   
151   # Create uninstaller
152   WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
153
154 SectionEnd