07aa820b774a6a4cdb270cb5fec2bb5663363fae
[YACASL2.git] / doc / install.texi
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @ifnottex
4 @documentlanguage ja_JP
5 @end ifnottex
6 @setfilename yacasl2_install
7 @documentencoding UTF-8
8 @settitle YACASL2のインストール
9 @firstparagraphindent insert
10 @paragraphindent 1
11 @ifhtml
12 @exampleindent 0
13 @end ifhtml
14 @c %**end of header
15
16 @copying
17 Copyright @copyright{} 2010-2012 j8takagi
18 @end copying
19
20 @titlepage
21 @title YACASL2のインストール
22 @author j8takagi
23 @insertcopying
24 @end titlepage
25
26 @node Top, Require, (dir), (dir)
27
28 @menu
29 * Require::       要件
30 * Download::      YACASL2ファイルのダウンロード
31 * Verify::        YACASL2ファイルの検証
32 * Expand::        YACASL2ファイルの展開
33 * Build::         @file{casl2} @file{comet2} @file{dumpword}のビルド
34 * Simple Test::   @file{casl2}の実行テスト
35 * Detail Test::   詳細なテスト
36 * Environment::   環境変数の設定
37 @end menu
38
39 @contents
40
41 @node Require, Download, Top, Top
42 @chapter 要件
43
44 YACASL2は、LinuxやMac OS Xなど、UNIX系のOS上で動作します。現在動作を確認しているのは、Ubuntu LinuxとVine Linux、Mac OS Xです。
45
46 インストール時に、@command{tar} @command{gcc} @command{make}が必要です。Linuxでは多くの場合、標準でインストールされています。Mac OS Xの場合、Xcodeの「Command Line Tools」に含まれます。
47
48 @node Download, Verify, Require, Top
49 @chapter YACASL2ファイルのダウンロード
50
51 @uref{http://www.j8takagi.net/yacasl2/, YACASL2のサイト}から、@file{tar.gz}または@file{tar.xz}ファイルと、対応する検証用ファイルをダウンロードします。@uref{http://github.com/j8takagi/YACASL2/downloads/, githubのダウンロードページ}から@file{tar.gz}などのファイルをダウンロードすることもできます。
52
53 @node Verify, Expand, Download, Top
54 @chapter YACASL2ファイルの検証
55
56 ダウンロードが完了したら、圧縮ファイルが改竄されていないか検証します。検証にはGnuPG分離署名か、MD5ハッシュ値を使います。
57
58 @section GnuPG分離署名での検証
59
60 GnuPGの@command{gpg}で圧縮ファイルを検証します。この検証を行うには、GnuPGがインストールされ、自分の秘密鍵と公開鍵のペアが作成されている必要があります。
61
62 @example
63 $ @kbd{gpg --verify yacasl2.tar.xz.asc}
64 gpg: Signature made Sat Oct 27 02:17:16 2012 JST using RSA key ID 25B62DD1
65 gpg: Can't check signature: public key not found
66 $ @kbd{gpg --recv-keys 25B62DD1}
67 gpg: requesting key 25B62DD1 from hkp server keys.gnupg.net
68 gpg: key 25B62DD1: public key "j8takagi <j8takagi@@nifty.com>" imported
69 gpg: Total number processed: 1
70 gpg:               imported: 1  (RSA: 1)
71
72 $ @kbd{gpg --lsign-key 25B62DD1}
73
74 pub  2048R/25B62DD1  created: 2012-09-29  expires: never       usage: SC
75                      trust: unknown       validity: full
76 sub  2048R/92E25C29  created: 2012-09-29  expires: never       usage: E
77 [  full  ] (1). j8takagi <j8takagi@@nifty.com>
78
79
80 pub  2048R/25B62DD1  created: 2012-09-29  expires: never       usage: SC
81                      trust: unknown       validity: full
82  Primary key fingerprint: ...
83  
84      .* <.*@@.*>
85
86 Are you sure that you want to sign this key with your
87 key ".* <.*@@.*>"
88
89 The signature will be marked as non-exportable.
90
91 Really sign? (y/N) @kbd{y}
92
93 You need a passphrase to unlock the secret key for
94 user: ".* <.*@@.*>"
95 2048-bit RSA key, ID ........, created 20..-..-..
96
97 <input password> @kbd{password}
98
99 $ @kbd{gpg --verify yacasl2.tar.xz.asc}
100 gpg: Signature made Sat Oct 27 02:17:16 2012 JST using RSA key ID 25B62DD1
101 gpg: checking the trustdb
102 gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
103 gpg: depth: 0  valid:   1  signed:   4  trust: 0-, 0q, 0n, 0m, 0f, 1u
104 gpg: depth: 1  valid:   4  signed:   0  trust: 4-, 0q, 0n, 0m, 0f, 0u
105 gpg: Good signature from "j8takagi <j8takagi@@nifty.com>"
106 @end example
107
108 @section MD5ハッシュ値での検証
109
110 @command{openssl}と@command{diff}で圧縮ファイルを検証します。
111
112 @example
113 $ @kbd{openssl md5 yacasl2.tar.gz | diff -s yacasl2.tar.gz.md5sum -}
114 Files yacasl2.tar.gz.md5sum and - are identical
115 @end example
116
117 @node Expand, Build, Verify, Top
118 @chapter YACASL2ファイルの展開
119
120 YACASL2ファイルをダウンロードしたら、@command{tar}コマンドで展開します。
121
122 @example
123 $ @kbd{tar xvzf yacasl2.tar.gz}
124 @end example
125
126 @node Build, Simple Test, Expand, Top
127 @chapter @file{casl2} @file{comet2} @file{dumpword}のビルド
128
129 展開したら、@command{make}コマンドで@file{casl2} @file{comet2} @file{dumpword}をビルドします。
130
131 @example
132 $ @kbd{cd yacasl2}
133 $ @kbd{make}
134 make -C src
135 make[1]: Entering directory ‘/home/kazubito/yacasl2/src’
136 gcc -c -g -Wall -I ../include casl2.c
137 gcc -c -g -Wall -I ../include word.c
138 gcc -c -g -Wall -I ../include hash.c
139 gcc -c -g -Wall -I ../include cerr.c
140 gcc -c -g -Wall -I ../include struct.c
141 gcc -c -g -Wall -I ../include cmd.c
142 gcc -c -g -Wall -I ../include assemble.c
143 gcc -c -g -Wall -I ../include token.c
144 gcc -c -g -Wall -I ../include label.c
145 gcc -c -g -Wall -I ../include macro.c
146 gcc -c -g -Wall -I ../include exec.c
147 gcc -c -g -Wall -I ../include dump.c
148 gcc -g -Wall -I ../include -o ../casl2 casl2.o word.o hash.o cerr.o st
149 ruct.o cmd.o assemble.o token.o label.o macro.o exec.o dump.o
150 gcc -c -g -Wall -I ../include comet2.c
151 gcc -g -Wall -I ../include -o ../comet2 comet2.o word.o hash.o cerr.o
152 struct.o cmd.o exec.o dump.o
153 gcc -c -g -Wall -I ../include dumpword.c
154 gcc -g -Wall -I ../include -o ../dumpword dumpword.o word.o cerr.o
155 make[1]: Leaving directory ‘/home/kazubito/yacasl2/src’
156 @end example
157
158 @node Simple Test, Detail Test, Build, Top
159 @chapter @file{casl2}の実行テスト
160
161 ビルドしたら、次のコマンドが正常に実行できるかを確認します。
162 正常に実行された場合は、「Hello, World!」と表示されます。
163
164 @example
165 $ @kbd{./casl2 as/hello.casl}
166 Hello, World!
167 @end example
168
169 @node Detail Test, Environment, Simple Test, Top
170 @chapter 詳細なテスト
171
172 次のコマンドを実行すると、正常にビルドできているかどうかを詳細にテストできます。
173
174 @example
175 $ @kbd{make check}
176 195 / 195 tests passed. Details in /home/username/yacasl2/test/integra
177 tion/casl2/Test.log
178 All tests are succeded.
179 149 / 149 tests passed. Details in /home/username/yacasl2/test/integra
180 tion/comet2/Test.log
181 All tests are succeded.
182 4 / 4 tests passed. Details in /home/username/yacasl2/test/integration
183 /dumpword/Test.log
184 All tests are succeded.
185 @end example
186
187 @node Environment,  , Detail Test, Top
188 @chapter 環境変数の設定
189
190 環境変数@code{PATH}や@code{CASL2LIB}を設定することで、YACASL2が使いやすくなります。環境変数は、使っているシェルを確認してから設定します。
191
192 @section シェルの確認
193
194 環境変数の設定方法は使っているシェルによって異なります。シェルは、次のコマンドで確認できます。
195
196 @example
197 $ @kbd{echo $SHELL}
198 /bin/bash
199 @end example
200
201 現在もっとも多く使われているシェルは、BASHでしょう。以下、BASHでの設定方法を説明します。
202
203 @section @code{PATH}にYACASL2のディレクトリを追加
204
205 @code{PATH}にYACASL2実行ファイルをインストールしたディレクトリを追加すると、ディレクトリの指定を省略して@command{casl2} @command{comet2} @command{dumpword}を実行できます。例えば、実行ファイルを@file{~/bin}にインストールしたときは、次のコマンドで設定できます。
206
207 @example
208 $ @kbd{PATH=$PATH:~/bin && export PATH}
209 @end example
210
211 環境変数の設定は、シェルの初期設定ファイルに追加することでログインしたあと自動的に反映されるようになります。BASHではホームディレクトリにある@file{.bashrc}が初期設定ファイルです。次のコマンドで追加できます。
212
213 @example
214 $ @kbd{echo ’PATH=$PATH:~/bin && export PATH’ >>~/.bashrc}
215 @end example
216
217
218 @section @code{CASL2LIB}の設定
219
220 環境変数@code{CASL2LIB}を設定しておけば、CASL IIプログラム作成時に共通ライブラリを呼び出す手間が小さくなります。例えば、CASL2LIBを@code{~/yacasl2/casl2lib}にインストールしたときは、次のコマンドで設定できます。
221
222 @example
223 $ @kbd{CASL2LIB=~/yacasl2/casl2lib && export CASL2LIB}
224 @end example
225
226 BASHの初期設定ファイル@file{.bashrc}には、次のコマンドで追加できます。
227
228 @example
229 $ @kbd{ echo 'CASL2LIB=~/yacasl2/casl2lib && export CASL2LIB' >>~/.bashrc}
230 @end example
231
232 @bye