Merge branch 'tizen' into tizen_3.0
[platform/upstream/libzbar.git] / zbar.nsi
1 #------------------------------------------------------------------------
2 #  Copyright 2009 (c) Jeff Brown <spadix@users.sourceforge.net>
3 #
4 #  This file is part of the ZBar Bar Code Reader.
5 #
6 #  The ZBar Bar Code Reader is free software; you can redistribute it
7 #  and/or modify it under the terms of the GNU Lesser Public License as
8 #  published by the Free Software Foundation; either version 2.1 of
9 #  the License, or (at your option) any later version.
10 #
11 #  The ZBar Bar Code Reader is distributed in the hope that it will be
12 #  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 #  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #  GNU Lesser Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser Public License
17 #  along with the ZBar Bar Code Reader; if not, write to the Free
18 #  Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 #  Boston, MA  02110-1301  USA
20 #
21 #  http://sourceforge.net/projects/zbar
22 #------------------------------------------------------------------------
23
24 !ifndef VERSION
25   !define VERSION "test"
26 !endif
27 !ifndef PREFIX
28   !define PREFIX "\usr\mingw32\usr"
29 !endif
30
31 !define ZBAR_KEY "Software\ZBar"
32 !define UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\ZBar"
33
34 OutFile zbar-${VERSION}-setup.exe
35
36 SetCompressor /SOLID bzip2
37
38 InstType "Typical"
39 InstType "Full"
40
41 InstallDir $PROGRAMFILES\ZBar
42 InstallDirRegKey HKLM ${ZBAR_KEY} "InstallDir"
43
44 !define SMPROG_ZBAR "$SMPROGRAMS\ZBar Bar Code Reader"
45
46 Icon ${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico
47 UninstallIcon ${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico
48
49 # do we need admin to install uninstall info?
50 #RequestExecutionLevel admin
51
52
53 !include "MUI2.nsh"
54 !include "Memento.nsh"
55
56
57 Name "ZBar"
58 Caption "ZBar ${VERSION} Setup"
59
60
61 !define MEMENTO_REGISTRY_ROOT HKLM
62 !define MEMENTO_REGISTRY_KEY ${UNINSTALL_KEY}
63
64 !define MUI_ABORTWARNING
65 !define MUI_FINISHPAGE_NOAUTOCLOSE
66 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
67
68 !define MUI_ICON ${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico
69 !define MUI_UNICON ${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico
70
71 !define MUI_WELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp
72 !define MUI_UNWELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp
73
74 !define MUI_HEADERIMAGE
75 !define MUI_HEADERIMAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Header\orange.bmp
76 !define MUI_HEADERIMAGE_UNBITMAP ${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp
77
78 !define MUI_WELCOMEPAGE_TITLE "Welcome to the ZBar ${VERSION} Setup Wizard"
79 !define MUI_WELCOMEPAGE_TEXT \
80     "This wizard will guide you through the installation of the \
81     ZBar Bar Code Reader version ${VERSION}."
82
83 !insertmacro MUI_PAGE_WELCOME
84
85 !insertmacro MUI_PAGE_LICENSE "share\doc\zbar\LICENSE"
86
87 !define MUI_COMPONENTSPAGE_SMALLDESC
88 !define MUI_COMPONENTSPAGE_CHECKBITMAP ${NSISDIR}\Contrib\Graphics\Checks\simple-round2.bmp
89
90 !insertmacro MUI_PAGE_COMPONENTS
91 !insertmacro MUI_PAGE_DIRECTORY
92 !insertmacro MUI_PAGE_INSTFILES
93
94 Function ShowREADME
95      Exec '"notepad.exe" "$INSTDIR\README.windows"'
96 FunctionEnd
97
98 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
99 !define MUI_FINISHPAGE_SHOWREADME
100 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowREADME
101 !define MUI_FINISHPAGE_LINK \
102         "Visit the ZBar website for the latest news, FAQs and support"
103 !define MUI_FINISHPAGE_LINK_LOCATION "http://zbar.sourceforge.net/"
104
105 !insertmacro MUI_PAGE_FINISH
106
107 !insertmacro MUI_UNPAGE_CONFIRM
108 !insertmacro MUI_UNPAGE_INSTFILES
109
110 !insertmacro MUI_LANGUAGE "English"
111
112 Section "ZBar Core Files (required)" SecCore
113     DetailPrint "Installing ZBar Program and Library..."
114     SectionIn 1 2 RO
115
116     SetOutPath $INSTDIR
117     File share\doc\zbar\README.windows
118     File share\doc\zbar\NEWS
119     File share\doc\zbar\TODO
120     File share\doc\zbar\COPYING
121     File share\doc\zbar\LICENSE
122
123     # emit a batch file to add the install directory to the path
124     FileOpen $0 zbarvars.bat w
125     FileWrite $0 "@rem  Add the ZBar installation directory to the path$\n"
126     FileWrite $0 "@rem  so programs may be run from the command prompt$\n"
127     FileWrite $0 "@set PATH=%PATH%;$INSTDIR\bin$\n"
128     FileWrite $0 "@cd /D $INSTDIR$\n"
129     FileWrite $0 "@echo For basic command instructions type:$\n"
130     FileWrite $0 "@echo     zbarcam --help$\n"
131     FileWrite $0 "@echo     zbarimg --help$\n"
132     FileWrite $0 "@echo Try running:$\n"
133     FileWrite $0 "@echo     zbarimg -d examples\barcode.png$\n"
134     FileClose $0
135
136     SetOutPath $INSTDIR\bin
137     File bin\libzbar-0.dll
138     File bin\zbarimg.exe
139     File bin\zbarcam.exe
140
141     # dependencies
142     File ${PREFIX}\bin\zlib1.dll
143     File ${PREFIX}\bin\libjpeg-7.dll
144     File ${PREFIX}\bin\libpng12-0.dll
145     File ${PREFIX}\bin\libtiff-3.dll
146     File ${PREFIX}\bin\libxml2-2.dll
147     File ${PREFIX}\bin\libiconv-2.dll
148     File ${PREFIX}\bin\libMagickCore-2.dll
149     File ${PREFIX}\bin\libMagickWand-2.dll
150
151     FileOpen $0 zbarcam.bat w
152     FileWrite $0 "@set PATH=%PATH%;$INSTDIR\bin$\n"
153     FileWrite $0 "@echo This is the zbarcam output window.$\n"
154     FileWrite $0 "@echo Hold a bar code in front of the camera (make sure it's in focus!)$\n"
155     FileWrite $0 "@echo and decoded results will appear below.$\n"
156     FileWrite $0 "@echo.$\n"
157     FileWrite $0 "@echo Initializing camera, please wait...$\n"
158     FileWrite $0 "@echo.$\n"
159     FileWrite $0 "@zbarcam.exe --prescale=640x480$\n"
160     FileWrite $0 "@if errorlevel 1 pause$\n"
161     FileClose $0
162
163     SetOutPath $INSTDIR\doc
164     File share\doc\zbar\html\*
165
166     SetOutPath $INSTDIR\examples
167     File share\zbar\barcode.png
168 SectionEnd
169
170 #SectionGroup "Start Menu and Desktop Shortcuts" SecShortcuts
171     Section "Start Menu Shortcuts" SecShortcutsStartMenu
172         DetailPrint "Creating Start Menu Shortcuts..."
173         SectionIn 1 2
174         SetOutPath "${SMPROG_ZBAR}"
175         #CreateShortCut "${SMPROG_ZBAR}\ZBar.lnk" "$INSTDIR\ZBar.exe"
176         CreateDirectory "${SMPROG_ZBAR}"
177         CreateShortCut "zbarcam.lnk" "$\"$INSTDIR\bin\zbarcam.bat$\"" "" \
178                        "$INSTDIR\bin\zbarcam.exe"
179         ExpandEnvStrings $0 '%comspec%'
180         CreateShortCut "ZBar Command Prompt.lnk" \
181                        $0 "/k $\"$\"$INSTDIR\zbarvars.bat$\"$\"" $0
182         CreateShortCut "Command Reference.lnk" \
183                        "$\"$INSTDIR\doc\ref.html$\""
184     SectionEnd
185
186 #    Section "Desktop Shortcut" SecShortcutsDesktop
187 #        DetailPrint "Creating Desktop Shortcut..."
188 #        SectionIn 1 2
189 #        SetOutPath $INSTDIR
190 #        #CreateShortCut "$DESKTOP\ZBar.lnk" "$INSTDIR\ZBar.exe"
191 #    SectionEnd
192 #SectionGroupEnd
193
194 Section "Development Headers and Libraries" SecDevel
195     DetailPrint "Installing ZBar Development Files..."
196     SectionIn 2
197
198     SetOutPath $INSTDIR\include
199     File include\zbar.h
200
201     SetOutPath $INSTDIR\include\zbar
202     File include\zbar\Video.h
203     File include\zbar\Exception.h
204     File include\zbar\Symbol.h
205     File include\zbar\Image.h
206     File include\zbar\ImageScanner.h
207     File include\zbar\Window.h
208     File include\zbar\Processor.h
209     File include\zbar\Decoder.h
210     File include\zbar\Scanner.h
211
212     SetOutPath $INSTDIR\lib
213     File lib\libzbar-0.def
214     File lib\libzbar-0.lib
215     File lib\libzbar.dll.a
216
217     SetOutPath $INSTDIR\examples
218     File share\zbar\scan_image.cpp
219     File share\zbar\scan_image.vcproj
220 SectionEnd
221
222 Section -post
223     DetailPrint "Creating Registry Keys..."
224     SetOutPath $INSTDIR
225     WriteRegStr HKLM ${ZBAR_KEY} "InstallDir" $INSTDIR
226
227     # register uninstaller
228     WriteRegStr HKLM ${UNINSTALL_KEY} "UninstallString" \
229                 "$\"$INSTDIR\uninstall.exe$\""
230     WriteRegStr HKLM ${UNINSTALL_KEY} "QuietUninstallString" \
231                 "$\"$INSTDIR\uninstall.exe$\" /S"
232     WriteRegStr HKLM ${UNINSTALL_KEY} "InstallLocation" "$\"$INSTDIR$\""
233
234     WriteRegStr HKLM ${UNINSTALL_KEY} "DisplayName" "ZBar Bar Code Reader"
235     WriteRegStr HKLM ${UNINSTALL_KEY} "DisplayIcon" "$INSTDIR\bin\zbarimg.exe,0"
236     WriteRegStr HKLM ${UNINSTALL_KEY} "DisplayVersion" "${VERSION}"
237
238     WriteRegStr HKLM ${UNINSTALL_KEY} "URLInfoAbout" "http://zbar.sf.net/"
239     WriteRegStr HKLM ${UNINSTALL_KEY} "HelpLink" "http://zbar.sf.net/"
240     WriteRegDWORD HKLM ${UNINSTALL_KEY} "NoModify" "1"
241     WriteRegDWORD HKLM ${UNINSTALL_KEY} "NoRepair" "1"
242
243     DetailPrint "Generating Uninstaller..."
244     WriteUninstaller $INSTDIR\uninstall.exe
245 SectionEnd
246
247
248 Section Uninstall
249     DetailPrint "Uninstalling ZBar Bar Code Reader.."
250
251     DetailPrint "Deleting Files..."
252     Delete $INSTDIR\examples\barcode.png
253     Delete $INSTDIR\examples\scan_image.cpp
254     Delete $INSTDIR\examples\scan_image.vcproj
255     RMDir $INSTDIR\examples
256     RMDir /r $INSTDIR\include
257     RMDir /r $INSTDIR\doc
258     RMDir /r $INSTDIR\lib
259     RMDir /r $INSTDIR\bin
260     Delete $INSTDIR\README.windows
261     Delete $INSTDIR\NEWS
262     Delete $INSTDIR\TODO
263     Delete $INSTDIR\COPYING
264     Delete $INSTDIR\LICENSE
265     Delete $INSTDIR\zbarvars.bat
266     Delete $INSTDIR\uninstall.exe
267     RMDir $INSTDIR
268
269     DetailPrint "Removing Shortcuts..."
270     RMDir /r "${SMPROG_ZBAR}"
271
272     DetailPrint "Deleting Registry Keys..."
273     DeleteRegKey HKLM ${ZBAR_KEY}
274     DeleteRegKey HKLM ${UNINSTALL_KEY}
275 SectionEnd
276
277
278 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
279     !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} \
280         "The core files required to use the bar code reader"
281 #    !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} \
282 #        "Adds icons to your start menu and/or your desktop for easy access"
283     !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcutsStartMenu} \
284         "Adds shortcuts to your start menu"
285 #    !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcutsDesktop} \
286 #        "Adds an icon on your desktop"
287     !insertmacro MUI_DESCRIPTION_TEXT ${SecDevel} \
288         "Optional files used to develop other applications using ZBar"
289 !insertmacro MUI_FUNCTION_DESCRIPTION_END