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