are also a good way to provide convenient access to a Haskell
layer over a C library.</para>
- <para>GHC comes with several packages (see <xref
- linkend="book-hslibs">), and packages can be added to or removed
+ <para>GHC comes with several packages (see the accompanying
+ library documentation), and packages can be added to or removed
from an existing GHC installation, using the supplied
<literal>ghc-pkg</literal><indexterm><primary><literal>ghc-pkg</literal></primary>
</indexterm> tool, described in <xref
<para>The <literal>ghc-pkg</literal> tool allows packages to be
added or removed from a package configuration file. By default,
the system-wide configuration file is used, but alternatively
- packages can be added or removed from a user-specified
+ packages can be added, updated or removed from a user-specified
configuration file using the <option>––config-file</option>
option. An empty package configuration file consists of the
string <quote><literal>[]</literal></quote>.</para>
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>––force</option></term>
+ <indexterm><primary><option>––force</option></primary></indexterm>
+ <listitem>
+ <para>Causes <literal>ghc-pkg</literal> to ignore missing
+ directories and libraries when adding a package, and just
+ go ahead and add it anyway. This might be useful if your
+ package installation system needs to add the package to
+ GHC before building and installing the files.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>When modifying the configuration file
<screen>
Package {
name = "mypkg",
- import_dirs = ["/usr/local/lib/imports/mypkg"],
+ import_dirs = ["${installdir}/imports/mypkg"],
source_dirs = [],
- library_dirs = ["/usr/local/lib"],
+ library_dirs = ["${installdir}"],
hs_libraries = ["HSmypkg" ],
extra_libraries = ["HSmypkg_cbits"],
include_dirs = [],
(for linking) when this package is being used.</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>framework_dirs</literal></term>
+ <indexterm><primary><literal>framework_dirs</literal></primary>
+ <secondary>package specification</secondary></indexterm>
+ <listitem>
+ <para>On Darwin/MacOS X, a list of directories containing frameworks for this
+ package. This corresponds to the <option>-framework-path</option> option.
+ It is ignored on all other platforms.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>extra_frameworks</literal></term>
+ <indexterm><primary><literal>extra_frameworks</literal></primary>
+ <secondary>package specification</secondary></indexterm>
+ <listitem>
+ <para>On Darwin/MacOS X, a list of frameworks to link to. This corresponds to the
+ <option>-framework</option> option. Take a look at Apple's developer documentation
+ to find out what frameworks actually are. This entry is ignored on all other platforms.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
+
+ <para>
+ The <literal>ghc-pkg</literal> tool performs expansion of
+ environment variables occurring in input package specifications.
+ So, if the <literal>mypkg</literal> was added to the package
+ database as follows:
+ </para>
+<screen>
+ $ installdir=/usr/local/lib ghc-pkg -a < mypkg.pkg
+</screen>
+
+ <para>
+ The occurrence of <literal>${installdir}</literal> is replaced
+ with <literal>/usr/local/lib</literal> in the package data that
+ is added for <literal>mypkg</literal>.
+ </para>
+
+ <para>
+ This feature enables the distribution of package specification
+ files that can be easily configured when installing.
+ </para>
<para>For examples of more package specifications, take a look
at the <literal>package.conf</literal> in your GHC