Changeset View
Changeset View
Standalone View
Standalone View
head/en_US.ISO8859-1/books/porters-handbook/special/chapter.xml
Show First 20 Lines • Show All 1,362 Lines • ▼ Show 20 Lines | [...]</screen> | ||||
<para>will install <literal>ipfs</literal> binary as | <para>will install <literal>ipfs</literal> binary as | ||||
<literal>${PREFIX}/bin/ipfs-go</literal> and</para> | <literal>${PREFIX}/bin/ipfs-go</literal> and</para> | ||||
<programlisting>GO_TARGET= ./dnscrypt-proxy:${PREFIX}/sbin/dnscrypt-proxy</programlisting> | <programlisting>GO_TARGET= ./dnscrypt-proxy:${PREFIX}/sbin/dnscrypt-proxy</programlisting> | ||||
<para>will install <literal>dnscrypt-proxy</literal> to | <para>will install <literal>dnscrypt-proxy</literal> to | ||||
<literal>${PREFIX}/sbin</literal>.</para> | <literal>${PREFIX}/sbin</literal>.</para> | ||||
</example> | </example> | ||||
</sect2> | </sect2> | ||||
<sect2 xml:id="using-cabal"> | |||||
<title>Building <application>Haskell</application> | |||||
Applications with <command>cabal</command></title> | |||||
<para>For ports that use <application>Cabal</application>, | |||||
build system defines <literal>USES=cabal</literal>. Refer to <xref | |||||
linkend="uses-cabal"/> for a list of variables that can be | |||||
set to control the build process.</para> | |||||
<example xml:id="cabal-ex1"> | |||||
<title>Creating a Port for a Hackage-hosted Haskell | |||||
Application</title> | |||||
<para>When preparing a Haskell Cabal port, the | |||||
<package role="port">devel/hs-cabal-install</package> program is | |||||
required, so make sure it is installed beforehand. First we need | |||||
to define common ports variables that allows | |||||
cabal-install to fetch the package distribution file:</para> | |||||
<programlisting>PORTNAME= ShellCheck | |||||
DISTVERSION= 0.6.0 | |||||
CATEGORIES= devel | |||||
MAINTAINER= haskell@FreeBSD.org | |||||
COMMENT= Shell script analysis tool | |||||
USES= cabal | |||||
.include <bsd.port.mk></programlisting> | |||||
<para>This minimal Makefile allows us to fetch the distribution file:</para> | |||||
<screen>&prompt.user; <userinput>make cabal-extract</userinput> | |||||
[...] | |||||
Downloading the latest package list from hackage.haskell.org | |||||
cabal get ShellCheck-0.6.0 | |||||
Downloading ShellCheck-0.6.0 | |||||
Downloaded ShellCheck-0.6.0 | |||||
Unpacking to ShellCheck-0.6.0/</screen> | |||||
<para>Now we have ShellCheck.cabal package description file, | |||||
which allows us to fetch all package's dependencies, | |||||
including transitive ones:</para> | |||||
<screen>&prompt.user; <userinput>make cabal-extract-deps</userinput> | |||||
[...] | |||||
Resolving dependencies... | |||||
Downloading base-orphans-0.8.2 | |||||
Downloaded base-orphans-0.8.2 | |||||
Downloading primitive-0.7.0.0 | |||||
Starting base-orphans-0.8.2 (lib) | |||||
Building base-orphans-0.8.2 (lib) | |||||
Downloaded primitive-0.7.0.0 | |||||
Downloading dlist-0.8.0.7 | |||||
[...]</screen> | |||||
<para>As a side effect, the package's dependencies are | |||||
also compiled, so the command may take some time. | |||||
Once done, a list of required dependencies can generated:</para> | |||||
<screen>&prompt.user; <userinput>make make-use-cabal</userinput> | |||||
USE_CABAL=QuickCheck-2.12.6.1 \ | |||||
hashable-1.3.0.0 \ | |||||
integer-logarithms-1.0.3 \ | |||||
[...]</screen> | |||||
<para>Haskell packages may contain revisions, just like | |||||
FreeBSD ports. Revisions can affect only <filename>.cabal</filename> | |||||
files, but it is still important to pull them in. | |||||
To check <varname>USE_CABAL</varname> items for available | |||||
revision updates, run following command:</para> | |||||
<screen>&prompt.user; <userinput>make make-use-cabal-revs</userinput> | |||||
USE_CABAL=QuickCheck-2.12.6.1_1 \ | |||||
hashable-1.3.0.0 \ | |||||
integer-logarithms-1.0.3_2 \ | |||||
[...]</screen> | |||||
<para>Note additional version numbers after <literal>_</literal> | |||||
symbol. Put newly generated <varname>USE_CABAL</varname> list | |||||
instead of an old one.</para> | |||||
<para>Finally, <filename>distinfo</filename> needs to be regenerated to | |||||
contain all the distribution files:</para> | |||||
<screen>&prompt.user; <userinput>make makesum</userinput> | |||||
=> ShellCheck-0.6.0.tar.gz doesn't seem to exist in /usr/local/poudriere/ports/git/distfiles/cabal. | |||||
=> Attempting to fetch https://hackage.haskell.org/package/ShellCheck-0.6.0/ShellCheck-0.6.0.tar.gz | |||||
ShellCheck-0.6.0.tar.gz 136 kB 642 kBps 00s | |||||
=> QuickCheck-2.12.6.1/QuickCheck-2.12.6.1.tar.gz doesn't seem to exist in /usr/local/poudriere/ports/git/distfiles/cabal. | |||||
=> Attempting to fetch https://hackage.haskell.org/package/QuickCheck-2.12.6.1/QuickCheck-2.12.6.1.tar.gz | |||||
QuickCheck-2.12.6.1/QuickCheck-2.12.6.1.tar.gz 65 kB 361 kBps 00s | |||||
[...]</screen> | |||||
<para>The port is now ready for a test build and further | |||||
adjustments like creating a plist, writing a description, | |||||
adding license information, options, etc. as normal.</para> | |||||
<para>If you are not testing your port in a clean environment | |||||
like with <application>Poudriere</application>, remember to | |||||
run <command>make clean</command> before any testing.</para> | |||||
</example> | |||||
</sect2> | |||||
</sect1> | </sect1> | ||||
<sect1 xml:id="using-autotools"> | <sect1 xml:id="using-autotools"> | ||||
<title>Using GNU Autotools</title> | <title>Using GNU Autotools</title> | ||||
<para>If a port needs any of the GNU Autotools software, add | <para>If a port needs any of the GNU Autotools software, add | ||||
<literal>USES=autoreconf</literal>. See <xref | <literal>USES=autoreconf</literal>. See <xref | ||||
linkend="uses-autoreconf"/> for more information.</para> | linkend="uses-autoreconf"/> for more information.</para> | ||||
▲ Show 20 Lines • Show All 5,753 Lines • ▼ Show 20 Lines | case of go.mod, vendor.json or similar).</para> | ||||
</listitem> | </listitem> | ||||
<listitem> | <listitem> | ||||
<para>As a last resort (deps are not included nor versions | <para>As a last resort (deps are not included nor versions | ||||
specified exactly) fetch versions of dependencies available | specified exactly) fetch versions of dependencies available | ||||
at the time of upstream development/release.</para> | at the time of upstream development/release.</para> | ||||
</listitem> | </listitem> | ||||
</itemizedlist> | </itemizedlist> | ||||
</sect1> | |||||
<sect1 xml:id="haskell-libs"> | |||||
<title>Haskell Libraries</title> | |||||
<para>Just like in case of Go language, Ports must not package or | |||||
install Haskell libraries. Haskell ports must link statically | |||||
to their dependencies and fetch all distribution files on | |||||
fetch stage.</para> | |||||
</sect1> | </sect1> | ||||
<sect1 xml:id="shell-completion"> | <sect1 xml:id="shell-completion"> | ||||
<title>Shell Completion Files</title> | <title>Shell Completion Files</title> | ||||
<para>Many modern shells (including bash, tcsh, and zsh) support | <para>Many modern shells (including bash, tcsh, and zsh) support | ||||
parameter and/or option tab-completion. This support usually | parameter and/or option tab-completion. This support usually | ||||
comes from completion files, which contain the definitions for | comes from completion files, which contain the definitions for | ||||
Show All 31 Lines |