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