Cabalでconfigure
スタイルを使用すると、sdl-configコマンドの出力に変数を代入する少しの設定スクリプトを書くことができます。値は$ foo.buildinfo.inファイルに置き換えられ、Cabalがビルドプロセスにインクルードする$ foo.buildinfoファイルが生成されます。
一般的な解決策:configureスクリプト
#!/bin/sh
SDLFLAGS=`sdl-config --cflags`
echo Found "$SDLFLAGS"
sed 's,@[email protected],'"$SDLFLAGS"',' z.buildinfo.in > z.buildinfo
$ foo.builinfo.inファイル
cc-options: @[email protected]
.cabalファイル
Build-type: Configure
あなたがz.buildinfoに「秘密結社の構成」「CC-オプション」フィールドを実行し保持するために作成されます。
cc-options: -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
秘密結社は、ビルドに含まれます。
完了。このようsdl
やcairo
ような構成のpkg-config-styleをサポートするツール、および他のためのpkg-config設定ツール
ため
具体的な解決策、陰謀団はすでに固有のサポートを持っていますsdl
ため
pkgconfig-depends: package list
A list of pkg-config packages, needed to build this package. They can be annotated with versions, e.g. gtk+-2.0 >= 2.10, cairo >= 1.0. If no version constraint is specified, any version is assumed to be acceptable. Cabal uses pkg-config to find if the packages are available on the system and to find the extra compilation and linker options needed to use the packages.
If you need to bind to a C library that supports pkg-config (use pkg-config --list-all to find out if it is supported) then it is much preferable to use this field rather than hard code options into the other fields.
ので、あなただけが必要です:
pkgconfig-depends: sdl
ねえ。私はあなたの指示とミハイルの編集に従った。キャバルファイル。私がビルドしようとすると、次のようなものが得られます。 cabal:内部エラー:パッケージにライブラリがありますが、対応する設定データがありません しかし、私のプロジェクトにはライブラリが含まれていません。実行可能ファイルは1つだけです。このメッセージはどういう意味ですか? :/ – fatuhoku
.cabalファイルの構文をチェックしてください(または 'cabal init'で新しいファイルを生成してみてください)。あなたの古い.cabalファイルを最初にバックアップします。 –
運がありません。同じメッセージ。 実際、元のファイルは 'cabal init'で生成されました。 私はHackage tracにカブのバグとしてこのファイルを提出しました。私はメッセージが実際に問題を適切に記述しているわけではないことは私には明らかだと思います。 – fatuhoku