summaryrefslogtreecommitdiff
path: root/share/man/man5/port-modules.5
blob: 49d3a5d465df795c06da967ed704501d7132dc0c (plain)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
.\"	$OpenBSD: port-modules.5,v 1.38 2009/05/19 21:24:43 sthen Exp $
.\"
.\" Copyright (c) 2008 Marc Espie
.\"
.\" 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: May 19 2009 $
.Dt PORT-MODULES 5
.Os
.Sh NAME
.Nm port-modules
.Nd format and conventions used in port modules
.Sh DESCRIPTION
The
.Ox
Ports framework is based on a gigantic makefile named
.Xr bsd.port.mk 5 .
.Pp
In order to curb unwieldy growth, parts of the framework
that are not always needed have been set apart in optional
files called
.Nm port modules ,
which are retrieved as needed through the
.Ev MODULES
variable of
.Xr bsd.port.mk 5 .
.Pp
Some of these modules correspond to basic mechanisms which are not
always needed, such as GNU autoconf, or perl5.
.Pp
Other modules correspond to shortcuts for using some other ports as
dependencies without needing to hardcode too much, such as libiconv or
the qt ports.
.Sh THE MODULES LOOK-UP MECHANISM
The variable
.Ev MODULES
should contain a list of module names.
Some core modules are a single word, all other modules should be
${PKGPATH}.
If the module is
.Pa some/dir/portname ,
the ports framework will look for a file named
.Pa ${PORTSDIR}/some/dir/portname/portname.port.mk
and include it.
.Pp
Most modules should conform to this syntax.
The historic practice of having a redirection file directly under
.Pa ${PORTSDIR}/infrastructure/mk
is deprecated for new modules.
.Pp
Modules may refer to each other.
The modules mechanism has specific recursion handling such that
adding
.Li MODULES += foo/bar
to a module will work as expected.
.Sh NAMING CONVENTIONS
Since there is no actual scope in makefiles, everything defined within
a module will be global to the ports framework, and thus may interfere
with other ports.
.Pp
As far as possible, all variables and targets belonging to a module named
.Pa some/dir/foo
should be named
.Ev MODFOO_*
and
.Ar modfoo_* .
.Pp
Following the same conventions as
.Xr bsd.port.mk 5 ,
internal variables and targets not intended for user consumption should be
named
.Ev _MODFOO_*
and
.Ar _modfoo_* .
.Pp
For instance, if a module wants some value to be available for the rest
of the world, it should define
.Ev MODFOO_VARNAME ,
with a name matching the basic infrastructure as far as possible.
That is, a port that defines specific dependencies will usually
define
.Ev MODFOO_WANTLIB ,
.Ev MODFOO_LIB_DEPENDS ,
and
.Ev MODFOO_RUN_DEPENDS ,
as appropriate.
.Pp
As an exception to the naming mechanism, some ports have several distinct
versions in the ports tree, say
.Pa x11/qt2 ,
.Pa x11/qt3 ,
and
.Pa x11/qt4 .
Instead of using the namespace
.Ev MODQT2* ,
variables will usually drop the version suffix and be simply called
.Ev MODQT_*
so that a port using the module can be switched from version to version
without needing to change everything.
.Pp
It is highly desirable to define names in both namespaces for such ports,
for example to define both
.Ev MODQT3_LIB_DEPENDS
and
.Ev MODQT_LIB_DEPENDS .
Normal client ports will use
.Ev MODQT_LIB_DEPENDS ,
but a port may exceptionally import both modules with
.Li MODULES += x11/qt3 x11/qt4
and differentiate between qt3 and qt4 needs with
.Ev MODQT3_LIB_DEPENDS
and
.Ev MODQT4_LIB_DEPENDS .
See
.Pa print/poppler
for an example.
.Sh OVERRIDING TARGET BEHAVIOR
The main framework contains several hooks that allow ports to override
normal behavior.
This evolved as an ad-hoc framework, where only hooks that turned out
to be needed were added.
If several modules define the same hook, hook behaviors will be
invoked in sequence.
.Bl -tag -width do-configure
.It Ar patch
There is a
.Ar post-patch
hook that can be activated by defining
.Ev MODFOO_post-patch .
It will be run right after
.Ar post-patch
and before
.Ev REORDER_DEPENDENCIES
touches things.
.It Ar configure
The normal
.Ar do-configure
behavior is to invoke all
.Ev MODFOO_configure
contents that are defined in
.Ev CONFIGURE_STYLE .
By default,
.Ar configure
will do nothing.
Some
.Ev CONFIGURE_STYLE
values, namely perl, gnu, imake, automake, autoconf, and autoupdate
will automatically import the correct module.
User-defined modules must both add to
.Ev CONFIGURE_STYLE
and import the correct module to override behavior.
Contrary to other hooks, module behavior is not invoked in
addition to
.Ar do-configure ,
but as the normal configure process.
If
.Ar do-configure
is overridden, normal hook processing will not happen.
.It Ar fake
There is a
.Ar pre-fake
hook that can be activated by defining
.Ev MODFOO_pre-fake .
This will be invoked right after
.Xr mtree 8 ,
and before the normal
.Ar pre-fake
behavior.
.It Ar install
There is a
.Ar pre-install
hook that can be activated by defining
.Ev MODFOO_pre-install .
It will be run right before installing the package with
.Xr pkg_add 1 .
.El
.Sh OVERRIDING VARIABLE BEHAVIOR
Some variables can be overridden by modules.
Be very cautious, as this can make the module difficult to use,
or interact badly with other modules.
As a rule, always provide the override as:
.Pp
.Dl VARIABLE ?= value
.Pp
and provide a module-specific variable with the same value:
.Pp
.Dl MODFOO_VARIABLE = value .
.Pp
The following variables can be overridden in a relatively safe fashion:
.Ev ALL_TARGET ,
.Ev CONFIGURE_SCRIPT ,
.Ev DESTDIRNAME ,
.Ev DIST_SUBDIR ,
.Ev DISTNAME ,
.Ev DISTFILES ,
.Ev EXTRACT_SUFX ,
.Ev FAKE_FLAGS ,
.Ev FETCH_MANUALLY ,
.Ev HOMEPAGE ,
.Ev IGNORE ,
.Ev IS_INTERACTIVE ,
.Ev LIBTOOL_FLAGS ,
.Ev MAKE_FILE ,
.Ev MASTER_SITES ,
.Ev MULTI_PACKAGES ,
.Ev NO_BUILD ,
.Ev NO_REGRESS ,
.Ev PATCH_LIST ,
.Ev PKG_ARCH ,
.Ev PKGNAME* ,
.Ev PREFIX ,
.Ev REGRESS_TARGET ,
.Ev REGRESS_IS_INTERACTIVE ,
.Ev REORDER_DEPENDENCIES ,
.Ev SEPARATE_BUILD ,
.Ev SHARED_ONLY ,
.Ev USE_GMAKE ,
.Ev USE_LIBTOOL ,
.Ev USE_MOTIF .
.Pp
The following variables can be added to in a relatively safe fashion:
.Ev BUILD_DEPENDS ,
.Ev CATEGORIES ,
.Ev CONFIGURE_ARGS ,
.Ev CONFIGURE_ENV ,
.Ev ERRORS ,
.Ev FAKE_FLAGS ,
.Ev FLAVOR ,
.Ev FLAVORS ,
.Ev INSTALL_TARGET ,
.Ev LIB_DEPENDS ,
.Ev MAKE_ENV ,
.Ev MAKE_FLAGS ,
.Ev PKG_ARGS ,
.Ev PSEUDO_FLAVORS ,
.Ev REGRESS_DEPENDS ,
.Ev REORDER_DEPENDENCIES ,
.Ev RUN_DEPENDS ,
.Ev SUBST_VARS ,
.Ev WANTLIB .
.Sh SPECIFIC MODULE INTERACTIONS
Some modules correspond to extra ports that will be used mostly as
.Ev BUILD_DEPENDS
or
.Ev RUN_DEPENDS .
Such modules can safely append values directly to the
.Ev BUILD_DEPENDS ,
.Ev RUN_DEPENDS ,
.Ev LIB_DEPENDS ,
and
.Ev WANTLIB
variables, as long as they also define module-specific variables for
all runtime dependencies.
.Pp
Simple client ports will use the module directly, and thus inherit extra
build and runtime dependencies.
.Pp
More sophisticated ports can use
.Ev MULTI_PACKAGES
to select specific behavior: build-time dependencies will always be
needed.
Runtime dependencies will be selected on a subpackage basis,
since runtime dependencies such as
.Ev LIB_DEPENDS-sub
do not inherit the default
.Ev LIB_DEPENDS
value.
The client port's author must only bear in mind that external modules
may add values to the default
.Ev WANTLIB ,
.Ev LIB_DEPENDS ,
and
.Ev RUN_DEPENDS ,
and thus that it is not safe to inherit from it blindly.
.Pp
Modules are imported during
.Pp
.Dl .include <bsd.port.mk>
.Pp
Thus they can be affected by user choices such as setting a variable
to Yes or No.
Modules may make decisions based on documented
.Ev MODFOO_BEHAVIOR
values.
.Pp
When modules are processed, only a few
.Xr bsd.port.mk 5
variables are already defined.
Modules may depend upon the following variables already having a sane
value:
.Ev ARCH ,
.Ev DISTDIR ,
.Ev LOCALBASE ,
.Ev LP64_ARCHS ,
.Ev NO_DEPENDS ,
.Ev NO_SHARED_ARCHS ,
.Ev NO_SHARED_LIBS ,
.Ev PKGPATH ,
.Ev PORTSDIR ,
.Ev USE_X11 ,
.Ev X11BASE .
Note that this is only relevant for tests.
It is perfectly okay to define variables or targets that depend on the
basic ports framework without having to care whether that variable is
already defined, since
.Xr make 1
performs lazy evaluation.
.Sh CORE MODULES DOCUMENTATION
The following modules are available.
.Bl -tag -width do-configure
.It apache-module
.It converters/libiconv
.It cpan
For perl ports coming from CPAN.
Wrapper around the normal perl module that fetches the file from
the correct location depending on DISTNAME, and sets a default
PKGNAME.
Also affects REGRESS_DEPENDS, CONFIGURE_STYLE, PKG_ARCH, and CATEGORIES.
.Pp
Some CPAN modules are only indexed by author, set CPAN_AUTHOR=ID
to locate the right directory.
.Pp
User settings: set CPAN_REPORT to Yes, CPAN_REPORT_DB to a valid directory,
and CPAN_REPORT_FROM to a valid email address to automate the reporting
of regress tests to CPAN.
.It devel/cmake
.It devel/gettext
.It devel/pmk
Sets CONFIGURE_SCRIPT, CONFIGURE_ARGS and MODPMK_configure.
It appends
.Pa devel/pmk
to BUILD_DEPENDS.
.It devel/scons
.It devel/waf
Adds
.Pa devel/waf
to BUILD_DEPENDS,
.Pa lang/python
to MODULES, and provides do-configure, do-build, do-install and
post-install targets.
do-build, do-install and post-install can be overridden in the port
Makefile.
.It gcc3
If USE_GCC3=No (defined by
.Pa /usr/share/mk/bsd.own.mk ) ,
and architecture is in MODGCC3_ARCHES, then the gcc 3.3.6
compilers will be put at the front of the path.
By default, only C language support is included by this module.
If other languages are needed, they must be listed in MODGCC3_LANGS
(e.g. c++, g77).
.It gcc4
If USE_GCC4=No (the default), and architecture is in
MODGCC4_ARCHES, then the gcc 4.2 compilers will be put at the front of
the path.
By default, only C language support is included by this module.
If other languages are needed, they must be listed in MODGCC4_LANGS
(e.g. c++, g77).
.It gnu
This module is documented in the main
.Xr bsd.port.mk 5
manpage.
.It imake
This module is documented in the main
.Xr bsd.port.mk 5
manpage.
.It java
Set MODJAVA_VER=x.y to use exactly the JDK x.y, MODJAVA_VER=x.y+ to
use any x.y or higher version.
Set MODJAVA_JRERUN=Yes if the port only needs the JRE at runtime.
The module sets JAVA_HOME, ONLY_FOR_ARCHS, MODJAVA_RUN_DEPENDS, and
appends to BUILD_DEPENDS and RUN_DEPENDS.
It heeds NO_BUILD.
.It lang/ghc
Sets ONLY_FOR_ARCHS, MODGHC_VERSION, BUILD_DEPENDS, and RUN_DEPENDS.
.It lang/lua
Appends to RUN_DEPENDS and CATEGORIES.
Also appends to BUILD_DEPENDS,
unless NO_BUILD has been set to Yes.
.It lang/mono
.It lang/ocaml
Sets OCAML_VERSION, MODOCAML_NATIVE.
Appends to BUILD_DEPENDS and MAKE_ENV.
This also selects a %%native%% plist fragment depending on whether
the architecture supports native compilation or not.
.It lang/python
Sets MODPY_VERSION, MODPY_BIN, MODPY_INCDIR, MODPY_LIBDIR, MODPY_SITEPKG,
MODPY_SETUP, MODPY_LIB_DEPENDS, MODPY_RUN_DEPENDS, MODPY_BUILD_DEPENDS.
Appends to RUN_DEPENDS unless MODPY_RUNDEP is set to No.
MODPY_VERSION is the default version used by all python modules.
Ports which use the setuptools module should set MODPY_SETUPTOOLS to Yes.
All ports that generate egg-info files should set MODPY_EGG_VERSION
to the version string used by the port's setup.py setup() function.
Extra arguments to the build and install commands can be passed via
MODPY_DISTUTILS_BUILDARGS and MODPY_DISTUTILS_INSTALLARGS.
Also affects CATEGORIES, MAKE_ENV, CONFIGURE_ENV, SHARED_ONLY, and SUBST_VARS.
May affect the regress target.
.It lang/ruby
Sets MODRUBY_REV, RUBY, MODRUBY_RUN_DEPENDS, MODRUBY_LIB_DEPENDS,
MODRUBY_LIBDIR, MODRUBY_DOCDIR, MODRUBY_EXAMPLEDIR, MODRUBY_ARCH.
Appends to BUILD_DEPENDS, RUN_DEPENDS, CATEGORIES and SUBST_VARS.
.It lang/tcl
Sets MODTCL_VERSION, MODTCL_BIN, MODTCL_INCDIR, MODTCL_LIBDIR,
MODTCL_BUILD_DEPENDS, MODTCL_RUN_DEPENDS, MODTCL_LIB, MODTCL_LIB_DEPENDS,
and MODTCL_CONFIG.
MODTCL_VERSION is the default version used by all Tcl ports and
may be overridden.
Provides MODTCL_TCLSH_ADJ and MODTCL_WISH_ADJ shell fragments to
patch the interpreter path in executable scripts.
Also affects CATEGORIES and SUBST_VARS.
.It perl
This module is documented in the main
.Xr bsd.port.mk 5
manpage.
.It textproc/intltool
Sets MODINTLTOOL_OVERRIDE.
.Pa textproc/intltool
is added to BUILD_DEPENDS.
MODINTLTOOL_OVERRIDE changes the paths of INTLTOOL_EXTRACT, INTLTOOL_MERGE and
INTLTOOL_UPDATE to use the installed versions of intltool-extract,
intltool-merge and intltool-update, instead of the version's packages into the
distfile of the port using this module.
Also affects CONFIGURE_ENV, MAKE_ENV and MAKE_FLAGS by appending
MODINTLTOOL_OVERRIDE to them.
.It www/drupal5
.It www/drupal6
.It www/pear
.It www/plone
.It www/zope
.It x11/gnome
Sets DESKTOP_FILES, EXTRACT_SUFX, MODGNOME_HELP_FILES, MODGNOME_BUILD_DEPENDS,
MODGNOME_RUN_DEPENDS, and USE_GMAKE.
EXTRACT_SUFX defaults to .tar.bz2.
Also affects CATEGORIES.
If DESKTOP_FILES=Yes, a dependency on
.Pa devel/desktop-file-utils
is appended
to MODGNOME_RUN_DEPENDS.
If MODGNOME_HELP_FILES=Yes, then
.Pa x11/gnome/yelp
is appended to MODGNOME_RUN_DEPENDS and
.Pa x11/gnome/doc-utils
is appended to MODGNOME_BUILD_DEPENDS.
This option is to be used when .xml GNOME help files are installed into
.Pa share/gnome/help/ .
Unless NO_BUILD=Yes, USE_LIBTOOL is set to Yes and
.Pa textproc/intltool
is appended to MODULES.
.Pp
MASTER_SITES and DISTNAME are built using GNOME_PROJECT and
GNOME_VERSION.
.It x11/gnustep
.It x11/kde
.It x11/qt2
.It x11/qt3
.It x11/qt4
.It x11/tk
Sets MODTK_VERSION, MODTK_BIN, MODTK_INCDIR, MODTK_LIBDIR,
MODTK_BUILD_DEPENDS, MODTK_RUN_DEPENDS, MODTK_LIB, MODTK_LIB_DEPENDS,
and MODTK_CONFIG.
MODTK_VERSION is the default version used by all Tk ports and
may be overridden.
Automatically adds the lang/tcl module, provides a default
MODTCL_VERSION to match MODTK_VERSION, and affects CATEGORIES,
SUBST_VARS, and USE_X11.
Note the MODTCL_WISH_ADJ shell fragment in the lang/tcl module.
.It x11/xfce4
Sets DIST_SUBDIR, EXTRACT_SUFX, CONFIGURE_STYLE,
CONFIGURE_ENV, USE_X11 and USE_GMAKE.
If DESKTOP_FILES is set to yes, it adds
.Pa devel/desktop-file-utils
to RUN_DEPENDS.
Unless XFCE_NO_SRC is set, USE_LIBTOOL is set to yes and
.Pa devel/gettext
and
.Pa textproc/intltool
are added to MODULES.
Also affects CATEGORIES.
.Pp
Xfce ports can be divided into three categories: core libraries and
applications, goodies, and panel plugins.
HOMEPAGE, MASTER_SITES and DISTNAME are built using XFCE_VERSION (which
defaults to XFCE_DESKTOP_VERSION if not set) and either XFCE_PROJECT,
XFCE_GOODIE or XFCE_PLUGIN.
One of the latter has to be provided by the port Makefile.
.El
.Sh SEE ALSO
.Xr make 1 ,
.Xr bsd.port.mk 5 ,
.Xr ports 7