uemacs

なんとなくココからソースを取得して make してみた。
README を見たら makefile.unx を makefile にリネイムして make しれ、とあったのでそのまま実行してみたのですが NG。

とりあえず

makefile の DEFINES な行を以下にして実行してみたがまだ駄目。

DEFINES=-DAUTOCONF -DSYSV -D_DARWIN_C_SOURCE

根拠としては estruct.h の末端の以下な部分によります。

/* Since Mac OS X's termios.h doesn't have the following 2 macros, define them.                                                 
 */
#if defined(SYSV) && defined(_DARWIN_C_SOURCE)
#define OLCUC 0000002
#define XCASE 0000004
#endif

ただ、現状では termio.c で以下なエラーが出てまして

termio.c: In function 'ttopen':
termio.c:161: error: 'TCGETA' undeclared (first use in this function)
termio.c:161: error: (Each undeclared identifier is reported only once
termio.c:161: error: for each function it appears in.)
termio.c:162: error: invalid use of undefined type 'struct termio'
termio.c:164: error: invalid use of undefined type 'struct termio'
termio.c:164: error: invalid use of undefined type 'struct termio'
termio.c:166: error: invalid use of undefined type 'struct termio'
termio.c:167: error: invalid use of undefined type 'struct termio'
termio.c:167: error: invalid use of undefined type 'struct termio'
termio.c:168: error: invalid use of undefined type 'struct termio'
termio.c:169: error: invalid use of undefined type 'struct termio'
termio.c:169: error: invalid use of undefined type 'struct termio'
termio.c:170: error: invalid use of undefined type 'struct termio'
termio.c:171: error: invalid use of undefined type 'struct termio'
termio.c:173: error: 'TCSETAW' undeclared (first use in this function)
termio.c: In function 'ttclose':
termio.c:251: error: 'TCSETAW' undeclared (first use in this function)
make: *** [termio.o] Error 1

困っている午後 3 時、というカンジです。なんとなく OSX で SYSV な define する、というのも微妙な気がしてるんですが。

SYSV ではなくて BSD を define してみたらコンパイルが通ったけどリンクできぬ、という形に変わりました。色んな意味で全然理解できてない事は分かりました。
とりあえず一つづつ見てみます。

Undefined symbols:
  "_rval", referenced from:
      _rval$non_lazy_ptr in eval.o

ええと、eval.c の中を見てみると

    case EVRVAL:
        return (itoa(rval));

みたいな事をしてますな。でも include している edef.h にて以下の記述もあります。

extern int rval;        /* return value of a subprocess */

ちなみに実体ですが global.c にて以下。(静的な変数として定義されてます)

int rval = 0;           /* return value of a subprocess */

んーとこれ、どーゆー意味だろ。0 代入してるし (何

こうして見るに

  • 変数はグローバルとして定義されている
  • eval.c において extern な変数宣言がある

ので、undefined になる訳はないんですが、マクロの関係で未定義になってたり、とかなのかなぁ。でも未定義になってたらコンパイルエラーは出てくるはず。
昔これ系でハマッた事があるような気がするんですが、後天性記憶不全。とは言え、出てるソレを見てみた所では上記な形で extern 宣言されてる変数ばかりな模様。

あら?

makefile 見てみたら globals.c が SRC に入っておらんのですがorz
dired 見てみたら

  • globals.c
  • posix.c
  • names.c

がコンパイルされてない。なんたるブービートラップ。

makefile 修正

してリトライ。まだ出る。

Undefined symbols:
  "_cuserid", referenced from:
      _dolock in pklock.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

cuserid って何だろ。
なんか -lcompat 付けて云々な記事があったのでそれに従ってみましたが駄目。libcompat って OSX に無いのだろうか。man 3 cuserid は No entry って言われてしまいます。

てーか

こんな形で呼び出してて戻りもクソも関係無い状態なのでコメントアウトしてやれ。

        cuserid(locker);

で、make 通りました。一応動作もしている模様。

動作確認

  • dired ナシ
  • C-x C-B でバッファのリスト見れる
  • C-g は Key not bound と言われる
  • 通常の key bind なソレは使える模様
  • 軽いのが好きな人は良いかも

で、git diff も貼ろうとしたんですが、微妙に出力がコワレ気味なので略します。それにしても何をしてるんだか的エントリだな。