Index: head/en_US.ISO8859-1/books/porters-handbook/special/chapter.xml =================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/special/chapter.xml +++ head/en_US.ISO8859-1/books/porters-handbook/special/chapter.xml @@ -1368,6 +1368,111 @@ ${PREFIX}/sbin. + + + Building <application>Haskell</application> + Applications with <command>cabal</command> + + For ports that use Cabal, + build system defines USES=cabal. Refer to for a list of variables that can be + set to control the build process. + + + Creating a Port for a Hackage-hosted Haskell + Application + + When preparing a Haskell Cabal port, the + devel/hs-cabal-install 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: + + PORTNAME= ShellCheck +DISTVERSION= 0.6.0 +CATEGORIES= devel + +MAINTAINER= haskell@FreeBSD.org +COMMENT= Shell script analysis tool + +USES= cabal + +.include <bsd.port.mk> + + This minimal Makefile allows us to fetch the distribution file: + + &prompt.user; make cabal-extract +[...] +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/ + + Now we have ShellCheck.cabal package description file, + which allows us to fetch all package's dependencies, + including transitive ones: + + &prompt.user; make cabal-extract-deps +[...] +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 +[...] + + 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: + + &prompt.user; make make-use-cabal +USE_CABAL=QuickCheck-2.12.6.1 \ +hashable-1.3.0.0 \ +integer-logarithms-1.0.3 \ +[...] + + Haskell packages may contain revisions, just like + FreeBSD ports. Revisions can affect only .cabal + files, but it is still important to pull them in. + To check USE_CABAL items for available + revision updates, run following command: + + &prompt.user; make make-use-cabal-revs +USE_CABAL=QuickCheck-2.12.6.1_1 \ +hashable-1.3.0.0 \ +integer-logarithms-1.0.3_2 \ +[...] + + Note additional version numbers after _ + symbol. Put newly generated USE_CABAL list + instead of an old one. + + Finally, distinfo needs to be regenerated to + contain all the distribution files: + + &prompt.user; make makesum +=> 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 +[...] + + 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. + + If you are not testing your port in a clean environment + like with Poudriere, remember to + run make clean before any testing. + + + @@ -7137,6 +7242,15 @@ at the time of upstream development/release. + + + + Haskell Libraries + + 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. Index: head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml =================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml +++ head/en_US.ISO8859-1/books/porters-handbook/uses/chapter.xml @@ -235,6 +235,109 @@ dependencies. + + <literal>cabal</literal> + + + Ports should not be created for Haskell libraries, see + for more information. + + + Possible arguments: (none), hpack + + Sets default values and targets used to build + Haskell software using Cabal. + A build dependency on the Haskell compiler port (GHC) + is added. If hpack argument is given, + a build dependency on devel/hs-hpack + is added and hpack is invoked at + configuration step to generate .cabal file. + + The framework provides the following variables: + + + + USE_CABAL + + + If the software uses Haskell dependencies, list them in + this variable. Each item should be present on Hackage and + be listed in form packagename-0.1.2. + Dependencies can have revisions, which are specified after the + _ symbol. Automatic generation of dependency + list is supported, see . + + + + + CABAL_FLAGS + + + List of flags to be passed to cabal-install + during the configuring and building stage. The flags are + passed verbatim. + + + + + EXECUTABLES + + + List of executable files installed by the port. + Default value: ${PORTNAME}. + Items from this list are automatically added to pkg-plist. + + + + + SKIP_CABAL_PLIST + + + If defined, do not add items from + ${EXECUTABLES} to pkg-plist. + + + + + opt_USE_CABAL + + + Adds items to ${USE_CABAL} + depending on opt option. + + + + + opt_EXECUTABLES + + + Adds items to ${EXECUTABLES} + depending on opt option. + + + + + opt_CABAL_FLAGS + + + If is enabled, append the value + to ${CABAL_FLAGS}. Otherwise, append + -value to disable the flag. + + + + + FOO_DATADIR_VARS + + + For an executable named FOO + list Haskell packages, whose data files + should be accessible by the executable. + + + + + <literal>cargo</literal>