% % This is part of CLFSja package. % % This is a CTIE change file for the original XML source of the CLFSbook. % @x @y @z @x Setting Up the Environment @y 環境設定 @z @x Set up a good working environment by creating two new startup files for the bash shell. While logged in as user clfs, issue the following command to create a new .bash_profile: @y 作業しやすい動作環境とするために bash シェルに対するスタートアップファイルを二つ作成します。 clfs ユーザーでログインして、以下のコマンドによって .bash_profile ファイルを生成します。 @z @x When logged on as user clfs, the initial shell is usually a login shell which reads the /etc/profile of the host (probably containing some settings and environment variables) and then .bash_profile. The exec env -i.../bin/bash command in the .bash_profile file replaces the running shell with a new one with a completely empty environment, except for the HOME, TERM, and PS1 variables. This ensures that no unwanted and potentially hazardous environment variables from the host system leak into the build environment. The technique used here achieves the goal of ensuring a clean environment. @y clfs ユーザーとしてログインした時、起動されるシェルは普通はログイン シェルとなります。 この時、ホストシステムの /etc/profile ファイル (おそらく環境変数がいくつか定義されている) と .bash_profile が読み込まれます。 .bash_profile ファイル内の exec env -i.../bin/bash というコマンドが、起動しているシェルを全くの空の環境として起動し直し HOMETERMPS1 という環境変数だけを設定します。 これはホストシステム内の不要な設定や危険をはらんだ設定を、ビルド環境に持ち込まないようにするためです。 このようにすることできれいな環境作りを実現できます。 @z @x The new instance of the shell is a non-login shell, which does not read the /etc/profile or .bash_profile files, but rather reads the .bashrc file instead. Create the .bashrc file now: @y 新しく起動するシェルはログインシェルではなくなります。 したがってこのシェルは /etc/profile ファイルや .bash_profile ファイルは読み込まず、代わりに .bashrc ファイルを読み込みます。 そこで以下のようにして .bashrc ファイルを生成します。 @z @x The set +h command turns off bash's hash function. Hashing is ordinarily a useful feature—bash uses a hash table to remember the full path of executable files to avoid searching the PATH time and again to find the same executable. However, the new tools should be used as soon as they are installed. By switching off the hash function, the shell will always search the PATH when a program is to be run. As such, the shell will find the newly compiled tools in /cross-tools as soon as they are available without remembering a previous version of the same program in a different location. @y set +h コマンドは bash のハッシュ機能を無効にします。 通常このハッシュ機能は有用なものです。 実行ファイルのフルパスをハッシュテーブルに記憶しておき、再度そのパスを探し出す際に PATH 変数の探査を省略します。 しかしこれより作り出すツール類はインストール直後にすぐ利用していきます。 ハッシュ機能を無効にすることで、プログラム実行が行われる際に、シェルは必ず PATH を探しにいきます。 つまり /cross-tools ディレクトリ以下に新たに構築したツール類は必ず実行されるようになるわけです。 そのツールの古いバージョンがどこか別のディレクトリにあったとしても、その場所を覚えていて実行されるということがなくなります。 @z @x Setting the user file-creation mask (umask) to 022 ensures that newly created files and directories are only writable by their owner, but are readable and executable by anyone (assuming default modes are used by the open(2) system call, new files will end up with permission mode 644 and directories with mode 755). @y ユーザーのファイル生成マスク (file-creation mask; umask) を 022 にセットするのは、新たなファイルやディレクトリの生成はその所有者にのみ許可し、他者は読み取りと実行を可能とするためです。 (システムコール open(2) にてデフォルトモードが適用される場合、新規生成ファイルのパーミッションモードは 644、同じくディレクトリは 755 となります。) @z @x The CLFS variable should be set to the chosen mount point. @y 環境変数 CLFS は常に指定したマウントポイントを指し示すように設定します。 @z @x The LC_ALL variable controls the localization of certain programs, making their messages follow the conventions of a specified country. Setting LC_ALL to POSIX or C (the two are equivalent) ensures that everything will work as expected in the temporary build environment. @y LC_ALL 変数は特定のプログラムが扱う国情報を制御します。 そのプログラムが出力するメッセージを、指定された国情報に基づいて構成します。 LC_ALL 変数はPOSIXCにセットしてください。(両者は同じです。) そのようにセットしておけば一時ビルド環境下での作業が問題なく進められます。 @z @x By putting /cross-tools/bin at the beginning of the PATH, the cross-compiler built in will be picked up by the build process for the temp-system packages before anything that may be installed on the host. This, combined with turning off hashing, helps to ensure that you will be using the cross-compile tools to build the temp-system in /tools. @y /cross-tools/bin ディレクトリを PATH 変数の先頭に設定します。 こうすることで一時システムにおける各パッケージのビルド時には において構築するクロスコンパイラーが利用されることになります。 つまりホストシステム内にあるコンパイラーが用いられないようにします。 この設定は、ハッシュ機能をオフとしたことと連携し、クロスコンパイルツールを用いて /tools ディレクトリ内に一時システムを構築していくものとなります。 @z @x The CFLAGS, CXXFLAGS and PKG_CONFIG_PATH variables should not be set while building the temporary system, so we unset them. @y CFLAGSCXXFLAGSPKG_CONFIG_PATH の各変数は、一時システムの構築時には設定すべきではありません。 そこでそれらは非設定とします。 @z @x Finally, to have the environment fully prepared for building the temporary tools, source the just-created user profile: @y 一時的なツールを構築する準備の最後として、今作り出したユーザープロファイルを source によって取り込みます。 @z