モジュールセットファイルの構文
JHBuild は モジュール間の依存関係を XML ファイルに記述します。RELAX-NG スキーマと文書型定義は、JHBuild の modulesets/ ディレクトリにあります。RELAX-NG スキーマにより、Emacs の nxml-mode でモジュールセットファイルを編集できます。
モジュールセットファイルのトップレベル要素は、moduleset 要素です。XML 名前空間は使用しません。トップレベル要素の配下に来るものは 3 種類あります。モジュールソース、インクルード文、およびモジュール定義です。
Content in the moduleset file can be conditionally included by use of the <if> tag to surround the conditional content. It is currently only possible to predicate the inclusion on whether a particular condition flag is set or not, using <if condition-set='cond'> or <if condition-unset='cond'>. Conditions are set by default on a per-OS basis but can be influenced by way of the conditions variable in jhbuildrc or the --conditions= commandline argument.
- 7.1. モジュールソース
- 7.2. 他のモジュールセットのインクルード
- 7.3. モジュールの定義
- 7.4. 非推奨となった要素
7.1. モジュールソース
すべてのモジュールの完全な場所を記述するのではなく、いくつかの "モジュールソース" をモジュールセットに記述し、モジュール定義において名前でそのソースを参照するようにします。モジュールセットから冗長な情報を減らすだけでなく、モジュールにたいする別のソースを指定するのも簡単になります (CVS や Subversion では、開発者やユーザーがさまざまなリポジトリアクセス手段を使用するのはよくあることです)。
repository 要素は、すべてのタイプのリポジトリを記述するのに使用します。branch 要素は、モジュール定義の内部で、追加の設定を指定するのに使用します。
<repository name="name" type="type" [ default="default" ] [ password="password" ] [ cvsroot="cvsroot" ] [ archive="archive" ] [ href="href" ] [ server="server" ] [ database="database" ] [ defbranch="defbranch" ] [ trunk-template="trunk-template" ] [ branches-template="branches-template" ] [ tags-template="tags-template" ] [ developer-href-example="developer-href-example" ] />
name 属性は、リポジトリの一意に定まる識別子です。
default 属性は、そのリポジトリがモジュールセットにおけるデフォルトのソースであるかを指定します。
type 属性は、リポジトリタイプを指定します。この属性には bzr、cvs、darcs、fossil、git、hg、mnt、svn、tarball のどれか1つを指定できます。モジュール定義内部で使用する branch など、その他の属性は type に依存します。それらは、以下のリポジトリタイプのサブセクションで説明します。
developer-href-example 属性は、開発者が使う、リポジトリの URL の書式を指定します。この属性は参考情報に過ぎません。
branch 要素は、モジュール定義の内部で使用します。
<branch [ repo="repository" ] [ module="module name" ] [ checkoutdir="checkoutdir" ] [ revision="revision" ] [ tag="tag" ] [ update-new-dirs="update-new-dirs" ] [ override-checkoutdir="override-checkoutdir" ] [ subdir="subdir" ] [ branch="branch" ] [ version="version" ] [ size="size" ] [ source-subdir="source-subdir" ] [ hash="hash" ]/>
All attributes have sensible defaults and depend on the module and repository definitions. Common attributes are described here.
repo 属性は、リポジトリのサーバーを指定します。
module 属性は、リポジトリからチェックアウトするモジュールの名前を指定します。デフォルトはモジュール ID です。
checkoutdir 属性は、チェックアウトディレクトリの名前を指定します。デフォルトはモジュール ID です。
その他の属性については、以下で説明します。
7.1.1. Bazaar
このリポジトリタイプは、Bazaar リポジトリを定義します。Bazaar 1.16 以降を推奨します。
<repository type="bzr" name="launchpad.net" href="lp:"/>
Additional attributes are: trunk-template (defaults to "%(module)s") and branches-template (defaults to "%(module)s/%(branch)s"). These attributes are used to specify templates for constructing URL. A branch element in the module definitions can specify branch and user attributes. These values will be substituted in the templates. If either of those are defined branches-template is used, otherwise trunk-template is used. This way you can override repository to build modules from your personal branch or build many modules from a repository with non-standard layout.
An addition branch element accepts revspec attribute to anchor on a particular revision. Any valid bzr revspec is accepted, for example date:yesterday, -5, tag:0.1 to get first revision since yesterday, 5 commits behind the tip or tag "0.1". See bzr help revisionspec for all possible values.
template 属性が定義された、リポジトリの例です:
<repository type="bzr" name="launchpad.net" href="lp:" trunk-template="~bzr-pqm/%(module)s/bzr.dev" branches-template="~bzr-pqm/%(module)s/%(branch)s"/>
上記のリポジトリにたいする、branch 要素の例です:
<branch repo="launchpad.net" module="bzr" checkoutdir="bzr-next"/>
<branch repo="launchpad.net" module="bzr" branch="2.2" checkoutdir="bzr-beta"/>
7.1.2. CVS
このリポジトリタイプは、CVS リポジトリを定義します。
password 属性は、リポジトリのパスワードを指定します。
cvsroot 属性は、リポジトリの root を指定します。
<repository type="cvs" name="tango.freedesktop.org" cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/tango" password=""/>
追加の属性は: revision、update-new-dirs、および override-checkoutdir です。
7.1.3. Darcs
このリポジトリタイプは、Darcs リポジトリを定義します。
<repository type="darcs" name="telepathy.freedesktop.org" href="http://projects.collabora.co.uk/darcs/telepathy/"/>
7.1.4. Git
このリポジトリタイプは、Git リポジトリを定義します。
<repository type="git" name="git.freedesktop.org" href="git://anongit.freedesktop.org/git/"/>
branch 要素には、次の属性を指定できます:
revision 属性は、更新フェーズで切り替えるローカルまたはリモートの追跡ブランチを指定します。デフォルトは 'master' です。この属性は、設定変数 branches で上書きできます。切り替えは、現在のブランチがリモートブランチの追跡ブランチにあたる場合にだけ発生し、ユーザーの作業の邪魔をしません。
tag 属性は、更新フェーズで無条件にチェックアウトするリビジョンを指定するために使用します。この属性は、revision 属性より優先されます。
<branch repo="git.freedesktop.org" module="swfdec/swfdec" checkoutdir="swfdec" revision="local-or-remote-branch" tag="tree-ish"/>
7.1.5. Mercurial
このリポジトリタイプは、Mercurial リポジトリを定義します。
<repository type="hg" name="hg.gtk-vnc" href="http://gtk-vnc.codemonkey.ws/hg/" />
<branch repo="hg.gtk-vnc" module="outgoing.hg" checkoutdir="gtk-vnc"/>
7.1.6. Monotone
このリポジトリタイプは、Monotone リポジトリを定義します。
server 属性は、リポジトリのサーバーを指定します。
database 属性は、リポジトリで使用するデータベースを指定します。
defbranch 属性は、使用するリポジトリのブランチを指定します。
<repository type="mtn" name="pidgin.im" server="pidgin.im" database="pidgin.im.mtn" defbranch="im.pidgin.pidgin"/>
7.1.7. Subversion
このリポジトリタイプは、Subversion リポジトリを定義します。
<repository type="svn" name="svn.gnome.org" default="yes" href="http://svn.gnome.org/svn/"/>
branch に revision を指定できます。この属性で、チェックアウトするブランチの定義、または、チェックアウトするブランチのリビジョン番号を指定します。
<branch revision="gnome-2-20"/>
trunk-template (デフォルトは "%(module)s/trunk")、branches-template (デフォルトは "%(module)s/branches/%(branch)s")、tags-template (デフォルトは "%(module)s/tags/%(tag)s") を使用して、カスタマイズされた svn レイアウトを指定できます。
7.1.8. System
このリポジトリタイプは、擬似的なシステムリポジトリを定義するのに使用します。システムリポジトリは、systemmodules を作成するのに必要となります。
<repository type="system" name="system"/>
7.1.9. Tarballs
このリポジトリタイプは、tarball のリポジトリを定義します。
<repository type="tarball" name="dbus/dbus-python" href="http://dbus.freedesktop.org/releases/dbus-python/"/>
branch 要素には、次の属性を指定できます:
module 属性により、ダウンロード、およびコンパイルするファイルを指定し、version 属性でモジュールのバージョンを指定します。
size、hash、同様に 旧来の md5sum 属性はオプションです。これらが指定された場合、パッケージが正しくダウンロードされたかチェックするのに使用されます。
The rename-tarball can be used to rename the tarball file when downloading, in case the original name conflicts with another module.
branch 要素は、任意の数の patch 要素を持つことができます。ここで指定したパッチは、展開したソースツリーにたいして記述した順に適用されます。file 属性でパッチのファイル名を指定し、strip 属性でパッチを適用する際に無視するディレクトリのレベル数を指定します(訳注:patch コマンドの -p オプションに相当)。
JHBuild に同梱されているモジュールセットでは、jhbuild/patches/ ディレクトリからパッチファイルを探します。URI で参照されるモジュールセットの場合、モジュールセットと同じディレクトリ、もしくはpatches/ というサブディレクトリからパッチファイルを探します。file 属性に URI を指定することもでき、その場合は指定された場所からファイルをダウンロードします。
<branch module="dbus-python-0.80.2.tar.gz" version="0.80.2" repo="dbus/dbus-python" hash="md5:2807bc85215c995bd595e01edd9d2077" size="453499"> <patch file="dbus-glib-build.patch" strip="1" /> </branch>
また、tarball の branch 要素は、内部に quilt 要素を含めることで、インポートしたい入れ子の branch を指定することもできます。
7.2. 他のモジュールセットのインクルード
JHBuild では include 要素により、モジュールセットから他のモジュールセットをインクルードすることができます。
<include href="uri"/>
href は、インクルードするモジュールセットを参照するための URI で、include 要素を含むファイルからの相対的な URI です。
参照されるモジュールセットからインポートされるのはモジュール定義だけで、モジュールソースはインポートされません。複数階層のインクルードもできますが、インクルードのループはできません(今のところループの処理は実装されていません)。
7.3. モジュールの定義
モジュールセットファイルで使用できるモジュール定義には、さまざまな種類があり、そのリストは簡単に拡張できます。以下に記載するのは、最も一般的なものです。
基本的にモジュール定義は、モジュールをどうやって取得するかを記述する branch 要素と、モジュールの依存関係を定義する dependencies、suggests、after 要素で構成されます。
dependencies 要素にリストされたモジュールは、それがインクルードされていない場合 jhbuild build のモジュールリストに追加され、依存するモジュールが最初にビルドされることを保証します。
モジュールリストを生成した後で、suggests 要素にリストされたモジュールが、モジュールリストの他に使用されます(追加のモジュールを取得しないとしても)。これはモジュールが他のモジュールに対してオプションの依存関係をもつ場合を想定したものです。
- 7.3.1. autotools
- 7.3.2. cmake
- 7.3.3. Meson
- 7.3.4. distutils
- 7.3.5. linux
- 7.3.6. perl
- 7.3.7. systemmodule
- 7.3.8. waf
- 7.3.9. testmodule
- 7.3.10. metamodule
7.3.1. autotools
autotools 要素は、GNU Autotools ビルドシステムでモジュールをコンパイルすることを定義します。
<autotools id="id" [ autogenargs="autogenargs" ] [ makeargs="makeargs" ] [ makeinstallargs="makeinstallargs" ] [ autogen-sh="autogen-sh" ] [ makefile="makefile" ] [ skip-autogen="skip-autogen" ] [ skip-install="skip-install" ] [ uninstall-before-install="uninstall-before-install" ] [ autogen-template="autogen-template" ] [ check-target="check-target" ] [ supports-non-srcdir-builds="supports-non-srcdir-builds" ] [ force-non-srcdir-builds="force-non-srcdir-builds" ] [ supports-unknown-configure-options="supports-unknown-configure-options" ] [ supports-static-analyzer="supports-static-analyzer" ]> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> </autotools>
autogenargs、makeargs、makeinstallargs 属性では、それぞれ autogen.sh、make および make install に引き渡す追加の引数を指定します。
autogen-sh 属性は、実行する autogen.sh スクリプトの名前を指定します。値 autoreconf は、モジュールに autogen.sh に相当するスクリプトがない場合に使用できます。その場合、JHBuild は、autoreconf -fi を実行し、その後で適切な configure を実行します。skip-autogen は、autogen.sh を実行するかどうかを指定します。指定できるのはブール値、あるいは never で、never を指定した場合は、autogen.sh の実行をスキップしません。skip-install は、ブール値の属性で、該当のモジュールにたいして make install コマンドをスキップするかどうかを指定します。makefile は、使用する makefile のファイル名を指定します。
The uninstall-before-install specifies any old installed files from the module should before removed before running the install step. This can be used to work around a problem where libtool tries to link one library it is installing against another library it is installing, but because of jhbuild's use of DESTDIR, finds the old installed library instead. The downside of specifying this is that it could cause problems if the user is currently running code that relies on installed files from the module.
supports-non-srcdir-builds 属性は、分離されたソースディレクトリでクリーンなビルドができないモジュールであることをマークします。
The force-non-srcdir-builds attribute is used to mark modules that can't be cleanly built from the source directory, but can be built from outside it.
autogen-template 属性は、autogen のコマンドラインをより細かく制御する必要がある場合に使用できます。これには Python のフォーマット文字列を使用でき、以下の変数が置換されます: srcdir、autogen-sh、prefix、libdir、autogenargs。次の記述例はデフォルトの autogen-template です。
%(srcdir)s/%(autogen-sh)s --prefix %(prefix)s --libdir %(libdir)s %(autogenargs)s
check-target 属性は、make check ターゲットがないモジュールの場合は指定しなければなりません(値は false)。
The supports-static-analyzer attribute must be specified (with false as value) for modules which don’t support being built under a static analysis tool such as scan-build.
The supports-unknown-configure-options attribute is used to mark modules that will error out if an unknown option is passed to configure. Global configure options will not be used for that module.
7.3.2. cmake
cmake 要素は、CMake ビルドシステムでモジュールをビルドすることを定義します。
<cmake id="modulename" [ cmakeargs="cmakeargs" ] [ ninjaargs="ninjaargs" ] [ makeargs="makeargs" ] [ skip-install="skip-install" ] [ cmakedir="cmakedir" ] [ use-ninja="use-ninja" ] [ force-non-srcdir-builds="force-non-srcdir-builds" ]> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> </cmake>
The cmakeargs attribute is used to specify additional arguments to pass to cmake.
The ninjaargs attribute is used to specify additional arguments to pass to ninja.
makeargs 属性は、make に引き渡す追加の引数を指定します。
The cmakedir attribute specifies the subdirectory where cmake will run in relation to srcdir.
The force-non-srcdir-builds attribute is used to mark modules that can't be cleanly built from the source directory, but can be built from outside it.
The use-ninja attribute is used to mark modules should be built using the Ninja backend for cmake, instead of the Make backend. The default is to use the Ninja backend.
7.3.3. Meson
The meson element is used to define a module which is configured using the Meson build system and built using the Ninja build tool.
<meson id="modulename" [ mesonargs="mesonargs" ] [ ninjaargs="ninjaargs" ] [ skip-install="skip-install" ]> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> </meson>
The mesonargs attribute is used to specify additional arguments to pass to meson.
The ninjaargs attribute is used to specify additional arguments to pass to ninja.
7.3.4. distutils
The distutils element is used to define a module which is built using python's distutils.
<distutils id="modulename" [ supports-non-srcdir-builds="yes|no" ]> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> </distutils>
7.3.5. linux
linux 要素は、linux カーネルのビルドで使用されるモジュールを定義します。加えて、kconfig サブ要素により、別のカーネル設定を選択することができます。
<linux id="id" [ makeargs="makeargs" ]> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> <kconfig [ repo="repo" ] version="version" [ module="module" ] [ config="config" ] /> </linux>
7.3.6. perl
perl 要素は、perl モジュールをビルドするために使用します。
makeargs 属性は、make に引き渡す追加の引数を指定します。
<perl id="modulename" [ makeargs="makeargs" ]> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> </perl>
7.3.7. systemmodule
systemmodule 要素は、システムによって提供される必要のあるモジュールを定義するために使用します。このモジュールは、お使いのディストリビューションのパッケージ管理システムを通じてインストールされます。
<systemmodule id="modulename"> <pkg-config>pkg-config.pc</pkg-config> <branch repo="system" version="version" /> </systemmodule>
システムモジュールが pkg-config ファイルを提供していない場合は、依存対象を特定するために systemdependencies タグを使用できます。dep タグの type 属性は、2 種類の値が使用可能です。
-
path 値。PATH を検索して、指定した名前に合致するプログラムを探します。
-
c_include 値。C インクルードパスを検索して、指定した名前に合致するヘッダーを探します。name には、サブディレクトリを含めることもできます。C インクルードパスは、設定変数 cflags または module_autogenargs 内の CPPFLAGS をセットすることで変更できます。
<systemmodule id="modulename"> <branch repo="system" version="version" /> <systemdependencies> <dep type="path" name="executable-name" /> </systemdependencies> </systemmodule> <systemmodule id="modulename"> <branch repo="system" version="version" /> <systemdependencies> <dep type="c_include" name="header-name" /> </systemdependencies> </systemmodule>
If the system module may be installed in different locations or installed with different names by different distributions, altdep tag can be used as subelements of dep tag to specify alternative locations or names. altdep tag support the same attributes as dep tag does.
<systemmodule id="modulename"> <branch repo="system" version="version" /> <systemdependencies> <dep type="path" name="executable-name"> <altdep type="path" name="alternative-executable-name-1" /> <altdep type="path" name="alternative-executable-name-2" /> ... <dep> </systemdependencies> </systemmodule> <systemmodule id="modulename"> <branch repo="system" version="version" /> <systemdependencies> <dep type="c_include" name="header-name"> <altdep type="c_include" name="alternative-header-name-1" /> <altdep type="c_include" name="alternative-header-name-2" /> ... <dep> </systemdependencies> </systemmodule>
7.3.8. waf
waf 要素は、Waf ビルドシステムでモジュールをビルドすることを定義します。
waf-command 属性は、使用する waf コマンドスクリプトを指定します。デフォルトは waf です。
The python-command attribute is used to specify the Python executable to use; it defaults to python. This is useful to build modules against version 3 of Python.
<waf id="modulename"> [ python-command="python-command" ] [ waf-command="waf-command" ]> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> </waf>
7.3.9. testmodule
testmodule 要素は、LDTP、または Dogtail でテストを実行するモジュールを作成するために使用します。
<testmodule id="id" type="type"> <branch [ ... ] > [...] </branch> <dependencies> <dep package="modulename"/> ... </dependencies> <after> <dep package="modulename"/> ... </after> <testedmodules> <tested package="package" /> </testedmodules> </testmodule>
type 属性には、モジュールで実行するテストのタイプを指定します。'dogtail' は、すべての .py ファイルの実行に Python を使用します。'ldtp' は 'ldtprunner run.xml' を実行します。
Unless the noxvfb configuration option is set, an Xvfb server is started to run the tests in.
7.3.10. metamodule
metamodule 要素は、実際には何もしないモジュールを定義します。このモジュールの唯一の目的は、依存関係のためです。
例えば、meta-gnome-desktop は GNOME デスクトップの主要コンポーネントに依存しているので、実際には完全なデスクトップをインストールするよう JHBuild に指定することになります。
<metamodule id="modulename"> <dependencies> <dep package="modulename"/> ... </dependencies> <suggests> <dep package="modulename"/> ... </suggests> </metamodule>
id 属性には、モジュールの名前を指定します。子要素は autotools と同様に処理されます。
7.4. 非推奨となった要素
- 7.4.1. モジュールソース
- 7.4.2. 非推奨となったモジュールタイプ
7.4.1. モジュールソース
7.4.1.1. cvsroot
cvsroot 要素は、現在は非推奨となっています - かわりに repository 要素を使用してください。
cvsroot 要素は、CVS リポジトリを記述するのに使用します。
<cvsroot name="rootname" [ default="yes|no" ] root="anon-cvsroot" password="anon-password"/>
name 属性は、CVS リポジトリを一意に識別する名前です。
default 属性には、モジュールセットファイルのデフォルトのモジュールソースを記述します。
root 属性には、このリポジトリへの匿名アクセスに使用される CVS root のリストを記述し、password 属性で匿名アクセスするときのパスワードを記述します。
7.4.1.2. svnroot
svnroot 要素は、現在は非推奨となっています - かわりに repository 要素を使用してください。
svnroot 要素は、Subversion リポジトリを記述するのに使用します。
<svnroot name="rootname" [ default="yes|no" ] href="anon-svnroot"/>
name 属性は、Subversion リポジトリを一意に識別する名前です。
default 属性には、モジュールセットファイルのデフォルトのモジュールソースを記述します。
href 属性には、リポジトリの URL のリストを記述します。おそらく http、https、svn のような URL となるでしょう。
7.4.2. 非推奨となったモジュールタイプ
このセクションでは、既存のモジュールセットでは使用されているものの、今後の使用は非推奨の要素について説明します。
- 7.4.2.1. tarball
7.4.2.1. tarball
この非推奨な要素は、autotools モジュールタイプと tarball リポジトリタイプの単なる軽量なラッパーです。
tarball 要素では、tarball からビルドされるモジュールを定義します。
<tarball id="modulename" [ version="version" ] [ checkoutdir="checkoutdir" ] [ autogenargs="autogenargs" ] [ makeargs="makeargs" ] [ autogen-sh="autogen-sh" ] [ supports-non-srcdir-builds="yes|no" ]> <source href="source-url" [ size="source-size" ] [ hash="source-algo:source-hash" ] [ md5sum="source-md5sum" ]/> <patches> <patch file="filename" strip="level"/> ... </patches> <dependencies> <dep package="modulename"/> ... </dependencies> <suggests> <dep package="modulename"/> ... </suggests> </tarball>
id、および version 属性は、モジュールを識別するために使用されます。
source 要素では、ダウンロードしてコンパイルするファイルを指定します。href は必須の属性で、size、hash、同様に 旧来の md5sum 属性はオプションです。最後の2つの属性が指定された場合は、ダウンロードされたソースが正しいものであるか確認するために使用されます。
patches 要素は、ソースツリーを展開後に1つ (または複数) のパッチの適用を指定します。file 属性はファイル名を指定し、strip 属性はパッチを適用する際に無視するディレクトリのレベル数を指定します(訳注:patch コマンドの -p オプションに相当)。
JHBuild に同梱されているモジュールセットでは、jhbuild/patches/ ディレクトリからパッチファイルを探します。URI で参照されるモジュールセットの場合、モジュールセットと同じディレクトリ、もしくはpatches/ というサブディレクトリからパッチファイルを探します。file 属性に URI を指定することもでき、その場合は指定された場所からファイルをダウンロードします。
その他の属性、および dependencies、suggests、after 要素は、autotools によって処理されます。