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