目 次

目 次
はじめに
第Ⅰ部
リブレソフトウェアとは何か
第1章
持続可能なソフトウェア開発················································································· 23
1.1
なぜソフトウェアの自由が必要なのか ········································································· 24
1.1.1
リブレソフトウェアとは·································································································· 24
(1) 公開型ソフトウェア ·········································································································· 24
(2) リブレソフトウェアの「リブレ」が意味するもの ····················································· 26
1.1.2
リブレソフトウェアの特徴······························································································ 26
(1) 自由を求めるソフトウェア······························································································ 26
1.1.3
世の中にはびこる誤解······································································································ 27
(1) フリー(自由)とフリー(無料) ························································································· 27
(2) ソースが公開されていれば十分か ················································································· 28
(3) フリーソフトウェアと社会主義 ····················································································· 28
1.1.4
誰もが参加できる開発体制······························································································ 29
(1) ソフトウェアの性能向上·································································································· 29
(2) バリエーションの確保······································································································ 29
1.1.5
持続可能な開発体制の実現······························································································ 29
1.2
ソフトウェア科学の発展·································································································· 31
1.2.1
成果の積み重ね ·················································································································· 31
(1) 情報交換の有用性 ·············································································································· 31
(2) 車輪の再発明 ······················································································································ 31
1.2.2
ソフトウェア部品化の幻想? ························································································· 33
(1) ライブラリ化 ······················································································································ 33
(2) 情報公開とライブラリの維持管理 ················································································· 34
7
第2章
フリーソフトウェアとオープンソースソフトウェア·································· 35
2.1
フリーソフトウェア運動·································································································· 36
2.1.1
フリーソフトウェアの概念······························································································ 36
(1) フリーソフトウェアの起源······························································································ 36
(2) Linux との邂逅 ·················································································································· 37
(3) ソフトウェア開発の自由·································································································· 37
2.1.2
コピーレフト ······················································································································ 38
(1) 時代遅れの著作権? ·········································································································· 38
(2) GNU プロジェクトの著作権戦略 ··················································································· 39
2.2
オープンソースソフトウェア ························································································· 40
2.2.1
OSI(Open Source Initiative) ························································································ 40
2.2.2
オープンソースソフトウェアの条件 ············································································· 41
(1) OSD の要点 ························································································································ 42
(2) 配布に関する配慮 ·············································································································· 43
2.2.3
オープンソースの抱える課題 ························································································· 44
(1) 言葉の紛らわしさ ·············································································································· 44
(2) 不利益が曖昧 ······················································································································ 45
2.3
ライセンス ·························································································································· 45
2.3.1
GPL とオープンソースライセンス ················································································ 45
(1) GPL と LGPL ···················································································································· 46
(2) GPL 互換ライセンス ········································································································ 47
(3) オープンソースライセンス······························································································ 47
2.3.2
ライセンスをめぐる問題·································································································· 48
(1) ライセンスの有効性 ·········································································································· 48
(2) 特許と著作権,その他の知的財産権 ············································································· 49
第3章
リブレソフトウェアを取り巻く現状 ·································································· 51
3.1
リブレソフトウェア・ビジネス ····················································································· 52
3.1.1
ビジネスモデル ·················································································································· 52
(1) リブレソフトウェア OS のディストリビューション ················································· 52
(2) 商用ソフトウェアとの組み合わせ ················································································· 53
(3) カスタマイズサービスやシステムインテグレーション ············································· 53
8
(4) サポート,教育,出版等·································································································· 54
3.2
電子政府とリブレソフトウェア ····················································································· 55
3.2.1
公共投資としてのリブレソフトウェア ········································································· 55
(1) ベンダ・ロックインの阻止······························································································ 55
3.2.2
世界の動向 ·························································································································· 56
(1) 欧米諸国の動き ·················································································································· 56
(2) 中南米,アフリカ ·············································································································· 58
(3) アジア各国の動向 ·············································································································· 59
3.2.3
日本における取り組み状況······························································································ 60
(1) 日本政府の考えるリブレソフトウェア ········································································· 60
(2) 産総研オープンソースデスクトップ導入実証実験 ····················································· 61
(3) 情報処理推進機構の取り組み ························································································· 61
(4) 自治体の動向 ······················································································································ 62
3.3
開発者コミュニティ ·········································································································· 63
3.3.1
リブレソフトウェア関連団体 ························································································· 64
(1) FSIJ,オープンソースグループ・ジャパン ································································ 64
(2) OSDN と OSDL ················································································································ 65
(3) 日本 Linux 協会 ················································································································· 65
3.3.2
様々なユーザ会 ·················································································································· 66
(1) アプリケーションのユーザ会 ························································································· 66
(2) 地域 LUG ···························································································································· 67
3.3.3
リブレソフトウェア支援企業 ························································································· 68
(1) OSCAR アライアンス ······································································································ 69
3.4
開発者の実態 ······················································································································ 70
3.4.1
FLOSS 調査 ······················································································································· 70
(1) 類似の調査 ·························································································································· 71
(2) 日本版 FLOSS ··················································································································· 71
9
第Ⅱ部
リブレソフトウェアの基礎
第4章
デスクトップでの利用······························································································· 75
4.1
リブレソフトウェアの利用価値 ····················································································· 76
4.1.1
サーバ用途からクライアント用途へ ············································································· 76
4.1.2
効率的な業務遂行と高品質なアウトプット ································································· 77
(1) 論理的な操作環境 ·············································································································· 77
4.2
OS の導入と環境構築 ······································································································· 79
4.2.1
プラットフォームの選択·································································································· 79
(1) Linux と FreeBSD ············································································································ 79
(2) ディストリビューション·································································································· 80
4.2.2
Linux OS のインストール ······························································································· 81
(1) 事前の情報収集 ·················································································································· 81
4.3
アプリケーションの追加·································································································· 82
4.3.1
アプリケーションの入手·································································································· 82
(1) アプリケーションのパッケージング ············································································· 83
(2) バイナリパッケージとソースパッケージ ····································································· 83
(3) インストール作業の例······································································································ 84
4.3.2
設定のヒント ······················································································································ 85
4.4
Linux の基礎(1) −システムの操作− ········································································· 86
4.4.1
起動と停止 ·························································································································· 86
(1) 電源を入れる ······················································································································ 87
(2) ブートローダ ······················································································································ 87
(3) ログインとログアウト······································································································ 87
(4) システム停止の手順 ·········································································································· 88
4.4.2
ログインパスワード ·········································································································· 89
(1) 良いパスワードと悪いパスワード ················································································· 89
(2) パスワードの変更 ·············································································································· 90
4.4.3
マルチユーザ・マルチタスク ························································································· 90
(1) シングルタスクとマルチタスク ····················································································· 90
(2) マルチユーザ環境 ·············································································································· 91
4.4.4
スーパユーザ,root の権限 ····························································································· 92
(1) スーパユーザ ······················································································································ 92
10
(2) 安全性 ·································································································································· 92
4.5
Linux の基礎(2) −ファイルシステム− ····································································· 93
4.5.1
ファイルとディレクトリ·································································································· 93
(1) ファイルシステム ·············································································································· 93
(2) ホームディレクトリとカレントディレクトリ ····························································· 94
4.5.2
ドライブのマウント ·········································································································· 94
(1) マウントという考え方······································································································ 94
4.5.3
パス ······································································································································ 95
(1) パスの表記 ·························································································································· 96
(2) 絶対パスと相対パス ·········································································································· 96
(3) リンク ·································································································································· 97
4.5.4
ユーザとグループ ·············································································································· 97
(1) ユーザ ID(UID)とグループ ID(GID) ·········································································· 97
(2) /etc/group ···························································································································· 98
4.5.5
ファイルのアクセス権······································································································ 98
(1) アクセス権の確認と変更·································································································· 99
第5章
端末エミュレータとシェル ··················································································· 101
5.1
端末エミュレータ ············································································································ 102
5.1.1
X Window System ·········································································································· 102
5.1.2
DOS プロンプトと端末エミュレータ·········································································· 103
(1) 端末エミュレータによるマルチタスク ······································································· 103
5.1.3
様々な実装 ························································································································ 104
(1) xterm と kterm················································································································ 104
5.2
シェル ································································································································ 105
5.2.1
シェルによる対話的操作································································································ 105
(1) カーネルとシェル ············································································································ 105
(2) CUI による操作 ··············································································································· 105
(3) ログインシェル ················································································································ 106
(4) 対話的操作とシェルスクリプト ··················································································· 106
5.2.2
シェルの機能 ···················································································································· 107
(1) エイリアス ························································································································ 107
11
(2) ヒストリーとコマンドライン編集 ··············································································· 107
(3) メタキャラクタ ················································································································ 108
5.2.3
ジョブ制御 ························································································································ 108
(1) プログラムの起動と終了,一時停止 ··········································································· 109
(2) 並列実行と逐次実行 ········································································································ 109
(3) ジョブとプロセスの一覧································································································ 110
(4) シグナル ···························································································································· 111
5.2.4
シェル変数,環境変数···································································································· 112
(1) シェル変数と環境変数···································································································· 112
(2) どのプログラムを起動するか ······················································································· 113
(3) 作業環境のカスタマイズ································································································ 114
5.3
ファイルの取り扱い ········································································································ 115
5.3.1
ファイル操作のコマンド································································································ 115
(1) ファイルの移動,削除,コピー ··················································································· 115
(2) ディレクトリの作成と削除···························································································· 116
(3) cat とページャ(more,less) ························································································· 116
5.3.2
標準入出力とエラー出力································································································ 117
(1) コマンドの入出力 ············································································································ 118
(2) 標準入力,標準出力 ········································································································ 119
(3) エラー出力先の分類(標準エラー出力) ······································································· 119
5.3.3
リダイレクトとパイプ···································································································· 120
(1) 入出力リダイレクト ········································································································ 120
(2) エラー出力のリダイレクト···························································································· 121
(3) パイプ ································································································································ 121
5.4
シェルスクリプト ············································································································ 122
5.4.1
プログラミング実行環境································································································ 122
(1) RAD ツールとしての利用法·························································································· 122
5.4.2
シェルスクリプトの実行································································································ 123
(1) シェルの指定 ···················································································································· 123
5.4.3
シェルスクリプトの例···································································································· 124
(1) 起動スクリプト ················································································································ 124
(2) 自動実行(cron,at) ········································································································ 125
12
(3) CGI スクリプト ··············································································································· 126
13
第Ⅲ部
リブレソフトウェア・アプリケーション
第6章
エディタ ························································································································· 129
6.1
エディタとワープロ ········································································································ 130
6.1.1
エディタとは ···················································································································· 130
(1) アンチ WYSIWYG 主義 ································································································· 131
6.2
vi ········································································································································· 132
6.2.1
vi の概要···························································································································· 132
(1) vi の概念···························································································································· 132
(2) vi が好まれる理由 ··········································································································· 133
(3) vi の起動と終了 ··············································································································· 133
6.2.2
文字の入力と訂正 ············································································································ 134
(1) カーソルの移動 ················································································································ 134
(2) モードの移行 ···················································································································· 135
(3) 編集操作 ···························································································································· 136
6.2.3
ファイル操作,検索,その他の使い方 ······································································· 137
(1) ファイルの読み込みと保存···························································································· 137
(2) 文字列の検索 ···················································································································· 138
(3) いろいろな機能 ················································································································ 138
6.3
GNU Emacs ····················································································································· 139
6.3.1
Emacs の概要··················································································································· 139
(1) Emacs の概念··················································································································· 140
(2) Emacs の起動と終了 ······································································································ 141
(3) GUI 版の Emacs,CUI 版の Emacs ··········································································· 142
6.3.2
文章編集の操作 ················································································································ 142
(1) カーソルの移動 ················································································································ 143
(2) 編集操作 ···························································································································· 143
(3) マークとリージョン ········································································································ 144
6.3.3
ファイル操作 ···················································································································· 145
(1) ファイルとバッファ ········································································································ 145
(2) ファイルに対する細かな気配り ··················································································· 146
(3) 画面の分割,フレームの操作 ······················································································· 147
6.3.4
14
検索,その他の使い方,Emacs の拡張 ······································································ 148
(1) インクリメンタルサーチ································································································ 148
(2) 操作の取り消し ················································································································ 149
(3) 環境設定,コマンドの定義···························································································· 149
第7章
インターネット・アクセス ··················································································· 151
7.1
Web ブラウザ ··················································································································· 152
7.1.1
ブラウザ戦争 ···················································································································· 152
(1) 夜明け前 ···························································································································· 153
(2) NCSA Mosaic ·················································································································· 153
(3) Netscape 対 Explorer····································································································· 154
7.1.2
リブレソフトウェアによる Web ブラウザ ································································· 154
(1) Mozilla ······························································································································ 155
(2) Konqueror と Galeon ····································································································· 156
7.1.3
テキストベース・ブラウザ···························································································· 157
(1) w3m と lynx ····················································································································· 157
7.1.4
ダウンローダとコピーツール ······················································································· 158
(1) wget ··································································································································· 159
(2) ミラーリング ···················································································································· 160
7.2
メールクライアント ········································································································ 161
7.2.1
Sylpheed ··························································································································· 161
(1) Sylpheed の特徴 ·············································································································· 162
7.2.2
Emacs で動作するメールクライアント ······································································ 163
(1) エディタとメールクライアントとの親和性 ······························································· 163
(2) Mew ··································································································································· 163
7.2.3
その他のメールクライアント ······················································································· 164
(1) 端末からのメール送受信································································································ 164
(2) 様々なメールクライアント···························································································· 166
7.2.4
メールの検索 ···················································································································· 167
第8章
文書作成 ························································································································· 169
8.1
LATEX·································································································································· 170
8.1.1
組版ソフトウェア ············································································································ 170
15
(1) 組版のココロ ···················································································································· 170
(2) 文書構造の明確化 ············································································································ 172
(3) DTP と組版ソフトウェア ······························································································ 172
(4) WYSI'N'WYG ·················································································································· 172
8.1.2
8.1.3
TEXと LATEX····················································································································· 173
組版から印刷まで ············································································································ 174
(1) LATEXソースの編集········································································································· 174
(2) コンパイルとチェック···································································································· 175
(3) PS ファイル,PDF ファイルへの変換と印刷···························································· 176
8.1.4
LATEXの活用 ····················································································································· 177
(1) スタイルファイル ············································································································ 177
(2) 数式の表現 ························································································································ 177
8.2
図版の作成 ························································································································ 178
8.2.1
お絵書きツールと画像処理ツール ··············································································· 178
(1) Tgif····································································································································· 178
(2) GIMP ································································································································· 179
(3)
8.2.2
画像ツール························································································································ 180
グラフの作成 ···················································································································· 181
(1) Gnuplot ····························································································································· 181
8.2.3
画像データ ························································································································ 182
(1) 画面のスナップショット································································································ 183
(2) フォーマットの変換 ········································································································ 183
(3) 文書へ挿入する ················································································································ 184
第9章
データ処理,その他のツール··············································································· 187
9.1
スクリプト言語 ················································································································ 188
9.1.1
お手軽プログラミング···································································································· 188
(1) ストリームエディタ ········································································································ 189
(2) Perl ···································································································································· 189
(3) Python と Ruby ··············································································································· 190
9.1.2
テキスト処理 ···················································································································· 190
(1) テキスト処理用コマンド································································································ 191
16
(2) テキスト処理スクリプトの例 ······················································································· 191
9.2
様々なアプリケーション································································································ 193
9.2.1
マルチメディアとグラフィクス ··················································································· 193
(1) 動画プレーヤ ···················································································································· 193
(2) 3D グラフィクス ············································································································· 194
9.2.2
小さなツール ···················································································································· 195
(1) カレンダと時計 ················································································································ 195
(2) 計算機 ································································································································ 196
9.3
足りないものは何? ········································································································ 198
9.3.1
デスクトップ環境 ············································································································ 198
(1) ポイントアンドクリック································································································ 199
9.3.2
相互運用性 ························································································································ 200
(1) Windows との連携 ·········································································································· 200
(2) オフィススイート ············································································································ 201
9.3.3
デスクトップ利用における課題 ··················································································· 202
(1) 仮名漢字変換 ···················································································································· 202
(2) 印刷環境 ···························································································································· 203
(3) 自由なフォント ················································································································ 204
第Ⅳ部
ソフトウェア開発の自由
第 10 章 すべてはソースコード ·························································································· 209
10.1
ソースコードの重要性···································································································· 210
10.1.1 原点回帰:ソフトウェアの自由 ··················································································· 210
(1) ソースコード重要性の再認識 ······················································································· 211
10.2
ソースパッケージの入手································································································ 212
10.2.1 ソースコードのパッケージング ··················································································· 212
(1) ソースパッケージの構成要素 ······················································································· 212
(2) パッケージ形式 ················································································································ 213
10.2.2 ソースコードを探す ········································································································ 214
10.3
ビルドとインストール···································································································· 215
10.3.1 ソフトウェアのビルド手順···························································································· 215
(1) パッケージの展開 ············································································································ 215
17
(2) ./configure と make ········································································································ 217
(3) システムへのインストールと環境設定 ······································································· 218
第 11 章 デバッグと改良 ········································································································ 221
11.1
バグの追求 ························································································································ 222
11.1.1 デバッグ手法 ···················································································································· 222
(1) デバッグライト ················································································································ 222
(2) デバッガとデバッグツール···························································································· 223
(3) ソースコードデバッガの利用 ······················································································· 224
11.1.2 問題箇所の特定 ················································································································ 224
(1) エラーメッセージ ············································································································ 224
(2) デバッグコード ················································································································ 225
(3) ブレークポイント ············································································································ 226
11.2
diff と patch ····················································································································· 227
11.2.1 オリジナルとの差分 ········································································································ 228
(1) diff の活用 ························································································································· 228
11.2.2 差分とパッチ ···················································································································· 229
(1) パッチの適用 ···················································································································· 229
(2) パッチのコンフリクト···································································································· 230
11.2.3 修正報告 ···························································································································· 230
(1) パッチ送付はボランティアにあらず ··········································································· 231
11.3
事例研究:アプリケーションの問題追跡 ··································································· 232
11.3.1 gscanbus ··························································································································· 232
11.3.2 不具合の発見と修正 ········································································································ 233
(1) 認識されない? ················································································································ 233
(2) ソースコードの追跡 ········································································································ 234
(3) デバッグ作業 ···················································································································· 236
(4) パッチの作成 ···················································································································· 237
第 12 章 リブレソフトウェア流の開発スタイル ························································· 239
12.1
モジュラリティ ················································································································ 240
12.1.1 機能の分割 ························································································································ 240
12.1.2 モジュールのサイズとインタフェース ······································································· 240
18
(1) 合言葉は KISS ················································································································· 241
(2) UNIX の考え方 ················································································································ 241
12.1.3 モジュールの階層化 ········································································································ 242
12.1.4 単体テスト・結合テスト································································································ 243
(1) テスト駆動開発 ················································································································ 243
(2) TDD のメリット ·············································································································· 244
12.2
分散開発の準備 ················································································································ 245
12.2.1 モジュールごとの分担開発···························································································· 245
(1) ファイル分割とヘッダファイル ··················································································· 245
(2) 分割コンパイル ················································································································ 248
(3) Makefile ···························································································································· 249
12.2.2 移植性の確保 ···················································································································· 250
(1) make から automake へ ································································································ 251
12.2.3 標準的開発方法の意義···································································································· 252
12.3
分散開発体制,ネットを介した共同作業の実現 ······················································· 253
12.3.1 共同開発のためのツール································································································ 253
(1) CVS ···································································································································· 254
(2) CVS を使った並行作業 ·································································································· 255
(3) リビジョン管理システム利用のポイント ··································································· 255
12.3.2 情報共有のためのルール································································································ 256
(1) コーディング規約 ············································································································ 256
(2) ソースコードのコメント文···························································································· 257
(3) コードとドキュメントの連携 ······················································································· 257
12.3.3 コミュニケーションの重要性 ······················································································· 258
(1) コミュニケーション・ツール ······················································································· 259
12.3.4 対外アピール ···················································································································· 259
(1) オンライン・コミュニケーション ··············································································· 260
(2) オフライン・コミュニケーション ··············································································· 261
参考文献············································································································································ 263
索
引 ··············································································································································· 269
19