]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/AltInstaller/InstallThirdPartyProgs.nsh
installer:
[lyx.git] / development / Win32 / packaging / AltInstaller / InstallThirdPartyProgs.nsh
1 # this file contains the installation actions for the third-party programs
2
3 Function Ghostscript
4
5   # if GhostScript is not installed
6   ${if} $GhostscriptPath == ""
7    # register Ghostscript
8    WriteRegStr HKLM "SOFTWARE\GPL Ghostscript\${GhostscriptVersion}" "GS_DLL" "${GhostscriptDir}\bin\gsdll32.dll"
9    WriteRegStr HKLM "SOFTWARE\GPL Ghostscript\${GhostscriptVersion}" "GS_LIB" "${GhostscriptDir}\lib"
10    
11    WriteRegStr HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
12    StrCpy $GhostscriptPath "${GhostscriptDir}\bin"
13   ${else}
14    # delete unnecessary files
15    RMDir /r ${GhostscriptDir}
16    StrCpy $DelGSDir "Yes" # used later in function ImageMagick
17   ${endif}
18
19 FunctionEnd
20
21 # -------------------------------------------
22
23 Function ImageMagick
24
25   # if ImageMagick is not installed
26   ${if} $ImageMagickPath == ""
27    # register ImageMagick
28    WriteRegStr HKLM "SOFTWARE\Classes\Applications" "AutoRun" "${ImageMagickDir}\convert.exe $$"
29    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "BinPath" "${ImageMagickDir}"
30    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "CoderModulesPath" "${ImageMagickDir}\modules\coders"
31    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "ConfigurePath" "${ImageMagickDir}\config"
32    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "FilterModulesPath" "${ImageMagickDir}\modules\filters"
33    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "LibPath" "${ImageMagickDir}"
34    
35    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "BinPath" "${ImageMagickDir}"
36    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "CoderModulesPath" "${ImageMagickDir}\modules\coders"
37    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "ConfigurePath" "${ImageMagickDir}\config"
38    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "FilterModulesPath" "${ImageMagickDir}\modules\filters"
39    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "LibPath" "${ImageMagickDir}"
40    WriteRegDWORD HKLM "SOFTWARE\ImageMagick\Current" "QuantumDepth" 0x00000010   
41    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "Version" "${ImageMagickVersion}"
42    
43    WriteRegStr HKLM "Software\ImageMagick" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
44    StrCpy $ImageMagickPath ${ImageMagickDir}
45   ${else}
46    # delete unnecessary files
47    RMDir /r ${ImageMagickDir}
48    # delete the "etc" folder when also the Ghostscript folder was deleted because it is then empty 
49    ${if} $DelGSDir == "Yes"
50    ${andif} $DelWMFDir == "Yes"
51     RMDir /r "$INSTDIR\etc"
52    ${endif}
53   ${endif}
54
55 FunctionEnd
56
57 # -------------------------------------------
58
59 Function eLyXer
60
61   # install eLyXer as Python module
62   ${if} $PythonPath != ""
63    # a Python module cannot simply started with
64    # ExecWait '$PythonPath\python.exe "$INSTDIR\bin\setup.py" install'
65    # therefore run a script
66    StrCpy $1 $INSTDIR 2 # get drive letter
67    FileOpen $R1 "$INSTDIR\bin\eLyXer.bat" w
68    FileWrite $R1 '$1$\r$\n\
69                   cd "$INSTDIR\bin"$\r$\n\
70                   "$PythonPath\python.exe" setup.py install'
71    FileClose $R1
72    ExecWait '"$INSTDIR\bin\eLyXer.bat"'
73    Delete "$INSTDIR\bin\eLyXer.bat"
74   ${else}
75    ExecWait '"$INSTDIR\bin\python.exe" "$INSTDIR\bin\setup.py" install'
76   ${endif}
77
78 FunctionEnd
79
80 # -------------------------------------------
81
82 Function Aiksaurus
83
84   # if Aiksaurus is not installed
85   ${if} $AiksaurusPath == ""
86    # extract Aiksaurus' program files
87    SetOutPath "$INSTDIR\external"
88    File /r "${PRODUCT_SOURCEDIR}\${AiksaurusInstall}"
89    # copy the files and register Aiksaurus
90    CopyFiles "$INSTDIR\${AiksaurusInstall}" "$APPDATA"
91 #   WriteRegStr HKLM "Software\Aiksaurus" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
92 #   WriteRegStr HKLM "Software\Aiksaurus" "Data Path" "${AiksaurusDir}"
93   ${endif}
94
95 FunctionEnd
96
97 # -------------------------------------------
98
99 !macro PrinterInit
100
101   ${if} ${AtLeastWinVista}
102     StrCpy $PrinterConf "printui.exe"
103   ${else}
104     StrCpy $PrinterConf "rundll32.exe printui.dll,PrintUIEntry"
105   ${endif}
106
107 !macroend
108
109 Function Metafile2eps
110
111   # if Metafile2eps is not installed
112   ${if} $WMFPath == ""
113    # delete printer
114    ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
115    # install printer and driver
116    ExecWait '$PrinterConf /if /f "$WINDIR\inf\ntprint.inf" /b "Metafile to EPS Converter" /r "FILE:" /m "MS Publisher Imagesetter"'
117    # restore DEVMODE with proper settings
118    ExecWait '$PrinterConf /q /Sr /n "Metafile to EPS Converter" /a "$INSTDIR\metafile2eps.dat" g'
119    # register printer
120    WriteRegStr HKLM "SOFTWARE\InkNote Selector" "" ${Metafile2epsDir}
121    # register Metafile2eps
122    Var /GLOBAL RegLocation
123    StrCpy $RegLocation "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Metafile to EPS Converter"
124    WriteRegStr HKLM "$RegLocation" "InstallLocation" "${Metafile2epsDir}"
125    WriteRegStr HKLM "$RegLocation" "DisplayName" "Metafile to EPS Converter"
126    WriteRegStr HKLM "$RegLocation" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
127    StrCpy $WMFPath "${Metafile2epsDir}"
128    # delete temporary file
129    Delete "$INSTDIR\metafile2eps.dat"
130   ${else}
131    # delete unnecessary files
132    RMDir /r "${Metafile2epsDir}"
133    StrCpy $DelWMFDir "Yes" # used later in function ImageMagick
134   ${endif}
135
136 FunctionEnd
137
138 # -------------------------------------------
139
140 !if ${INSTALLER_VERSION} == "Complete"
141
142  Function PostScript
143
144   # if no PostScript viewer is installed
145   ${if} $PSVPath == ""
146    ${if} $InstallGSview == "true"
147     # launch installer
148     MessageBox MB_OK|MB_ICONINFORMATION "$(GSviewInfo)"
149     ExecWait "$INSTDIR\${GSviewInstall}"
150     # test if GSview is installed
151     StrCpy $PSVPath ""
152     ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"    
153     ${if} $PSVPath == ""
154      MessageBox MB_OK|MB_ICONEXCLAMATION "$(GSviewError)"
155     ${endif}
156    ${endif}
157   ${endif}
158
159  FunctionEnd
160
161 !endif # endif ${INSTALLER_VERSION} == "Complete"
162
163 # -------------------------------------------
164
165 !if ${INSTALLER_VERSION} == "Complete"
166
167  Function BibTeX
168
169   # if no BibTeX editor is installed
170   ${if} $BibTeXEditorPath == ""
171    ${if} $InstallJabRef == "true"
172     # launch installer
173     MessageBox MB_OK|MB_ICONINFORMATION "$(JabRefInfo)"
174     ExecWait "$INSTDIR\${JabRefInstall}"
175     # test if JabRef is installed
176     StrCpy $BibTeXEditorPath ""
177     ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "UninstallString"    
178     ${if} $BibTeXEditorPath == ""
179      MessageBox MB_OK|MB_ICONEXCLAMATION "$(JabRefError)"
180     ${else}
181      WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
182     ${endif}
183    ${endif}
184   ${endif}
185
186  FunctionEnd
187
188 !endif # endif ${INSTALLER_VERSION} == "Complete"
189