xref: /openbsd/share/man/man5/cabal-module.5 (revision 73471bf0)
1.\"	$OpenBSD: cabal-module.5,v 1.2 2021/07/25 11:29:42 espie Exp $
2.\"
3.\" Copyright (c) 2021 Greg Steuck
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: July 25 2021 $
28.Dt CABAL-MODULE 5
29.Os
30.Sh NAME
31.Nm cabal-module
32.Nd devel/cabal port module for building Haskell programs
33.Sh DESCRIPTION
34This manual page documents the behavior of setting
35.Li MODULES=devel/cabal
36in the
37.Xr ports 7
38tree.
39.Pp
40Uses
41.Xr cabal 1
42to automate packaging Haskell binary projects.
43During
44.Cm fetch ,
45the dependent packages enumerated in
46.Ev MODCABAL_MANIFEST
47are downloaded into the
48.Pa hackage
49subdirectory of
50.Ev DIST_SUBDIR .
51During
52.Cm post-extract ,
53the dependency sources are unpacked into
54.Ev WORKDIR .
55Special care is taken to replace .cabal files if they are updated
56post-release on hackage.
57A custom
58.Pa cabal.project.local
59file gets created to direct
60.Xr cabal 1
61to the extracted packages and prevent any network interaction.
62In rare cases a custom
63.Pa cabal.project
64is required.
65This module automatically copies such files from port's
66.Pa files
67into
68.Ev WRKSRC .
69During
70.Cm build ,
71.Xr cabal 1
72is invoked to build the executables listed in
73.Ev MODCABAL_EXECUTABLES .
74.Pp
75.Pa lang/ghc
76and
77.Pa devel/cabal-install
78are added to
79.Ev BUILD_DEPENDS .
80This module uses
81.Ev MASTER_SITES9
82to download the sources from hackage.
83.Pp
84This module parameters:
85.Bl -tag -width MODCABAL_EXECUTABLES
86.It MODCABAL_STEM
87Name of the package on hackage (required).
88.It MODCABAL_VERSION
89Version of the package (required).
90.It MODCABAL_MANIFEST
91Hackage dependencies required by this package, see below.
92.It MODCABAL_DATA_DIR
93data-dir from .cabal file (if executable needs this)
94.It MODCABAL_REVISION
95Numeric revision of .cabal file on hackage if one is
96needed on top of .cabal file contained in the .tar.gz file.
97.It MODCABAL_BUILD_ARGS
98passed to cabal v2-build
99.It MODCABAL_FLAGS
100custom feature
101.Fl -flags
102for
103.Xr cabal 1 .
104.It MODCABAL_EXECUTABLES
105Executable target in .cabal file, defaults to hackage package name in
106.Ev MODCABAL_STEM .
107.El
108.Pp
109This module adds currently adds no
110.Xr make 1
111targets.
112.Sh DEPENDENCY MANIFEST
113Hackage dependencies are listed in
114.Ev MODCABAL_MANIFEST
115as space separate triples of
116.Em package
117.Em version
118.Em revision .
119They correspond to the main package values of
120.Ev MODCABAL_STEM
121.Ev MODCABAL_VERSION
122.Ev MODCABAL_REVISION .
123.Pp
124The contents of
125.Ev MODCABAL_MANIFEST
126is normally generated by
127.Pa devel/cabal-bundler
128which creates a working build plan from hackage dependency information.
129.Sh EXAMPLES
130To create a new Haskell binary port one would install cabal-bundler
131port, look up the chosen package version number on hackage.
132E.g.
133.Pp
134$
135.Cm cabal-bundler
136.Fl -openbsd
137.Ar cpphs-1.20
138.Sh SEE ALSO
139.Xr cabal 1 ,
140.Xr port-modules 5
141