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