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