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