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