commit:     f6e84ff2dfd1ffed828390ff78148999cf7eed37
Author:     Akinori Hattori <hattya <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 23 13:13:20 2017 +0000
Commit:     Akinori Hattori <hattya <AT> gentoo <DOT> org>
CommitDate: Sun Jul 23 13:15:23 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6e84ff2

app-i18n/canfep: add support for Unix98 PTY

Gentoo-Bug: 212709

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 app-i18n/canfep/canfep-1.0-r1.ebuild         | 41 +++++++++++++++++
 app-i18n/canfep/files/canfep-posix-pty.patch | 67 ++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)

diff --git a/app-i18n/canfep/canfep-1.0-r1.ebuild 
b/app-i18n/canfep/canfep-1.0-r1.ebuild
new file mode 100644
index 00000000000..9d542a19716
--- /dev/null
+++ b/app-i18n/canfep/canfep-1.0-r1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit toolchain-funcs
+
+DESCRIPTION="Canna Japanese kana-kanji frontend processor on console"
+HOMEPAGE="http://www.geocities.co.jp/SiliconValley-Bay/7584/canfep/";
+SRC_URI="http://www.geocities.co.jp/SiliconValley-Bay/7584/${PN}/${P}.tar.gz
+       unicode? ( 
http://hp.vector.co.jp/authors/VA020411/patches/${PN}_utf8.diff )"
+
+LICENSE="canfep"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"
+IUSE="unicode"
+
+RDEPEND="app-i18n/canna
+       sys-libs/ncurses:="
+DEPEND="${RDEPEND}
+       virtual/pkgconfig"
+
+PATCHES=( "${FILESDIR}"/${PN}-posix-pty.patch )
+
+src_prepare() {
+       use unicode && eapply "${DISTDIR}"/${PN}_utf8.diff
+       sed -i 's/$(CFLAGS)/$(CFLAGS) $(LDFLAGS)/' Makefile
+
+       default
+}
+
+src_compile() {
+       emake \
+               CC="$(tc-getCXX)" \
+               LIBS="-lcanna $(pkg-config --libs ncurses)"
+}
+
+src_install() {
+       dobin ${PN}
+       dodoc 00{changes,readme}
+}

diff --git a/app-i18n/canfep/files/canfep-posix-pty.patch 
b/app-i18n/canfep/files/canfep-posix-pty.patch
new file mode 100644
index 00000000000..caa451232ef
--- /dev/null
+++ b/app-i18n/canfep/files/canfep-posix-pty.patch
@@ -0,0 +1,67 @@
+https://bugs.gentoo.org/show_bug.cgi?id=212709
+
+Author: OKUMURA N. Shin-ya <[email protected]>
+
+--- a/pty.C
++++ b/pty.C
+@@ -257,6 +257,23 @@
+         }
+     }
+ 
++#if defined(_POSIX_C_SOURCE)
++    // BSD pty �������ʤ��Τǡ�POSIX ����ˡ���
++    if ((master = posix_openpt(O_RDWR)) >= 0) {
++        if (grantpt(master) == 0 && unlockpt(master) == 0) {
++            // �ޥ����ǥХ���̾�ϸ���
++            strcpy(line, "/dev/ptmx");
++            tcgetattr(0, &tt);
++            tt.c_iflag &= ~ISTRIP;
++            ioctl(0, TIOCGWINSZ, (char*) &win);
++            return;
++        }
++        close(master);
++    } else {
++        perror("/dev/ptmx");
++    }
++#endif  // _POSIX_C_SOURCE
++
+     printf("Out of pty's\n");
+     fail();
+ }
+@@ -265,12 +282,36 @@
+ void
+ Pty::getslave()
+ {
++#if defined(_POSIX_C_SOURCE)
++    // �ޥ����ǥХ����� POSIX �����ξ���
++    if (strcmp(line, "/dev/ptmx") == 0) {
++        char *slave_devname = ptsname(master);
++        if (slave_devname == NULL) {
++            perror("ptsname");
++            fail();
++        }
++        slave = open(slave_devname, O_RDWR);
++        if (slave < 0) {
++            perror(slave_devname);
++            fail();
++        }
++        strcpy(line, slave_devname);
++    } else {
++        line[strlen("/dev/")] = 't';
++        slave = open(line, O_RDWR);
++        if (slave < 0) {
++            perror(line);
++            fail();
++        }
++    }
++#else   // ! _POSIX_C_SOURCE
+     line[strlen("/dev/")] = 't';
+     slave = open(line, O_RDWR);
+     if (slave < 0) {
+         perror(line);
+         fail();
+     }
++#endif  // _POSIX_C_SOURCE
+     tcsetattr(slave, TCSAFLUSH, &tt);
+     if (!hs)
+         win.ws_row--;

Reply via email to