License file for NSIS installer.
[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\*.dist
88
89 SectionEnd ; end of default section
90
91 Section "Pazpar2 Runtime" Pazpar2_Runtime
92         SectionIn 1 2
93         IfFileExists "$INSTDIR\bin\pazpar2.exe" 0 Noservice
94         ExecWait '"$INSTDIR\bin\pazpar2.exe" -remove'
95 Noservice:
96         SetOutPath $INSTDIR\bin
97         File "${VS_RUNTIME_DLL}"
98         File "${VS_RUNTIME_MANIFEST}"
99         File ..\bin\*.dll
100         File ..\bin\*.exe
101         SetOutPath $SMPROGRAMS\Pazpar2
102         SetOutPath $SMPROGRAMS\Pazpar2\Server
103         CreateShortCut "$SMPROGRAMS\Pazpar2\Server\Server on console.lnk" \
104                  "$INSTDIR\bin\pazpar2.exe" '-f"$INSTDIR\etc\pazpar2.cfg"'
105         CreateShortCut "$SMPROGRAMS\Pazpar2\Server\Install Z39.50 service.lnk" \
106                   "$INSTDIR\bin\pazpar2.exe" '-installa -f"$INSTDIR\etc\pazpar2.cfg"'
107         CreateShortCut "$SMPROGRAMS\Pazpar2\Server\Remove Pazpar2 service.lnk" \
108                  "$INSTDIR\bin\pazpar2.exe" '-remove'
109 SectionEnd
110
111 Section "Pazpar2 Documentation" Pazpar2_Documentation
112         SectionIn 1 2
113         SetOutPath $INSTDIR\doc
114         File /r ..\doc\*.css
115         File /r ..\doc\*.ent
116         File /r ..\doc\*.html
117         File /r ..\doc\*.xml
118         File /r ..\doc\*.png
119         File /r ..\doc\*.xsl
120         SetOutPath $SMPROGRAMS\Pazpar2
121         CreateShortCut "$SMPROGRAMS\Pazpar2\HTML Documentation.lnk" \
122                  "$INSTDIR\doc\index.html"
123 SectionEnd
124
125 Section "Pazpar2 Source" Pazpar2_Source
126         SectionIn 1
127         SetOutPath $INSTDIR
128         File /r ..\*.c
129         File /r ..\*.h
130         SetOutPath $INSTDIR\win
131         File makefile
132         File *.nsi
133 SectionEnd
134
135 ; begin uninstall settings/section
136 UninstallText "This will uninstall Pazpar2 ${VERSION} from your system"
137
138 Section Uninstall
139 ; add delete commands to delete whatever files/registry keys/etc you installed here.
140         Delete "$INSTDIR\uninst.exe"
141         DeleteRegKey HKLM "SOFTWARE\Index Data\Pazpar2"
142         DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Pazpar2"
143         ExecWait '"$INSTDIR\bin\pazpar2" -remove'
144         RMDir /r $SMPROGRAMS\Pazpar2
145         RMDir /r $INSTDIR
146         IfFileExists $INSTDIR 0 Removed 
147                 MessageBox MB_OK|MB_ICONEXCLAMATION \
148                  "Note: $INSTDIR could not be removed."
149 Removed:
150 SectionEnd
151
152 ;--------------------------------
153 ;Descriptions
154
155   ;Language strings
156 LangString DESC_Pazpar2_Runtime ${LANG_ENGLISH} "Pazpar2 runtime files needed in order for it to run, such as DLLs."
157 LangString DESC_Pazpar2_Documentation ${LANG_ENGLISH} "Pazpar2 Users' guide and reference in HTML."
158 LangString DESC_Pazpar2_Source ${LANG_ENGLISH} "Source code of Pazpar2. Required if you need to rebuild Pazpar2 (for debugging purposes)."
159
160 ;Assign language strings to sections
161 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
162 !insertmacro MUI_DESCRIPTION_TEXT ${Pazpar2_Runtime} $(DESC_Pazpar2_Runtime)
163 !insertmacro MUI_DESCRIPTION_TEXT ${Pazpar2_Documentation} $(DESC_Pazpar2_Documentation)
164 !insertmacro MUI_DESCRIPTION_TEXT ${Pazpar2_Source} $(DESC_Pazpar2_Source)
165 !insertmacro MUI_FUNCTION_DESCRIPTION_END
166
167 ; eof