Skip to content

Instantly share code, notes, and snippets.

@y2q-actionman
Last active July 23, 2018 03:43
Show Gist options
  • Save y2q-actionman/47394595f5091a2b7e55dc284575ae4f to your computer and use it in GitHub Desktop.
Save y2q-actionman/47394595f5091a2b7e55dc284575ae4f to your computer and use it in GitHub Desktop.
jnethack 3.6.0 0.8 compile
https://nethackwiki.com/wiki/Status_hilites
https://osdn.net/projects/jnethack/news/25783
# iconv
https://qiita.com/tatsumack/items/9f1ae8dee4dbb33b7406
--- nethack-3.6.1/circle.yml 1970-01-01 09:00:00.000000000 +0900
+++ jnethack/source/circle.yml 2016-02-14 04:06:09.061085100 +0900
@@ -0,0 +1,10 @@
+dependencies:
+ pre:
+ - sudo apt-get update; sudo apt-get install nkf
+
+test:
+ pre:
+ - find . -type f |xargs nkf -e --overwrite
+ - sh sys/unix/setup.sh sys/unix/hints/linux
+ override:
+ - make install

完全にこれにのっとる http://blog.livedoor.jp/tek_nishi/archives/9557915.html

Linux だとこれもあるが http://nethack-users.osdn.jp/jnethack/JNH36001BuildLinux.txt

package

brew install gcc

Mac では GCCclang の alias で、 input-charset などのオプションが使えないので必要。

brew install moreutils

“iconvではファイルを上書きできないので、代行するツールをゲット” と元ページにある。それは `sponge` だそうだ。 nkf なら上書きできると思うけど、まあいいや

get source

https://osdn.net/projects/jnethack/ から、以下を拾う。

  • nethack-360-src.tgz
  • jnethack-3.6.0-0.8.diff.gz

3.6.0-0.9 以降は、 iconv への依存がある。 gcc-8 でコンパイルすると、 iconv とのリンクになぜか失敗してしまう。 面倒そうだったので中断。

apply patch

gzcat ../jnethack-3.6.0-0.8.diff.gz | patch -p1
find . -type f -name '*.c' -o -name '*.h' | xargs -I{} sh -c 'iconv -f cp932 -t utf-8 {} | sponge {}'

sys/unix/hints/macosx10.10 を修正

CC=gcc-8
CFLAGS+= -fexec-charset=CP932

こんな設定が必要な理由:

  • jnethack は exec-charset=cp932 (もしくは euc-jp?) を要求。
  • jnechack の diff も CP932
  • しかし、 Availability.h というファイルはUTF-8 (元ページにある)

なので、全部 UTF-8 にしてから、 exec-charset=cp932 にするようコンパイルしている。(すごい)

build

sh sys/unix/setup.sh sys/unix/hints/macosx10.10
make
make install

make install により、 ~/bin/jnethack が作成される。

Shift-jis プロファイルの端末で起動すればOK.

OPTION MENUCOLOR

バイナリのexec-charsetと合っている必要がある。 例えば、以下を .nethackrc に書き、Shift-JIS で保存すると通った。

MENUCOLOR=" 呪われていない"=yellow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment