pkg/60647: New package: inputmethod/anthy-unicode and inputmethod/anthy-unicode-elisp

"Showta Ishizaki via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.devel.pkgsrc.bugs
Message-ID <[email protected]>
>Number:         60647
>Category:       pkg
>Synopsis:       New package: inputmethod/anthy-unicode and inputmethod/anthy-unicode-elisp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 26 16:45:00 +0000 2026
>Originator:     Showta Ishizaki
>Release:        pkgsrc current (2026Q3)
>Organization:
>Environment:
System: NetBSD 11.0/amd64; also built on NetBSD 9.4 and 10.1

>Description:

anthy-unicode is the maintained fork of anthy.  The anthy in pkgsrc
(inputmethod/anthy) is 9100h, whose last release was in 2009; anthy-unicode
(https://github.com/fujiwarat/anthy-unicode) is still released and moves the
internal encoding from EUC-JP to UTF-8, which is where the name comes from.
FreeBSD has replaced japanese/anthy with japanese/anthy-unicode, and Debian's
anthy source package is now anthy-unicode; pkgsrc and OpenBSD still ship only
9100h.

These two packages add it, split the way inputmethod/anthy and
inputmethod/anthy-elisp are: anthy-unicode builds the C library, the agent
and the dictionaries with EMACS=no, and anthy-unicode-elisp installs the
Emacs lisp and is the only part that depends on EMACS_TYPE.  Everything is
installed under -unicode names (bin/anthy-agent-unicode,
lib/libanthy-unicode, the japanese-anthy-unicode input method, and the
elisp under .../anthy-unicode/), so anthy and anthy-unicode can be installed
side by side.  anthy-unicode ships a buildlink3.mk so a future
consumer built against the fork (an ibus or uim variant) can link it.

anthy-unicode-elisp carries one patch, patch-src-util_anthy-unicode.el.  The
elisp was modernised to names newer than the older Emacs versions pkgsrc
still accepts, so it no longer loads on emacs20 or converts on emacs21; the
patch guards the six removed names with fboundp/boundp and sets UTF-8 on the
pipe to the agent.  It has been sent upstream as fujiwarat/anthy-unicode#21
and can be dropped once a release includes it.  On emacs20 and emacs21 the
agent's UTF-8 also needs editors/mule-ucs, which the Makefile pulls in for
EMACS_VERSION_MAJOR < 22.

Built on NetBSD 11.0/amd64; pkglint is clean for both.  japanese-anthy-unicode
was driven through a conversion (nihongo -> the kanji) and
deactivate-input-method on emacs26, 28, 29, 30 and 31, and on emacs20.7 and
emacs21.4 with Mule-UCS installed.

>How-To-Repeat:

Unpack the shar below under pkgsrc/, add

	SUBDIR+=	anthy-unicode
	SUBDIR+=	anthy-unicode-elisp

to inputmethod/Makefile after anthy-elisp, then build
inputmethod/anthy-unicode-elisp (it pulls in inputmethod/anthy-unicode).

>Fix:
The shar of both directories follows.

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	anthy-unicode-elisp/DESCR
#	anthy-unicode-elisp/Makefile
#	anthy-unicode-elisp/PLIST
#	anthy-unicode/DESCR
#	anthy-unicode/Makefile
#	anthy-unicode/Makefile.common
#	anthy-unicode/PLIST
#	anthy-unicode/buildlink3.mk
#	anthy-unicode/distinfo
#	anthy-unicode/patches/patch-src-util_anthy-unicode.el
#
echo x - 'anthy-unicode-elisp/DESCR'
sed 's/^X//' >'anthy-unicode-elisp/DESCR' << 'END-of-anthy-unicode-elisp/DESCR'
XEmacs lisp files for anthy-unicode, the maintained Unicode fork of anthy.
XThey install as anthy-unicode.el and friends and talk to
Xanthy-agent-unicode, so they do not collide with inputmethod/anthy-elisp
Xand both can be installed at once.
END-of-anthy-unicode-elisp/DESCR
echo x - 'anthy-unicode-elisp/Makefile'
sed 's/^X//' >'anthy-unicode-elisp/Makefile' << 'END-of-anthy-unicode-elisp/Makefile'
X# $NetBSD$
X
X.include	"../../inputmethod/anthy-unicode/Makefile.common"
X
XPKGNAME=	${EMACS_PKGNAME_PREFIX}anthy-unicode-elisp-${ANTHY_UNICODE_VERSION}
XCATEGORIES=	inputmethod editors
X
XMAINTAINER=	[email protected]
XCOMMENT=	Emacs lisp files for inputmethod/anthy-unicode
X
XDEPENDS+=	anthy-unicode>=${ANTHY_UNICODE_VERSION}:../../inputmethod/anthy-unicode
X
XUSE_LIBTOOL=		yes
XCONFIGURE_ENV+=		EMACS=${EMACS_BIN:Q}
XEMACS_MODULES+=		base leim
X
X# The accepted versions were measured, not guessed: on NetBSD 11.0/amd64 the
X# package was built with emacs26, 28, 29, 30 and 31, and with emacs20.7 and
X# emacs21.4, and japanese-anthy-unicode was driven through a conversion
X# (nihongo -> the kanji) and deactivate-input-method in each.  emacs26/27/28
X# are not listed because they were removed from pkgsrc and no longer appear
X# in editors/emacs/modules.mk, so naming them would not select anything.
X#
X# emacs20 and emacs21 additionally need the patch
X# (patch-src-util_anthy-unicode.el) and Mule-UCS; see the
X# EMACS_VERSION_MAJOR < 22 block below.
XEMACS_VERSIONS_ACCEPTED=	emacs29 emacs29nox
XEMACS_VERSIONS_ACCEPTED+=	emacs30 emacs30nox
XEMACS_VERSIONS_ACCEPTED+=	emacs31 emacs31nox
XEMACS_VERSIONS_ACCEPTED+=	emacs21 emacs21nox emacs20
X
X.include "../../editors/emacs/modules.mk"
X
X.if ${EMACS_VERSION_MAJOR} < 22
X# anthy-agent-unicode speaks UTF-8 and nothing else (src-util/input.c sets
X# ANTHY_UTF8_ENCODING unconditionally; --eucjp only reaches the --egg
X# protocol).  But Emacs 20 has no utf-8 coding system at all, and Emacs 21's
X# mule-utf-8 cannot represent CJK: the mule-unicode-* charsets cover
X# U+0100-U+33FF and U+E000-U+FFFF but not U+4E00-U+9FFF, and utf-translate-cjk
X# only arrives in Emacs 22.  Mule-UCS supplies a utf-8 that maps CJK onto
X# japanese-jisx0208, so both versions work through it.
X#
X# It is needed for byte compilation too: the 20/21 byte compiler writes the
X# decoded buffer with no-conversion, so the mule-unicode internal form (a
X# 4-byte sequence starting 0x9C) lands in the .elc verbatim and cannot be
X# read back.  Through Mule-UCS it becomes the 3-byte jisx0208 form and round
X# trips.
XDEPENDS+=	${EMACS_PKGNAME_PREFIX}Mule-UCS-[0-9]*:../../editors/mule-ucs
XELISP_PRELOAD=	-L ${EMACS_LISPPREFIX}/mule-ucs -l un-define
X.endif
X
XELISP_EL=	anthy-unicode.el anthy-unicode-azik.el anthy-unicode-conf.el \
X		anthy-unicode-dic.el anthy-unicode-isearch.el \
X		anthy-unicode-kyuri.el
X
X# Byte compile here rather than through the upstream Makefile (elisp-comp),
X# for two reasons: ELISP_PRELOAD has to be fed in first, and leim-list.el has
X# to be left out.  leim-list.el carries a no-byte-compile cookie on its first
X# line, but that cookie is only honoured from Emacs 22 on; the 20 and 21
X# batch-byte-compile write a leim-list.elc anyway, which is not in PLIST and
X# makes the install fail.
Xdo-build:
X	cd ${WRKSRC}/src-util && ${EMACS_BIN} -batch -q -no-site-file \
X		${ELISP_PRELOAD} -L . -f batch-byte-compile ${ELISP_EL}
X
Xdo-install:
X	${INSTALL_DATA_DIR} ${DESTDIR}${EMACS_LISPPREFIX}/anthy-unicode
X	${INSTALL_DATA} ${WRKSRC}/src-util/*.el	${DESTDIR}${EMACS_LISPPREFIX}/anthy-unicode
X	${INSTALL_DATA} ${WRKSRC}/src-util/*.elc ${DESTDIR}${EMACS_LISPPREFIX}/anthy-unicode
X
X.include "../../mk/bsd.pkg.mk"
END-of-anthy-unicode-elisp/Makefile
echo x - 'anthy-unicode-elisp/PLIST'
sed 's/^X//' >'anthy-unicode-elisp/PLIST' << 'END-of-anthy-unicode-elisp/PLIST'
X@comment $NetBSD$
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-azik.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-azik.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-conf.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-conf.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-dic.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-dic.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-isearch.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-isearch.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-kyuri.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-kyuri.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode.elc
X${EMACS_LISPPREFIX}/anthy-unicode/leim-list.el
END-of-anthy-unicode-elisp/PLIST
echo x - 'anthy-unicode/DESCR'
sed 's/^X//' >'anthy-unicode/DESCR' << 'END-of-anthy-unicode/DESCR'
XAnthy is a Japanese kana-kanji conversion engine.  anthy-unicode is the
Xmaintained fork of anthy 9100h, whose last release was in 2009.  It moves
Xthe internal encoding from EUC-JP to UTF-8, from which it takes its name,
Xand installs everything under -unicode names so that it can be used
Xalongside the original.
END-of-anthy-unicode/DESCR
echo x - 'anthy-unicode/Makefile'
sed 's/^X//' >'anthy-unicode/Makefile' << 'END-of-anthy-unicode/Makefile'
X# $NetBSD$
X
X.include	"../../inputmethod/anthy-unicode/Makefile.common"
X
XMAINTAINER=	[email protected]
XCOMMENT=	Kana Kanji conversion system (Unicode fork of anthy)
X
XUSE_LIBTOOL=		yes
XUSE_TOOLS+=		printf
X
XCONFIGURE_ENV+=		EMACS=no
XEGDIR=			${PREFIX}/share/examples/anthy-unicode
XINSTALL_MAKE_FLAGS+=	sysconfdir=${EGDIR}
XCONF_FILES+=		${EGDIR}/anthy-unicode.conf ${PKG_SYSCONFDIR}/anthy-unicode.conf
XINSTALLATION_DIRS=	share/doc/anthy-unicode
X
XPKGCONFIG_OVERRIDE+=	anthy-unicode.pc.in
X
XUNLIMIT_RESOURCES+=	stacksize
X
Xpost-install:
X.for f in doc/DICUTIL doc/ELISP doc/GUIDE.english README README.en
X	${INSTALL_DATA} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/share/doc/anthy-unicode
X.endfor
X
X.include	"../../mk/bsd.pkg.mk"
END-of-anthy-unicode/Makefile
echo x - 'anthy-unicode/Makefile.common'
sed 's/^X//' >'anthy-unicode/Makefile.common' << 'END-of-anthy-unicode/Makefile.common'
X# $NetBSD$
X# used by inputmethod/anthy-unicode/Makefile
X# used by inputmethod/anthy-unicode-elisp/Makefile
X
XANTHY_UNICODE_VERSION=	1.0.0.20260213
XDISTNAME=		anthy-unicode-${ANTHY_UNICODE_VERSION}
XCATEGORIES=		inputmethod
XMASTER_SITES=		${MASTER_SITE_GITHUB:=fujiwarat/}
XGITHUB_PROJECT=		anthy-unicode
XGITHUB_RELEASE=		${ANTHY_UNICODE_VERSION}
X
XDISTINFO_FILE=		${.CURDIR}/../../inputmethod/anthy-unicode/distinfo
XPATCHDIR=		${.CURDIR}/../../inputmethod/anthy-unicode/patches
X
XHOMEPAGE=		https://github.com/fujiwarat/anthy-unicode/
XLICENSE=		gnu-gpl-v2
X
XGNU_CONFIGURE=		yes
XUSE_LANGUAGES=		c
END-of-anthy-unicode/Makefile.common
echo x - 'anthy-unicode/PLIST'
sed 's/^X//' >'anthy-unicode/PLIST' << 'END-of-anthy-unicode/PLIST'
X@comment $NetBSD$
Xbin/anthy-agent-unicode
Xbin/anthy-dic-tool-unicode
Xbin/anthy-morphological-analyzer-unicode
Xinclude/anthy-unicode-1.0/anthy/anthy.h
Xinclude/anthy-unicode-1.0/anthy/dicutil.h
Xinclude/anthy-unicode-1.0/anthy/input.h
Xlib/libanthy-unicode.la
Xlib/libanthydic-unicode.la
Xlib/libanthyinput-unicode.la
Xlib/pkgconfig/anthy-unicode.pc
Xshare/anthy-unicode/anthy.dic
Xshare/anthy-unicode/dic-tool-usage.txt
Xshare/anthy-unicode/typetab
Xshare/anthy-unicode/zipcode.t
Xshare/doc/anthy-unicode/DICUTIL
Xshare/doc/anthy-unicode/ELISP
Xshare/doc/anthy-unicode/GUIDE.english
Xshare/doc/anthy-unicode/README
Xshare/doc/anthy-unicode/README.en
Xshare/examples/anthy-unicode/anthy-unicode.conf
END-of-anthy-unicode/PLIST
echo x - 'anthy-unicode/buildlink3.mk'
sed 's/^X//' >'anthy-unicode/buildlink3.mk' << 'END-of-anthy-unicode/buildlink3.mk'
X# $NetBSD$
X
XBUILDLINK_TREE+=	anthy-unicode
X
X.if !defined(ANTHY_UNICODE_BUILDLINK3_MK)
XANTHY_UNICODE_BUILDLINK3_MK:=
X
XBUILDLINK_API_DEPENDS.anthy-unicode+=	anthy-unicode>=1.0.0.20260213
XBUILDLINK_PKGSRCDIR.anthy-unicode?=	../../inputmethod/anthy-unicode
X.endif # ANTHY_UNICODE_BUILDLINK3_MK
X
XBUILDLINK_TREE+=	-anthy-unicode
END-of-anthy-unicode/buildlink3.mk
echo x - 'anthy-unicode/distinfo'
sed 's/^X//' >'anthy-unicode/distinfo' << 'END-of-anthy-unicode/distinfo'
X$NetBSD$
X
XBLAKE2s (anthy-unicode-1.0.0.20260213.tar.gz) = 184005918110fb3381927d20052ff541fb826e5e376ee4aa7c55715f19c201db
XSHA512 (anthy-unicode-1.0.0.20260213.tar.gz) = fcb7651c3d1cfa389fc1d25606c088528154e659668af92908c202b5cf936f81fc28b616f3bc764be4835a8016c347c1a7e0a14691bd1a7697bac3df842d694e
XSize (anthy-unicode-1.0.0.20260213.tar.gz) = 5184155 bytes
XSHA1 (patch-src-util_anthy-unicode.el) = c7c2c59eb0d3a4e7c32a4093197ea48a45901d82
END-of-anthy-unicode/distinfo
echo x - 'anthy-unicode/patches/patch-src-util_anthy-unicode.el'
sed 's/^X//' >'anthy-unicode/patches/patch-src-util_anthy-unicode.el' << 'END-of-anthy-unicode/patches/patch-src-util_anthy-unicode.el'
X$NetBSD$
X
XMake anthy-unicode.el work on the older Emacs versions pkgsrc still carries,
Xnot only on a current one.
X
Xanthy-unicode inherited anthy 9100h's elisp and modernised the names it uses.
XThat is the mirror image of what 9100h now does on a current Emacs: where
X9100h calls names Emacs has since removed, anthy-unicode calls names Emacs 20
Xand 21 do not have yet.
X
X  set-face-underline              new in Emacs 22.1; Emacs 20 has
X                                  set-face-underline-p only.  The call is at
X                                  top level, so on Emacs 20 loading the file
X                                  signals an error, and anthy-unicode-isearch
X                                  and anthy-unicode-kyuri then fail to
X                                  byte-compile because they require it --
X                                  5 of the 7 .elc files get built.
X  mapc                            new in Emacs 21.  9100h used mapcar in this
X                                  same line, which every Emacs and XEmacs has.
X  set-process-query-on-exit-flag  new in Emacs 22.1; Emacs 20 and 21 have
X                                  process-kill-without-query.  It is called
X                                  from anthy-check-agent, which starts the
X                                  agent, so on Emacs 21 the package builds
X                                  cleanly and dies on the first conversion.
X  deactivate-current-input-method-function,
X  deactivate-input-method         renamed from inactivate-* in Emacs 24.3.
X                                  Emacs 20 and 21 know the old names only, so
X                                  the input method cannot be switched off.
X
XThe coding system of the pipe to the agent is set explicitly as well.
Xanthy-agent-unicode speaks UTF-8 -- src-util/input.c sets
XANTHY_UTF8_ENCODING unconditionally, and --eucjp only reaches the --egg
Xprotocol, which the elisp does not use.  9100h's anthy.el set euc-japan on
Xthe pipe for exactly this reason; anthy-unicode commented that out and left
Xthe Emacs default in charge, which is utf-8 only on a current Emacs.  On
XEmacs 21 with the Japanese language environment the default decodes the
Xagent's replies as euc-jp, and the conversion result arrives as mojibake.
X
XEmacs 20 has no utf-8 coding system at all, and Emacs 21's mule-utf-8 cannot
Xrepresent CJK ideographs: it decodes into the mule-unicode-* charsets, which
Xcover U+0100-U+33FF and U+E000-U+FFFF but not U+4E00-U+9FFF, and
Xutf-translate-cjk does not exist before Emacs 22.  So the kanji come back as
Xeight-bit characters, and a .elc compiled from these UTF-8 sources cannot be
Xread back either, because the compiler writes the mule-unicode internal form
Xstraight into the .elc.  Mule-UCS supplies a utf-8 that maps CJK onto
Xjapanese-jisx0208 and fixes both, so it is loaded when emacs-major-version is
Xbelow 22.  The require is wrapped in condition-case, so nothing changes where
XMule-UCS is not installed, and nothing at all happens on Emacs 22 and later.
X
XFrom Emacs 21 on, the byte compiler warns that the value from mapcar is
Xunused and suggests mapc or dolist.  The same warning is already raised twice
Xin this package -- anthy-unicode-azik.el:226 and anthy-unicode-conf.el:108
Xcall mapcar the same way -- so this adds a third of a warning that is already
Xthere, which is the price of keeping Emacs 20 in the accepted list.  Guarding
Xthe one call with fboundp would cost more lines than the warning is worth.
X
XMeasured on NetBSD 11.0/amd64 with emacs 20.7, 21.4 and 30.2: with this patch
Xand Mule-UCS, all three byte-compile the six files, convert nihongo to the
Xkanji, and deactivate the input method cleanly.  Without it, Emacs 20 stops
Xat load and Emacs 21 at the first conversion.
X
X--- src-util/anthy-unicode.el.orig
X+++ src-util/anthy-unicode.el
X@@ -70,12 +70,23 @@
X (defvar anthy-agent-unicode-command-list '("anthy-agent-unicode")
X   "anthy-agent-unicodeのPATH 名")
X 
X+;; Emacs 20 と 21 の utf-8 は CJK を含まない (20 には utf-8 そのものが無い)。
X+;; anthy-agent-unicode は UTF-8 で話すので、Mule-UCS があれば載せる。
X+(if (and (not (featurep 'xemacs))
X+	 (< emacs-major-version 22)
X+	 (not (featurep 'un-define)))
X+    (condition-case nil
X+	(require 'un-define)
X+      (error nil)))
X+
X ;; face
X (defvar anthy-highlight-face nil)
X (defvar anthy-underline-face nil)
X (copy-face 'highlight 'anthy-highlight-face)
X (if (not (featurep 'xemacs))
X-    (set-face-underline 'anthy-highlight-face t))
X+    (if (fboundp 'set-face-underline)
X+	(set-face-underline 'anthy-highlight-face t)
X+      (set-face-underline-p 'anthy-highlight-face t)))
X (copy-face 'underline 'anthy-underline-face)
X 
X ;;
X@@ -250,7 +261,7 @@
X 	(delete-region start (+ start len))
X 	(goto-char start)))
X   (setq anthy-preedit "")
X-  (mapc 'delete-overlay anthy-preedit-overlays)
X+  (mapcar 'delete-overlay anthy-preedit-overlays)
X   (setq anthy-preedit-overlays nil))
X 
X (defun anthy-select-face-by-attr (attr)
X@@ -752,7 +763,11 @@
X 	(if anthy-agent-unicode-process
X 	    (kill-process anthy-agent-unicode-process))
X 	(setq anthy-agent-unicode-process proc)
X-	(set-process-query-on-exit-flag proc nil)
X+	(if (fboundp 'set-process-query-on-exit-flag)
X+	    (set-process-query-on-exit-flag proc nil)
X+	  (process-kill-without-query proc))
X+	(if (coding-system-p 'utf-8)
X+	    (set-process-coding-system proc 'utf-8 'utf-8))
X ;;	(if anthy-xemacs
X ;;	    (if (coding-system-p (find-coding-system 'euc-japan))
X ;;		(set-process-coding-system proc 'euc-japan 'euc-japan))
X@@ -871,7 +886,9 @@
X ;; leim の activate
X ;;
X (defun anthy-unicode-leim-activate (&optional name)
X-  (setq deactivate-current-input-method-function 'anthy-unicode-leim-inactivate)
X+  (if (boundp 'deactivate-current-input-method-function)
X+      (setq deactivate-current-input-method-function 'anthy-unicode-leim-inactivate)
X+    (setq inactivate-current-input-method-function 'anthy-unicode-leim-inactivate))
X   (setq anthy-leim-active-p t)
X   (anthy-update-mode)
X   (when (eq (selected-window) (minibuffer-window))
X@@ -881,7 +898,9 @@
X ;; emacsのバグ避けらしいです
X ;;
X (defun anthy-unicode-leim-exit-from-minibuffer ()
X-  (deactivate-input-method)
X+  (if (fboundp 'deactivate-input-method)
X+      (deactivate-input-method)
X+    (inactivate-input-method))
X   (when (<= (minibuffer-depth) 1)
X     (remove-hook 'minibuffer-exit-hook 'anthy-unicode-leim-exit-from-minibuffer)))
X 
END-of-anthy-unicode/patches/patch-src-util_anthy-unicode.el
exit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.