1 #------------------------------------------------------------------------
2 # Copyright 2009 (c) Jeff Brown <spadix@users.sourceforge.net>
4 # This file is part of the ZBar Bar Code Reader.
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.
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.
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
21 # http://sourceforge.net/projects/zbar
22 #------------------------------------------------------------------------
25 !define VERSION "test"
28 !define PREFIX "\usr\mingw32\usr"
31 !define ZBAR_KEY "Software\ZBar"
32 !define UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\ZBar"
34 OutFile zbar-${VERSION}-setup.exe
36 SetCompressor /SOLID bzip2
41 InstallDir $PROGRAMFILES\ZBar
42 InstallDirRegKey HKLM ${ZBAR_KEY} "InstallDir"
44 !define SMPROG_ZBAR "$SMPROGRAMS\ZBar Bar Code Reader"
46 Icon ${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico
47 UninstallIcon ${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico
49 # do we need admin to install uninstall info?
50 #RequestExecutionLevel admin
54 !include "Memento.nsh"
58 Caption "ZBar ${VERSION} Setup"
61 !define MEMENTO_REGISTRY_ROOT HKLM
62 !define MEMENTO_REGISTRY_KEY ${UNINSTALL_KEY}
64 !define MUI_ABORTWARNING
65 !define MUI_FINISHPAGE_NOAUTOCLOSE
66 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
68 !define MUI_ICON ${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico
69 !define MUI_UNICON ${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico
71 !define MUI_WELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp
72 !define MUI_UNWELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp
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
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}."
83 !insertmacro MUI_PAGE_WELCOME
85 !insertmacro MUI_PAGE_LICENSE "share\doc\zbar\LICENSE"
87 !define MUI_COMPONENTSPAGE_SMALLDESC
88 !define MUI_COMPONENTSPAGE_CHECKBITMAP ${NSISDIR}\Contrib\Graphics\Checks\simple-round2.bmp
90 !insertmacro MUI_PAGE_COMPONENTS
91 !insertmacro MUI_PAGE_DIRECTORY
92 !insertmacro MUI_PAGE_INSTFILES
95 Exec '"notepad.exe" "$INSTDIR\README.windows"'
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/"
105 !insertmacro MUI_PAGE_FINISH
107 !insertmacro MUI_UNPAGE_CONFIRM
108 !insertmacro MUI_UNPAGE_INSTFILES
110 !insertmacro MUI_LANGUAGE "English"
112 Section "ZBar Core Files (required)" SecCore
113 DetailPrint "Installing ZBar Program and Library..."
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
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"
136 SetOutPath $INSTDIR\bin
137 File bin\libzbar-0.dll
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
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"
163 SetOutPath $INSTDIR\doc
164 File share\doc\zbar\html\*
166 SetOutPath $INSTDIR\examples
167 File share\zbar\barcode.png
170 #SectionGroup "Start Menu and Desktop Shortcuts" SecShortcuts
171 Section "Start Menu Shortcuts" SecShortcutsStartMenu
172 DetailPrint "Creating Start Menu Shortcuts..."
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$\""
186 # Section "Desktop Shortcut" SecShortcutsDesktop
187 # DetailPrint "Creating Desktop Shortcut..."
189 # SetOutPath $INSTDIR
190 # #CreateShortCut "$DESKTOP\ZBar.lnk" "$INSTDIR\ZBar.exe"
194 Section "Development Headers and Libraries" SecDevel
195 DetailPrint "Installing ZBar Development Files..."
198 SetOutPath $INSTDIR\include
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
212 SetOutPath $INSTDIR\lib
213 File lib\libzbar-0.def
214 File lib\libzbar-0.lib
215 File lib\libzbar.dll.a
217 SetOutPath $INSTDIR\examples
218 File share\zbar\scan_image.cpp
219 File share\zbar\scan_image.vcproj
223 DetailPrint "Creating Registry Keys..."
225 WriteRegStr HKLM ${ZBAR_KEY} "InstallDir" $INSTDIR
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$\""
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}"
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"
243 DetailPrint "Generating Uninstaller..."
244 WriteUninstaller $INSTDIR\uninstall.exe
249 DetailPrint "Uninstalling ZBar Bar Code Reader.."
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
263 Delete $INSTDIR\COPYING
264 Delete $INSTDIR\LICENSE
265 Delete $INSTDIR\zbarvars.bat
266 Delete $INSTDIR\uninstall.exe
269 DetailPrint "Removing Shortcuts..."
270 RMDir /r "${SMPROG_ZBAR}"
272 DetailPrint "Deleting Registry Keys..."
273 DeleteRegKey HKLM ${ZBAR_KEY}
274 DeleteRegKey HKLM ${UNINSTALL_KEY}
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