aboutsummaryrefslogtreecommitdiff
path: root/x11/rxvt-unicode
diff options
context:
space:
mode:
authorThierry Thomas <thierry@FreeBSD.org>2006-06-04 19:29:23 +0000
committerThierry Thomas <thierry@FreeBSD.org>2006-06-04 19:29:23 +0000
commit7a9fe0970fed6608d7e076072a0d5be983760c75 (patch)
tree79ce8c19de0533f48d32005d03c191846d638551 /x11/rxvt-unicode
parent6db773073483611d79ddc6abf68303263b137ed6 (diff)
downloadports-7a9fe0970fed6608d7e076072a0d5be983760c75.tar.gz
ports-7a9fe0970fed6608d7e076072a0d5be983760c75.zip
rxvt-unicode assume wchar_t is Unicode, but it's not true for FreeBSD.
Add a patch which converts the IM input charater to Unicode. It requires additional patch dependancy and enlarge executable size, so a knob WITHOUT_IMLOCALE_FIX is provided to disable this feature. PR: ports/98166 Submitted by: Kuang-che Wu <kcwu (at) csie.org>
Notes
Notes: svn path=/head/; revision=164355
Diffstat (limited to 'x11/rxvt-unicode')
-rw-r--r--x11/rxvt-unicode/Makefile12
-rw-r--r--x11/rxvt-unicode/files/extra-patch-imlocale74
2 files changed, 86 insertions, 0 deletions
diff --git a/x11/rxvt-unicode/Makefile b/x11/rxvt-unicode/Makefile
index 819049de04e7..fe3355ec09f9 100644
--- a/x11/rxvt-unicode/Makefile
+++ b/x11/rxvt-unicode/Makefile
@@ -7,6 +7,7 @@
PORTNAME= rxvt-unicode
PORTVERSION= 7.7
+PORTREVISION= 1
CATEGORIES= x11
MASTER_SITES= http://dist.schmorp.de/rxvt-unicode/%SUBDIR%/
MASTER_SITE_SUBDIR= . Attic
@@ -14,6 +15,10 @@ MASTER_SITE_SUBDIR= . Attic
MAINTAINER= thierry@FreeBSD.org
COMMENT= A clone of the terminal emulator rxvt modified to support Unicode
+.if !defined(WITHOUT_IMLOCALE_FIX)
+PATCH_DEPENDS= ${SITE_PERL}/${PERL_ARCH}/Encode/HanExtra.pm:${PORTSDIR}/chinese/p5-Encode-HanExtra \
+ ${SITE_PERL}/${PERL_ARCH}/Encode/JIS2K.pm:${PORTSDIR}/converters/p5-Encode-JIS2K
+.endif
LIB_DEPENDS= Xft.2:${PORTSDIR}/x11-fonts/libXft
BUILD_DEPENDS= pkg-config:${PORTSDIR}/devel/pkg-config
@@ -164,6 +169,7 @@ pre-everything::
@${ECHO_MSG} "WITHOUT_LINESPACE disable support for line-spacing"
@${ECHO_MSG} "WITHOUT_MOUSEWHEEL disable support for scrolling via mouse wheel"
@${ECHO_MSG} "WITHOUT_SMART_RESIZE disable smart growth/shrink behaviour"
+ @${ECHO_MSG} "WITHOUT_IMLOCALE_FIX disable imlocale encoding conversion fix"
@${ECHO_MSG}
.ifndef(WITH_ENCODING)
@${ECHO_MSG} "==> You can compile in support for additional codeset groups by setting the WITH_ENCODING variable"
@@ -177,6 +183,12 @@ pre-everything::
@${ECHO_MSG}
.endif
+.if !defined(WITHOUT_IMLOCALE_FIX)
+post-patch:
+ @${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-imlocale
+ @cd ${WRKSRC}/src && ./gentables
+.endif
+
pre-configure:
@${PERL} -pi -e 's|(PTYCHAR2\s+"[^"]+)"|\1ghijklmnopqrstuv"|' \
${WRKSRC}/src/ptytty.C
diff --git a/x11/rxvt-unicode/files/extra-patch-imlocale b/x11/rxvt-unicode/files/extra-patch-imlocale
new file mode 100644
index 000000000000..4cc39ce778c2
--- /dev/null
+++ b/x11/rxvt-unicode/files/extra-patch-imlocale
@@ -0,0 +1,74 @@
+diff -ur src/command.C.orig src/command.C
+--- src/command.C.orig Mon Feb 20 22:41:16 2006
++++ src/command.C Sun May 21 09:36:40 2006
+@@ -301,6 +301,26 @@
+ }
+ #endif
+
++void from_imlocale_to_locale(const char *imlocale, const char *locale, wchar_t *wkbuf, int len)
++{
++ if(!imlocale || !locale)
++ return;
++
++ if(!strchr(imlocale,'.') || !strchr(locale,'.'))
++ return;
++
++ codeset imcs = codeset_from_name(strchr(imlocale, '.'));
++ codeset cs = codeset_from_name(strchr(locale, '.'));
++
++ if (imcs == CS_UNKNOWN || cs == CS_UNKNOWN)
++ return;
++
++ for(int i=0; i<len; i++) {
++ wchar_t unicode = TO_UNICODE(imcs, wkbuf[i]);
++ wkbuf[i] = FROM_UNICODE(cs, unicode);
++ }
++}
++
+ void
+ rxvt_term::key_press (XKeyEvent &ev)
+ {
+@@ -361,6 +381,9 @@
+ if (rs[Rs_imLocale])
+ SET_LOCALE (locale);
+
++ if (rs[Rs_imLocale])
++ from_imlocale_to_locale(rs[Rs_imLocale], locale, wkbuf, len);
++
+ if (status_return == XLookupChars
+ || status_return == XLookupBoth)
+ {
+diff -ur src/encoding.C.orig src/encoding.C
+--- src/encoding.C.orig Mon Feb 20 22:41:16 2006
++++ src/encoding.C Sun May 21 09:36:40 2006
+@@ -151,6 +151,7 @@
+ static uint32_t cs_us_ascii_from_unicode (unicode_t unicode) { return unicode <= 127 ? unicode : NOCHAR; }
+
+ #define cs_us_ascii_to_unicode_16 cs_unicode_to_unicode
++static unicode_t cs_unicode_16_to_unicode (uint32_t enc) { return enc <= 65535 ? enc : NOCHAR; }
+ static uint32_t cs_unicode_16_from_unicode (unicode_t unicode) { return unicode <= 65535 ? unicode : NOCHAR; }
+
+ #define ENCODING_DEFAULT
+diff -ur src/encoding.h.orig src/encoding.h
+--- src/encoding.h.orig Sun May 21 08:14:15 2006
++++ src/encoding.h Sun May 21 08:16:54 2006
+@@ -2,6 +2,7 @@
+ #define ENCODING_H
+
+ #include <inttypes.h>
++#define ENCODING_TO_UNICODE 1
+
+ typedef uint32_t unicode_t;
+
+diff -ur src/gentables.orig src/gentables
+--- src/gentables Sun May 21 08:14:15 2006
++++ src/gentables.orig Sun May 21 08:15:08 2006
+@@ -13,7 +13,7 @@
+
+ my $gen;
+
+-$TO_UNICODE = 0; # also generate to_unicode tables
++$TO_UNICODE = 1; # also generate to_unicode tables
+
+ sub linear {
+ my ($a, $l, $h, $b) = @_;