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