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