Windows: Change check for vcredist YAZ-848
[yaz-moved-to-github.git] / win / yaz.nsi
1 ; This file is part of the YAZ toolkit.
2 ; Copyright (C) Index Data
3 ; See the file LICENSE for details.
4
5 !include EnvVarUpdate.nsh
6 !include version.nsi
7
8 !include "MUI.nsh"
9
10 SetCompressor bzip2
11
12 Name "YAZ"
13 Caption "Index Data YAZ ${VERSION} Setup"
14 OutFile "yaz_${VERSION}.exe"
15
16 LicenseText "You must read the following license before installing:"
17 LicenseData license.txt
18
19 ComponentText "This will install the YAZ Toolkit on your computer:"
20 InstType "Full (w/ Source)"
21 InstType "Lite (w/o Source)"
22
23 InstallDirRegKey HKLM "SOFTWARE\Index Data\YAZ" ""
24
25
26 ;----------------------------
27 ; Pages
28
29
30   !insertmacro MUI_PAGE_LICENSE "license.txt"
31   !insertmacro MUI_PAGE_COMPONENTS
32   !insertmacro MUI_PAGE_DIRECTORY
33   !insertmacro MUI_PAGE_INSTFILES
34   
35   !insertmacro MUI_UNPAGE_CONFIRM
36   !insertmacro MUI_UNPAGE_INSTFILES
37 ; Page components
38 ; Page directory
39 ; Page instfiles
40
41 ; UninstPage uninstConfirm
42 ; UninstPage instfiles
43
44 ;--------------------------------
45 ;Languages
46  
47 !insertmacro MUI_LANGUAGE "English"
48
49 ;--------------------------------
50
51 Section "" ; (default section)
52         SetOutPath "$INSTDIR"
53         ; add files / whatever that need to be installed here.
54         WriteRegStr HKLM "SOFTWARE\Index Data\YAZ" "" "$INSTDIR"
55         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YAZ" "DisplayName" "YAZ ${VERSION} (remove only)"
56         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YAZ" "UninstallString" '"$INSTDIR\uninst.exe"'
57         ; write out uninstaller
58         WriteUninstaller "$INSTDIR\uninst.exe"
59         SetOutPath $SMPROGRAMS\YAZ
60         CreateShortCut "$SMPROGRAMS\YAZ\YAZ Program Directory.lnk" \
61                  "$INSTDIR"
62         WriteINIStr "$SMPROGRAMS\YAZ\YAZ Home page.url" \
63               "InternetShortcut" "URL" "http://www.indexdata.com/yaz/"
64         CreateShortCut "$SMPROGRAMS\YAZ\Uninstall YAZ.lnk" \
65                 "$INSTDIR\uninst.exe"
66         SetOutPath $INSTDIR
67         File LICENSE.txt
68         File ..\README
69         File ..\NEWS
70         SetOutPath $INSTDIR
71         SetOutPath $INSTDIR\ztest
72         File ..\ztest\dummy-grs
73         File ..\ztest\dummy-words
74         SetOutPath $INSTDIR\etc
75         File ..\etc\*.xml
76         File ..\etc\*.xsl
77         File ..\etc\pqf.properties
78
79 SectionEnd ; end of default section
80
81 Section "YAZ Runtime" YAZ_Runtime
82         SectionIn 1 2
83         SetOutPath $INSTDIR\bin
84 !if "${VS_REDIST_FULL}" != ""
85         File "${VS_REDIST_FULL}"
86         ReadRegDword $1 HKLM "${VS_REDIST_KEY}" "Version"
87         ${If} $1 == ""
88           ExecWait '"$INSTDIR\bin\${VS_REDIST_EXE}" /passive /nostart'
89         ${endif}
90         Delete "$INSTDIR\bin\${VS_REDIST_EXE}"
91 !endif
92         IfFileExists "$INSTDIR\bin\yaz-ztest.exe" 0 Noservice
93         ExecWait '"$INSTDIR\bin\yaz-ztest.exe" -remove'
94 Noservice:
95         File ..\bin\*.dll
96         File ..\bin\*.exe
97         SetOutPath $SMPROGRAMS\YAZ
98         CreateShortCut "$SMPROGRAMS\YAZ\YAZ Client.lnk" \
99                  "$INSTDIR\bin\yaz-client.exe"
100         SetOutPath $SMPROGRAMS\YAZ\Server
101         CreateShortCut "$SMPROGRAMS\YAZ\Server\Server on console on port 9999.lnk" \
102                  "$INSTDIR\bin\yaz-ztest.exe" '-w"$INSTDIR\ztest"'
103         CreateShortCut "$SMPROGRAMS\YAZ\Server\Install Z39.50 service on port 210.lnk" \
104                   "$INSTDIR\bin\yaz-ztest.exe" '-installa tcp:@:210'
105         CreateShortCut "$SMPROGRAMS\YAZ\Server\Remove Z39.50 service.lnk" \
106                  "$INSTDIR\bin\yaz-ztest.exe" '-remove'
107 SectionEnd
108
109 Section "YAZ Development" YAZ_Development
110         SectionIn 1 2
111         SetOutPath $INSTDIR\include\yaz
112         File ..\include\yaz\*.h
113         SetOutPath $INSTDIR\lib
114         File ..\lib\yaz*.lib
115 SectionEnd
116
117 Section "YAZ Documentation" YAZ_Documentation
118         SectionIn 1 2
119         SetOutPath $INSTDIR\doc
120         File /nonfatal /r ..\doc\*.css
121         File /nonfatal /r ..\doc\*.ent
122         File /nonfatal /r ..\doc\*.html
123         File /r ..\doc\*.xml
124         File /r ..\doc\*.png
125         File /nonfatal /r ..\doc\*.xsl
126         SetOutPath $SMPROGRAMS\YAZ
127         CreateShortCut "$SMPROGRAMS\YAZ\HTML Documentation.lnk" \
128                  "$INSTDIR\doc\index.html"
129 SectionEnd
130
131 Section "YAZ Source" YAZ_Source
132         SectionIn 1
133         SetOutPath $INSTDIR
134         File ..\IDMETA
135         File /r ..\*.c
136         File /r /x yaz ..\*.h
137         SetOutPath $INSTDIR\util
138         File ..\util\yaz-asncomp
139         SetOutPath $INSTDIR\src
140         File ..\src\*.y
141         File ..\src\*.tcl
142         File ..\src\*.csv
143         File ..\src\*.asn
144         File ..\src\codetables*.xml
145         SetOutPath $INSTDIR\test
146         File ..\test\marc*.*
147         File ..\test\*.sh
148         File ..\test\*.xml
149         File ..\test\*.asn
150         SetOutPath $INSTDIR\win
151         File makefile
152         File *.nsi
153         File *.rc
154 SectionEnd
155
156 Section "YAZ4J" YAZ4J
157         SectionIn 1 2
158         SetOutPath $INSTDIR\bin
159         File /nonfatal ..\bin\yaz4j.dll
160         SetOutPath $INSTDIR\java
161         File /nonfatal ..\java\yaz4j.jar
162 SectionEnd
163
164 Section "YAZ Path" YAZ_PATH
165         SectionIn 1 2
166         ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin"
167 SectionEnd
168
169 ; begin uninstall settings/section
170 UninstallText "This will uninstall YAZ ${VERSION} from your system"
171
172 Section Uninstall
173 ; add delete commands to delete whatever files/registry keys/etc you installed here.
174         Delete "$INSTDIR\uninst.exe"
175         DeleteRegKey HKLM "SOFTWARE\Index Data\YAZ"
176         DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\YAZ"
177         ExecWait '"$INSTDIR\bin\yaz-ztest" -remove'
178         RMDir /r $SMPROGRAMS\YAZ
179         RMDir /r $INSTDIR
180         ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin"
181         IfFileExists $INSTDIR 0 Removed 
182                 MessageBox MB_OK|MB_ICONEXCLAMATION \
183                  "Note: $INSTDIR could not be removed."
184 Removed:
185 SectionEnd
186
187 ;--------------------------------
188 ;Descriptions
189
190   ;Language strings
191 LangString DESC_YAZ_Runtime ${LANG_ENGLISH} "YAZ runtime files needed in order for YAZ to run, such as DLLs."
192 LangString DESC_YAZ_Development ${LANG_ENGLISH} "Header files and import libraries required for developing software using YAZ."
193 LangString DESC_YAZ_Documentation ${LANG_ENGLISH} "YAZ Users' guide and reference in HTML. Describes both YAZ applications and the API."
194 LangString DESC_YAZ_Source ${LANG_ENGLISH} "Source code of YAZ. Required if you need to rebuild YAZ (for debugging purposes)."
195 LangString DESC_YAZ4J ${LANG_ENGLISH} "Java wrapper for the ZOOM API of YAZ."
196 LangString DESC_YAZ_PATH ${LANG_ENGLISH} "Update PATH to include binaries of YAZ."
197
198 ;Assign language strings to sections
199 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
200 !insertmacro MUI_DESCRIPTION_TEXT ${YAZ_Runtime} $(DESC_YAZ_Runtime)
201 !insertmacro MUI_DESCRIPTION_TEXT ${YAZ_Development} $(DESC_YAZ_Development)
202 !insertmacro MUI_DESCRIPTION_TEXT ${YAZ_Documentation} $(DESC_YAZ_Documentation)
203 !insertmacro MUI_DESCRIPTION_TEXT ${YAZ_Source} $(DESC_YAZ_Source)
204 !insertmacro MUI_DESCRIPTION_TEXT ${YAZ4J} $(DESC_YAZ4J)
205 !insertmacro MUI_DESCRIPTION_TEXT ${YAZ_PATH} $(DESC_YAZ_PATH)
206 !insertmacro MUI_FUNCTION_DESCRIPTION_END
207
208 ; eof