.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DH 1" .TH DH 1 "2020-01-19" "12.8" "Debhelper" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "名前" .IX Header "名前" dh \- debhelper コマンドシーケンサー .SH "書式" .IX Header "書式" \&\fBdh\fR \fIsequence\fR [\fB\-\-with\fR \fIaddon\fR[\fB,\fR\fIaddon\fR ...]] [\fB\-\-list\fR] [\fIdebhelper オプション\fR] .SH "説明" .IX Header "説明" \&\fBdh\fR は一連の debhelper コマンドを実行します。\fIdebian/rules\fR ファイルに記載されたターゲットに対応する \&\fIsequence\fRをサポートします。サポートするターゲット: \fBbuild-arch\fR, \fBbuild-indep\fR, \fBbuild\fR, \&\fBclean\fR, \fBinstall-indep\fR, \fBinstall-arch\fR, \fBinstall\fR, \fBbinary-arch\fR, \&\fBbinary-indep\fR, \fBbinary\fR です。 .SH "override ターゲット" .IX Header "override ターゲット" \&\fBdh\fR が利用する \fIdebian/rules\fR にて、override ターゲットを指定することで、呼び出される一連の処理途中で動作を変更できます。 .PP ターゲット \fIdh_command\fR を変更するためには、\fBoverride_\fR\fIdh_command\fR というターゲットを rule ファイルに記載します。こちらが指定されていると、\fIdh_command\fR が動作する代わりに \fBoverride_\fR\fIdh_command\fR ターゲットを呼び出します。override ターゲットでは、コマンドにオプションを追加したり、コマンド全てを置き換えたりできます。後に例を挙げます。 .PP アーキテクチャ依存パッケージを作るときのみ、あるいはアーキテクチャ非依存パッケージを作るときのみ動作するように override ターゲットを定義することもできます。その場合、\fBoverride_\fR\fIdh_command\fR\fB\-arch\fR や、\fBoverride_\fR\fIdh_command\fR\fB\-indep\fR を使ってください (なお、この機能を使うには、Build\-Depends 行で debhelper バージョン 8.9.7 以上を指定する必要があります)。 .SH "オプション" .IX Header "オプション" .IP "\fB\-\-with\fR \fIaddon\fR[\fB,\fR\fIaddon\fR ...]" 4 .IX Item "--with addon[,addon ...]" 一連のコマンド中の適切な位置で実行するアドオンを、debhelper コマンドへ指定します。このオプションは繰り返し指定することもできますし、複数のアドオンをカンマ区切りで列挙して指定できます。このオプションは debhelper コマンドを提供するサードパーティ製パッケージと共に利用する時に使います。\fI\s-1PROGRAMMING\s0\fR ファイルに、一連のアドオン用インターフェースについてのドキュメントがあります。 .Sp A \fBBuild-Depends\fR relation on the package \fBdh\-sequence\-\fR\fIaddon\fR implies a \&\fB\-\-with\fR \fIaddon\fR. This avoids the need for an explicit \fB\-\-with\fR in \&\fIdebian/rules\fR that only duplicates what is already declared via the build dependencies in \fIdebian/control\fR. The relation can (since 12.5) be made optional via e.g. build-profiles. This enables you to easily disable an addon that is only useful with certain profiles (e.g. to facilitate bootstrapping). .Sp Since debhelper 12.5, addons can also be activated in \fBindep\fR\-only mode (via \fBBuild-Depends-Indep\fR) or \fBarch\fR\-only mode (via \&\fBBuild-Depends-Arch\fR). Such addons are only active in the particular sequence (e.g. \fBbinary-indep\fR) which simplifies dependency management for cross-builds. .Sp Please note that addons activated via \fBBuild-Depends-Indep\fR or \&\fBBuild-Depends-Arch\fR are subject to additional limitations to ensure the result is deterministic even when the addon is unavailable (e.g. during clean). This implies that some addons are incompatible with these restrictions and can only be used via \fBBuild-Depends\fR (or manually via \&\fIdebian/rules\fR). Currently, such addons can only add commands to sequences. .IP "\fB\-\-without\fR \fIaddon\fR" 4 .IX Item "--without addon" \&\fB\-\-with\fR とは逆に、指定されたアドオンを無効にします。このオプションは繰り返し指定することもできますし、アドオン名をカンマ区切りで指定もできます。 .IP "\fB\-\-list\fR, \fB\-l\fR" 4 .IX Item "--list, -l" 利用可能なアドオン一覧を表示する。 .Sp When called only with this option, \fBdh\fR can be called from any directory (i.e. it does not need access to files from a source package). .IP "\fB\-\-no\-act\fR" 4 .IX Item "--no-act" 指定された一連の処理でのコマンドを表示しますが、表示だけして実際にはコマンドは実行しません。 .Sp 通常、dh は何も実行しないであろうとわかっている動作コマンドをスキップすることに注意してください。\-\-no\-act を指定すると、一連の動作内でのコマンド一覧をすべて出力します。 .PP \&\fBdh\fR に渡された他のオプションは、実行される各コマンドにも渡されます。これは、\fB\-v\fR, \fB\-X\fR, \fB\-N\fR のようなオプションをセットするのに利用できます。また、他の特別なオプションについても同様となります。 .SH "使用例" .IX Header "使用例" コマンドを実際には動作させず、一連の動作でどのコマンドが実行されるかを見る: .PP .Vb 1 \& dh binary\-arch \-\-no\-act .Ve .PP 以下は非常にシンプルな rules ファイルです。ここではパッケージに対して追加オプション無しでデフォルトのコマンド群が呼び出されます。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ .Ve .PP 特定の debhelper コマンドへオプションを渡したい事がよくあります。これを簡単に行う方法は、そのコマンドへ override を追加することです。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \& \& override_dh_strip: \& dh_strip \-Xfoo \& \& override_dh_auto_configure: \& dh_auto_configure \-\- \-\-with\-foo \-\-disable\-bar .Ve .PP \&\fBdh_auto_configure\fR\|(1) や \fBdh_auto_build\fR\|(1) が処理をする際、何を処理すればよいか判断できないような変わったパッケージがたまに存在します。ここでは、\fBdh_auto_configure\fR\|(1) や \&\fBdh_auto_build\fR\|(1) を実行せずに、代わりのコマンドを実行させる方法を示します。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \& \& override_dh_auto_configure: \& ./mondoconfig \& \& override_dh_auto_build: \& make universe\-explode\-in\-delight .Ve .PP 別のよくある例として、特定の debhelper コマンドが実行される前後で手動で何かをしたい場合があります。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \& \& # Example assumes debhelper/12.8 and compat 10+ \& execute_after_dh_fixperms: \& chmod 4755 debian/foo/usr/bin/foo .Ve .PP If you are on an older debhelper or compatibility level, the above example would have to be written as. .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \& \& # Older debhelper versions or using compat 9 or lower. \& override_dh_fixperms: \& dh_fixperms \& chmod 4755 debian/foo/usr/bin/foo .Ve .PP Python tools are not run by dh by default, due to the continual change in that area. Here is how to use \fBdh_python2\fR. .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \-\-with python2 .Ve .PP こちらは Perl による \fBModule::Build\fR ビルドシステムを強制的に使う方法です。これは、debhelper が誤ってパッケージが MakeMaker を使っていると認識する場合に必要となります。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \-\-buildsystem=perl_build .Ve .PP 以下に \fBdh_auto_\fR\fI*\fR コマンドがどこにパッケージソースがあるかを変更する例を載せます。これはサブディレクトリにソースが存在するようなパッケージで使います。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \-\-sourcedirectory=src .Ve .PP \&\fBdh_auto_\fR\fI*\fR にサブディレクトリでビルドするように指定する方法を以下に示します。こちらを指定すると、\fBclean\fR 処理でこれらディレクトリが取り除かれるようになります: .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \-\-builddirectory=build .Ve .PP パッケージが並列ビルド可能であれば、互換性レベル 10 を使うか dh に \fB\-\-parallel\fR を指定して下さい。すると \&\fBdpkg-buildpackage \-j\fR が有効になります。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \-\-parallel .Ve .PP パッケージが複数スレッドを使うと安定してビルド出来ない場合は、dh (あるいは関連する \fBdh_auto_\fR\fI*\fR コマンド)に \&\fB\-\-no\-parallel\fR を指定して下さい。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \-\-no\-parallel .Ve .PP ここでは、\fBdh\fR に、実行してほしくないコマンドを実行させないようにする方法を示します。その場合、それらのコマンドに対する override ターゲットを空にすることにより行います。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \& \& # 実行させたくないコマンド: \& override_dh_auto_test override_dh_compress override_dh_fixperms: .Ve .PP ドキュメントパッケージを作成するのに時間がかかる場合があります。この場合、アーキテクチャ非依存用の override ターゲットを使ってビルドを分離することができます。こうすると、build\-arch や binary-arch を実行するとき、ドキュメントパッケージのビルドが省略されます。 .PP .Vb 3 \& #!/usr/bin/make \-f \& %: \& dh $@ \& \& override_dh_auto_build\-indep: \& $(MAKE) \-C docs \& \& # doc ターゲット実行時はテストは不要 \& override_dh_auto_test\-indep: \& \& override_dh_auto_install\-indep: \& $(MAKE) \-C docs install .Ve .PP 上の例に加え、ファイルに chmod を実行しなければならないがそれはアーキテクチャ依存パッケージをビルドする際のみ必要で、ドキュメントのみをビルドする時には実行しないとしたらどうなるでしょうか。 .PP .Vb 3 \& # Example assumes debhelper/12.8 and compat 10+ \& execute_after_dh_fixperms\-arch: \& chmod 4755 debian/foo/usr/bin/foo .Ve .SH "内部動作" .IX Header "内部動作" \&\fBdh\fR の内部動作に興味がある人向けに、以下に内部でどのように動作しているのかを記載します。 .PP In compat 10 (or later), \fBdh\fR creates a stamp file \&\fIdebian/debhelper\-build\-stamp\fR after the build step(s) are complete to avoid re-running them. It is possible to avoid the stamp file by passing \&\fB\-\-without=build\-stamp\fR to \fBdh\fR. This makes \*(L"no clean\*(R" builds behave more like what some people expect at the expense of possibly running the build and test twice (the second time as root or under \fBfakeroot\fR\|(1)). .PP Inside an override target, \fBdh_*\fR commands will create a log file \&\fIdebian/package.debhelper.log\fR to keep track of which packages the command(s) have been run for. These log files are then removed once the override target is complete. .PP 互換性レベル 9 とそれ以前では、各 debhelper コマンドは \fIdebian/package.debhelper.log\fR に実行がうまく行ったものを記録します (これは \fBdh_clean\fR が消去します)。これにより、\fBdh\fR は既にどのコマンドが実行されたか、あるいはどのパッケージに対して実行されたか、何のコマンドを再びスキップすればよいのかがわかります。 .PP Each time \fBdh\fR is run (in compat 9 or earlier), it examines the log, and finds the last logged command that is in the specified sequence. It then continues with the next command in the sequence. .PP dh に処理の流れの名前を指定することにより、debian/rules に記載した依存関係にあるターゲットも実行されます。例えば、\*(L"binary\*(R" という処理の流れを指定すると、\*(L"install\*(R" ターゲットも実行されます。 .PP \&\fBdh\fR は、\fB\s-1DH_INTERNAL_OPTIONS\s0\fR 環境変数をチェックし、override ターゲットの中で実行される debhelper コマンドに情報を渡します。この環境変数に記載されている内容は (実際には環境変数が存在していると) 、その環境変数の名前が示唆するとおり、どの時点でも debhelper コマンドの動作に影響を与えます。 .PP \&\fBbuild-indep\fR, \fBinstall-indep\fR, \fBbinary-indep\fR の一連の処理に記載されているコマンドには、アーキテクチャ非依存パッケージをビルドする時にだけ確実に作用するように \fB\-i\fR オプションを使って情報が引き渡されます。\fBbuild-arch\fR, \fBinstall-arch\fR, \fBbinary-arch\fR の一連の処理に対しては、\fB\-a\fR にて引き渡され、アーキテクチャ依存パッケージにのみ確実に作用するように動作します。 .SH "参照" .IX Header "参照" \&\fBdebhelper\fR\|(7) .PP このプログラムは debhelper の一部です。 .SH "作者" .IX Header "作者" Joey Hess