; parser.nsi
;
!include "MUI.nsh"
!include "Library.nsh"
;--------------------------------
; Configuration
!define VER_FILE "3_5_0"
!define VER_DISPLAY "3.5.0"
!define VER_LANG "en"
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\Parser 3"
; General
Name "Parser ${VER_DISPLAY}"
Caption "Parser ${VER_DISPLAY}"
SetCompressor /SOLID lzma
SetOverwrite ifnewer
CRCCheck on
AllowRootDirInstall false
SetDatablockOptimize on
SetDateSave on
; The file to write
OutFile "parser${VER_FILE}_${VER_LANG}.exe"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "logo.bmp"
!define MUI_HEADERIMAGE_NOSTRETCH
; !define MUI_BGCOLOR "99D228"
!define MUI_ICON "favicon.ico"
!define MUI_UNICON "favicon.ico"
; Interface Settings
;!define MUI_ABORTWARNING
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
;--------------------------------
; Pages
!define MUI_LICENSEPAGE_RADIOBUTTONS
!define MUI_WELCOMEPAGE_TEXT "This programm will install Parser ${VER_DISPLAY} on your computer.\r\n\r\nClick Next to continue"
!define MUI_COMPONENTSPAGE_TEXT '"Select components to install and click Next to continue" "" "Components"'
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license_${VER_LANG}.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
; Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; Installer Sections
Section ""
WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayName" "Parser 3 (remove only)"
WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayVersion" "${VER_DISPLAY}"
WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\parser3_uninst.exe"
WriteRegStr HKLM "${UNINSTALL_PATH}" "HelpLink" "http://www.parser.ru/en/"
WriteRegStr HKLM "${UNINSTALL_PATH}" "URLInfoAbout" "http://www.parser.ru/en/"
WriteRegDWORD HKLM "${UNINSTALL_PATH}" "NoModify" 1
WriteRegStr HKLM "${UNINSTALL_PATH}" "UninstallString" '"$INSTDIR\parser3_uninst.exe"'
SetOutPath $INSTDIR
WriteUninstaller "parser3_uninst.exe"
SectionEnd
Section "CGI with XML" XML
SetOutPath $INSTDIR
File "cgi_xml\*.*"
SectionEnd
Section "IIS ISAPI with XML" ISAPIXML
SetOutPath $INSTDIR
File "isapi_xml\*.*"
SectionEnd
SubSection /e "Documentation"
Section "CHM" CHM
CreateDirectory "$INSTDIR\docs"
SetOutPath $INSTDIR\docs
File "docs\*.${VER_LANG}.chm"
SectionEnd
Section "PDF" PDF
CreateDirectory "$INSTDIR\docs"
SetOutPath $INSTDIR\docs
File "docs\*.${VER_LANG}.pdf"
SectionEnd
SubSectionEnd
SubSection /e "Misc" other
Section "Main configuration file" AUTO
SetOutPath $INSTDIR
File "config\auto.p"
CreateDirectory "$INSTDIR\charsets"
SetOutPath $INSTDIR\charsets
File "config\charsets\*.*"
SectionEnd
Section "libcurl library" LIBCURL
SetOutPath $INSTDIR
File "lib\curl\libcurl.dll"
SectionEnd
Section "libmemcached library" LIBMEMCACHED
SetOutPath $INSTDIR
File "lib\memcached\libmemcached.dll"
SectionEnd
Section "_test.html" test
CreateDirectory "$INSTDIR\other"
SetOutPath $INSTDIR\other
File "other\${VER_LANG}\_test.html"
SectionEnd
SubSectionEnd
SubSection /e "SQL drivers"
Section "MySQL driver" MYSQL
CreateDirectory "$INSTDIR\lib"
SetOutPath $INSTDIR\lib
File "sql\parser3mysql.dll"
File "lib\sql\libmySQL.dll"
SectionEnd
Section "SQLite driver" SQLITE
CreateDirectory "$INSTDIR\lib"
SetOutPath $INSTDIR\lib
File "sql\parser3sqlite.dll"
File "lib\sql\sqlite3.dll"
SectionEnd
Section "ODBC driver" ODBC
CreateDirectory "$INSTDIR\lib"
SetOutPath $INSTDIR\lib
File "sql\parser3odbc.dll"
SectionEnd
Section "Oracle driver" ORACLE
CreateDirectory "$INSTDIR\lib"
SetOutPath $INSTDIR\lib
File "sql\parser3oracle.dll"
SectionEnd
Section "PostgreSQL driver" PGSQL
CreateDirectory "$INSTDIR\lib"
SetOutPath $INSTDIR\lib
File "sql\parser3pgsql.dll"
File "lib\sql\libpq.dll"
SetOutPath $INSTDIR
File "lib\sql\libintl.dll"
SectionEnd
SubSectionEnd
;--------------------------------
; Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${XML} "Can be used with any web-server which supports CGI scripts"
!insertmacro MUI_DESCRIPTION_TEXT ${ISAPIXML} "IIS ISAPI extension is more efficient than CGI"
!insertmacro MUI_DESCRIPTION_TEXT ${CHM} "Documentation as Windows help file"
!insertmacro MUI_DESCRIPTION_TEXT ${PDF} "Documentation ready to print"
!insertmacro MUI_DESCRIPTION_TEXT ${AUTO} "Main configuration file (auto.p)"
!insertmacro MUI_DESCRIPTION_TEXT ${LIBCURL} "libcurl library which is used from curl class"
!insertmacro MUI_DESCRIPTION_TEXT ${LIBMEMCACHED} "libmemcached library which is used from memcached class"
!insertmacro MUI_DESCRIPTION_TEXT ${test} "File to test Parser installation"
!insertmacro MUI_DESCRIPTION_TEXT ${MYSQL} "Driver to access MySQL servers"
!insertmacro MUI_DESCRIPTION_TEXT ${SQLITE} "Driver for SQLite"
!insertmacro MUI_DESCRIPTION_TEXT ${PGSQL} "Driver to access PgSQL servers"
!insertmacro MUI_DESCRIPTION_TEXT ${ODBC} "Driver to access data via ODBC"
!insertmacro MUI_DESCRIPTION_TEXT ${ORACLE} "Driver to access ORACLE servers"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
DirText "Specify a folder where your web-server keeps CGI-scripts" "Folder to install Parser ${VER_DISPLAY}" "Change"
InstallDir "$7"
InstallDirRegKey HKLM "SOFTWARE\Art Lebedev Studio\Parser 3" "Install_Dir"
;--------------------------------
; Uninstaller Section
UninstallText "Uninstall Parser 3 Click Next to continue" "Folder"
UninstallSubCaption 0 ": Confirm"
UninstallSubCaption 1 ": Deleting files"
UninstallSubCaption 2 ": Delete completed"
UninstallButtonText "Next"
; special uninstall section.
Section "Uninstall"
; remove files
Delete "$INSTDIR\charsets\*.cfg"
RMDir "$INSTDIR\charsets"
; SQL drivers
Delete "$INSTDIR\lib\parser3*.dll"
; SQL libs
Delete "$INSTDIR\lib\libmySQL.dll"
Delete "$INSTDIR\lib\sqlite*.dll"
Delete "$INSTDIR\lib\libpq*.dll"
RMDir "$INSTDIR\lib"
Delete "$INSTDIR\libintl.dll"
; DOCs
Delete "$INSTDIR\docs\*.*"
RMDir "$INSTDIR\docs"
; CURL
Delete "$INSTDIR\libcurl.dll"
; MEMCACHED
Delete "$INSTDIR\libmemcached.dll"
; rest
Delete "$INSTDIR\*parser3*.*"
Delete "$INSTDIR\readme.*.txt"
Delete "$INSTDIR\Readme"
Delete "$INSTDIR\auto.p"
Delete "$INSTDIR\other\_test.html"
RMDir "$INSTDIR\other"
; remove registry keys
DeleteRegKey HKLM "SOFTWARE\Art Lebedev Studio\"
DeleteRegKey HKLM "${UNINSTALL_PATH}"
; MUST REMOVE UNINSTALLER, too
Delete $INSTDIR\parser3_uninst.exe
; remove directories used.
; RMDir "$INSTDIR"
SectionEnd
;!define SF_SELECTED 1
;!define SF_SUBSEC 2
;!define SF_SUBSECEND 4
;!define SF_BOLD 8
;!define SF_RO 16
;!define SF_EXPAND 32
;!define SECTION_OFF 0xFFFFFFFE
Function .onInit
StrCpy $INSTDIR "C:\"
; looking for directory with Apache installation
Push $5
Push $6
Push $7
; Apache 2.0 and may be early
StrCpy $5 0
loop1:
EnumRegKey $6 HKLM "SOFTWARE\Apache Group\Apache" "$5"
StrCmp $6 "" end1
IntOp $5 $5 + 1
ReadRegStr $7 HKLM "SOFTWARE\Apache Group\Apache\$6" "ServerRoot"
StrCmp $7 "" loop1
StrCpy $INSTDIR "$7cgi-bin"
Goto loop1
end1:
; Apache 2.2
StrCpy $5 0
loop2:
EnumRegKey $6 HKLM "SOFTWARE\Apache Software Foundation\Apache" "$5"
StrCmp $6 "" end2
IntOp $5 $5 + 1
ReadRegStr $7 HKLM "SOFTWARE\Apache Software Foundation\Apache\$6" "ServerRoot"
StrCmp $7 "" loop2
StrCpy $INSTDIR "$7cgi-bin"
Goto loop2
end2:
; MessageBox MB_OK "$INSTDIR"
Pop $7
Pop $6
Pop $5
Push $0
StrCpy $1 ${XML}
SectionGetFlags ${XML} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${XML} $0
SectionGetFlags ${ISAPIXML} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${ISAPIXML} $0
SectionGetFlags ${CHM} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${CHM} $0
SectionGetFlags ${PDF} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${PDF} $0
SectionGetFlags ${AUTO} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${AUTO} $0
SectionGetFlags ${LIBCURL} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${LIBCURL} $0
SectionGetFlags ${LIBMEMCACHED} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${LIBMEMCACHED} $0
SectionGetFlags ${MYSQL} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${MYSQL} $0
SectionGetFlags ${SQLITE} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${SQLITE} $0
SectionGetFlags ${ODBC} $0
IntOp $0 $0 & ${SF_SELECTED}
SectionSetFlags ${ODBC} $0
SectionGetFlags ${ORACLE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${ORACLE} $0
SectionGetFlags ${PGSQL} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${PGSQL} $0
Pop $0
FunctionEnd
Function .onSelChange
; MessageBox MB_OK 'onSelChange'
Push $0
; Turn off old selected section
SectionGetFlags $1 $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags $1 $0
; Now remember the current selection
Push $2
StrCpy $2 $1
SectionGetFlags ${XML} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 +2 +2
StrCpy $1 ${XML}
SectionGetFlags ${ISAPIXML} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 +2 +2
StrCpy $1 ${ISAPIXML}
StrCmp $2 $1 0 +2
SectionGetFlags $1 $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags $1 $0
Pop $2
Pop $0
FunctionEnd
Function .onInstSuccess
WriteRegStr HKLM "SOFTWARE\Art Lebedev Studio\Parser 3" "Install_Dir" "$INSTDIR"
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to read a short installation instruction?" IDNO NoReadMe
Exec 'notepad.exe "$INSTDIR\readme.${VER_LANG}.txt"'
NoReadMe:
FunctionEnd
E-mail: