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

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

E-mail: