〜2002年6月上旬〜
Cygwinで--enable-sharedだとエラーになるのは直ってないので
--disable-shared --enable-static
しないとだめ。
% CFLAGS=-Os DLLTOOL=i686-pc-cygwin-dlltool \ RANLIB=i686-pc-cygwin-ranlib ../configure \ --prefix=/usr/local/cygwin-local --target=i686-pc-cygwin \ --host=i686-pc-cygwin --build=i586-pc-linux-gnu \ --disable-shared --enable-static
更新。$LDFLAGSの件はruby-gnome-users-ja MLにも書いたけど、順番がまずい。
--- extconf.rb.orig 2002-06-01 13:35:50.000000000
+++ extconf.rb 2002-06-01 21:12:12.000000000
@@ -15,3 +15,3 @@
if not version.chomp.empty?
- $LDFLAGS += ' ' + `#{config_cmd} --libs`.chomp
+ $libs += ' ' + `#{config_cmd} --libs`.chomp
$CFLAGS += ' ' + `#{config_cmd} --cflags`.chomp
筋肉番付は打ち切りになったようだ。
1.7に入った。早速makeしてみるとエラーに。
ext/win32ole/win32ole.c:676: structure has no member named `bool'
w32apiが古いのか?今使ってるのはw32api-1.2-1だから、 最新のw32api-1.4-2にしてみよう。
そういえばw32apiだけを更新ってしたことがなかったかな。
% CFLAGS=-Os ./configure \ --target=i686-pc-cygwin \ --host=i686-pc-cygwin \ --build=i586-pc-linux-gnu \ --prefix=/usr/local/cygwin % make % make tooldir=/usr/local/cygwin install
ついでにmingwも1.3-2に上げる。手順は全く同じ。
だめだなあ。うーむ。nativeだとちゃんとうまくいってる。何が違う? あ、わかった。PLATFORMは駆逐したからfake.rbで置換するのをやめたからだ。 だからcase whenでcygwinにならない。-DNONAMELESSUNIONがつかないのが原因だ。 まだPLATFORMを使ってるライブラリがあったのか。 というよりPLATFORMを使うべきじゃないってあまり知られてないのかな。 version.cにも書いてあるんだけど。
/* obsolete constants */
rb_define_global_const("VERSION", v);
rb_define_global_const("RELEASE_DATE", d);
rb_define_global_const("PLATFORM", p);
いつなくなっても不思議ではない。RUBY_がついてるものを使おうよ。
1.4の頃は確かにできなかったけど、今なら\が使えます。
% ruby-1.4.6 -e 'p %w[a\ b]' ["a\\", "b"] % ruby -e 'p %w[a\ b]' ["a b"]
と思ったら、空白じゃなくて空文字列だ。無理っぽい。
え?それって1.6にない拡張ライブラリですよね?かなり無理な注文です。 configure.linenoは初めて見るけどautoconfの残骸だろうか。
ChangeLog を見ると、 フロッピーの件 は直ったようだ。
<trini@kernel.crashing.org> [PATCH] Fix RAMDISK config problem The following fixes compilation with CONFIG_BLK_DEV_RAM=y I assume that Rusty intended to use a test for CONFIG_BLK_DEV_RAM and not BLOCK_DEV_RAM.
suspendはまだだめみたい。というわけで待ちだ。
<axboe@suse.de> [PATCH] documentation and tq_disk removals This should be the last of tq_disk, at least the trivial ones. md still has some queue_task references, I'll let Ingo/Neil clean those up. suspend is still broken, it was broken before too though. I guess Pavel will want to fix that.
惜しい。
arch/i386/kernel/kernel.o: In function `do_suspend_lowlevel': arch/i386/kernel/kernel.o(.text+0x7c20): undefined reference to `acpi_save_register_state' arch/i386/kernel/kernel.o(.text+0x7c27): undefined reference to `acpi_enter_sleep_state'
arch/i386/kernel/suspend.cで呼んでるってことは、 ソフトウェアサスペンドを使いたければCONFIG_ACPIはyじゃなきゃだめってことか?
defaultがbinmodeになる。
As promised, I have been making binmode the default in cygwin. You can still use the mount command (or setup.exe for that matter) to default to text mode but I am slowly removing all text mode assumptions from the code, specifically for accesses of remote shares (as was previously requested in this mailing list).
ということなので、ますますtext modeは使われなくなりそう。 ま、開発者もtext modeを使ってないんだから遅過ぎる選択とも言える。
5.8.0 RC1が出たので試す。 と思ったがperl-currentをrsyncしてたことを忘れてた。 こっちを試そう。
make all testすると 2時間近くかかる だけに簡単に試せないんだが、その間perldeltaを読む。 openがかなり拡張されてる。
PerlIO is Now The Default IO is now by default done via PerlIO rather than system's "stdio". PerlIO allows "layers" to be "pushed" onto a file handle to alter the handle's behaviour. Layers can be specified at open time via 3-arg form of open: open($fh,'>:crlf :utf8', $path) || ... or on already opened handles via extended C<binmode>: binmode($fh,':encoding(iso-8859-7)');
という感じでPerlはstdioを捨てたようだ。あ、defaultってことは選べるのか。
File handles can be opened to "in memory" files held in Perl scalars via: open($fh,'>', \$variable) || ...
ふむ。なるほど。
早速sjisなリテラルを試す。
% echo 'print "表示\n";' |iconv -t sjis |\ perl -Mencoding=sjis,Filter,1 |iconv -f utf-8 表示
というわけでFilterはうまくいってるようだ。 次にスクリプトはutf-8でSTDOUTはeucにしてみる。
% echo 'print "表示\n";' |iconv -t utf-8 |\ perl -Mencoding=utf-8,STDOUT,euc-jp 表示
okだ。じゃsjisなスクリプトでSTDOUTはeucだとどう?
% echo 'print "表示\n";' |iconv -t sjis |\ perl -Mencoding=sjis,Filter,1,STDOUT,euc-jp |iconv -f utf-8 表示
だめだな。utf-8のままだ。じゃeucでeucだと?
% echo 'print "表示\n";' |\ perl -Mencoding=euc-jp,Filter,1,STDOUT,euc-jp |iconv -f utf-8 表示
やっぱりutf-8のままか。 /usr/local/lib/perl5/5.8.0/i586-linux/encoding.pm を見るとFilter処理のときはSTDOUTの設定はしてないな。
binmode(STDIN); binmode(STDOUT);
となってる。じゃ自分でbinmodeすればいいのか。こんな感じで。
binmode(STDOUT, ":encoding(euc-jp"));
ってなんでbinmodeにこんな機能をつけ加えたんだろう? openも引数が3つになってるし、Perlは新しい関数を増やすのが嫌いらしい。 それはそれとして結局use utf8;も必要でこうするとうまくいく。
% echo 'binmode(STDOUT,":encoding(euc-jp)");print "表示\n";' |\ iconv -t sjis|perl -Mencoding=sjis,Filter,1 -Mutf8 表示
これをスクリプトにするとこうなる。
% iconv -f sjis sjis2euc-jp.pl #! /usr/local/bin/perl use encoding "sjis", Filter=>1; use utf8; binmode(STDOUT, ":encoding(euc-jp)"); print "表示\n";
いろんなもんをuseするし、さらにsjis->utf8->euc-jpと変換されるわけで、 実行すると非常に遅い。
% time perl sjis2euc-jp.pl 表示 perl sjis2euc-jp.pl 1.06s user 0.11s system 99% cpu 1.171 total
encodingが大半を占めている。
% time perl -Mencoding=euc-jp -e0 perl -Mencoding=euc-jp -e0 0.79s user 0.09s system 101% cpu 0.868 total % time perl -Mutf8 -e0 perl -Mutf8 -e0 0.13s user 0.02s system 101% cpu 0.148 total
更新。
2000-12-26バージョンも手に入りにくくなってるので、そろそろ新しくしよう。 使う時必要なのは
glib-2.0.3-20020525.zip gtk+-1.3.0-20020313.zip libiconv-1.7.zip libintl-0.10.40-20020310.zip
のDLLで、make時に必要なのは-devがついてる
glib-dev-2.0.3-20020525.zip gtk+-dev-1.3.0-20020313.zip libiconv-dev-1.7.zip
だ(include/とlib/)。libintlはなぜか分かれてない。 pkg-configも入れてもいいが、Cygwinにもパッケージがあるのでそっちを使った。
適当なディレクトリで全部展開する(/usr/local/gtkとする)。 Ruby/GTKで試してみよう。ruby-gtk-0.28は 例の問題 があるのでCVS版を使う。 最新のGTK+ for Windowsはpkg-configに対応してるので楽だ。
% cd gtk % PKG_CONFIG_PATH=/usr/local/gtk/lib/pkgconfig \ ruby extconf.rb \ --with-gtk-config='pkg-config gtk+-1.3-win32-production --define-variable=prefix=/usr/local/gtk'
prefixは/targetになってるので/targetを作ってそこに置けばprefixを置き換える必要はない。
% PKG_CONFIG_PATH=/target/lib/pkgconfig \ ruby extconf.rb \ --with-gtk-config='pkg-config gtk+-1.3-win32-production'
という感じ。これでok。
patchutils のinterdiffを使うと incremental patchが作れる。たとえば-dj patchだと
% interdiff -z patch-2.5.20-dj{3,4}.diff.bz2 | \
bzip2 >patch-2.5.20-dj3-dj4.diff.bz2
という感じ。
こう来たか。
suspend.c:306: warning: #warning This might be broken. \ We need to somehow wait for data to reach the disk
新しいGTK+ for Windowsにしたらgdkwin32.hの場所が変更になったようでエラーになる。 もう面倒だから
#define HWND_DESKTOP 0 #define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
としちゃおうか?