Update nkf to 2.09.

While here, add support of self test if PKGSRC_RUN_TEST=YES,
and let p5-nkf to sync with nkf.

Changes:
 * Add -Z4 option.  Convert JIS X 0208 KANA to JIS X 0201 KANA (ZENKAKU to HANKAKU).
 * Add -g=0, -g=1, --guess=0 and --guess=1 option.
   guesses linefeed code.
 * Add some comple option.  See also config.h for more information.
 * Some bug fixes.
 * Change license from original one to zlib's one.
 * Change SCM from CVS to Git.
This commit is contained in:
obache 2009-01-22 08:50:12 +00:00
parent 462b9e477d
commit 5f1dfd5d76
8 changed files with 148 additions and 23 deletions

View file

@ -1,19 +1,16 @@
# $NetBSD: Makefile,v 1.11 2008/01/13 13:13:42 obache Exp $
# $NetBSD: Makefile,v 1.12 2009/01/22 08:50:12 obache Exp $
DISTNAME= nkf-2.0.8b
PKGNAME= nkf-2.08b
.include "${.CURDIR}/Makefile.common"
PKGNAME= nkf-2.09
CATEGORIES= japanese converters
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_JP:=nkf/26243/}
MAINTAINER= cjs@NetBSD.org
HOMEPAGE= http://sourceforge.jp/projects/nkf/
COMMENT= Convert between various Japanese character encodings
PKG_INSTALLATION_TYPES= overwrite pkgviews
PKG_DESTDIR_SUPPORT= user-destdir
WRKSRC= ${WRKDIR}/nkf-2.0.8
INSTALLATION_DIRS= bin ${PKGMANDIR}/man1
BUILD_TARGET= nkf
@ -22,4 +19,11 @@ do-install:
${INSTALL_PROGRAM} ${WRKSRC}/nkf ${DESTDIR}${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/nkf.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
.include "../../mk/bsd.prefs.mk"
.if !empty(PKGSRC_RUN_TEST:M[yY][eE][sS])
USE_TOOLS+= perl
TEST_TARGET= test
.endif
.include "../../mk/bsd.pkg.mk"

View file

@ -0,0 +1,11 @@
# $NetBSD: Makefile.common,v 1.1 2009/01/22 08:50:12 obache Exp $
# used by converters/nkf/Makefile
# used by converters/p5-nkf/Makefile
DISTNAME= nkf-2.0.9
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_JP:=nkf/37177/}
HOMEPAGE= http://sourceforge.jp/projects/nkf/
DISTINFO_FILE= ${.CURDIR}/../../converters/nkf/distinfo
PATCHDIR= ${.CURDIR}/../../converters/nkf/patches

View file

@ -1,5 +1,8 @@
$NetBSD: distinfo,v 1.5 2008/01/13 13:13:42 obache Exp $
$NetBSD: distinfo,v 1.6 2009/01/22 08:50:12 obache Exp $
SHA1 (nkf-2.0.8b.tar.gz) = 9587e427173b6c0420284afef19b18b3f905fbaa
RMD160 (nkf-2.0.8b.tar.gz) = 952698a09f8e28b6385a7b41301e95dc237aa893
Size (nkf-2.0.8b.tar.gz) = 152883 bytes
SHA1 (nkf-2.0.9.tar.gz) = 68e9d5c6224940e6f1fe1d3cf0a54e47c5769a27
RMD160 (nkf-2.0.9.tar.gz) = c27b176f675428c0cbfb7779700979e60de3a42f
Size (nkf-2.0.9.tar.gz) = 157686 bytes
SHA1 (patch-aa) = 04ae92c1ff89b68750cb64186921b8984d527879
SHA1 (patch-ab) = dcb7619ef049f3e9824566565281efaec54587fa
SHA1 (patch-ac) = 2d891bdd891cabd760f7fd905d2ecc5e40908ad0

View file

@ -0,0 +1,40 @@
$NetBSD: patch-aa,v 1.1 2009/01/22 08:50:12 obache Exp $
Fix: redefinition of macro SP (workarround).
http://git.sourceforge.jp/view?p=nkf/nkf.git;a=commitdiff;h=d2f5d12b00a610a371ec48f6c841953b792aa721
NKF.xs must follow nkf.c doesn't have WISH_TRUE AND NO_X0201
http://git.sourceforge.jp/view?p=nkf/nkf.git;a=commitdiff;h=f06661980bb179714f60338e09d48ae66ca15f97
--- NKF.mod/NKF.xs.orig 2009-01-20 09:49:31.000000000 +0000
+++ NKF.mod/NKF.xs
@@ -95,7 +95,9 @@ nkf_putchar_grow(unsigned int c)
#define PERL_XS 1
#include "../utf8tbl.c"
+#undef SP
#include "../nkf.c"
+#define SP sp /* perl's CORE/pp.h */
/* package defenition */
@@ -134,9 +136,6 @@ nkf(...)
data = SvPV(ST(argc),i_len);
input_ctr = 0;
- if(x0201_f == WISH_TRUE)
- x0201_f = ((!iso2022jp_f)? TRUE : NO_X0201);
-
/* allocate the result buffer */
/* During conversion, stirngs length may grow. This is the unit */
@@ -178,9 +177,6 @@ nkf_continue(...)
data = SvPV(ST(0),i_len);
input_ctr = 0;
- if(x0201_f == WISH_TRUE)
- x0201_f = ((!iso2022jp_f)? TRUE : NO_X0201);
-
/* allocate the result buffer */
/* During conversion, stirngs length may grow. This is the unit */

