Index: head/textproc/uim/Makefile =================================================================== --- head/textproc/uim/Makefile (revision 513136) +++ head/textproc/uim/Makefile (revision 513137) @@ -1,117 +1,117 @@ # Created by: MANTANI Nobutaka # $FreeBSD$ PORTNAME= uim PORTVERSION= 1.8.8 -PORTREVISION?= 1 +PORTREVISION?= 2 CATEGORIES?= textproc MASTER_SITES= https://github.com/uim/uim/releases/download/${PORTVERSION}/ .if !defined(UIM_SLAVE) && defined(WITHOUT_X11) PKGNAMESUFFIX= -nox11 .endif MAINTAINER= nobutaka@FreeBSD.org COMMENT?= Input method library LICENSE= BSD3CLAUSE GPLv2+ GPLv3+ LGPL21+ PD LICENSE_COMB= multi LICENSE_FILE= ${WRKSRC}/COPYING USES+= gettext gmake gnome iconv libedit libtool pathfix pkgconfig perl5 sqlite tar:bzip2 USE_LDCONFIG= yes USE_GNOME+= glib20 intltool USE_PERL5= build GNU_CONFIGURE= yes OPTIONS_DEFINE= DOCS X11 OPTIONS_DEFAULT= X11 .include .if ${PORT_OPTIONS:MX11} USE_XORG+= x11 xext LIB_DEPENDS+= libXft.so:x11-fonts/libXft CONFIGURE_ARGS+= --with-x --with-xft .endif .if !defined(UIM_SLAVE) .if ${PORT_OPTIONS:MX11} USE_GNOME+= cairo gdkpixbuf2 gtk20 LIB_DEPENDS+= libfreetype.so:print/freetype2 \ libfontconfig.so:x11-fonts/fontconfig CONFIGURE_ARGS+= --with-gtk2 .endif CONFIGURE_ARGS+= --enable-emacs --with-sj3 --with-canna --with-prime .endif CPPFLAGS+= -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib CFLAGS+= -I${LOCALBASE}/include .if !defined(UIM_SLAVE) DOCSDIR_JA= ${PREFIX}/share/doc/ja/uim DOCSDIR_SIGSCHEME= ${PREFIX}/share/doc/uim/sigscheme PLIST_SUB+= DOCSDIR_JA="${DOCSDIR_JA:S,^${PREFIX}/,,}" \ DOCSDIR_SIGSCHEME="${DOCSDIR_SIGSCHEME:S,^${PREFIX}/,,}" .endif .if empty(PORT_OPTIONS:MX11) PLIST_SUB+= X11="@comment " .else PLIST_SUB+= X11="" .endif .include .if ${ARCH} == "amd64" || ${ARCH} == "sparc64" CONFIGURE_ARGS+= --enable-storage=fatty .endif .for _x in x xft gtk2 qt anthy canna m17nlib prime scim dict .if ${CONFIGURE_ARGS:M--with-${_x}} == "" CONFIGURE_ARGS+=--without-${_x} .endif .endfor .for _x in gnome-applet kde-applet emacs pref .if ${CONFIGURE_ARGS:M--enable-${_x}} == "" CONFIGURE_ARGS+=--disable-${_x} .endif .endfor post-patch: ${REINPLACE_CMD} -e 's,%%LOCALBASE%%,${LOCALBASE},' ${WRKSRC}/scm/skk-custom.scm do-build: .if !defined(UIM_SLAVE) .for d in replace sigscheme uim scm xim po fep emacs pixmaps tables cd ${WRKSRC}/${d} && ${MAKE_CMD} .endfor .if ${PORT_OPTIONS:MX11} cd ${WRKSRC}/gtk2/candwin && ${MAKE_CMD} .endif .endif do-install: .if !defined(UIM_SLAVE) cd ${WRKSRC} && ${MAKE_CMD} DESTDIR=${STAGEDIR} install-data-am .for d in sigscheme uim scm xim po fep emacs pixmaps tables cd ${WRKSRC}/${d} && ${MAKE_CMD} DESTDIR=${STAGEDIR} install .endfor .if ${PORT_OPTIONS:MX11} cd ${WRKSRC}/gtk2/candwin && ${MAKE_CMD} DESTDIR=${STAGEDIR} install .endif .endif .if !defined(UIM_SLAVE) post-install: ${MKDIR} ${STAGEDIR}${DATADIR}/helperdata ${MKDIR} ${STAGEDIR}${DOCSDIR} ${MKDIR} ${STAGEDIR}${DOCSDIR_JA} ${INSTALL_DATA} ${WRKSRC}/doc/KEY ${STAGEDIR}${DOCSDIR}/KEY ${INSTALL_DATA} ${WRKSRC}/fep/README ${STAGEDIR}${DOCSDIR}/README.fep ${INSTALL_DATA} ${WRKSRC}/fep/README ${STAGEDIR}${DOCSDIR}/README.key ${INSTALL_DATA} ${WRKSRC}/fep/README.ja ${STAGEDIR}${DOCSDIR_JA}/README.fep ${INSTALL_DATA} ${WRKSRC}/xim/README ${STAGEDIR}${DOCSDIR}/README.xim .endif .include Index: head/textproc/uim/files/patch-scm_anthy.scm =================================================================== --- head/textproc/uim/files/patch-scm_anthy.scm (nonexistent) +++ head/textproc/uim/files/patch-scm_anthy.scm (revision 513137) @@ -0,0 +1,255 @@ +--- scm/anthy.scm.orig 2017-08-14 00:07:27 UTC ++++ scm/anthy.scm +@@ -67,6 +67,10 @@ + (define anthy-candidate-type-upper-halfwidth-alnum -7) + (define anthy-candidate-type-upper-fullwidth-alnum -8) + ++(define anthy-compiled-encoding 0) ++(define anthy-euc-jp-encoding 1) ++(define anthy-utf8-encoding 2) ++ + ;; I don't think the key needs to be customizable. + (define-key anthy-space-key? '(" ")) + +@@ -85,12 +89,12 @@ + ((anthy-context-converting ac) + (anthy-do-commit ac)) + ((anthy-context-transposing ac) +- (im-commit ac (anthy-transposing-text ac))) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-transposing-text ac)))) + ((and + (anthy-context-on ac) + (anthy-has-preedit? ac)) + (im-commit +- ac (anthy-make-whole-string ac #t (anthy-context-kana-mode ac))))) ++ ac (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t (anthy-context-kana-mode ac)))))) + (anthy-flush ac) + (anthy-update-preedit ac))) + +@@ -101,14 +105,14 @@ + ((anthy-context-converting ac) + (anthy-do-commit ac)) + ((anthy-context-transposing ac) +- (im-commit ac (anthy-transposing-text ac)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-transposing-text ac))) + (anthy-flush ac)) + ((and + (anthy-context-on ac) + (anthy-has-preedit? ac) + (not (= old-kana new-mode))) + (im-commit +- ac (anthy-make-whole-string ac #t (anthy-context-kana-mode ac))) ++ ac (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t (anthy-context-kana-mode ac)))) + (anthy-flush ac))) + (anthy-update-preedit ac)))) + +@@ -372,7 +376,8 @@ + (set! anthy-version (anthy-version->major.minor + (anthy-lib-get-anthy-version))))) + (if anthy-lib-initialized? +- (anthy-context-set-ac-id! ac (anthy-lib-alloc-context))) ++ (anthy-context-set-ac-id! ++ ac (anthy-lib-alloc-context anthy-utf8-encoding))) + (anthy-context-set-widgets! ac anthy-widgets) + (anthy-context-set-rkc! ac rkc) + (anthy-context-set-preconv-ustr! ac (ustr-new '())) +@@ -582,7 +587,7 @@ + (> (string-length preconv-str) + 0)) + (begin +- (anthy-lib-set-string ac-id preconv-str) ++ (anthy-lib-set-string ac-id (anthy-lib-eucjp-to-utf8 preconv-str)) + (let ((nr-segments (anthy-lib-get-nr-segments ac-id))) + (ustr-set-latter-seq! (anthy-context-segments ac) + (make-list nr-segments 0)) +@@ -708,16 +713,16 @@ + + ;; direct key => commit + (direct +- (im-commit ac direct)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 direct))) + + ;; space key => commit + ((anthy-space-key? key key-state) + (if (anthy-context-alnum ac) +- (im-commit ac (list-ref ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (list-ref + ja-alnum-space + (- (anthy-context-alnum-type ac) +- anthy-type-halfwidth-alnum))) +- (im-commit ac (list-ref ja-space (anthy-context-kana-mode ac))))) ++ anthy-type-halfwidth-alnum)))) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (list-ref ja-space (anthy-context-kana-mode ac)))))) + + ((anthy-non-composing-symbol? ac key) + (anthy-commit-raw ac)) +@@ -798,7 +803,7 @@ + (> (string-length preconv-str) 0) + type) + (begin +- (anthy-lib-set-string ac-id preconv-str) ++ (anthy-lib-set-string ac-id (anthy-lib-eucjp-to-utf8 preconv-str)) + (expand-segment) + (anthy-lib-commit-segment ac-id 0 type)))))) + +@@ -851,7 +856,7 @@ + (if (anthy-commit-key? key key-state) + (begin + (anthy-learn-transposing-text ac) +- (im-commit ac (anthy-transposing-text ac)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-transposing-text ac))) + (anthy-flush ac) + #f) + #t) +@@ -889,7 +894,7 @@ + #t) + ; implicit commit + (begin +- (im-commit ac (anthy-transposing-text ac)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-transposing-text ac))) + (anthy-flush ac) + (anthy-proc-input-state ac key key-state)))))))) + +@@ -1139,7 +1144,7 @@ + (begin + (im-commit + ac +- (anthy-make-whole-string ac #t (ja-opposite-kana kana))) ++ (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t (ja-opposite-kana kana)))) + (anthy-flush ac))) + + ;; Transposing¾õÂÖ¤Ø°Ü¹Ô +@@ -1157,7 +1162,7 @@ + ((anthy-hiragana-key? key key-state) + (if (not (= kana anthy-type-hiragana)) + (begin +- (im-commit ac (anthy-make-whole-string ac #t kana)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t kana))) + (anthy-flush ac))) + (anthy-context-set-kana-mode! ac anthy-type-hiragana) + (anthy-context-set-alnum! ac #f)) +@@ -1165,7 +1170,7 @@ + ((anthy-katakana-key? key key-state) + (if (not (= kana anthy-type-katakana)) + (begin +- (im-commit ac (anthy-make-whole-string ac #t kana)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t kana))) + (anthy-flush ac))) + (anthy-context-set-kana-mode! ac anthy-type-katakana) + (anthy-context-set-alnum! ac #f)) +@@ -1173,7 +1178,7 @@ + ((anthy-halfkana-key? key key-state) + (if (not (= kana anthy-type-halfkana)) + (begin +- (im-commit ac (anthy-make-whole-string ac #t kana)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t kana))) + (anthy-flush ac))) + (anthy-context-set-kana-mode! ac anthy-type-halfkana) + (anthy-context-set-alnum! ac #f)) +@@ -1201,7 +1206,7 @@ + (not (anthy-context-alnum ac)) + (anthy-kana-toggle-key? key key-state)) + (begin +- (im-commit ac (anthy-make-whole-string ac #t kana)) ++ (im-commit ac (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t kana))) + (anthy-flush ac) + (anthy-context-kana-toggle ac))) + +@@ -1217,7 +1222,7 @@ + (begin + (im-commit + ac +- (anthy-make-whole-string ac #t kana)) ++ (anthy-lib-eucjp-to-utf8 (anthy-make-whole-string ac #t kana))) + (anthy-flush ac))) + + ;; left +@@ -1372,7 +1377,10 @@ + (not (anthy-context-predicting ac))) + (let* ((use-pending-rk-for-prediction? #f) + (preconv-str +- (anthy-make-whole-string ac #t (anthy-context-kana-mode ac))) ++ (anthy-make-whole-string ++ ac ++ (not use-pending-rk-for-prediction?) ++ (anthy-context-kana-mode ac))) + (ac-id (anthy-context-ac-id ac)) + (preedit-len + (+ +@@ -1385,7 +1393,8 @@ + (>= preedit-len anthy-prediction-start-char-count) + force-check?) + (begin +- (anthy-lib-set-prediction-src-string ac-id preconv-str) ++ (anthy-lib-set-prediction-src-string ++ ac-id (anthy-lib-eucjp-to-utf8 preconv-str)) + (let ((nr (anthy-lib-get-nr-predictions ac-id))) + (if (and + nr +@@ -1419,7 +1428,7 @@ + (define anthy-context-transposing-state-preedit + (lambda (ac) + (let ((transposing-text (anthy-transposing-text ac))) +- (list (cons preedit-reverse transposing-text) ++ (list (cons preedit-reverse (anthy-lib-eucjp-to-utf8 transposing-text)) + (cons preedit-cursor ""))))) + + (define anthy-transposing-text +@@ -1461,7 +1470,7 @@ + (let* ((preconv + (ja-join-vu (string-to-list + (anthy-make-whole-string ac #t anthy-type-hiragana)))) +- (unconv-candidate (anthy-lib-get-unconv-candidate ac-id seg-idx)) ++ (unconv-candidate (anthy-lib-eucjp-to-utf8 (anthy-lib-get-unconv-candidate ac-id seg-idx))) + (unconv (if unconv-candidate + (ja-join-vu (string-to-list unconv-candidate)) + '())) +@@ -1513,7 +1522,7 @@ + preedit-underline)) + (cand (if (> cand-idx anthy-candidate-type-halfwidth-alnum) + (anthy-lib-get-nth-candidate ac-id seg-idx cand-idx) +- (anthy-get-raw-candidate ac ac-id seg-idx cand-idx))) ++ (anthy-lib-eucjp-to-utf8 (anthy-get-raw-candidate ac ac-id seg-idx cand-idx)))) + (seg (list (cons attr cand)))) + (if (and separator + (< 0 seg-idx)) +@@ -1537,15 +1546,15 @@ + (list + (and (not (ustr-cursor-at-beginning? preconv-str)) + (cons preedit-underline +- (string-append-map-ustr-former extract-kana preconv-str))) ++ (anthy-lib-eucjp-to-utf8 (string-append-map-ustr-former extract-kana preconv-str)))) + (and (> (string-length pending) 0) +- (cons preedit-underline pending)) ++ (cons preedit-underline (anthy-lib-eucjp-to-utf8 pending))) + (and (anthy-has-preedit? ac) + (cons preedit-cursor "")) + (and (not (ustr-cursor-at-end? preconv-str)) + (cons + preedit-underline +- (string-append-map-ustr-latter extract-kana preconv-str))))))) ++ (anthy-lib-eucjp-to-utf8 (string-append-map-ustr-latter extract-kana preconv-str)))))))) + + (define anthy-get-commit-string + (lambda (ac) +@@ -1556,8 +1565,9 @@ + anthy-candidate-type-halfwidth-alnum) + (anthy-lib-get-nth-candidate + ac-id seg-idx cand-idx) +- (anthy-get-raw-candidate +- ac ac-id seg-idx cand-idx))) ++ (anthy-lib-eucjp-to-utf8 ++ (anthy-get-raw-candidate ++ ac ac-id seg-idx cand-idx)))) + (iota (ustr-length segments)) + (ustr-whole-seq segments))))) + +@@ -1882,7 +1892,7 @@ + (register-im + 'anthy + "ja" +- "EUC-JP" ++ "UTF-8" + anthy-im-name-label + anthy-im-short-desc + #f Property changes on: head/textproc/uim/files/patch-scm_anthy.scm ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/textproc/uim/files/patch-uim_anthy.c =================================================================== --- head/textproc/uim/files/patch-uim_anthy.c (nonexistent) +++ head/textproc/uim/files/patch-uim_anthy.c (revision 513137) @@ -0,0 +1,124 @@ +--- uim/anthy.c.orig 2017-08-14 00:07:27 UTC ++++ uim/anthy.c +@@ -40,6 +40,7 @@ + #include "uim.h" + #include "uim-scm.h" + #include "uim-scm-abbrev.h" ++#include "uim-util.h" + #include "dynlib.h" + + +@@ -51,6 +52,9 @@ void uim_anthy_plugin_instance_quit(void); + static uim_bool initialized; + static uim_lisp context_list; + ++static void *iconv_cd_e2u; ++static void *iconv_cd_u2e; ++ + static void + validate_segment_index(anthy_context_t ac, int i) + { +@@ -96,15 +100,26 @@ init_anthy_lib(void) + } + + static uim_lisp +-create_context(void) ++create_context(uim_lisp encoding_) + { + anthy_context_t ac; + uim_lisp ac_; ++ int encoding; + ++ /* 0: compiled, 1: EUC-JP, 2: UTF-8 */ ++ encoding = C_INT(encoding_); ++ ++ if (!iconv_cd_e2u) ++ iconv_cd_e2u = uim_iconv->create("UTF-8", "EUC-JP"); ++ ++ if (!iconv_cd_u2e) ++ iconv_cd_u2e = uim_iconv->create("EUC-JP", "UTF-8"); ++ + ac = anthy_create_context(); + if (!ac) + uim_fatal_error("anthy_create_context() failed"); + ++ anthy_context_set_encoding(ac, encoding); + ac_ = MAKE_PTR(ac); + context_list = uim_scm_callf("cons", "oo", ac_, context_list); + +@@ -338,6 +353,42 @@ commit_nth_prediction(uim_lisp ac_, uim_lisp nth_) + #endif + } + ++static uim_lisp ++eucjp_to_utf8(uim_lisp str_) ++{ ++ const char *str; ++ char *convstr; ++ uim_lisp utf8_; ++ ++ if (!iconv_cd_e2u) ++ return MAKE_STR("〓"); ++ ++ str = REFER_C_STR(str_); ++ convstr = uim_iconv->convert(iconv_cd_e2u, str); ++ utf8_ = MAKE_STR(convstr); ++ free(convstr); ++ ++ return utf8_; ++} ++ ++static uim_lisp ++utf8_to_eucjp(uim_lisp str_) ++{ ++ const char *str; ++ char *convstr; ++ uim_lisp eucjp_; ++ ++ if (!iconv_cd_u2e) ++ return MAKE_STR(""); ++ ++ str = REFER_C_STR(str_); ++ convstr = uim_iconv->convert(iconv_cd_u2e, str); ++ eucjp_ = MAKE_STR(convstr); ++ free(convstr); ++ ++ return eucjp_; ++} ++ + #ifndef ENABLE_ANTHY_STATIC + void + uim_plugin_instance_init(void) +@@ -352,7 +403,7 @@ uim_anthy_plugin_instance_init(void) + uim_scm_eval_c_string("(require-extension (srfi 1))"); /* for delete! */ + + uim_scm_init_proc0("anthy-lib-init", init_anthy_lib); +- uim_scm_init_proc0("anthy-lib-alloc-context", create_context); ++ uim_scm_init_proc1("anthy-lib-alloc-context", create_context); + uim_scm_init_proc1("anthy-lib-free-context", release_context); + uim_scm_init_proc2("anthy-lib-set-string", set_string); + uim_scm_init_proc1("anthy-lib-get-nr-segments",get_nr_segments); +@@ -368,6 +419,8 @@ uim_anthy_plugin_instance_init(void) + uim_scm_init_proc2("anthy-lib-get-nth-prediction", get_nth_prediction); + uim_scm_init_proc2("anthy-lib-commit-nth-prediction", + commit_nth_prediction); ++ uim_scm_init_proc1("anthy-lib-eucjp-to-utf8", eucjp_to_utf8); ++ uim_scm_init_proc1("anthy-lib-utf8-to-eucjp", utf8_to_eucjp); + } + + #ifndef ENABLE_ANTHY_STATIC +@@ -385,5 +438,14 @@ uim_anthy_plugin_instance_quit(void) + + anthy_quit(); + initialized = UIM_FALSE; ++ ++ if (iconv_cd_e2u) { ++ uim_iconv->release(iconv_cd_e2u); ++ iconv_cd_e2u = NULL; ++ } ++ if (iconv_cd_u2e) { ++ uim_iconv->release(iconv_cd_u2e); ++ iconv_cd_u2e = NULL; ++ } + } + } Property changes on: head/textproc/uim/files/patch-uim_anthy.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property