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