From: Brian S. <xue...@us...> - 2007-10-18 01:35:52
|
Update of /cvsroot/popfile/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15973 Modified Files: Tag: b0_22_2 getparser.nsh Log Message: Use the new URL for the MeCab parser files. Stop installing minimal Perl packages when using the uninstaller's /MODIFY option (this reduces the size of the installer by around 800 KB). Install minimal Perl packages even if the MeCab download fails (oops!). If registry has the previous Nihongo parser setting, use it as the default setting for the "Choose Nihongo Parser" page. When uninstalling stop asking the user to select a parser (oops!). If the download fails do not try to quote the program's name, just refer to the "Add/Remove Programs" list. Index: getparser.nsh =================================================================== RCS file: /cvsroot/popfile/windows/Attic/getparser.nsh,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** getparser.nsh 14 Oct 2007 17:21:48 -0000 1.1.2.1 --- getparser.nsh 18 Oct 2007 01:35:50 -0000 1.1.2.2 *************** *** 98,108 **** #-------------------------------------------------------------------------- ! ; Temporarily use the "downloads" directory on the project's "new" server: ! ! !define C_NPD_MECAB_PERL "http://h1212143.stratoserver.net/downloads/MeCab.tar.gz" ! !define C_NPD_MECAB_DICT "http://h1212143.stratoserver.net/downloads/mecab-ipadic.zip" ! ;; !define C_NPD_MECAB_PERL "http://getpopfile.org/parser/MeCab.tar.gz" ! ;; !define C_NPD_MECAB_DICT "http://getpopfile.org/parser/mecab-ipadic.zip" #-------------------------------------------------------------------------- --- 98,108 ---- #-------------------------------------------------------------------------- ! ; Temporarily use the "anonymous" URL of the project's new server: ! !define C_NPD_MECAB_PERL "http://h1212143.stratoserver.net/installer/nihongo/mecab/MeCab.tar.gz" ! !define C_NPD_MECAB_DICT "http://h1212143.stratoserver.net/installer/nihongo/mecab/mecab-ipadic.zip" ! ! ;; !define C_NPD_MECAB_PERL "http://getpopfile.org/installer/nihongo/mecab/MeCab.tar.gz" ! ;; !define C_NPD_MECAB_DICT "http://getpopfile.org/installer/nihongo/mecab/mecab-ipadic.zip" #-------------------------------------------------------------------------- *************** *** 179,182 **** --- 179,233 ---- #-------------------------------------------------------------------------- + # Macro: NIHONGO_PERL_SUPPORT + # + # When processing 'Nihongo' (i.e. Japanese) text POPFile needs some Perl + # packages which are not part of the basic minimal Perl. All three parsers + # are assumed to have similar Perl requirements so we install more or less + # the same extra Perl packages for each parser (hence this macro). + # + # In order to keep the size of the uninstaller down (and thus reduce the + # overall size of the installer) we only install these extra Perl packages + # when _installing_ POPFile. When the uninstaller is used to _change_ the + # selected Nihongo parser an error message asking the user to re-run the + # installer is shown if it looks like these extra Perl packages are missing + # from the existing installation. + #-------------------------------------------------------------------------- + + !macro NIHONGO_PERL_SUPPORT PARSER + + !if '${UN}' != 'un.' + + ;-------------------------------------------------------------------------- + ; Install Perl modules: base.pm, bytes.pm, the Encode collection and, + ; if relevant, Text::Kakasi (the requirement for bytes_heavy.pl was + ; added when the minimal Perl was updated to use ActivePerl 5.8.7) + ;-------------------------------------------------------------------------- + + SetOutPath "$G_MPLIBDIR" + File "${C_PERL_DIR}\lib\base.pm" + File "${C_PERL_DIR}\lib\bytes.pm" + File "${C_PERL_DIR}\lib\bytes_heavy.pl" + File "${C_PERL_DIR}\lib\Encode.pm" + + SetOutPath "$G_MPLIBDIR\Encode" + File /r "${C_PERL_DIR}\lib\Encode\*" + + SetOutPath "$G_MPLIBDIR\auto\Encode" + File /r "${C_PERL_DIR}\lib\auto\Encode\*" + + !endif + + !if '${PARSER}' == 'kakasi' + SetOutPath "$G_MPLIBDIR\Text" + File "${C_PERL_DIR}\site\lib\Text\Kakasi.pm" + + SetOutPath "$G_MPLIBDIR\auto\Text\Kakasi" + File "${C_PERL_DIR}\site\lib\auto\Text\Kakasi\*" + !endif + + !macroend + + + #-------------------------------------------------------------------------- # Macro: SECTION_KAKASI # *************** *** 244,248 **** Call ${UN}PFI_IsNT Pop ${L_RESERVED} ! StrCmp ${L_RESERVED} "0" continue ; Running on a non-Win9x system so we ensure the Kakasi environment variables --- 295,299 ---- Call ${UN}PFI_IsNT Pop ${L_RESERVED} ! StrCmp ${L_RESERVED} "0" update_minPerl ; Running on a non-Win9x system so we ensure the Kakasi environment variables *************** *** 258,291 **** System::Call 'Kernel32::SetEnvironmentVariableA(t, t) \ i("KANWADICTPATH", "$G_ROOTDIR\kakasi\share\kakasi\kanwadict").r0' ! StrCmp ${L_RESERVED} 0 0 continue MessageBox MB_OK|MB_ICONSTOP "$(PFI_LANG_CONVERT_ENVNOTSET) (KANWADICTPATH)" ! continue: ! ! ;-------------------------------------------------------------------------- ! ; Install Perl modules: base.pm, bytes.pm, the Encode collection and Text::Kakasi ! ; (the requirement for bytes_heavy.pl was added when the minimal Perl was updated ! ; to use ActivePerl 5.8.7 components) ! ;-------------------------------------------------------------------------- ! ! SetOutPath "$G_MPLIBDIR" ! File "${C_PERL_DIR}\lib\base.pm" ! File "${C_PERL_DIR}\lib\bytes.pm" ! File "${C_PERL_DIR}\lib\bytes_heavy.pl" ! File "${C_PERL_DIR}\lib\Encode.pm" ! ! SetOutPath "$G_MPLIBDIR\Encode" ! File /r "${C_PERL_DIR}\lib\Encode\*" ! ! SetOutPath "$G_MPLIBDIR\auto\Encode" ! File /r "${C_PERL_DIR}\lib\auto\Encode\*" ! ! SetOutPath "$G_MPLIBDIR\Text" ! File "${C_PERL_DIR}\site\lib\Text\Kakasi.pm" ! ! SetOutPath "$G_MPLIBDIR\auto\Text\Kakasi" ! File "${C_PERL_DIR}\site\lib\auto\Text\Kakasi\*" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" "$G_PARSER" Pop ${L_RESERVED} --- 309,326 ---- System::Call 'Kernel32::SetEnvironmentVariableA(t, t) \ i("KANWADICTPATH", "$G_ROOTDIR\kakasi\share\kakasi\kanwadict").r0' ! StrCmp ${L_RESERVED} 0 0 update_minPerl MessageBox MB_OK|MB_ICONSTOP "$(PFI_LANG_CONVERT_ENVNOTSET) (KANWADICTPATH)" ! update_minPerl: ! !insertmacro NIHONGO_PERL_SUPPORT "kakasi" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" "$G_PARSER" + DetailPrint "" + DetailPrint "'NihongoParser' setting in registry (HKLM) updated to '$G_PARSER'" + + SetDetailsPrint textonly + DetailPrint "" + DetailPrint "$(PFI_LANG_INST_PROG_ENDSEC)" + SetDetailsPrint listonly Pop ${L_RESERVED} *************** *** 345,348 **** --- 380,390 ---- Push ${L_LISTSIZE} + ; Install the necessary extra Perl packages required by the MeCab parser. If there is a + ; problem downloading or installing the MeCab parser then POPFile will automatically + ; use the internal parser instead. Since the internal parser requires the same set of + ; extra Perl packages, we install them now in order to keep the MeCab install code simple. + + !insertmacro NIHONGO_PERL_SUPPORT "mecab" + ; Unlike the NSISdl plugin shipped with NSIS, the Inetc plugin leaves the "Show Details" ; button in view so we temporarily disable it during the download to avoid a messy display *************** *** 405,420 **** installer_error_exit: ! Push $R1 ; No need to preserve $R0 here as it is known as ${L_RESULT} in this 'Section' ! ! ; The first system call gets the full pathname (returned in $R0) and the second call ! ; extracts the filename (and possibly the extension) part (returned in $R1) ! ! System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024)' ! System::Call 'comdlg32::GetFileTitleA(t R0, t .R1, i 1024)' ! StrCpy $G_PLS_FIELD_1 $R1 ! MessageBox MB_OK|MB_ICONEXCLAMATION "${C_NPLS_REPEATMECAB}" - - Pop $R1 Goto exit --- 447,452 ---- installer_error_exit: ! StrCpy $G_PLS_FIELD_1 "(undefined)" MessageBox MB_OK|MB_ICONEXCLAMATION "${C_NPLS_REPEATMECAB}" Goto exit *************** *** 454,458 **** Call ${UN}PFI_IsNT Pop ${L_RESERVED} ! StrCmp ${L_RESERVED} "0" update_minPerl ; Running on a non-Win9x system so we ensure the MeCab environment variable --- 486,490 ---- Call ${UN}PFI_IsNT Pop ${L_RESERVED} ! StrCmp ${L_RESERVED} "0" set_parser_in_registry ; Running on a non-Win9x system so we ensure the MeCab environment variable *************** *** 462,490 **** System::Call 'Kernel32::SetEnvironmentVariableA(t, t) \ i("MECABRC", "$G_ROOTDIR\mecab\etc\mecabrc").r0' ! StrCmp ${L_RESERVED} 0 0 update_minPerl MessageBox MB_OK|MB_ICONSTOP "$(PFI_LANG_CONVERT_ENVNOTSET) (MECABRC)" ! update_minPerl: ! ! ;-------------------------------------------------------------------------- ! ; Install additional Perl modules: base.pm, bytes.pm and the Encode collection ! ;-------------------------------------------------------------------------- ! ! SetOutPath "$G_MPLIBDIR" ! File "${C_PERL_DIR}\lib\base.pm" ! File "${C_PERL_DIR}\lib\bytes.pm" ! File "${C_PERL_DIR}\lib\bytes_heavy.pl" ! File "${C_PERL_DIR}\lib\Encode.pm" ! ! SetOutPath "$G_MPLIBDIR\Encode" ! File /r "${C_PERL_DIR}\lib\Encode\*" ! ! SetOutPath "$G_MPLIBDIR\auto\Encode" ! File /r "${C_PERL_DIR}\lib\auto\Encode\*" ! WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" "$G_PARSER" exit: SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_ENDSEC)" SetDetailsPrint listonly --- 494,508 ---- System::Call 'Kernel32::SetEnvironmentVariableA(t, t) \ i("MECABRC", "$G_ROOTDIR\mecab\etc\mecabrc").r0' ! StrCmp ${L_RESERVED} 0 0 set_parser_in_registry MessageBox MB_OK|MB_ICONSTOP "$(PFI_LANG_CONVERT_ENVNOTSET) (MECABRC)" ! set_parser_in_registry: WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" "$G_PARSER" + DetailPrint "" + DetailPrint "'NihongoParser' setting in registry (HKLM) updated to '$G_PARSER'" exit: SetDetailsPrint textonly + DetailPrint "" DetailPrint "$(PFI_LANG_INST_PROG_ENDSEC)" SetDetailsPrint listonly *************** *** 533,562 **** !insertmacro SECTIONLOG_ENTER "Internal Parser" - StrCmp $G_PARSER "internal" 0 do_nothing SetDetailsPrint textonly ! DetailPrint "Internal parser selected during installation" SetDetailsPrint listonly ! ;-------------------------------------------------------------------------- ! ; Install Perl modules: base.pm, bytes.pm and the Encode collection ! ;-------------------------------------------------------------------------- ! ! SetOutPath "$G_MPLIBDIR" ! File "${C_PERL_DIR}\lib\base.pm" ! File "${C_PERL_DIR}\lib\bytes.pm" ! File "${C_PERL_DIR}\lib\bytes_heavy.pl" ! File "${C_PERL_DIR}\lib\Encode.pm" ! ! SetOutPath "$G_MPLIBDIR\Encode" ! File /r "${C_PERL_DIR}\lib\Encode\*" ! ! SetOutPath "$G_MPLIBDIR\auto\Encode" ! File /r "${C_PERL_DIR}\lib\auto\Encode\*" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" "$G_PARSER" SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_ENDSEC)" SetDetailsPrint listonly --- 551,568 ---- !insertmacro SECTIONLOG_ENTER "Internal Parser" StrCmp $G_PARSER "internal" 0 do_nothing SetDetailsPrint textonly ! DetailPrint "Internal parser selected" SetDetailsPrint listonly ! !insertmacro NIHONGO_PERL_SUPPORT "internal" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" "$G_PARSER" + DetailPrint "" + DetailPrint "'NihongoParser' setting in registry (HKLM) updated to '$G_PARSER'" SetDetailsPrint textonly + DetailPrint "" DetailPrint "$(PFI_LANG_INST_PROG_ENDSEC)" SetDetailsPrint listonly *************** *** 670,676 **** # three parser sections are disabled (i.e. unselected so nothing gets installed). # ! # The default parser is 'Kakasi', as used by POPFile 0.22.5 and earlier releases, ! # and this default is set up here, including the initial state of the three ! # radio buttons used on the "Choose Parser" custom page. # # Note that the 'Nihongo Parser' section is _always_ executed, even if the user --- 676,683 ---- # three parser sections are disabled (i.e. unselected so nothing gets installed). # ! # For a clean installation the default parser is 'Kakasi', as used by POPFile ! # 0.22.5 and earlier releases. If, however, a previous Nihongo parser selection ! # is found in the registry it will be used as the default when initialising the ! # "Choose Nihongo Parser" page's radiobuttons. # # Note that the 'Nihongo Parser' section is _always_ executed, even if the user *************** *** 678,682 **** # # Note also that when an English-only build of the installer or uninstaller is ! # used then 'Nihongo Parser' must appear in the COMPONENTS page. # # This macro makes maintenance easier by ensuring that both processes use identical --- 685,690 ---- # # Note also that when an English-only build of the installer or uninstaller is ! # used then 'Nihongo Parser' must appear in the COMPONENTS page otherwise there ! # would be no way to install a Nihongo parser. # # This macro makes maintenance easier by ensuring that both processes use identical *************** *** 687,721 **** Function ${UN}ShowOrHideNihongoParser ! !ifndef ENGLISH_MODE ! StrCmp $LANGUAGE ${LANG_JAPANESE} select_default_parser ! ; The user has not selected 'Nihongo' language for this installation so there ! ; is no need to install a Nihongo parser. Make the 'Nihongo Parser' component ! ; invisible and disable the three sections used to install the Nihongo parsers. ! StrCpy $G_PARSER "" ! SectionSetText ${${UN}SecParser} "" ; this makes the component invisible ! !insertmacro UnselectSection ${${UN}SecKakasi} ! Goto deselect_other_parsers ! select_default_parser: !endif StrCpy $G_PARSER "kakasi" !insertmacro SelectSection ${${UN}SecKakasi} !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 1" "State" "1" ! !ifndef ENGLISH_MODE ! deselect_other_parsers: ! !endif ! ! !insertmacro UnselectSection ${${UN}SecMeCab} ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 2" "State" "0" ! !insertmacro UnselectSection ${${UN}SecInternalParser} ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 3" "State" "0" FunctionEnd !macroend --- 695,741 ---- Function ${UN}ShowOrHideNihongoParser ! ; Reset (clear) all parser selection data ! !insertmacro UnselectSection ${${UN}SecKakasi} ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 1" "State" "0" ! !insertmacro UnselectSection ${${UN}SecMeCab} ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 2" "State" "0" ! !insertmacro UnselectSection ${${UN}SecInternalParser} ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 3" "State" "0" ! !ifndef ENGLISH_MODE ! StrCmp $LANGUAGE ${LANG_JAPANESE} select_default_parser ! StrCpy $G_PARSER "" ; Do not install a Nihongo parser ! SectionSetText ${${UN}SecParser} "" ; This makes the component invisible ! Goto exit + select_default_parser: !endif + ; Use the most recently installed Nihongo parser as the default selection (if possible) + + ReadRegStr $G_PARSER HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "NihongoParser" + StrCmp $G_PARSER "mecab" mecab + StrCmp $G_PARSER "internal" internal + + ; Use 'Kakasi' as the default selection + StrCpy $G_PARSER "kakasi" !insertmacro SelectSection ${${UN}SecKakasi} !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 1" "State" "1" + Goto exit ! mecab: ! !insertmacro SelectSection ${${UN}SecMeCab} ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 2" "State" "1" ! Goto exit ! internal: ! !insertmacro SelectSection ${${UN}SecInternalParser} ! !insertmacro MUI_INSTALLOPTIONS_WRITE "ioP.ini" "Field 3" "State" "1" + exit: FunctionEnd !macroend *************** *** 740,743 **** --- 760,766 ---- !macro FUNCTION_CHOOSEPARSER UN Function ${UN}ChooseParser + !if '${UN}' == 'un.' + StrCmp $G_UNINST_MODE "uninstall" exit + !endif !ifndef ENGLISH_MODE |