windows installer for tesseract

368 views
Skip to first unread message

estetus

unread,
Oct 6, 2010, 5:58:06 AM10/6/10
to tesseract-dev
Hello!

I hear that in tesseract project "There is no windows installer!
(Still looking for volunteers to create one.) "
See http://code.google.com/p/tesseract-ocr/wiki/ReadMe

I prepared test version of installed for tesseract 3.0 on windows.
My installed is based on NSIS (http://nsis.sourceforge.net/Main_Page)

Step by step how to prepare installer from script:
1. download tesseract archive for windows
http://tesseract-ocr.googlecode.com/files/tesseract-3.00.win32.zip
2. place NSIS script (it is below) to unpacked contant
3. install NSIS
4. compile NSIS script and get executable installer

I hope it help to tesseract project.



!define VERSION 3.0

!define PRODUCT_NAME "tesseract"

!define PRODUCT_VERSION "${VERSION}"

!define PRODUCT_PUBLISHER ""

!define PRODUCT_WEB_SITE "http://code.google.com/p/tesseract-ocr"

;!define PRODUCT_DIR_REGKEY "Software/Microsoft"

;!define PRODUCT_UNINST_KEY "Software/Microsoft"

;!define PRODUCT_UNINST_ROOT_KEY "Software/Microsoft"

SetCompressor lzma

Name "Tesseract-OCR ${VERSION}"

Caption "Tesseract-OCR ${VERSION}"

;Icon "icon_1.ico"

;UninstallIcon "install_icon.ico"

BrandingText /TRIMCENTER " (c) 2010 tesseract "

InstallDir "$PROGRAMFILES\Tesseract-OCR"

InstallDirRegKey HKCU "Software\tesseract-ocr" ""

ShowInstDetails show

XPStyle on

SpaceTexts

CRCCheck on

InstProgressFlags smooth colored

;Name of program and file

!ifdef VERSION

OutFile tesseract-ocr-setup-${VERSION}.exe

!else

OutFile tesseract-ocr-setup.exe

!endif



Function .onInit

MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install
tesseract-ocr?" \

/SD IDYES IDNO no IDYES yes

no:

SetSilent silent

Goto done

yes:

SetSilent normal

;InitPluginsDir

;File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Graphics
\Header\nsis.bmp"

;File /oname=$PLUGINSDIR\splash.bmp "new.bmp"

;advsplash::show 1000 600 400 -1 $PLUGINSDIR\splash

;Pop $0 ; $0 has '1' if the user closed the splash screen
early,

; '0' if everything closed normal, and '-1' if
some error occured.

;IfFileExists $INSTDIR\loadmain.exe PathGood

done:



FunctionEnd



!include "MUI.nsh"

;MUI Settings

!define MUI_ABORTWARNING

;!define MUI_ICON "install_icon.ico"

;!define MUI_UNICON "uninstall_icon.ico"

;Welcome page

!define MUI_HEADERIMAGE

;

;!define MUI_HEADERIMAGE_BITMAP "452.bmp"

;!define MUI_HEADERIMAGE_UNBITMAP "452.bmp"

!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH

;;!define MUI_HEADERIMAGE_RIGHT

;!define MUI_WELCOMEFINISHPAGE_BITMAP "logo.bmp"

!define MUI_WELCOMEPAGE_TITLE_3LINES

!define MUI_COMPONENTSPAGE_SMALLDESC



;--------------------------------

;Pages

;License page

!define MUI_LICENSEPAGE_CHECKBOX

;!define MUI_LICENSEPAGE_TEXT "$(License)"

;!insertmacro MUI_PAGE_LICENSE "${MUI_LICENSEPAGE_TEXT}"

!insertmacro MUI_PAGE_LICENSE "doc/COPYING"

!ifdef VERSION

Page custom PageReinstall PageLeaveReinstall

!endif

!insertmacro MUI_PAGE_COMPONENTS

!insertmacro MUI_PAGE_DIRECTORY

!insertmacro MUI_PAGE_INSTFILES

!define MUI_FINISHPAGE_LINK "http://code.google.com/p/tesseract-
ocr/"

!define MUI_FINISHPAGE_LINK_LOCATION "http://code.google.com/p/
tesseract-ocr/"

;!define MUI_FINISHPAGE_RUN "$INSTDIR\tesseract.exe"

;!define MUI_FINISHPAGE_NOREBOOTSUPPORT

!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\doc\README"

!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_CONFIRM

!insertmacro MUI_UNPAGE_INSTFILES

;!insertmacro MUI_UNPAGE_FINISH



;--------------------------------

;Languages

!insertmacro MUI_LANGUAGE "English"



;!insertmacro MUI_LANGUAGE "Indonesian"

;!insertmacro MUI_LANGUAGE "Irish"

;!insertmacro MUI_LANGUAGE "Italian"

;!insertmacro MUI_LANGUAGE "Japanese"

;!insertmacro MUI_LANGUAGE "Korean"

;!insertmacro MUI_LANGUAGE "Kurdish"

;!insertmacro MUI_LANGUAGE "Latvian""

;!insertmacro MUI_LANGUAGE "Lithuanian"

;!insertmacro MUI_LANGUAGE "Luxembourgish"

;!insertmacro MUI_LANGUAGE "Macedonian"

;!insertmacro MUI_LANGUAGE "Malay"

;!insertmacro MUI_LANGUAGE "Mongolian"

;!insertmacro MUI_LANGUAGE "Norwegian"

;!insertmacro MUI_LANGUAGE "NorwegianNynorsk"

;!insertmacro MUI_LANGUAGE "Polish"

;!insertmacro MUI_LANGUAGE "Portuguese"

;!insertmacro MUI_LANGUAGE "PortugueseBR"

;!insertmacro MUI_LANGUAGE "Romanian"

!insertmacro MUI_LANGUAGE "Russian"

;!insertmacro MUI_LANGUAGE "Serbian"

;!insertmacro MUI_LANGUAGE "SerbianLatin"

;!insertmacro MUI_LANGUAGE "SimpChinese"

;!insertmacro MUI_LANGUAGE "Slovak"

;!insertmacro MUI_LANGUAGE "Slovenian"

;!insertmacro MUI_LANGUAGE "Spanish"

;!insertmacro MUI_LANGUAGE "SpanishInternational"

;!insertmacro MUI_LANGUAGE "Swedish"

;!insertmacro MUI_LANGUAGE "Thai"

;!insertmacro MUI_LANGUAGE "TradChinese"

;!insertmacro MUI_LANGUAGE "Turkish"

!insertmacro MUI_LANGUAGE "Ukrainian"

;!insertmacro MUI_LANGUAGE "Uzbek"

;!insertmacro MUI_LANGUAGE "Welsh"



;--------------------------------



;Installer Sections

ShowInstDetails show

InstProgressFlags smooth colored



Section "Tesseract-OCR" SecDummy

SetOutPath "$INSTDIR"

;files inclided in distribution

File dlltest.exe

File leptonlib.dll

File tessdll.dll

File tessdll.lib

File tesseract.exe

CreateDirectory "$INSTDIR\tessdata"

CreateDirectory "$INSTDIR\tessdata\configs"

SetOutPath "$INSTDIR\tessdata\configs"

File tessdata\configs\ambigs.train

File tessdata\configs\api_config

File tessdata\configs\box.train

File tessdata\configs\box.train.stderr

File tessdata\configs\digits

File tessdata\configs\inter

File tessdata\configs\kannada

File tessdata\configs\logfile

File tessdata\configs\makebox

File tessdata\configs\unlv

CreateDirectory "$INSTDIR\tessdata\tessconfigs"

SetOutPath "$INSTDIR\tessdata\tessconfigs"

File tessdata\tessconfigs\batch

File tessdata\tessconfigs\batch.nochop

File tessdata\tessconfigs\matdemo

File tessdata\tessconfigs\msdemo

File tessdata\tessconfigs\nobatch

File tessdata\tessconfigs\segdemo

CreateDirectory "$INSTDIR\training"

SetOutPath "$INSTDIR\training"

File training\cntraining.exe

File training\combine_tessdata.exe

File training\mftraining.exe

File training\unicharset_extractor.exe

File training\wordlist2dawg.exe

CreateDirectory "$INSTDIR\doc"

SetOutPath "$INSTDIR\doc"

File doc\AUTHORS

File doc\COPYING

File doc\eurotext.tif

File doc\phototest.tif

File doc\README

File doc\ReleaseNotes

;Store installation folder

WriteRegStr HKCU "Software\tesseract-ocr" "" $INSTDIR

WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run"
"tesseract-ocr" "C:\Program Files\Tesseract-OCR\tesseract.exe"



; Download language files

StrCpy $2 "$INSTDIR\$1"

StrCpy $1 "tesseract-2.00.deu.tar.gz"

;NSISdl::download "http://tesseract-ocr.googlecode.com/files/
tesseract-2.00.deu.tar.gz" $INSTDIR

NSISdl::download "http://tesseract-ocr.googlecode.com/files/$1" $2

StrCpy $1 "tesseract-2.00.eng.tar.gz"

NSISdl::download "http://tesseract-ocr.googlecode.com/files/$1" $2

StrCpy $1 "tesseract-2.00.fra.tar.gz"

NSISdl::download "http://tesseract-ocr.googlecode.com/files/$1" $2

StrCpy $1 "tesseract-2.00.ita.tar.gz"

NSISdl::download "http://tesseract-ocr.googlecode.com/files/$1" $2

StrCpy $1 "tesseract-2.00.nld.tar.gz"

NSISdl::download "http://tesseract-ocr.googlecode.com/files/$1" $2

StrCpy $1 "tesseract-2.01.por.tar.gz"

NSISdl::download "http://tesseract-ocr.googlecode.com/files/$1" $2

StrCpy $1 "tesseract-2.00.spa.tar.gz"

NSISdl::download "http://tesseract-ocr.googlecode.com/files/$1" $2

;Quit



;Create uninstaller

WriteUninstaller "$INSTDIR\Uninstall.exe"

;ExecShell "open" "http://code.google.com/p/tesseract-ocr/"

;ExecShell "open" '"$INSTDIR"'

;BringToFront

SectionEnd



;Section "Help" SecHelp

;CreateDirectory "$INSTDIR\Help"

;SetOutPath "$INSTDIR\Help"

;File "Ïîìîùü.chm"

;SectionEnd



;Section "Languages support" SecLanguage

;SectionEnd





Section "Shortcuts creation" SecCS

CreateDirectory "$SMPROGRAMS\Tesseract-OCR"

CreateShortCut "$SMPROGRAMS\Tesseract-OCR\tesseract-ocr.lnk"
"$INSTDIR\tesseract.exe" "" "$INSTDIR\tesseract.exe" 0

CreateShortCut "$SMPROGRAMS\Tesseract-OCR\Uninstall.lnk" "$INSTDIR
\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

;CreateShortCut "$DESKTOP\Tesseract-OCR.lnk" "$INSTDIR
\tesseract.exe" "" "$INSTDIR\tesseract.exe" 0

;CreateShortCut "$QUICKLAUNCH\.lnk" "$INSTDIR\tesseract.exe" ""
"$INSTDIR\tesseract.exe" 0

SectionEnd



;--------------------------------

;Descriptions

;Language strings

LangString DESC_SecDummy ${LANG_RUSSIAN} "Installation files."

;LangString DESC_SecHelp ${LANG_RUSSIAN} "Help information."

LangString DESC_SecCS ${LANG_RUSSIAN} "Add shortcuts to Start menu."



;Assign language strings to sections

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN

!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)

;!insertmacro MUI_DESCRIPTION_TEXT ${SecHelp} $(DESC_SecHelp)

!insertmacro MUI_DESCRIPTION_TEXT ${SecCS} $(DESC_SecCS)

!insertmacro MUI_FUNCTION_DESCRIPTION_END



;--------------------------------

;Uninstaller Section



Section "Uninstall"

!define MUI_FINISHPAGE_SHOWREADME

!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create desktop shortcut"

!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDeskShortcut

DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Run
\tesseract-ocr"

DeleteRegKey /ifempty HKCU "Software\tesseract-ocr"

Delete "$INSTDIR\*.*"

Delete "$SMPROGRAMS\Tesseract-OCR\*.*"

Delete "$INSTDIR\Tesseract-OCR\tessdata\*.*"

Delete "$INSTDIR\Tesseract-OCR\tessdata\configs\*.*"

Delete "$INSTDIR\Tesseract-OCR\tessdata\tessconfigs\*.*"

Delete "$INSTDIR\Tesseract-OCR\training\*.*"

Delete "$INSTDIR\Tesseract-OCR\doc\*.*"

RMDir "$INSTDIR\Tesseract-OCR\tessdata"

RMDir "$INSTDIR\Tesseract-OCR"

;Delete "$DESKTOP\Tesseract-OCR.lnk"

;Delete "$QUICKLAUNCH\Tesseract-OCR.lnk"

RMDir "$INSTDIR"

RMDir "$SMPROGRAMS\Tesseract-OCR"

SectionEnd



Function PageReinstall



FunctionEnd



Function PageLeaveReinstall



FunctionEnd

Jimmy O'Regan

unread,
Oct 6, 2010, 12:10:33 PM10/6/10
to tesser...@googlegroups.com
On 6 October 2010 10:58, estetus <est...@gmail.com> wrote:
> Hello!
>
> I hear that in tesseract project "There is no windows installer!
> (Still looking for volunteers to create one.) "
> See http://code.google.com/p/tesseract-ocr/wiki/ReadMe
>

Correct.

> I prepared test version of installed for tesseract 3.0 on windows.
> My installed is based on NSIS (http://nsis.sourceforge.net/Main_Page)
>

Great - if we had to pick an ideal way to go, NSIS would be it.

> Step by step how to prepare installer from script:
> 1. download tesseract archive for windows
> http://tesseract-ocr.googlecode.com/files/tesseract-3.00.win32.zip
> 2. place NSIS script (it is below) to unpacked contant
> 3. install NSIS
> 4. compile NSIS script and get executable installer
>
> I hope it help to tesseract project.
>

Well, if you're willing to contribute it under the Apache licence,
I'll be happy to add it to SVN.

It looks like there are a few extra lines added, so maybe if you send
it again, with the Apache header? (This time, as an attachment :)

Thanks for doing this!

--
<Leftmost> jimregan, that's because deep inside you, you are evil.
<Leftmost> Also not-so-deep inside you.

Sergey Bronnikov

unread,
Oct 7, 2010, 8:00:36 AM10/7/10
to Jimmy O'Regan, tesser...@googlegroups.com
Hello!

license text was added.
NSIS script attached.

> > �;File "????????????.chm"

--
sergeyb@

tesseract.nsi

Jimmy O'Regan

unread,
Oct 7, 2010, 8:35:12 AM10/7/10
to Sergey Bronnikov, tesser...@googlegroups.com
2010/10/7 Sergey Bronnikov <est...@gmail.com>:

> Hello!
>
> license text was added.
> NSIS script attached.

Thanks! Added in revision 509.

; TODO:
; - check that tesseract was already installed
; - insert sexy tesseract logos and artwork in installer instead
default pictures ;)
; - add installation of language files
; - improve localization

The logo and localisation apply generally. Does anyone know any artists?

Reply all
Reply to author
Forward
0 new messages