Summary
Graphviz
[2003-12-01-3] の日本語化
キモは GD と FreeType フォントらしい.
※編集中
CVS からソースの入手
$ cvs -d :pserver:anoncvs@cvs-graphviz.research.att.com:/home/cvsroot login
password は "anoncvs"
$ cvs -d :pserver:anoncvs@cvs-graphviz.research.att.com:/home/cvsroot co graphviz
$ cd graphviz
- 東風フォントのインストール
# aptitude install ttf-kochi-gothic
- 日本語化のためのソース改変
gd/Makefile.in.orig
60行目
を
CFLAGS = @CFLAGS@ -DJISX0208 -DHAVE_ICONV -DHAVE_STDARG_H -DHAVE_ERRNO_H
dotneato/common/gdgen.c
565行目付近
else if (strcasecmp(fontbuf, "courier") == 0)
fontlist = "courier;Courier;COURIER;cour";
return fontlist;
を
else if (strcasecmp(fontbuf, "courier") == 0)
fontlist = "courier;Courier;COURIER;cour";
fontlist = "kochi-gothic";
return fontlist;
configure ファイルの生成
$ ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4 --output=aclocal.m4t
autoreconf: `aclocal.m4' is created
autoreconf: configure.ac: tracing
configure.ac:128: warning: AC_PROG_LEX invoked multiple times
autoconf/programs.m4:438: AC_DECL_YYTEXT is expanded from...
aclocal.m4:7066: AM_PROG_LEX is expanded from...
configure.ac:128: the top level
autoreconf: running: libtoolize --copy --force
Putting files in AC_CONFIG_AUX_DIR, `config'.
autoreconf: `aclocal.m4' is unchanged
autoreconf: running: /usr/bin/autoconf --force
configure.ac:128: warning: AC_PROG_LEX invoked multiple times
autoconf/programs.m4:438: AC_DECL_YYTEXT is expanded from...
aclocal.m4:7066: AM_PROG_LEX is expanded from...
configure.ac:128: the top level
configure.ac:46: error: possibly undefined macro: AC_DEFINE_UNQUOTED
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:235: error: possibly undefined macro: AC_MSG_WARN
autoreconf: /usr/bin/autoconf failed with exit status: 1
エラー
「Autoconf のドキュメントを見ろ.」か.
CVS じゃないほうでやってみる.
ソースを取ってくる
$ wget http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.0.tar.gz
$ tar xzvf graphviz-2.0.tar.gz
$ cd graphviz-2.0
- 日本語化のためのソース改変
gd/Makefile.in.orig
224行目
を
CFLAGS = @CFLAGS@ -DJISX0208 -DHAVE_ICONV -DHAVE_STDARG_H -DHAVE_ERRNO_H
dotneato/common/gdgen.c
565行目付近
else if (strcasecmp(fontbuf, "courier") == 0)
fontlist = "courier;Courier;COURIER;cour";
return fontlist;
を
else if (strcasecmp(fontbuf, "courier") == 0)
fontlist = "courier;Courier;COURIER;cour";
fontlist = "kochi-gothic";
return fontlist;
configure と make
$ ./configure
$ make
Making all in lefty
make[2]: Entering directory `/home/yoshiki/src/graphviz-2.0/lefty'
Making all in ws
make[3]: Entering directory `/home/yoshiki/src/graphviz-2.0/lefty/ws'
Making all in x11
make[4]: Entering directory `/home/yoshiki/src/graphviz-2.0/lefty/ws/x11'
Making all in libfilereq
make[5]: Entering directory `/home/yoshiki/src/graphviz-2.0/lefty/ws/x11/libfilereq'
if /bin/sh ../../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../../.. -I/usr/X11R6/include -I/usr/local/include -O2 -Wall -MT Dir.lo -MD -MP -MF ".deps/Dir.Tpo" -c -o Dir.lo Dir.c; \
then mv -f ".deps/Dir.Tpo" ".deps/Dir.Plo"; else rm -f ".deps/Dir.Tpo"; exit 1; fi
mkdir -p .libs
gcc -DHAVE_CONFIG_H -I. -I. -I../../../.. -I/usr/X11R6/include -I/usr/local/include -O2 -Wall -MT Dir.lo -MD -MP -MF .deps/Dir.Tpo -c Dir.c -fPIC -DPIC -o .libs/Dir.o
In file included from Dir.c:56:
SFinternal.h:50:26: X11/Xaw/Text.h: No such file or directory
SFinternal.h:51:31: X11/Xaw/AsciiText.h: No such file or directory
In file included from Dir.c:56:
SFinternal.h:108: error: parse error before "SFtextPos"
SFinternal.h:108: warning: type defaults to `int' in declaration of `SFtextPos'
SFinternal.h:108: warning: data definition has no type or storage class
make[5]: *** [Dir.lo] エラー 1
make[5]: Leaving directory `/home/yoshiki/src/graphviz-2.0/lefty/ws/x11/libfilereq'
make[4]: *** [all-recursive] エラー 1
make[4]: Leaving directory `/home/yoshiki/src/graphviz-2.0/lefty/ws/x11'
make[3]: *** [all-recursive] エラー 1
make[3]: Leaving directory `/home/yoshiki/src/graphviz-2.0/lefty/ws'
make[2]: *** [all-recursive] エラー 1
make[2]: Leaving directory `/home/yoshiki/src/graphviz-2.0/lefty'
make[1]: *** [all-recursive] エラー 1
make[1]: Leaving directory `/home/yoshiki/src/graphviz-2.0'
make: *** [all] エラー 2
Text.h と AsciiText.h が無いためにエラー
xaw をキーに Text.h と AsciiText.h を検索
$ auto-apt search xaw
usr/X11R6/include/X11/Xaw/Text.h libdevel/libxaw7-dev
usr/X11R6/include/X11/Xaw/AsciiText.h libdevel/libxaw7-dev
ibxaw7-dev というパッケージに発見
libxaw7-dev をインストールして再挑戦
# aptitude install libxaw7-dev
$ make
make[3]: Entering directory `/home/yoshiki/src/graphviz-2.0/lefty'
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../lefty/ws/x11 -I../lefty/os/unix -I../lefty/dot2l -I/usr/local/include -DLEFTYPATH=\"/usr/local/share/graphviz/lefty\" -DHAVEDOT -I/usr/X11R6/include -O2 -Wall -MT code.o -MD -MP -MF ".deps/code.Tpo" -c -o code.o code.c; \
then mv -f ".deps/code.Tpo" ".deps/code.Po"; else rm -f ".deps/code.Tpo"; exit 1; fi
中略
mkdir -p .libs
gcc -DLEFTYPATH=\"/usr/local/share/graphviz/lefty\" -DHAVEDOT -I/usr/X11R6/include -O2 -Wall -o lefty code.o common.o display.o exec.o g.o gfxview.o internal.o lefty.o lex.o mem.o parse.o str.o tbl.o txtview.o -L/usr/local/lib ../lefty/dot2l/.libs/libdot2l.a ../lefty/ws/x11/.libs/libws.a ../lefty/ws/x11/libfilereq/.libs/libfilereq.a ../lefty/os/unix/.libs/libos.a -L/usr/X11R6/lib -lSM -lICE -lXpm -lXt -lXmu -lXext -lX11 -lm
../lefty/ws/x11/.libs/libws.a(gbutton.o)(.text+0x1f7): In function `.L8':
: undefined reference to `commandWidgetClass'
../lefty/ws/x11/.libs/libws.a(glabel.o)(.text+0x1be): In function `.L8':
: undefined reference to `labelWidgetClass'
../lefty/ws/x11/.libs/libws.a(gmenu.o)(.text+0x59): In function `GMcreatewidget':
: undefined reference to `simpleMenuWidgetClass'
../lefty/ws/x11/.libs/libws.a(gmenu.o)(.text+0x278): In function `GMmenuaddentries':
: undefined reference to `smeBSBObjectClass'
../lefty/ws/x11/.libs/libws.a(gquery.o)(.text+0x15e): In function `GQcreatewidget':
: undefined reference to `dialogWidgetClass'
../lefty/ws/x11/.libs/libws.a(gquery.o)(.text+0x1a9): In function `GQcreatewidget':
: undefined reference to `XawDialogAddButton'
../lefty/ws/x11/.libs/libws.a(gquery.o)(.text+0x1cd): In function `GQcreatewidget':
: undefined reference to `XawDialogAddButton'
../lefty/ws/x11/.libs/libws.a(gquery.o)(.text+0x30b): In function `GQcreatewidget':
: undefined reference to `dialogWidgetClass'
../lefty/ws/x11/.libs/libws.a(gquery.o)(.text+0x9b2): In function `GQqueryask':
: undefined reference to `XawDialogGetValueString'
../lefty/ws/x11/.libs/libws.a(gquery.o)(.text+0xaf2): In function `GQqueryask':
: undefined reference to `commandWidgetClass'
../lefty/ws/x11/.libs/libws.a(gscroll.o)(.text+0x1b1): In function `.L8':
: undefined reference to `viewportWidgetClass'
../lefty/ws/x11/.libs/libws.a(gscroll.o)(.text+0x907): In function `.L56':
: undefined reference to `XawViewportSetCoordinates'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x22c): In function `.L8':
: undefined reference to `asciiTextWidgetClass'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x2af): In function `.L8':
: undefined reference to `XawTextSetSelectionArray'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x85d): In function `.L82':
: undefined reference to `XawTextSetInsertionPoint'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x86b): In function `.L82':
: undefined reference to `XawTextGetInsertionPoint'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x8a3): In function `.L82':
: undefined reference to `FMT8BIT'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x8c8): In function `.L82':
: undefined reference to `XawTextReplace'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x8d6): In function `.L82':
: undefined reference to `XawTextGetInsertionPoint'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x915): In function `.L82':
: undefined reference to `XawTextReplace'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0xd23): In function `.L124':
: undefined reference to `XawTextGetSource'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0xd32): In function `.L124':
: undefined reference to `FMT8BIT'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0xd63): In function `.L124':
: undefined reference to `XawTextSourceRead'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0xe36): In function `.L132':
: undefined reference to `XawTextGetSource'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0xe54): In function `.L132':
: undefined reference to `XawTextGetSelectionPos'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0xe61): In function `.L132':
: undefined reference to `FMT8BIT'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0xe93): In function `.L132':
: undefined reference to `XawTextSourceRead'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x10cf): In function `Gtweolaction':
: undefined reference to `XawTextGetInsertionPoint'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x10dc): In function `Gtweolaction':
: undefined reference to `XawTextGetSource'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x10f1): In function `Gtweolaction':
: undefined reference to `FMT8BIT'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x111e): In function `Gtweolaction':
: undefined reference to `XawTextSourceSearch'
../lefty/ws/x11/.libs/libws.a(gtext.o)(.text+0x1195): In function `Gtweolaction':
: undefined reference to `XawTextSourceRead'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(SelFile.o)(.text+0x239): In function `SFcreateWidgets':
: undefined reference to `formWidgetClass'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(SelFile.o)(.text+0x324): In function `SFcreateWidgets':
: undefined reference to `labelWidgetClass'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(SelFile.o)(.text+0x6dc): In function `SFcreateWidgets':
: undefined reference to `asciiTextWidgetClass'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(SelFile.o)(.text+0x841): In function `SFcreateWidgets':
: undefined reference to `scrollbarWidgetClass'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(SelFile.o)(.text+0x100e): In function `SFcreateWidgets':
: undefined reference to `commandWidgetClass'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(SelFile.o)(.text+0x1803): In function `SFtextChanged':
: undefined reference to `XawTextGetInsertionPoint'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(SelFile.o)(.text+0x188e): In function `SFtextChanged':
: undefined reference to `XawTextGetInsertionPoint'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0x3c8): In function `SFclearList':
: undefined reference to `XawScrollbarSetThumb'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0x420): In function `SFclearList':
: undefined reference to `XawScrollbarSetThumb'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0x45a): In function `SFclearList':
: undefined reference to `XawScrollbarSetThumb'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0x595): In function `SFdeleteEntry':
: undefined reference to `XawScrollbarSetThumb'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0xdaa): In function `SFscrollTimer':
: undefined reference to `XawScrollbarSetThumb'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0x151b): more undefined references to `XawScrollbarSetThumb' follow
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0x17c1): In function `SFpathSliderMovedCallback':
: undefined reference to `XawTextSetInsertionPoint'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Draw.o)(.text+0x1890): In function `SFpathAreaSelectedCallback':
: undefined reference to `XawScrollbarSetThumb'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Path.o)(.text+0xc73): In function `SFupdatePath':
: undefined reference to `XawScrollbarSetThumb'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Path.o)(.text+0x1097): In function `SFsetText':
: undefined reference to `FMT8BIT'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Path.o)(.text+0x10c8): In function `SFsetText':
: undefined reference to `XawTextReplace'
../lefty/ws/x11/libfilereq/.libs/libfilereq.a(Path.o)(.text+0x10de): In function `SFsetText':
: undefined reference to `XawTextSetInsertionPoint'
collect2: ld returned 1 exit status
make[3]: *** [lefty] エラー 1
make[3]: Leaving directory `/home/yoshiki/src/graphviz-2.0/lefty'
make[2]: *** [all-recursive] エラー 1
make[2]: Leaving directory `/home/yoshiki/src/graphviz-2.0/lefty'
make[1]: *** [all-recursive] エラー 1
make[1]: Leaving directory `/home/yoshiki/src/graphviz-2.0'
make: *** [all] エラー 2
ソースをaptで持ってくる.(Version 1.16)
# apt-get source graphviz
- 日本語化のためのソース改変
configure
DEFAULT_FONTPATH="/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:/usr/common/share/fonts/ttf";
を
DEFAULT_FONTPATH="/usr/share/fonts/truetype/kochi:/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:/usr/common/share/fonts/ttf";
gd/Makefile.in
135行目
を
CFLAGS = @CFLAGS@ -DJISX0208 -DHAVE_ICONV -DHAVE_STDARG_H -DHAVE_ERRNO_H
dotneato/common/gdgen.c
435行目付近
#ifdef HAVE_GD_FONTCONFIG
return font;
#else
を
#ifdef HAVE_GD_FONTCONFIG
font = "kochi-gothic";
return font;
#else
489行目付近
else if (strcasecmp(fontbuf, "courier") == 0)
fontlist = "courier;Courier;COURIER;cour";
return fontlist;
を
else if (strcasecmp(fontbuf, "courier") == 0)
fontlist = "courier;Courier;COURIER;cour";
fontlist = "kochi-gothic";
return fontlist;
configure と make
$ ./configure
$ make
# make install
追記
Garphviz の開発版は UTF-8 で書いて,フォント指定すれば日本語が通るらしい
Reference
Graphviz - Download - Source
http://www.graphviz.org/Download_source.php
はてなダイアリー - svnseeds' ghoti! - 2003-06-19
http://d.hatena.ne.jp/svnseeds/20030619#p3
Graphviz-ja
http://nile.ulis.ac.jp/~masao/software/graphviz-ja/
Omicron - GraphViz
http://tiki.is.os-omicron.org/tiki.cgi?c=v&p=GraphViz
ダビスタなページ - いろいろ - 2004-12-24 - 最近のGraphViz
http://ff.pekori.to/nikki/2004.html