View file

@ -0,0 +1,43 @@
$NetBSD: patch-ab,v 1.1 2009/01/22 08:50:12 obache Exp $
Fix: can't run test.
http://git.sourceforge.jp/view?p=nkf/nkf.git;a=commitdiff;h=b7ee1f1b26ba715116fd8f66e83bf1ad8a95bcce
--- NKF.mod/test.pl.orig 2009-01-20 09:49:31.000000000 +0000
+++ NKF.mod/test.pl
@@ -114,8 +114,35 @@ END {print "not ok 1\n" unless $loaded;}
} else {
print "no 5\n";
}
+}
+sub command_tests {
+ my @tests = @_;
+ my ($in, $out, $ans);
+ for (my $i = 0; $i <= $#tests; $i += 3){
+ local (@nkf) = split(/ /,$tests[$i]);
+ shift(@nkf);
+ $in = $tests[$i+1];
+ $ans = $tests[$i+2];
+ $out = NKF::nkf(@nkf,$in);
+ $out =~ s/ //g if $nkf =~ /-\w+m[NS]/o;
+ $ans =~ s/ //g if $nkf =~ /-\w+m[NS]/o;
+ if ($out ne $ans) {
+ last;
+ }
+ }
+ if ($out eq $ans) {
+ print "Ok\n";
+ return;
+ }
+ print "Fail\n";
+ if ($diff) {
+ open(R,"|od -c >tmp.result.bad"); binmode R; print R $out; close(R);
+ open(R,"|od -c >tmp.expect.bad"); binmode R; print R $ans; close(R);
+ system "diff -c tmp.result.bad tmp.expect.bad";
+ }
+ return;
}
do "../nkf_test.pl";

View file

@ -0,0 +1,23 @@
$NetBSD: patch-ac,v 1.1 2009/01/22 08:50:12 obache Exp $
Fix: can't run test.
http://git.sourceforge.jp/view?p=nkf/nkf.git;a=commitdiff;h=b7ee1f1b26ba715116fd8f66e83bf1ad8a95bcce
--- nkf_test.pl.orig 2009-01-20 09:49:31.000000000 +0000
+++ nkf_test.pl
@@ -957,6 +957,7 @@ eofeof
printf "%-40s", "test_data/bugs10904";
&test("$nkf -Mj",$example{'test_data/bugs10904'},$example{'test_data/bugs10904.ans'});
+ if (!NKF) {
printf "%-40s", "Guess NL";
&command_tests(
"$nkf --guess","none", "ASCII\n",
@@ -980,6 +981,7 @@ printf "%-40s", "Guess NL";
"$nkf --guess","\r\n.\n", "ASCII (MIXED NL)\n",
"$nkf --guess","\r\n.\r", "ASCII (MIXED NL)\n",
"$nkf --guess","\r\n.\r\n", "ASCII (CRLF)\n");
+ }
printf "%-40s", "Convert NL to LF";
&command_tests(

View file

@ -1,21 +1,27 @@
# $NetBSD: Makefile,v 1.16 2008/10/19 19:17:42 he Exp $
# $NetBSD: Makefile,v 1.17 2009/01/22 08:50:12 obache Exp $
#
DISTNAME= nkf205
PKGNAME= p5-nkf-2.05
PKGREVISION= 2
.include "../../converters/nkf/Makefile.common"
PKGNAME= p5-nkf-2.09
SVR4_PKGNAME= p5nkf
CATEGORIES= japanese converters perl5
MASTER_SITES= http://www01.tcp-ip.or.jp/~furukawa/nkf_utf8/
MAINTAINER= tech-pkg-ja@jp.NetBSD.org
HOMEPAGE= http://sourceforge.jp/projects/nkf/
COMMENT= Perl library for Network Kanji code conversion Filter
PKG_DESTDIR_SUPPORT= user-destdir
WRKSRC= ${WRKDIR}/${DISTNAME}/NKF.mod
USE_LANGUAGES= c
PERL5_CONFIGURE_DIRS= NKF.mod
BUILD_DIRS= ${PERL5_CONFIGURE_DIRS}
PERL5_PACKLIST= auto/NKF/.packlist
SUBST_CLASSES+= sp
SUBST_STAGE.sp= pre-configure
SUBST_FILES.sp= nkf.c
SUBST_SED.sp= -e 's/SP/SPSP/g'
.include "../../lang/perl5/module.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,5 +0,0 @@
$NetBSD: distinfo,v 1.4 2005/06/25 03:26:15 taca Exp $
SHA1 (nkf205.tar.gz) = 78f1321d0dec16dd9bb6f046a349aadc86c027b4
RMD160 (nkf205.tar.gz) = 55d48e281f6491c299897c3f22c3f0a2b2a13b16
Size (nkf205.tar.gz) = 149809 bytes