Annotation of win32/dist/parser_mui_en.nsi, revision 1.2

1.1       misha       1: ; parser.nsi
                      2: ;
                      3: 
                      4: !include "MUI.nsh"
                      5: !include "Library.nsh"
                      6: 
                      7: ;--------------------------------
                      8: ; Configuration
                      9:        
                     10:        var MSVCR_EXIST
                     11:        var MSVCP_EXIST
                     12: 
1.2     ! moko       13:        !define VER_FILE "3_4_6b"
        !            14:        !define VER_DISPLAY "3.4.6b"
1.1       misha      15:        !define VER_LANG "en"
                     16:        !define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\Parser 3"
                     17: 
                     18:        ; General
                     19:        Name "Parser ${VER_DISPLAY}"
                     20:        Caption "Parser ${VER_DISPLAY}"
                     21: 
                     22:        SetCompressor /SOLID lzma
                     23:        SetOverwrite ifnewer
                     24:        CRCCheck on
                     25:        AllowRootDirInstall false
                     26:        SetDatablockOptimize on
                     27:        SetDateSave on
                     28: 
                     29:        ; The file to write
                     30:        OutFile "parser${VER_FILE}_${VER_LANG}.exe"
                     31: 
                     32:        !define MUI_HEADERIMAGE
                     33:        !define MUI_HEADERIMAGE_BITMAP "logo.bmp"
                     34:        !define MUI_HEADERIMAGE_NOSTRETCH
                     35: 
                     36: ;      !define MUI_BGCOLOR "99D228"
                     37:        !define MUI_ICON "favicon.ico"
                     38:        !define MUI_UNICON "favicon.ico"
                     39: 
                     40: ; Interface Settings
                     41:        ;!define MUI_ABORTWARNING
                     42:        !define MUI_COMPONENTSPAGE_SMALLDESC
                     43:        !define MUI_FINISHPAGE_NOAUTOCLOSE
                     44:        !define MUI_UNFINISHPAGE_NOAUTOCLOSE
                     45: 
                     46: ;--------------------------------
                     47: ; Pages
                     48:        !define MUI_LICENSEPAGE_RADIOBUTTONS
                     49:        !define MUI_WELCOMEPAGE_TEXT "This programm will install Parser ${VER_DISPLAY} on your computer.\r\n\r\nClick Next to continue"
                     50:        !define MUI_COMPONENTSPAGE_TEXT '"Select components to install and click Next to continue" "" "Components"'
                     51:        
                     52:        !insertmacro MUI_PAGE_WELCOME
                     53:        !insertmacro MUI_PAGE_LICENSE "license_${VER_LANG}.txt"
                     54:        !insertmacro MUI_PAGE_COMPONENTS
                     55:        !insertmacro MUI_PAGE_DIRECTORY
                     56:        !insertmacro MUI_PAGE_INSTFILES
                     57:        
                     58:        !insertmacro MUI_UNPAGE_CONFIRM
                     59:        !insertmacro MUI_UNPAGE_INSTFILES
                     60:  
                     61: ;--------------------------------
                     62: ; Languages
                     63:   !insertmacro MUI_LANGUAGE "English"
                     64: 
                     65: ;--------------------------------
                     66: ; Installer Sections
                     67: 
                     68: Section ""
                     69:        WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayName" "Parser 3 (remove only)"
                     70:        WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayVersion" "${VER_DISPLAY}"
                     71:        WriteRegStr HKLM "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\parser3_uninst.exe"
                     72:        WriteRegStr HKLM "${UNINSTALL_PATH}" "HelpLink" "http://www.parser.ru/en/"
                     73:        WriteRegStr HKLM "${UNINSTALL_PATH}" "URLInfoAbout" "http://www.parser.ru/en/"
                     74:        WriteRegDWORD HKLM "${UNINSTALL_PATH}" "NoModify" 1
                     75:        WriteRegStr HKLM "${UNINSTALL_PATH}" "UninstallString" '"$INSTDIR\parser3_uninst.exe"'
                     76:        SetOutPath $INSTDIR
                     77:        WriteUninstaller "parser3_uninst.exe"
                     78: SectionEnd
                     79: 
                     80: Section "CGI with XML" XML
                     81:        SetOutPath $INSTDIR
                     82:        File "cgi_xml\*.*"
                     83:        call InstallLibs
                     84: SectionEnd
                     85: 
                     86: 
                     87: Section "IIS ISAPI with XML" ISAPIXML
                     88:        SetOutPath $INSTDIR
                     89:        File "isapi_xml\*.*"
                     90:        call InstallLibs
                     91: SectionEnd
                     92: 
                     93: 
                     94: SubSection /e "Documentation"
                     95: 
                     96:        Section "CHM" CHM
                     97:                CreateDirectory "$INSTDIR\docs"
                     98:                SetOutPath $INSTDIR\docs
                     99:                File "docs\*.${VER_LANG}.chm"
                    100:        SectionEnd
                    101:        
                    102:        Section "PDF" PDF
                    103:                CreateDirectory "$INSTDIR\docs"
                    104:                SetOutPath $INSTDIR\docs
                    105:                File "docs\*.${VER_LANG}.pdf"
                    106:        SectionEnd
                    107: 
                    108: SubSectionEnd
                    109: 
                    110: 
                    111: SubSection /e "Misc" other
                    112: 
                    113:        Section "Main configuration file" AUTO
                    114:                SetOutPath $INSTDIR
                    115:                File "config\auto.p"
                    116:                CreateDirectory "$INSTDIR\charsets"
                    117:                SetOutPath $INSTDIR\charsets
                    118:                File "config\charsets\*.*"
                    119:        SectionEnd
                    120: 
                    121:        Section "libcurl library" LIBCURL
                    122:                SetOutPath $INSTDIR
                    123:                File "lib\curl\libcurl.dll"
                    124:        SectionEnd
                    125: 
                    126:        Section "libmemcached library" LIBMEMCACHED
                    127:                SetOutPath $INSTDIR
                    128:                File "lib\memcached\libmemcached.dll"
                    129:        SectionEnd
                    130: 
                    131:        Section "_test.html" test
                    132:                CreateDirectory "$INSTDIR\other"
                    133:                SetOutPath $INSTDIR\other
                    134:                File "other\${VER_LANG}\_test.html"
                    135:        SectionEnd
                    136: 
                    137: SubSectionEnd
                    138: 
                    139: 
                    140: SubSection /e "SQL drivers"
                    141: 
                    142:        Section "MySQL driver" MYSQL
                    143:                CreateDirectory "$INSTDIR\lib"
                    144:                SetOutPath $INSTDIR\lib
                    145:                File "sql\parser3mysql.dll"
                    146: 
                    147:                File "lib\sql\libmysql.dll"
                    148:        SectionEnd
                    149:        
                    150:        
                    151:        Section "SQLite driver" SQLITE
                    152:                CreateDirectory "$INSTDIR\lib"
                    153:                SetOutPath $INSTDIR\lib
                    154:                File "sql\parser3sqlite.dll"
                    155: 
                    156:                File "lib\sql\sqlite3.dll"
                    157:        SectionEnd
                    158:        
                    159:        
                    160:        Section "ODBC driver" ODBC
                    161:                CreateDirectory "$INSTDIR\lib"
                    162:                SetOutPath $INSTDIR\lib
                    163:                File "sql\parser3odbc.dll"
                    164:        SectionEnd
                    165:        
                    166:        
                    167:        Section "Oracle driver" ORACLE
                    168:                CreateDirectory "$INSTDIR\lib"
                    169:                SetOutPath $INSTDIR\lib
                    170:                File "sql\parser3oracle.dll"
                    171:        SectionEnd
                    172:        
                    173:        
                    174:        Section "PostgreSQL driver" PGSQL
                    175:                CreateDirectory "$INSTDIR\lib"
                    176:                SetOutPath $INSTDIR\lib
                    177:                File "sql\parser3pgsql.dll"
                    178: 
                    179:                File "lib\sql\libpq.dll"
                    180: 
                    181:                SetOutPath $INSTDIR
                    182:                File "lib\sql\libintl.dll"
                    183:        SectionEnd
                    184: 
                    185: SubSectionEnd
                    186: 
                    187: 
                    188: 
                    189: Function InstallLibs
                    190:        IfFileExists "$SYSDIR\msvcr71.dll" 0 new_msvcr
                    191:                StrCpy $MSVCR_EXIST 1
                    192:        new_msvcr:
                    193:        !insertmacro InstallLib DLL $MSVCR_EXIST REBOOT_NOTPROTECTED lib\system\msvcr71.dll $SYSDIR\msvcr71.dll $TEMP
                    194: 
                    195:        IfFileExists "$SYSDIR\msvcp71.dll" 0 new_msvcp
                    196:                StrCpy $MSVCP_EXIST 1
                    197:        new_msvcp:
                    198:        !insertmacro InstallLib DLL $MSVCP_EXIST REBOOT_NOTPROTECTED lib\system\msvcp71.dll $SYSDIR\msvcp71.dll $TEMP
                    199: FunctionEnd
                    200: 
                    201: 
                    202: ;--------------------------------
                    203: ; Descriptions
                    204: 
                    205:   !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
                    206:     !insertmacro MUI_DESCRIPTION_TEXT ${XML}   "Can be used with any web-server which supports CGI scripts"
                    207:     !insertmacro MUI_DESCRIPTION_TEXT ${ISAPIXML}   "IIS ISAPI extension is more efficient than CGI"
                    208: 
                    209:     !insertmacro MUI_DESCRIPTION_TEXT ${CHM} "Documentation as Windows help file"
                    210:     !insertmacro MUI_DESCRIPTION_TEXT ${PDF} "Documentation ready to print"
                    211: 
                    212:     !insertmacro MUI_DESCRIPTION_TEXT ${AUTO} "Main configuration file (auto.p)"
                    213:     !insertmacro MUI_DESCRIPTION_TEXT ${LIBCURL} "libcurl library which is used from curl class"
                    214:     !insertmacro MUI_DESCRIPTION_TEXT ${LIBMEMCACHED} "libmemcached library which is used from memcached class"
                    215:     !insertmacro MUI_DESCRIPTION_TEXT ${test} "File to test Parser installation"
                    216: 
                    217:     !insertmacro MUI_DESCRIPTION_TEXT ${MYSQL}  "Driver to access MySQL servers"
                    218:     !insertmacro MUI_DESCRIPTION_TEXT ${SQLITE} "Driver for SQLite"
                    219:     !insertmacro MUI_DESCRIPTION_TEXT ${PGSQL}  "Driver to access PgSQL servers"
                    220:     !insertmacro MUI_DESCRIPTION_TEXT ${ODBC}   "Driver to access data via ODBC"
                    221:     !insertmacro MUI_DESCRIPTION_TEXT ${ORACLE} "Driver to access ORACLE servers"
                    222:   !insertmacro MUI_FUNCTION_DESCRIPTION_END
                    223: 
                    224: DirText "Specify a folder where your web-server keeps CGI-scripts" "Folder to install Parser ${VER_DISPLAY}" "Change"
                    225: InstallDir "$7"
                    226: InstallDirRegKey HKLM "SOFTWARE\Art Lebedev Studio\Parser 3" "Install_Dir"
                    227: 
                    228: 
                    229: 
                    230: ;--------------------------------
                    231: ; Uninstaller Section
                    232: 
                    233: UninstallText "Uninstall Parser 3 Click Next to continue" "Folder"
                    234: UninstallSubCaption 0 ": Confirm"
                    235: UninstallSubCaption 1 ": Deleting files"
                    236: UninstallSubCaption 2 ": Delete completed"
                    237: UninstallButtonText "Next"
                    238: 
                    239: 
                    240: ; special uninstall section.
                    241: Section "Uninstall"
                    242: ;      remove files
                    243:        Delete "$INSTDIR\charsets\*.cfg"
                    244:        RMDir "$INSTDIR\charsets"
                    245: 
                    246: ; SQL drivers
                    247:        Delete "$INSTDIR\lib\parser3*.dll"
                    248: 
                    249: ; SQL libs
                    250:        Delete "$INSTDIR\lib\libmysql.dll"
                    251:        Delete "$INSTDIR\lib\sqlite*.dll"
                    252:        Delete "$INSTDIR\lib\libpq*.dll"
                    253: 
                    254:        RMDir "$INSTDIR\lib"
                    255: 
                    256:        Delete "$INSTDIR\libintl.dll"
                    257: 
                    258: ; DOCs
                    259:        Delete "$INSTDIR\docs\*.*"
                    260:        RMDir "$INSTDIR\docs"
                    261: 
                    262: ; CURL
                    263:        Delete "$INSTDIR\libcurl.dll"
                    264: 
                    265: ; MEMCACHED
                    266:        Delete "$INSTDIR\libmemcached.dll"
                    267: 
                    268: ; rest
                    269:        Delete "$INSTDIR\*parser3*.*"
                    270: 
                    271:        Delete "$INSTDIR\readme.*.txt"
                    272:        Delete "$INSTDIR\Readme"
                    273:        Delete "$INSTDIR\auto.p"
                    274: 
                    275:        Delete "$INSTDIR\other\_test.html"
                    276:        RMDir "$INSTDIR\other"
                    277: 
                    278:        !insertmacro UnInstallLib DLL SHARED NOREMOVE $SYSDIR\msvcr71.dll
                    279:        !insertmacro UnInstallLib DLL SHARED NOREMOVE $SYSDIR\msvcp71.dll
                    280: ;      remove registry keys
                    281:        DeleteRegKey HKLM "SOFTWARE\Art Lebedev Studio\"
                    282:        DeleteRegKey HKLM "${UNINSTALL_PATH}"
                    283: ;      MUST REMOVE UNINSTALLER, too
                    284:        Delete $INSTDIR\parser3_uninst.exe
                    285: ;      remove directories used.
                    286: ;      RMDir "$INSTDIR"
                    287: SectionEnd
                    288: 
                    289: 
                    290: ;!define SF_SELECTED   1
                    291: ;!define SF_SUBSEC     2
                    292: ;!define SF_SUBSECEND  4
                    293: ;!define SF_BOLD       8
                    294: ;!define SF_RO         16
                    295: ;!define SF_EXPAND     32
                    296: 
                    297: ;!define SECTION_OFF   0xFFFFFFFE
                    298: 
                    299: Function .onInit
                    300:        StrCpy $INSTDIR "C:\"
                    301: 
                    302:        ; looking for directory with Apache installation
                    303:        Push $5
                    304:        Push $6
                    305:        Push $7
                    306: 
                    307:        ; Apache 2.0 and may be early
                    308:        StrCpy $5 0
                    309: loop1:
                    310:        EnumRegKey $6 HKLM "SOFTWARE\Apache Group\Apache" "$5"
                    311:        StrCmp $6 "" end1
                    312:        IntOp $5 $5 + 1
                    313:        ReadRegStr $7 HKLM "SOFTWARE\Apache Group\Apache\$6" "ServerRoot"
                    314:        StrCmp $7 "" loop1
                    315:        StrCpy $INSTDIR "$7cgi-bin"
                    316:        Goto loop1
                    317: end1:
                    318: 
                    319:        ; Apache 2.2
                    320:        StrCpy $5 0
                    321: loop2:
                    322:        EnumRegKey $6 HKLM "SOFTWARE\Apache Software Foundation\Apache" "$5"
                    323:        StrCmp $6 "" end2
                    324:        IntOp $5 $5 + 1
                    325:        ReadRegStr $7 HKLM "SOFTWARE\Apache Software Foundation\Apache\$6" "ServerRoot"
                    326:        StrCmp $7 "" loop2
                    327:        StrCpy $INSTDIR "$7cgi-bin"
                    328:        Goto loop2
                    329: end2:
                    330: 
                    331:        ; MessageBox MB_OK "$INSTDIR"
                    332: 
                    333:        Pop $7
                    334:        Pop $6
                    335:        Pop $5
                    336:        
                    337:     Push $0
                    338: 
                    339:     StrCpy $1 ${XML}
                    340: 
                    341:     SectionGetFlags ${XML} $0
                    342:     IntOp $0 $0 | ${SF_SELECTED}
                    343:     SectionSetFlags ${XML} $0
                    344: 
                    345:     SectionGetFlags ${ISAPIXML} $0
                    346:     IntOp $0 $0 & ${SECTION_OFF}
                    347:     SectionSetFlags ${ISAPIXML} $0
                    348: 
                    349: 
                    350: 
                    351:     SectionGetFlags ${CHM} $0
                    352:     IntOp $0 $0 |  ${SF_SELECTED}
                    353:     SectionSetFlags ${CHM} $0
                    354: 
                    355:     SectionGetFlags ${PDF} $0
                    356:     IntOp $0 $0 & ${SECTION_OFF}
                    357:     SectionSetFlags ${PDF} $0
                    358: 
                    359: 
                    360: 
                    361:     SectionGetFlags ${AUTO} $0
                    362:     IntOp $0 $0 |  ${SF_SELECTED}
                    363:     SectionSetFlags ${AUTO} $0
                    364: 
                    365:     SectionGetFlags ${LIBCURL} $0
                    366:     IntOp $0 $0 |  ${SF_SELECTED}
                    367:     SectionSetFlags ${LIBCURL} $0
                    368: 
                    369:     SectionGetFlags ${LIBMEMCACHED} $0
                    370:     IntOp $0 $0 |  ${SF_SELECTED}
                    371:     SectionSetFlags ${LIBMEMCACHED} $0
                    372: 
                    373: 
                    374: 
                    375:     SectionGetFlags ${MYSQL} $0
                    376:     IntOp $0 $0 |  ${SF_SELECTED}
                    377:     SectionSetFlags ${MYSQL} $0
                    378: 
                    379:     SectionGetFlags ${SQLITE} $0
                    380:     IntOp $0 $0 |  ${SF_SELECTED}
                    381:     SectionSetFlags ${SQLITE} $0
                    382: 
                    383:     SectionGetFlags ${ODBC} $0
                    384:     IntOp $0 $0 & ${SF_SELECTED}
                    385:     SectionSetFlags ${ODBC} $0
                    386: 
                    387:     SectionGetFlags ${ORACLE} $0
                    388:     IntOp $0 $0 & ${SECTION_OFF}
                    389:     SectionSetFlags ${ORACLE} $0
                    390: 
                    391:     SectionGetFlags ${PGSQL} $0
                    392:     IntOp $0 $0 & ${SECTION_OFF}
                    393:     SectionSetFlags ${PGSQL} $0
                    394: 
                    395:     Pop $0
                    396: FunctionEnd
                    397: 
                    398: Function .onSelChange
                    399: ;      MessageBox MB_OK 'onSelChange'
                    400:     Push $0
                    401: 
                    402:     ; Turn off old selected section
                    403:     SectionGetFlags $1 $0
                    404:     IntOp $0 $0 & ${SECTION_OFF}
                    405:     SectionSetFlags $1 $0
                    406: 
                    407:     ; Now remember the current selection
                    408:     Push $2
                    409:     StrCpy $2 $1
                    410: 
                    411:     SectionGetFlags ${XML} $0
                    412:     IntOp $0 $0 & ${SF_SELECTED}
                    413:     IntCmp $0 ${SF_SELECTED} 0 +2 +2
                    414:         StrCpy $1 ${XML}
                    415: 
                    416:     SectionGetFlags ${ISAPIXML} $0
                    417:     IntOp $0 $0 & ${SF_SELECTED}
                    418:     IntCmp $0 ${SF_SELECTED} 0 +2 +2
                    419:         StrCpy $1 ${ISAPIXML}
                    420: 
                    421:     StrCmp $2 $1 0 +2
                    422:         SectionGetFlags $1 $0
                    423:         IntOp $0 $0 | ${SF_SELECTED}
                    424:         SectionSetFlags $1 $0
                    425:     Pop $2
                    426:     Pop $0
                    427: FunctionEnd
                    428: 
                    429: 
                    430: Function .onInstSuccess
                    431:        WriteRegStr HKLM "SOFTWARE\Art Lebedev Studio\Parser 3" "Install_Dir" "$INSTDIR"
                    432:        MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to read a short installation instruction?" IDNO NoReadMe
                    433:        Exec 'notepad.exe "$INSTDIR\readme.${VER_LANG}.txt"'
                    434: NoReadMe:
                    435: FunctionEnd

E-mail: