For Development HEAD DRAFTSearch (procedure/syntax/module):

3.7 補助プログラム

Gaucheをインストールすると、Gaucheでの開発に役立ついくつかの補助プログラムも インストールされます。

gauche-config

インストールされたGaucheのコンフィグレーションパラメータを問い合わせるプログラムです。

gauche-package

拡張パッケージマネージャ。拡張パッケージをインストールし、またインストールされた 拡張の設定を問い合わせることができます。 自分で新たな拡張を書く際にも使えます。

gauche-install

installプログラムの代替。Gauche拡張モジュールは、システムのinstall コマンドのかわりにこのプログラムを使えば、プラットフォームごとの細かい違いを 気にする必要がなくなります。

gauche-compile-r7rs

このプログラムはGaucheスクリプトから実行可能バイナリを作るのに使えます。

gauche-cesconv

さらに、Gaucheのconfigure時に--enable-shared-commandsを渡すと、 以下のプログラムも追加でインストールされます。

scheme-r7rs
scheme-srfi-0
scheme-srfi-7

これらはSRFI-22で推奨されているSchemeインタプリタの標準名です。 goshへのシンボリックリンクになります。 

compile-r7rs

これはSRFI-138で推奨されているSchemeコンパイラ名です。 gauche-compile-r7rsへのシンボリックリンクになります。

これらの名前はScheme界で共通のため、他のScheme処理系が同じ名前のプログラムを既に インストールしているかもしれないことに留意してください。


3.7.1 gauche-config - 設定を問い合わせる

Program: gauche-config [option]

オプションを与えずに起動すると使い方を表示します。 オプションを与えると、configure時にそのオプションに結び付けられた文字列を 表示します。

いくつか例を示します。実際に表示される文字列はプラットフォームによって異なります。

  • 実行アーキテクチャの表示:
    $ gauche-config --arch
    x86_64-pc-linux-gnu
    
  • Gaucheをリンクするプログラムをビルドする際に必要なライブラリフラグ:
    $ gauche-config -l
    -lgauche-0.98 -lmbedtls -lcrypt -lrt -lm  -lpthread
    
  • Gauche拡張をコンパイルする際に必要なインクルードパスフラグ:
    $ gauche-config -I
    -I/usr/lib/gauche-0.98/0.9.15/include
    

コマンドは以下のコマンドライン引数を取ります。ひとつだけ指定できます。

一般のパラメータ:

-V

現在のGaucheのバージョン

Gaucheを使ったアプリケーションのコンパイルのためのパラメータ:

-I

Gaucheを使ったプログラムをコンパイルするのに必要なインクルードパスオプション (Gaucheのインストール先のパスが空白を含んでいる場合、これは 使えません。下の–incdirsを見てください。)

-L

Gaucheを使ったプログラムをコンパイルするのに必要なライブラリパスオプション (Gaucheのインストール先のパスが空白を含んでいる場合、これは 使えません。下の–incdirsを見てください。)

-l

Gaucheを使ったプログラムをリンクする時に必要なライブラリオプション

--cc

このGaucheをコンパイルする時に使われたCコンパイラ名

--cpp

Cプリプロセッサを走らせるコマンド

--ac

Gauche用のautoconfマクロがインストールされているディレクトリ名

--reconfigure

現在インストールされているGaucheに使われたconfigureのオプション

--arch

autoconf形式のアーキテクチャシグネチャ (cpu-vendor-kernel-os)

--incdirs
--archdirs

それぞれ、インクルードファイルとライブラリファイルが探されるディレクトリのリスト。 各ディレクトリ名は、それが空白を含んでいる場合はクオートされています。また、 それぞれのディレクトリ名の間はUnixでは ’:’、Windowsでは ’;’ で区切られています。

--local-incdir
--local-libdir

これらは、追加のローカルヘッダファイルやライブラリファイルを探すために必要な ’-I’ および ’-L’ フラグのリストです。これらはconfigure時の ’–with-local’ オプションにより設定されます。追加のローカルディレクトリは、’-I’、’-L’、’–incdirs’ ’–arcdirs’ の出力にも含まれます。

ファイルをインストールするためのパラメータ:

--prefix

configure時に設定されたディレクトリプレフィクス

--sysincdir
--siteincdir
--pkgincdir

それぞれ、システム/サイト/パッケージレベルの拡張モジュールヘッダファイルが インストールされるべきディレクトリ

--syslibdir
--sitelibdir
--pkglibdir

それぞれ、システム/サイト/パッケージのSchemeファイルがインストールされる べきディレクトリ

--sysarchdir
--sitearchdir
--pkgarchdir

それぞれ、システム/サイト/パッケージのDSOファイルがインストールされる べきディレクトリ

--mandir
--infodir

それぞれ、Gaucheのmanpageとinfoドキュメントがインストールされるべきディレクトリ

拡張モジュールをビルドするためのパラメータ:

--object-suffix

コンパイルされたオブジェクトファイルの拡張子 (例: ’o’ や ’obj’)

--executable-suffix

実行可能ファイルの拡張氏(ピリオドを含む)。Unixシステムでは空文字列、 Windowsでは ’.exe’。

--so-suffix

動的ロード(dlopen)可能なファイルの拡張子 (例: ’so’)

--so-cflags

動的ロード可能なファイルを作るために追加で必要なCFLAGS

--so-ldflags

動的ロード可能なファイルを作るために追加で必要なLDFLAGS

--so-libs

動的ロード可能なファイルを作るために追加で必要なライブラリ

--dylib-suffix

動的リンクされる (dlopenされるのではない) ライブラリファイルの拡張子。 通常は–so-suffixと同じだが、OSXでは ’dylib’。

--dylib-ldflags

