Happy new year
[pazpar2-moved-to-github.git] / win / pazpar2.nsi
1 ; This file is part of Pazpar2.
2 ; Copyright (C) Index Data
3 ; See the file LICENSE for details.
4
5 !include version.nsi
6
7 ; Microsoft runtime CRT 
8 ; Uncomment exactly ONE of the sections below
9 ; 1: MSVC 6
10 ;!define VS_RUNTIME_DLL ""
11 ;!define VS_RUNTIME_MANIFEST ""
12
13 ; 2: VS 2003
14 ; !define VS_RUNTIME_DLL "c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\msvcr71.dll"
15 ;!define VS_RUNTIME_MANIFEST ""
16
17 ; 3: VS 2005
18 ;!define VS_RUNTIME_DLL      "c:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\msvcr80.dll"
19 ;!define VS_RUNTIME_MANIFEST "c:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest"
20
21 ; 4: VS 2008
22 !define VS_RUNTIME_DLL      "c:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\msvcr90.dll"
23 !define VS_RUNTIME_MANIFEST "c:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest"
24
25
26 !include "MUI.nsh"
27
28 SetCompressor bzip2
29
30 Name "Pazpar2"
31 Caption "Index Data Pazpar2 ${VERSION} Setup"
32 OutFile "pazpar2_${VERSION}.exe"
33
34 LicenseText "You must read the following license before installing:"
35 LicenseData license.txt
36
37 ComponentText "This will install Pazpar2 on your computer:"
38 InstType "Full (w/ Source)"
39 InstType "Lite (w/o Source)"
40
41 InstallDir "$PROGRAMFILES\Pazpar2"
42 InstallDirRegKey HKLM "SOFTWARE\Index Data\Pazpar2" ""
43
44
45 ;----------------------------
46 ; Pages
47
48
49   !insertmacro MUI_PAGE_LICENSE "license.txt"
50   !insertmacro MUI_PAGE_COMPONENTS
51   !insertmacro MUI_PAGE_DIRECTORY
52   !insertmacro MUI_PAGE_INSTFILES
53   
54   !insertmacro MUI_UNPAGE_CONFIRM
55   !insertmacro MUI_UNPAGE_INSTFILES
56 ; Page components
57 ; Page directory
58 ; Page instfiles
59
60 ; UninstPage uninstConfirm
61 ; UninstPage instfiles
62
63 ;--------------------------------
64 ;Languages
65  
66 !insertmacro MUI_LANGUAGE "English"
67
68 ;--------------------------------
69
70 Section "" ; (default section)
71         SetOutPath "$INSTDIR"
72         ; add files / whatever that need to be installed here.
73         WriteRegStr HKLM "SOFTWARE\Index Data\Pazpar2" "" "$INSTDIR"
74         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pazpar2" "DisplayName" "Pazpar2 ${VERSION} (remove only)"
75         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pazpar2" "UninstallString" '"$INSTDIR\uninst.exe"'
76         ; write out uninstaller
77         WriteUninstaller "$INSTDIR\uninst.exe"
78         SetOutPath $SMPROGRAMS\Pazpar2
79         CreateShortCut "$SMPROGRAMS\Pazpar2\Pazpar2 Program Directory.lnk" \
80                  "$INSTDIR"
81         WriteINIStr "$SMPROGRAMS\Pazpar2\Pazpar2 Home page.url" \
82               "InternetShortcut" "URL" "http://www.indexdata.dk/pazpar2/"
83         CreateShortCut "$SMPROGRAMS\Pazpar2\Uninstall Pazpar2.lnk" \
84                 "$INSTDIR\uninst.exe"
85         SetOutPath $INSTDIR
86         File LICENSE.txt
87         File ..\README
88         File ..\NEWS
89         SetOutPath $INSTDIR\etc
90         File /r ..\etc\*.xml
91         File /r ..\etc\*.xsl
92         File /r ..\etc\*.mmap
93         File /oname=pazpar2.cfg ..\etc\pazpar2.cfg.dist 
94         SetOutPath $INSTDIR\log
95
96 SectionEnd ; end of default section
97
98 Section "Pazpar2 Runtime" Pazpar2_Runtime
99         SectionIn 1 2
100         IfFileExists "$INSTDIR\bin\pazpar2.exe" 0 Noservice
101         ExecWait '"$INSTDIR\bin\pazpar2.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\Pazpar2
109         SetOutPath $SMPROGRAMS\Pazpar2\Server
110         CreateShortCut "$SMPROGRAMS\Pazpar2\Server\Server on console.lnk" \
111                  "$INSTDIR\bin\pazpar2.exe" '-f"$INSTDIR\etc\pazpar2.cfg"'
112         CreateShortCut "$SMPROGRAMS\Pazpar2\Server\Install Pazpar2 service.lnk" \
113                  "$INSTDIR\bin\pazpar2.exe" '-install -l"$INSTDIR\log\pazpar2.log" -f"$INSTDIR\etc\pazpar2.cfg"'
114         CreateShortCut "$SMPROGRAMS\Pazpar2\Server\Remove Pazpar2 service.lnk" \
115                  "$INSTDIR\bin\pazpar2.exe" '-remove'
116 SectionEnd
117
118 Section "Pazpar2 Documentation" Pazpar2_Documentation
119         SectionIn 1 2
120         SetOutPath $INSTDIR\doc
121         File /r ..\doc\*.css
122         File /r ..\doc\*.ent
123         File /r ..\doc\*.html
124         File /r ..\doc\*.xml
125         File /r ..\doc\*.png
126         File /r ..\doc\*.xsl
127         SetOutPath $SMPROGRAMS\Pazpar2
128         CreateShortCut "$SMPROGRAMS\Pazpar2\HTML Documentation.lnk" \
129                  "$INSTDIR\doc\index.html"
130 SectionEnd
131
132 Section "Pazpar2 Source" Pazpar2_Source
133         SectionIn 1
134         SetOutPath $INSTDIR
135         File /r ..\*.c
136         File /r ..\*.h
137         SetOutPath $INSTDIR\win
138         File makefile
139         File *.nsi
140 SectionEnd
141
142 ; begin uninstall settings/section
143 UninstallText "This will uninstall Pazpar2 ${VERSION} from your system"
144
145 Section Uninstall
146 ; add delete commands to delete whatever files/registry keys/etc you installed here.
147         Delete "$INSTDIR\uninst.exe"
148         DeleteRegKey HKLM "SOFTWARE\Index Data\Pazpar2"
149         DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Pazpar2"
150         ExecWait '"$INSTDIR\bin\pazpar2" -remove'
151         RMDir /r $SMPROGRAMS\Pazpar2
152         RMDir /r $INSTDIR
153         IfFileExists $INSTDIR 0 Removed 
154                 MessageBox MB_OK|MB_ICONEXCLAMATION \
155                  "Note: $INSTDIR could not be removed."
156 Removed:
157 SectionEnd
158
159 ;--------------------------------
160 ;Descriptions
161
162   ;Language strings
163 LangString DESC_Pazpar2_Runtime ${LANG_ENGLISH} "Pazpar2 runtime files needed in order for it to run, such as DLLs."
164 LangString DESC_Pazpar2_Documentation ${LANG_ENGLISH} "Pazpar2 Users' guide and reference in HTML."
165 LangString DESC_Pazpar2_Source ${LANG_ENGLISH} "Source code of Pazpar2. Required if you need to rebuild Pazpar2 (for debugging purposes)."
166
167 ;Assign language strings to sections
168 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
169 !insertmacro MUI_DESCRIPTION_TEXT ${Pazpar2_Runtime} $(DESC_Pazpar2_Runtime)
170 !insertmacro MUI_DESCRIPTION_TEXT ${Pazpar2_Documentation} $(DESC_Pazpar2_Documentation)
171 !insertmacro MUI_DESCRIPTION_TEXT ${Pazpar2_Source} $(DESC_Pazpar2_Source)
172 !insertmacro MUI_FUNCTION_DESCRIPTION_END
173
174 ; eof