first pass installer

- add version and icon resources for libzbar, zbarimg
This commit is contained in:
spadix@users.sf.net 2009-06-22 01:13:03 -04:00
parent eea0e1e64c
commit 86d9202b7f
12 changed files with 485 additions and 3 deletions

View File

@ -1,4 +1,6 @@
current:
* first pass installer
- add version and icon resources for libzbar, zbarimg
* zbarimg working in windows
- switch to StretchDIBits over DrawDib
- refactor some window drawing code to remove redundancies

View File

@ -60,3 +60,29 @@ EXTRA_DIST += perl/MANIFEST perl/README perl/Changes perl/COPYING.LIB \
perl/examples/scan_image.pl \
perl/t/barcode.png perl/t/ZBar.t perl/t/Decoder.t perl/t/Image.t \
perl/t/Processor.t perl/t/Scanner.t perl/t/pod.t perl/t/pod-coverage.t
if WIN32
dist_doc_DATA += README.windows
pkgdata_DATA = $(srcdir)/examples/barcode.png \
$(srcdir)/examples/scan_image.cpp $(srcdir)/examples/scan_image.vcproj
%-rc.o: %.rc
$(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) -o $@ $<
%-rc.lo: %.rc
$(LIBTOOL) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) -o $@ $<
# install to tmp dest and run NSIS to generate installer
dist-nsis: html-local
test ! -e _nsis || test -d _nsis && rm -rf _nsis
mkdir _nsis
tmpinst=`cd _nsis && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR=$$tmpinst prefix=/ install
cp zbar/.libs/libzbar-0.dll.def _nsis/lib/libzbar-0.def
cp -r doc/html _nsis/share/doc/zbar/
$(WINEXEC) lib.exe /machine:x86 /def:_nsis/lib/libzbar-0.def /out:_nsis/lib/libzbar-0.lib
cd _nsis && \
makensis -NOCD -V2 -DVERSION=$(VERSION) $(srcdir)/zbar.nsi
endif

61
README.windows Normal file
View File

@ -0,0 +1,61 @@
ZBAR BAR CODE READER
====================
The ZBar Bar Code Reader is a library for scanning and decoding bar
codes from various sources such as video streams, image files or raw
intensity sensors. It supports EAN/UPC, Code 128, Code 39 and
Interleaved 2 of 5. Included with the library are basic applications
for decoding captured bar code images and using a video device (eg,
webcam) as a bar code scanner. The flexible, layered architecture
features a fast, streaming interface with a minimal memory footprint.
Check the ZBar home page for the latest release, mailing lists, etc.
http://zbar.sourceforge.net/
License information can be found in 'COPYING.LIB'.
INSTALLING
==========
The zbarimg program uses ImageMagick to read image files. You will
need at least ImageMagick version 6.2.6 if you want to scan image
files. ImageMagick may be obtained from
http://www.imagemagick.org/
Download and install the current Windows binary release, making sure
that you select the *Dynamic* (DLL) version, eg:
ImageMagick-x.y.z-w-Q16-windows-dll.exe
You will also want the "Update executable search path" box checked
during installation.
RUNNING
=======
This version of the package includes *only command line programs*.
(The graphical interface is scheduled for a future release)
Invoke Start -> Programs -> ZBar Bar Code Reader -> Start ZBar Command Prompt
to open a shell that has the zbarimg command available (in the PATH).
To decode an image file, type:
zbarimg "C:\path\to\barcode.png"
For basic command instructions, type:
zbarimg --help
Check the manual for more details.
REPORTING BUGS
==============
Bugs can be reported on the SourceForge project page
http://www.sourceforge.net/projects/zbar/
Please include the ZBar version number and a detailed description of
the problem. You'll probably have better luck if you're also familiar
with the concepts from:
http://www.catb.org/~esr/faqs/smart-questions.html

3
TODO
View File

@ -15,8 +15,6 @@ wrappers:
* drag-and-drop for widgets (configurable...)
* Perl build support integration?
* Perl object lifetime problems? (eg Symbol)
* base library python bindings
* start w/enum wrappers
* GTK and Qt perl bindings
* C++ global wrappers
@ -59,6 +57,7 @@ image formats:
window:
* add XShm support
* X protocol error handling
* Direct2D
* API to query used interface (video, window?) (/format?)
* mode to preserve aspect ratio (default?)
* simple image manipulations scale(xv?)/mirror

View File

@ -8,6 +8,7 @@ AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_SRCDIR(zbar/scanner.c)
LT_PREREQ([2.2])
LT_INIT([dlopen win32-dll])
LT_LANG([Windows Resource])
dnl update these just before each release (along w/pacakge version above)
dnl LIB_VERSION update instructions copied from libtool docs:
@ -35,6 +36,16 @@ AC_DEFINE_UNQUOTED([ZBAR_VERSION_MINOR],
[[`echo "$PACKAGE_VERSION" | sed -e 's/^[^.]*\.\([^.]*\)$/\1/'`]],
[Program minor version (after '.') as a number])
cur=`echo "$LIB_VERSION" | sed -e 's/:.*$//'`
age=`echo "$LIB_VERSION" | sed -e 's/^.*://'`
AC_DEFINE_UNQUOTED([LIB_VERSION_MAJOR], [[$(( $cur - $age ))]],
[Library major version])
AC_DEFINE_UNQUOTED([LIB_VERSION_MINOR], [[$age]],
[Library minor version])
AC_DEFINE_UNQUOTED([LIB_VERSION_REVISION],
[[`echo "$LIB_VERSION" | sed -e 's/^[^:]*:\([^:]*\):.*$/\1/'`]],
[Library revision])
dnl windows build
AC_CANONICAL_HOST

View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="scan_image"
RootNamespace="scan_image"
Keyword="Win32Proj">
<Platforms>
<Platform Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../bin"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="4"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\lib\libzbar-0.lib kernel32.lib $(NoInherit)"
ShowProgress="0"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp">
<File RelativePath=".\scan_image.cpp"/>
</Filter>
</Files>
</VisualStudioProject>

BIN
zbar.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

268
zbar.nsi Normal file
View File

@ -0,0 +1,268 @@
#------------------------------------------------------------------------
# Copyright 2009 (c) Jeff Brown <spadix@users.sourceforge.net>
#
# This file is part of the ZBar Bar Code Reader.
#
# The ZBar Bar Code Reader is free software; you can redistribute it
# and/or modify it under the terms of the GNU Lesser Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# The ZBar Bar Code Reader is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with the ZBar Bar Code Reader; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
#
# http://sourceforge.net/projects/zbar
#------------------------------------------------------------------------
!ifndef VERSION
!define VERSION "test"
!endif
!define ZBAR_KEY "Software\ZBar"
!define UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\ZBar"
OutFile zbar-${VERSION}-setup.exe
SetCompressor /SOLID bzip2
InstType "Typical"
InstType "Full"
InstallDir $PROGRAMFILES\ZBar
InstallDirRegKey HKLM ${ZBAR_KEY} "InstallDir"
!define SMPROG_ZBAR "$SMPROGRAMS\ZBar Bar Code Reader"
# do we need admin to install DLL and uninstall info?
RequestExecutionLevel admin
!include "MUI2.nsh"
!include "Memento.nsh"
Name "ZBar"
Caption "ZBar ${VERSION} Setup"
# Check that ImageMagick is installed
Function .onInit
SearchPath $0 "CORE_RL_wand_.dll"
IfErrors 0 goinstall
MessageBox MB_OKCANCEL|MB_ICONSTOP \
"ImageMagick was not found in your PATH!$\n\
$\n\
The zbarimg program will not be able to scan image files \
unless you install ImageMagick$\n\
$\n\
See the README for more details$\n\
$\n\
Press OK to continue anyway...$\n\
Press Cancel to abort the installation..." \
/SD IDCANCEL \
IDOK goinstall
Abort
goinstall:
FunctionEnd
!define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY ${UNINSTALL_KEY}
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_ICON ${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico
!define MUI_UNICON ${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico
!define MUI_WELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Header\orange.bmp
!define MUI_HEADERIMAGE_UNBITMAP ${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp
!define MUI_WELCOMEPAGE_TITLE "Welcome to the ZBar ${VERSION} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT \
"This wizard will guide you through the installation of the \
ZBar Bar Code Reader version ${VERSION}."
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "share\doc\zbar\COPYING.LIB"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_COMPONENTSPAGE_CHECKBITMAP ${NSISDIR}\Contrib\Graphics\Checks\simple-round2.bmp
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Function ShowREADME
Exec '"notepad.exe" "$INSTDIR\README.windows"'
FunctionEnd
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowREADME
!define MUI_FINISHPAGE_LINK \
"Visit the ZBar website for the latest news, FAQs and support"
!define MUI_FINISHPAGE_LINK_LOCATION "http://zbar.sourceforge.net/"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "ZBar Core Files (required)" SecCore
DetailPrint "Installing ZBar Program and Library..."
SectionIn 1 2 RO
SetOutPath $INSTDIR
File share\doc\zbar\README.windows
File share\doc\zbar\NEWS
File share\doc\zbar\TODO
File share\doc\zbar\COPYING.LIB
# emit a batch file to add the install directory to the path
FileOpen $0 zbarvars.bat w
FileWrite $0 "@rem Add the ZBar installation directory to the path$\n"
FileWrite $0 "@rem so programs may be run from the command prompt$\n"
FileWrite $0 "@set PATH=%PATH%;$INSTDIR\bin$\n"
FileWrite $0 "@echo For basic command instructions type:$\n"
FileWrite $0 "@echo zbarimg --help$\n"
FileClose $0
SetOutPath $INSTDIR\bin
File bin\libzbar-0.dll
File bin\zbarimg.exe
SetOutPath $INSTDIR\doc
File share\doc\zbar\html\*
SetOutPath $INSTDIR\examples
File share\zbar\barcode.png
SectionEnd
#SectionGroup "Start Menu and Desktop Shortcuts" SecShortcuts
Section "Start Menu Shortcut" SecShortcutsStartMenu
DetailPrint "Creating Start Menu Shortcut..."
SectionIn 1 2
SetOutPath $INSTDIR
#CreateShortCut "${SMPROG_ZBAR}\ZBar.lnk" "$INSTDIR\ZBar.exe"
CreateDirectory "${SMPROG_ZBAR}"
ExpandEnvStrings $0 '%comspec%'
CreateShortCut "${SMPROG_ZBAR}\Start ZBar Command Prompt.lnk" \
$0 "/k $\"$\"$INSTDIR\zbarvars.bat$\"$\"" $0
CreateShortCut "${SMPROG_ZBAR}\Command Reference.lnk" \
"$\"$INSTDIR\doc\zbarimg.html$\""
SectionEnd
# Section "Desktop Shortcut" SecShortcutsDesktop
# DetailPrint "Creating Desktop Shortcut..."
# SectionIn 1 2
# SetOutPath $INSTDIR
# #CreateShortCut "$DESKTOP\ZBar.lnk" "$INSTDIR\ZBar.exe"
# SectionEnd
#SectionGroupEnd
Section "Development Headers and Libraries" SecDevel
DetailPrint "Installing ZBar Development Files..."
SectionIn 2
SetOutPath $INSTDIR\include
File include\zbar.h
SetOutPath $INSTDIR\include\zbar
File include\zbar\Video.h
File include\zbar\Exception.h
File include\zbar\Symbol.h
File include\zbar\Image.h
File include\zbar\ImageScanner.h
File include\zbar\Window.h
File include\zbar\Processor.h
File include\zbar\Decoder.h
File include\zbar\Scanner.h
SetOutPath $INSTDIR\lib
File lib\libzbar-0.def
File lib\libzbar-0.lib
SetOutPath $INSTDIR\examples
File share\zbar\scan_image.cpp
File share\zbar\scan_image.vcproj
SectionEnd
Section -post
DetailPrint "Creating Registry Keys..."
SetOutPath $INSTDIR
WriteRegStr HKLM ${ZBAR_KEY} "InstallDir" $INSTDIR
# register uninstaller
WriteRegStr HKLM ${UNINSTALL_KEY} "UninstallString" \
"$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM ${UNINSTALL_KEY} "QuietUninstallString" \
"$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM ${UNINSTALL_KEY} "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM ${UNINSTALL_KEY} "DisplayName" "ZBar Bar Code Reader"
WriteRegStr HKLM ${UNINSTALL_KEY} "DisplayIcon" "$INSTDIR\zbarimg.exe,0"
WriteRegStr HKLM ${UNINSTALL_KEY} "DisplayVersion" "${VERSION}"
WriteRegStr HKLM ${UNINSTALL_KEY} "URLInfoAbout" "http://zbar.sf.net/"
WriteRegStr HKLM ${UNINSTALL_KEY} "HelpLink" "http://zbar.sf.net/"
WriteRegDWORD HKLM ${UNINSTALL_KEY} "NoModify" "1"
WriteRegDWORD HKLM ${UNINSTALL_KEY} "NoRepair" "1"
DetailPrint "Generating Uninstaller..."
WriteUninstaller $INSTDIR\uninstall.exe
SectionEnd
Section Uninstall
DetailPrint "Uninstalling ZBar Bar Code Reader.."
DetailPrint "Deleting Files..."
RMDir /r $INSTDIR\examples
RMDir /r $INSTDIR\include
RMDir /r $INSTDIR\doc
RMDir /r $INSTDIR\lib
RMDir /r $INSTDIR\bin
Delete $INSTDIR\README.windows
Delete $INSTDIR\NEWS
Delete $INSTDIR\TODO
Delete $INSTDIR\COPYING.LIB
Delete $INSTDIR\zbarvars.bat
Delete $INSTDIR\uninstall.exe
RMDir $INSTDIR
DetailPrint "Removing Shortcuts..."
RMDir /r "${SMPROG_ZBAR}"
DetailPrint "Deleting Registry Keys..."
DeleteRegKey HKLM ${ZBAR_KEY}
DeleteRegKey HKLM ${UNINSTALL_KEY}
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} \
"The core files required to use the bar code reader"
# !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} \
# "Adds icons to your start menu and/or your desktop for easy access"
!insertmacro MUI_DESCRIPTION_TEXT ${SecShortcutsStartMenu} \
"Adds shortcuts to your start menu"
# !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcutsDesktop} \
# "Adds an icon on your desktop"
!insertmacro MUI_DESCRIPTION_TEXT ${SecDevel} \
"Optional files used to develop other applications using ZBar"
!insertmacro MUI_FUNCTION_DESCRIPTION_END

View File

@ -33,9 +33,11 @@ if HAVE_POLL
zbar_libzbar_la_SOURCES += zbar/processor/posix.h zbar/processor/posix.c
endif
if WIN32
zbar_libzbar_la_SOURCES += zbar/processor/win.h zbar/processor/win.c
zbar_libzbar_la_SOURCES += zbar/processor/win.h zbar/processor/win.c \
zbar/libzbar.rc
zbar_libzbar_la_CPPFLAGS += -mthreads
zbar_libzbar_la_LDFLAGS += -mthreads
zbar_libzbar_la_LIBADD += zbar/libzbar-rc.lo
endif
if HAVE_V4L1

32
zbar/libzbar.rc Normal file
View File

@ -0,0 +1,32 @@
#include <config.h>
#include <winver.h>
#define STR(s) #s
#define XSTR(s) STR(s)
VS_VERSION_INFO VERSIONINFO
FILEVERSION LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_REVISION, 0
PRODUCTVERSION ZBAR_VERSION_MAJOR, ZBAR_VERSION_MINOR, 0, 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
{
BLOCK "StringFileInfo" {
BLOCK "040904E4" {
VALUE "ProductName", "ZBar Bar Code Reader"
VALUE "Company Name", "ZBar Bar Code Reader"
VALUE "InternalName", "libzbar"
VALUE "OriginalFilename", "libzbar-" XSTR(LIB_VERSION_MAJOR) ".dll"
VALUE "FileVersion", XSTR(LIB_VERSION_MAJOR) "." \
XSTR(LIB_VERSION_MINOR) "." XSTR(LIB_VERSION_REVISION)
VALUE "ProductVersion", PACKAGE_VERSION
VALUE "FileDescription", "Bar code scanning library"
VALUE "LegalCopyright", "Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>"
}
}
BLOCK "VarFileInfo" {
VALUE "Translation", 0x0409, 0x04e4
}
}

View File

@ -4,3 +4,8 @@ zbarimg_zbarimg_CPPFLAGS = $(MAGICK_CFLAGS) $(AM_CPPFLAGS)
zbarimg_zbarimg_LDADD = $(MAGICK_LIBS) zbar/libzbar.la
# automake bug in "monolithic mode"?
CLEANFILES += zbarimg/.libs/zbarimg
if WIN32
zbarimg_zbarimg_SOURCES += zbarimg/zbarimg.rc
zbarimg_zbarimg_LDADD += zbarimg/zbarimg-rc.o
endif

30
zbarimg/zbarimg.rc Normal file
View File

@ -0,0 +1,30 @@
#include <config.h>
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION ZBAR_VERSION_MAJOR, ZBAR_VERSION_MINOR, 0, 0
PRODUCTVERSION ZBAR_VERSION_MAJOR, ZBAR_VERSION_MINOR, 0, 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
{
BLOCK "StringFileInfo" {
BLOCK "040904E4" {
VALUE "ProductName", "ZBar Bar Code Reader"
VALUE "Company Name", "ZBar Bar Code Reader"
VALUE "InternalName", "zbarimg"
VALUE "OriginalFilename", "zbarimg.exe"
VALUE "FileVersion", PACKAGE_VERSION
VALUE "ProductVersion", PACKAGE_VERSION
VALUE "FileDescription", "Scan bar codes from image files"
VALUE "LegalCopyright", "Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>"
}
}
BLOCK "VarFileInfo" {
VALUE "Translation", 0x0409, 0x04e4
}
}
APP_ICON ICON "zbar.ico"