動的リンクされるライブラリファイルを作るのに必要なLDFLAGS。

--rpath-flag

RPATHを埋め込むためのコンパイラフラグ

--default-cflags

Gaucheをコンパイルする時に使われたCFLAGS。拡張モジュールをコンパイルする時にも 同じフラグを使うべき。

--cppflags

Cプリプロセッサに渡されるコンパイラフラグ

--static-libs

Gaucheを静的リンクする時に必要なリンクフラグ (’-llib’) のリスト。 ’-l’ と似ているが、これは拡張モジュールが必要とするライブラリ、 及びGaucheの静的ライブラリ本体(’-lgauche-static-X.X’)を含んでいる。

--libgauche-so

動的リンクされるlibgaucheのbasename


3.7.2 gauche-package - 拡張パッケージの管理

Program: gauche-package command [arg …]

This command can be used to build and install Gauche extensions, query installed ones, and help start building new ones. It has several subcommands, which can be listed with gauche-package help.


3.7.3 gauche-install - ファイルのインストール

Program: gauche-install [options] file dest
Program: gauche-install [options] file … dir
Program: gauche-install -d [options] dir …
Program: gauche-install -T dir [options] file …
Program: gauche-install -U dir [options] file …

このコマンドはファイルをインストールするのに使えます。 BSDのinstallコマンドの上位互換になっているので、 installコマンドをそのまま置き換えることができます。 最初の3つの形式はinstallコマンドと同じ動作です。

1番目と2n番目の景色は、filedest(ファイル名)もしくは dir(既存のディレクトリ)へとコピーします。 パーミッションやオーナー情報も指定できます。 cpの上位版と考えても良いでしょう。

3つ目の形式は、dir …が無ければそれを作ります。 mkdir -pの上位版と考えても良いでしょう。

4番目の形式は、file …をdirにコピーします。 2番目の形式とおn大きな違いは、fileが相対パスが指定された場合に、 その相対パスが保存されることです。つまり、次のコマンドを実行すると:

gauche-install -T /usr/local/mytool foo.scm bar/baz.scm

/usr/local/mytool/foo.scm/usr/local/mytool/bar/baz.scmが作られます。 2番目の形式では、インストール先にサブディレクトリbarが作られません。 この形式はサブディレクトリを持つファイルツリーをまるごとインストールするのに便利です。

5番目の形式は、-Tでインストールされるであろうファイルを アンインストールします。-T-Uに変えるだけで アンインストールできます。

次のコマンドライン引数が認識されます。

-C
--canonical-suffix

インストールされるファイルが拡張子.sciを持っていた場合、 それを.scmに置き換えます。これはGauche特有のオプションです。

-T dir
--target dir

ファイルをdir以下にインストールします。ディレクトリがまだ無ければ作ります。 ファイルの相対パスは保存されます (4番目の形式のみ)。

-U dir
--uninstall dir

-Tの動作を元に戻します。つまり、指定のファイルをdirから 取り除きます。

-S dir
--srcdir dir

file …をdirの下から探します。 VPATHを使う場合に便利です。

--shebang path

ファイルの内容の先頭に#!pathを追加します。 スクリプトをインストールするのに便利です。

-d
--directory

指定のディレクトリを作詞絵します (3番目の形式のみ。)

-m mode
--mode mode

インストールするファイルのパーミッションを指定します。

-p prefix
--strip-prefix prefix

file …の相対パスから、prefixと一致するプレフィクスを 取り除いてインストールします (4,5番目の形式のみ。)

-o owner
--owner owner

インストールするファイルのオーナーを指定します。

-g group
--group group

インストールするファイルのグループを指定します。

-v
--verbose

冗長なメッセージを出します。

-d
--dry-run

どういうアクションが実行されるかを出力しますが、実際に実行はしません。


3.7.4 gauche-compie-r7rs - スクリプトのコンパイル

For Gauche-specific programs, we have tools/build-standalone Scheme script (see スタンドアロン実行可能ファイルの作成). We recommend that script, for it is more featureful.

The gauche-compile-r7rs and compile-r7rs script is provided so that you can invoke a ’Scheme compiler’ with a standardized manner. It may be handy if other tools (e.g. IDE) need to invoke a Scheme compiler as a subprocess.

This interface is defined in SRFI-138, which also suggests the name compile-r7rs. We only install gauche-compile-r7rs by default so that we won’t accidentally clobber other implementation’s program, but if you give --enable-shared-commands option to configure script, a symbolic link compile-r7rs is created.

Program: gauche-compile-r7rs [options] script.scm
Program: compile-r7rs [options] script.scm

Compile a Scheme source file script.scm and produce an executable binary. The compile-r7rs is only installed if Gauche is configured with --enable-shared-commands.

Note: SRFI-138 states that if the environment variable COMPILE_R7RS is defined, it is assumed to a pathname of another program and is executed instead of Gauche’s compile-r7rs. We think the feature is rather confusing than convenient, so we don’t support it. If you want to run alternative implementation’s compiler, there are more explicit means such as running it directly or change PATH.

The following command-line arguments are recognized.

-I path
-A path

Prepend or append path to the path list the referenced libraries are searched. These options can be specified multiple times.

-o outfile

Specifies output executable filename. When omitted, a.out (on POSIX systems) or a.exe (on Windows) are used.

-D feature-id

Adds feature-id to the list of feature identifiers. This is to switch code conditionally in the source with cond-expand. This option can be specified multiple times.

Note that this does not enable certain features. So you shouldn’t specify system-reserved feature identifiers (see プラットフォーム依存の機能). This is also different from -D option of tools/build-standalone.



For Development HEAD DRAFTSearch (procedure/syntax/module):
DRAFT