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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
|
.\" $OpenBSD: port-modules.5,v 1.249 2020/12/12 15:13:28 rsadowski 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: December 12 2020 $
.Dt PORT-MODULES 5
.Os
.Sh NAME
.Nm port-modules
.Nd documentation 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
For convenience, setting
.Ev CONFIGURE_STYLE
in a port's main Makefile is enough to get perl5 or autoconf support, but
.Ar gnu ,
.Ar imake
and
.Ar perl5
are actually modules, and there is some glue in
.Xr bsd.port.mk 5
that magically adds the required module in that case.
This doesn't work when parsing modules.
For instance, if you set
.Li CONFIGURE_STYLE=gnu
in a module, you also need to
.Li MODULES += gnu .
.Pp
Other modules correspond to shortcuts for using some other ports as
dependencies without needing to hardcode too much, such as
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/qt3
and
.Pa x11/qt4 .
Instead of using the namespace
.Ev MODQT3* ,
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 Cm extract
There is a
.Cm post-extract
hook that can be activated by defining
.Ev MODFOO_post-extract .
It will be run right after
.Cm post-extract .
.It Cm patch
There is a
.Cm post-patch
hook that can be activated by defining
.Ev MODFOO_post-patch .
It will be run right after
.Cm post-patch .
.It Cm gen
There is a
.Cm gen
hook that can be activated by defining
.Ev MODFOO_gen .
It will be run right after
.Cm do-gen
and before
.Ev REORDER_DEPENDENCIES
touches things.
.It Cm configure
There is a
.Cm pre-configure
hook that can be activated by defining
.Ev MODFOO_pre-configure .
It will be run right after
.Cm pre-configure .
The normal
.Cm do-configure
behavior is to invoke all
.Ev MODFOO_configure
contents that are defined in
.Ev CONFIGURE_STYLE .
By default,
.Cm configure
will do nothing.
.Pp
Some
.Ev CONFIGURE_STYLE
values, namely perl, gnu, imake, and autoconf,
will automatically import the correct module.
User-defined modules must both add to
.Ev CONFIGURE_STYLE
and import the correct module to override behavior.
.Pp
Contrary to other hooks, module behavior is not invoked in
addition to
.Cm do-configure ,
but as the normal configure process.
If
.Cm do-configure
is overridden, normal hook processing will not happen.
.It Cm fake
There is a
.Cm 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
.Cm pre-fake
behavior.
.Pp
This can occasionally be used for ports that require some specific
fake installation setup that will be provided by runtime dependencies.
.It Cm install
There is a
.Cm post-install
hook that can be activated by defining
.Ev MODFOO_post-install .
This will be invoked at the end of
.Cm install ,
right after the normal
.Cm post-install
behavior.
.El
.Pp
Some targets, such as
.Cm do-build
or
.Cm do-install ,
can't be overridden simply.
A module that, for instance, requires specific
.Cm do-build
behavior should do so in two steps:
.Bl -bullet
.It
Define a variable named
.Ev MODFOO_BUILD_TARGET
that contains the commands necessary for
.Cm do-build :
.Bd -literal -offset indent
MODFOO_BUILD_TARGET = cmd1; cmd2
.Ed
.It
Override
.Cm do-build
only if it's not already defined by the port proper:
.Bd -literal -offset indent
\&.if !target(do-build)
do-build:
@${MODFOO_BUILD_TARGET}
\&.endif
.Ed
.El
That way, if several modules require specific actions for those targets,
the end user can choose the appropriate order in which to run the actions:
.Bd -literal -offset indent
do-build:
@${MODBAR_BUILD_TARGET}
@${MODFOO_BUILD_TARGET}
...
.Ed
.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_TEST ,
.Ev PATCH_LIST ,
.Ev PKG_ARCH ,
.Ev PKGNAME* ,
.Ev PREFIX ,
.Ev TEST_TARGET ,
.Ev TEST_IS_INTERACTIVE ,
.Ev REORDER_DEPENDENCIES ,
.Ev SEPARATE_BUILD ,
.Ev USE_GMAKE ,
.Ev USE_LIBTOOL .
.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 TEST_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 DISTDIR ,
.Ev LOCALBASE ,
.Ev NO_DEPENDS ,
.Ev PKGPATH ,
.Ev PORTSDIR ,
.Ev X11BASE
and all arch-dependent constants from
.Xr bsd.port.arch.mk 5 ,
such as
.Ev PROPERTIES
or
.Ev LP64_ARCHS .
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 cpan
For perl ports coming from CPAN.
Wrapper around the normal perl module that fetches the file from
the correct location depending on
.Ev DISTNAME ,
and sets a default
.Ev PKGNAME .
Also affects
.Ev TEST_DEPENDS ,
.Ev CONFIGURE_STYLE ,
.Ev PKG_ARCH ,
and
.Ev CATEGORIES .
.Pp
Some CPAN modules are only indexed by author, set
.Li CPAN_AUTHOR=ID
to locate the right directory.
.Pp
If no
.Ev HOMEPAGE
is defined, it will default to
.Pa http://search.cpan.org/dist/${DISTNAME:C/-[^-]*$//}/
.Pp
User settings: set
.Ev CPAN_REPORT
to Yes,
.Ev CPAN_REPORT_DB
to a valid directory,
and
.Ev CPAN_REPORT_FROM
to a valid email address to automate the reporting
of regression tests to CPAN.
.Pp
If
.Ev MODCPAN_EXAMPLES
is set, the following variables will be set.
.Ev MODCPAN_EXAMPLES_DIST
will hold the default directory in the distfile with
example scripts.
.Ev MODCPAN_EXAMPLES_DIR
will be set to the standard installation directory for
examples.
Sets the
.Cm post-install
target if none has been defined to install the examples,
otherwise
.Ev MODCPAN_POST_INSTALL
should be used as such:
.Bd -literal
post-install:
...
${MODCPAN_POST_INSTALL}
.Ed
.It databases/mariadb
Adds small framework for testing ports that require running MariaDB.
Defines
.Ev MODMARIADB_TEST_TARGET
which consists actual commands to run in
.Cm do-test
target.
If this target isn't defined, it will be added automatically.
.Pp
The actual test command to be run could be specified in the
.Ev MODMARIADB_TEST_CMD .
Default is similar to what
.Xr bsd.port.mk 5
runs itself.
.Pp
The MariaDB server being started will listen on UNIX domain socket
only, minimizing impact on running system.
The path to socket is recorded in
.Ev MODMARIADB_TEST_SOCKET .
Any local user will be able to connect without password.
.Pp
If the
.Ev MODMARIADB_TEST_DBNAME
variable is set, the database with such name will be set up before
running actual test command.
Otherwise (default), the test is responsible to call
.Xr mysqladmin 1
itself, if needed.
.Pp
The
.Pa databases/mariadb,-server
will get added to
.Ev TEST_DEPENDS ,
but not to any other
.Ev *_DEPENDS .
The
.Ev MODMARIADB_CLIENT_ARGS
and
.Ev MODMARIADB_ADMIN_ARGS
variables hold arguments for
.Xr mysql 1
and
.Xr mysqladmin 1 ,
respectively; those argument lists could be used in test scripts
for connecting to test server, if they aren't satisfied by environment.
.It databases/postgresql
Adds small framework for testing ports that require running Postgres.
Defines
.Ev MODPOSTGRESQL_TEST_TARGET
which consists actual commands to run in
.Cm do-test
target.
If this target isn't defined, it will be added automatically.
.Pp
The actual test command to be run could be specified in the
.Ev MODPOSTGRESQL_TEST_CMD .
Default is similar to what
.Xr bsd.port.mk 5
runs itself.
.Pp
The Postgres server being started will listen on UNIX domain socket
only, minimizing impact on running system.
The path to directory where socket will be created is set by
.Ev MODPOSTGRESQL_TEST_PGHOST ,
defaulting to
.Pa ${WRKDIR} .
Any local user will be able to connect without password.
.Pp
If the
.Ev MODPOSTGRESQL_TEST_DBNAME
variable is set, the database with such name will be set up before
running actual test command.
Otherwise (default), the test is responsible to call
.Xr initdb 1
itself.
.Pp
The
.Pa databases/postgresql,-server
will get added to
.Ev TEST_DEPENDS ,
but not to any other
.Ev *_DEPENDS .
.It devel/cmake
Adds
.Pa devel/cmake
to
.Ev BUILD_DEPENDS
and fills up
.Ev CONFIGURE_ARGS ,
.Ev CONFIGURE_ENV
and
.Ev MAKE_ENV .
Sets up
.Cm configure
target.
If
.Ev CONFIGURE_STYLE
was not set before, sets its value to `cmake'.
Changes default value of
.Ev SEPARATE_BUILD
to `Yes' because modern CMake requires out-of-source build anyway.
Changes
.Ev TEST_TARGET
to `test' as this is standard for CMake projects.
Also this module has the following knobs:
.Bl -tag -width Ds
.It MODCMAKE_WANTCOLOR
If set to `Yes', CMake will colorize its output.
Should not be used in ports Makefiles.
Default value is `No'.
.It MODCMAKE_VERBOSE
If set to `Yes', CMake will print details during configure and build
stages about exact command being run, etc.
Should not be used in ports Makefiles.
Default value is `Yes'.
.It MODCMAKE_DEBUG
If set to `Yes', CMake will produce a debug build instead of a release
build.
The exact effects on the build process depend on settings specified in
the CMake config files.
Default value is `No'.
.El
Also,
.Sq nojunk
is added to DPB_PROPERTIES because CMake's include files parser cheats
too much.
.It devel/cargo
Automates download and compilation of dependencies of a Rust project using
.Xr cargo 1 .
During
.Cm fetch ,
static dependencies ("crates") listed in
.Ev MODCARGO_CRATES
are downloaded using
.Ev MODCARGO_DIST_SUBDIR
as
.Ev DIST_SUBDIR .
During
.Cm post-extract ,
crates defined in
.Ev MODCARGO_CRATES
are moved to the
.Ev MODCARGO_VENDOR_DIR
directory.
During
.Cm post-patch ,
crate-metadata are generated using
.Pa devel/cargo-generate-vendor .
With
.Ev CONFIGURE_STYLE
set to
.Sq cargo ,
cargo is configured to use
.Ev MODCARGO_VENDOR_DIR
instead of the standard crates-io network source.
Finally, any crates listed in
.Ev MODCARGO_CRATES_UPDATE
are updated.
.Ev MODCARGO_RUSTFLAGS
can be used to pass custom flags to all
.Xr rustc 1
invocations.
.Pp
.Pa lang/rust ,
.Pa devel/cargo
and
.Pa devel/cargo-generate-vendor
are added to
.Ev BUILD_DEPENDS .
By default
.Ev MASTER_SITES9
is used to download the crates.
.Pp
This module defines:
.Bl -tag -width MODCARGO_CRATES_UPDATE
.It MODCARGO_CARGOTOML
Path to cargo manifest.
Defaults to
.Pa ${WRKSRC}/Cargo.toml .
.It MODCARGO_CRATES
Crates that will be downloaded by the module.
.It MODCARGO_CRATES_UPDATE
List of crates to update, overriding the version listed in Cargo.lock.
.It MODCARGO_FEATURES
List of features to be used when building.
.It MODCARGO_VENDOR_DIR
Name of the local directory for vendoring crates.
Defaults to
.Pa ${WRKSRC}/modcargo-crates .
.El
.Pp
This module adds three
.Xr make 1
targets:
.Bl -tag -width modcargo-gen-crates-licenses
.It Cm modcargo-metadata
Rerun the generation of crates' metadata.
.It Cm modcargo-gen-crates
Generate the
.Ev MODCARGO_CRATES
list from Cargo.lock (a preliminary crates list is not required).
.It Cm modcargo-gen-crates-licenses
Generate the
.Ev MODCARGO_CRATES
list with license information from crates present in the
.Ev MODCARGO_VENDOR_DIR
directory.
.El
.It devel/dconf
Sets
.Ev CONFIGURE_ARGS ,
.Ev BUILD_DEPENDS
and
.Ev RUN_DEPENDS .
This module is used by ports installing gsettings schemas under
.Pa ${PREFIX}/share/glib-2.0/schemas/ .
It requires the following goo in the PLIST:
.Bd -literal -offset indent
@exec %D/bin/glib-compile-schemas %D/share/glib-2.0/schemas >/dev/null
@unexec-delete %D/bin/glib-compile-schemas %D/share/glib-2.0/schemas >/dev/null
.Ed
.It devel/gconf2
A link from
.Xr gconftool-2 1
to
.Xr true 1
will be put at the front of the
.Ev PATH .
Sets
.Ev CONFIGURE_ARGS ,
.Ev BUILD_DEPENDS
and
.Ev RUN_DEPENDS .
According to the values of
.Ev MODGCONF2_LIBDEP ,
sets
.Ev LIB_DEPENDS .
User settings: set
.Ev MODGCONF2_SCHEMAS_DIR
to the directory name under
.Pa ${LOCALBASE}/share/schemas/
where schemas files will be installed.
.It devel/meson
Adds
.Pa devel/meson
and
.Pa devel/ninja
to
.Ev BUILD_DEPENDS .
Sets up
.Cm configure
target.
If
.Ev CONFIGURE_STYLE
was not set before, sets its value to `meson'.
Changes default value of
.Ev SEPARATE_BUILD
to `Yes' because meson requires out-of-source build.
If
.Ev CONFIGURE_STYLE
is 'meson',
.Ev MODMESON_CONFIGURE_ARGS
and
.Ev MODMESON_CONFIGURE_ENV
will add default values to
.Ev CONFIGURE_ARGS
and
.Ev CONFIGURE_ENV .
Also this module has the following knob:
.Bl -tag -width Ds
.It MODMESON_WANTCOLOR
If set to `Yes', meson will colorize its output.
Should not be used in ports Makefiles.
Default value is `No'.
.El
.It devel/pmk
Sets
.Ev CONFIGURE_SCRIPT ,
.Ev CONFIGURE_ARGS
and
.Ev MODPMK_configure .
It appends
.Pa devel/pmk
to
.Ev BUILD_DEPENDS .
.It devel/qmake
This module automates usage of qmake, independently of the actual
version of Qt being used.
This module requires that one of the
.Pa x11/qt3 ,
.Pa x11/qt4
or
.Pa x11/qt5
to be used as well.
.Pp
If
.Ev CONFIGURE_STYLE
was not set before, sets its value to
.Sq qmake .
If
.Ev CONFIGURE_STYLE
contains
.Sq qmake
the module will define each of the
.Ar do-build
and
.Ar do-install
targets, unless port already defines one; also,
.Ev SEPARATE_BUILD
will be set to
.Sq Yes
unless it's already set to some value.
Also, unless
.Ev NO_TEST
is set, the
.Ar do-test
target will be defined.
.Pp
The following variables could be used in qmake-based ports:
.Bl -tag -width 1234
.It Ev MODQMAKE_ARGS
Additional arguments for qmake invocation.
The module already defines some.
.It Ev MODQMAKE_INSTALL_ROOT
Root directory for fake install.
Normally, it's a WRKINST, but some (broken) ports require another value,
like PREFIX.
.It Ev MODQMAKE_PROJECTS
List of qmake project files to be used, relative to WRKSRC.
Directories containing those projects could be used as well,
see qmake documentation for details.
Defaults to
.Sq \&. ,
which means the (only) project in WRKSRC directory.
.It Ev MODQMAKE_RECURSIVE
If
.Sq Yes ,
then qmake will be run recursively during configure stage;
otherwise, only projects mentioned in
.Ev MODQMAKE_PROJECTS
will be processed during configure stage, and their descendants will
be visited during main build phase.
Sometimes a qmake project processing depends on files generated
by other qmake project during build, and recursive builds break this.
For Qt4+ defaults to
.Sq Yes ,
and Qt3 doesn't support recursive configuring.
.It Ev MODQMAKE_build
Actual commands that module will use to build all
.Ev MODQMAKE_PROJECTS
provided.
To be used in complicated cases, when port have to use its own
.Ar do-build
target or mix different
.Ev CONFIGURE_STYLE
values.
.It Ev MODQMAKE_install
Same as for
.Ev MODQMAKE_build ,
but used in
.Ar do-install
stage.
.El
.It devel/scons
Adds
.Pa devel/scons
to
.Ev BUILD_DEPENDS .
Sets
.Ev MODSCONS_BIN
and
.Ev MODSCONS_ENV .
Also defines an overridable
.Ev MODSCONS_FLAGS .
It provides a
.Cm do-build
and
.Cm do-install
targets that can be overridden in the port Makefile.
.It font
Used for ports which primarily install fonts.
Affects
.Ev PKG_ARCH
and
.Ev EXTRACT_SUFX .
Appends to
.Ev CATEGORIES .
When
.Ev TYPEFACE
is set in combination with
.Ev V
or
.Ev VERSION
it sets
.Ev PKGNAME .
.Ev TYPEFACE
should be set to the name of the typeface.
This sets
.Ev FONTDIR
using said typeface name.
.Ev FONTTYPES
defaults to `ttf' but can be set to include the extenions of
fonts which are to be installed.
Also sets
.Ev FONT_DISTDIR .
A
.Cm do-install
target is provided if the port tself does not provide it.
.It fortran
Sets
.Ev MODFORTRAN_LIB_DEPENDS ,
.Ev MODFORTRAN_WANTLIB ,
.Ev MODFORTRAN_BUILD_DEPENDS .
Set
.Ev MODFORTRAN_COMPILER
to `gfortran', or `flang', depending on what the port requires.
The default is `gfortran'.
The dependencies are chosen according to
.Ev MODFORTRAN_COMPILER .
.It gcc4
If
.Ev COMPILER_VERSION
is not gcc4 (defined by
.Pa /usr/share/mk/bsd.own.mk ) ,
and architecture is in
.Ev MODGCC4_ARCHS ,
then the gcc4 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
.Ev MODGCC4_LANGS
(e.g. c++, fortran).
The
.Ev MODGCC4_VERSION
variable can be used to change the version of gcc.
By default gcc 4.9 is used.
If
.Ev MODGCC4_LANGS
contains c++, this module provides
.Ev MODGCC4_CPPLIBDEP
and
.Ev MODGCC4_CPPWANTLIB .
.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
.Li MODJAVA_VER=x.y
to use exactly the JDK x.y,
.Li MODJAVA_VER=x.y+
to use any x.y or higher version.
Set
.Li MODJAVA_JRERUN=Yes
if the port only needs the JRE at runtime.
The module sets
.Ev JAVA_HOME ,
.Ev ONLY_FOR_ARCHS ,
.Ev MODJAVA_RUN_DEPENDS ,
.Ev MODJAVA_SHARE_DIR ,
.Ev MODJAVA_JAR_DIR ,
.Ev MODJAVA_EXAMPLE_DIR
and
.Ev MODJAVA_DOC_DIR .
It appends to
.Ev BUILD_DEPENDS ,
.Ev RUN_DEPENDS ,
.Ev CATEGORIES
and
.Ev SUBST_VARS .
If
.Li MODJAVA_BUILD=ant
then this module provides
.Ev MODJAVA_BUILD_DIR ,
.Ev MODJAVA_BUILD_FILE
and
.Ev MODJAVA_BUILD_TARGET_NAME ,
as well as a
.Cm do-build
target (if not already defined).
It heeds
.Ev NO_BUILD .
.It lang/clang
Similar to gcc3 and gcc4 modules.
If architecture is in MODCLANG_ARCHS, the CLang 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
.Ev MODCLANG_LANGS
(e.g. c++).
Sets
.Ev MODCLANG_VERSION
which is also appended to
.Ev SUBST_VARS .
.It lang/erlang
.It lang/ghc
Sets
.Ev ONLY_FOR_ARCHS ,
.Ev MODGHC_VER ,
.Ev BUILD_DEPENDS ,
and
.Ev RUN_DEPENDS .
Build and further actions are based on the list of values in
.Ev MODGHC_BUILD :
.Bl -tag -width register
.It Ar nort
no runtime dependency on
.Pa lang/ghc
nor the hs- prefix to
.Ev PKGNAME
will be added,
.It Ar cabal
get the typical Cabal targets defined,
.It Ar haddock
generate API documentation using
.Pa devel/haddock ,
.It Ar register
create and include register/unregister scripts,
.It Ar hackage
the distfiles are available on Hackage.
.El
.Pp
Also affects
.Ev CATEGORIES ,
.Ev CONFIGURE_STYLE
and
.Ev SUBST_VARS .
.Cm do-build ,
.Cm do-install
and
.Cm do-test
targets are provided if the port itself didn't set them.
If
.Ar register
has been set, the PLIST needs to be modified in order to
add the relevant @exec/@unexec lines.
This module will run the Setup script and ensure the documentation
will be built (if
.Ar haddock
has been set), and that the package is
registered as a library usable by
.Pa lang/ghc
(if
.Ar register
has been set).
Extra arguments and environment additions for the Setup configure
command can be specified with
.Ev MODGHC_SETUP_CONF_ARGS
and
.Ev MODGHC_SETUP_CONF_ENV .
.It lang/go
Adds Go toolchain support.
Requires
.Ev ALL_TARGET
to be set to canonical Go import path of port.
(Module sets it automatically for ports that use
.Ev GH_ACCOUNT
and
.Ev GH_PROJECT
macros.)
.Pp
During execution of
.Cm pre-configure
target module moves source code from
.Pa ${MODGO_SUBDIR}
to
.Pa ${WRKSRC} ,
subdirectory of
.Pa ${MODGO_WORKSPACE}
- specially-crafted Go workspace located at
.Pa ${WRKDIR}/go .
During
.Cm do-build
module calls
.Dq go install
with
.Ev GOPATH
set to
.Pa ${MODGO_WORKSPACE} ,
runs its output through sed to prevent writes outside
.Ev WRKDIR
sandbox and sends output to
.Xr sh 1 .
During
.Cm do-install
it copies executables from
.Pa ${MODGO_WORKSPACE}/bin
to
.Pa ${PREFIX}/bin ,
and/or directories
.Pa ${MODGO_WORKSPACE}/pkg
and
.Pa ${MODGO_WORKSPACE}/src
to
.Pa ${PREFIX}/go ,
depending on
.Ev MODGO_TYPE
contents.
.Pp
Sets
.Ev BUILD_DEPENDS ,
.Ev RUN_DEPENDS ,
.Ev ALL_TARGET ,
.Ev TEST_TARGET ,
.Ev ONLY_FOR_ARCHS ,
.Ev SEPARATE_BUILD ,
and
.Ev WRKSRC .
.Pp
Appends to
.Ev CATEGORIES .
.Pp
Defines:
.Bl -tag -width MODGO_WORKSPACE
.It Ev MODGO_TYPE
Type of port.
May be any combination of:
.Bl -tag -width lib
.It bin
ordinary binary, which should be installed to
.Pa ${PREFIX}/bin ,
.It lib
library, which should come with source code.
.El
.Pp
Defaults to
.Ar bin .
.It Ev MODGO_WORKSPACE
Path to Go workspace set up for port build process.
Defaults to
.Pa ${WRKDIR}/go .
See Go documentation for details.
.It Ev MODGO_SUBDIR
Path to Go source code within port's sources tarball.
Defaults to
.Pa ${WRKDIST} .
.It Ev MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for building ports.
By default, happens during execution of
.Cm pre-configure
target.
.It Ev MODGO_BUILDDEP
Controls whether contents of
.Ev MODGO_BUILD_DEPENDS
are appended to port's
.Ev BUILD_DEPENDS .
Defaults to
.Ar Yes .
.It Ev MODGO_MODNAME
is the module name as defined in the
.Pa go.mod
file contained in a project.
If this is set,
.Ev MODGO_MODULES ,
.Ev MODGO_MODFILES
and
.Ev MODGO_VERSION
need to be defined as well.
Setting this will also set
.Ev ALL_TARGET .
When
.Ev MODGO_MODFILES
is set, and a "cmd" directory is found in
.Ev WRKSRC ,
"cmd/..." is appended to
.Ev ALL_TARGET
in
.Cm do-build
automatically.
.It Ev MODGO_VERSION
Sets the specific version of a Go module to use.
For example: v0.1.3.
.It Ev MODGO_MODULES
List of modules and their specific versions that an application depends on.
.It Ev MODGO_MODFILES
List of go.mod files and their versions that are required for dependency
resolution.
These are required by Go to determine the full dependency graph.
.El
.Pp
Additionally defines
.Ev MODGO_PACKAGES ,
.Ev MODGO_SOURCES
and
.Ev MODGO_TOOLS
(paths for installed Go packages, sources and tools respectively),
.Ev MODGO_CMD
and
.Ev MODGO_FLAGS
(source code build command and flags passed as its arguments),
.Ev MODGO_LDFLAGS ,
.Ev MODGO_BUILD_CMD
and
.Ev MODGO_TEST_CMD
(commands for building and testing go packages; normally called with canonical
Go package names as arguments),
.Ev MODGO_{BUILD,INSTALL,TEST}_TARGET
and
.Ev MODGO_{BUILD,RUN}_DEPENDS .
.Pp
This module adds one
.Xr make 1
target:
.Bl -tag -width modgo-gen-modules
.It Cm modgo-gen-modules
Generate the
.Ev MODGO_MODULES
and the
.Ev MODGO_MODFILES
lists.
.El
.It lang/lua
Sets
.Ev MODLUA_BIN ,
.Ev MODLUA_DATADIR ,
.Ev MODLUA_DEP ,
.Ev MODLUA_DEP_VERSION ,
.Ev MODLUA_DOCDIR ,
.Ev MODLUA_EXAMPLEDIR ,
.Ev MODLUA_INCL_DIR ,
.Ev MODLUA_LIB ,
.Ev MODLUA_LIBDIR ,
.Ev MODLUA_VERSION ,
.Ev MODLUA_WANTLIB .
Appends to
.Ev CATEGORIES .
Also appends to
.Ev BUILD_DEPENDS ,
unless
.Ev NO_BUILD
has been set to Yes.
Also appends to
.Ev RUN_DEPENDS ,
unless
.Ev MODLUA_RUNDEP
is set to No.
Appends
.Ev MODLUA_VERSION ,
.Ev MODLUA_LIB ,
.Ev MODLUA_INCL_DIR ,
.Ev MODLUA_EXAMPLEDIR ,
.Ev MODLUA_DOCDIR ,
.Ev MODLUA_LIBDIR ,
.Ev MODLUA_DATADIR ,
.Ev MODLUA_DEP ,
.Ev MODLUA_DEP_VERSION ,
.Ev MODLUA_BIN
to
.Ev SUBST_VARS .
.Ev MODLUA_DEFAULT_VERSION
is set to 5.1.
.Ev MODLUA_VERSION is set to
.Ev MODLUA_DEFAULT_VERSION
by default.
Ports can be built with several lua versions.
If no FLAVOR is set it defaults to MODLUA_DEFAULT_VERSION.
Otherwise the FULLPKGNAME is adjusted, if MODLUA_SA is not set.
In order to set a build, run or test dependency on a lua port,
use the following, which will propagate the currently used flavor:
.Ev MODLUA_BUILD_DEPENDS ,
.Ev MODLUA_TEST_DEPENDS ,
.Ev MODLUA_RUN_DEPENDS .
.It lang/mono
Sets
.Ev MODMONO_ONLY_FOR_ARCHS ,
.Ev CONFIGURE_ENV ,
.Ev MAKE_FLAGS ,
.Ev MODMONO_BUILD_DEPENDS
and
.Ev MODMONO_RUN_DEPENDS .
If
.Ev MODMONO_DEPS
is set to Yes,
.Pa lang/mono
is appended to
.Ev BUILD_DEPENDS
and
.Ev RUN_DEPENDS .
.Ev DLLMAP_FILES
defines in which files the module will substitute hardcoded
shared library versions using a
.Cm post-configure
target.
.It lang/node
Adds common dependencies to
.Ev RUN_DEPENDS
and
.Ev BUILD_DEPENDS .
Recognizes two additional types of
.Ev CONFIGURE_STYLE Ns s ,
"npm" and "npm ext".
"npm ext" should be used for npm packages that contain C++ extensions which
need to be compiled.
"npm" should be used for other npm packages.
If regression tests are included that can be run using
.Pa devel/node-expresso ,
append "expresso" to
.Ev CONFIGURE_STYLE .
.Pa devel/node-expresso
will be appended to
.Ev TEST_DEPENDS
and a default
.Ev MODNODE_TEST_TARGET
will be defined, along with a
.Cm do-test
target if it has not already been set.
If "expresso" isn't appended to
.Ev CONFIGURE_STYLE ,
.Ev TEST_TARGET
will be set to "test".
One of these two
.Ev CONFIGURE_STYLE Ns s
should be used or the module doesn't affect anything except
.Ev RUN_DEPENDS
and
.Ev BUILD_DEPENDS .
Requires
.Ev NPM_NAME
to be set to the name of the npm package.
Uses
.Ev NPM_NAME
and
.Ev NPM_VERSION
to set
.Ev DISTNAME ,
and
.Ev PKGNAME ,
and
.Ev MASTER_SITES .
If the npm package depends on other npm packages, the npm package names it
depends on should be listed in
.Ev MODNODE_DEPENDS .
Adds default
.Cm do_build
and
.Cm do_install
tasks, and you can reference the default implementations via
.Ev MODNODE_BUILD_TARGET
and
.Ev MODNODE_INSTALL_TARGET .
.It lang/ocaml
Appends to
.Ev BUILD_DEPENDS
and
.Ev MAKE_ENV .
This selects a %%native%% plist fragment and
.Ev ocaml_native
property depending on whether the architecture supports native
compilation.
If dynamic linking is supported on the native architecture,
the %%dynlink%% plist fragment and
.Ev ocaml_native_dynlink
property is set.
When
.Ev CONFIGURE_STYLE
is set to `oasis',
overrides for the
.Cm do-build ,
.Cm do-install ,
and
.Cm do-test
targets are added.
.It lang/php
Used for ports using PHP in some way:
either extensions to PHP, or software written in PHP.
Sets
.Ev MODPHP_RUN_DEPENDS ,
.Ev MODPHP_LIB_DEPENDS ,
.Ev MODPHP_WANTLIB ,
.Ev MODPHP_BIN ,
.Ev MODPHP_PHPIZE ,
.Ev MODPHP_PHP_CONFIG ,
.Ev MODPHP_INCDIR
and
.Ev MODPHP_LIBDIR .
Adds to
.Ev RUN_DEPENDS
and
.Ev BUILD_DEPENDS
unless
.Ev MODPHP_RUNDEP
or
.Ev MODPHP_BUILDDEP
are set.
If
.Ev MODPHP_DO_PHPIZE
is set, prepares a build environment for extensions that use phpize.
.Pp
Ports using PDO for database connectivity often have a choice of
dependencies (pdo_sqlite, pdo_mysql, pdo_pgsql and others).
The module constructs
.Ev MODPHP_PDO_DEPENDS
from the PDO types listed in
.Ev MODPHP_PDO_ALLOWED
(defaulting to "sqlite mysql pgsql").
This can be added to
.Ev RUN_DEPENDS
and allows any of these PDO packages to satisfy the dependency, with
.Ev MODPHP_PDO_PREF
(sqlite by default) chosen if none are installed.
.It lang/php/pecl
Used for ports for PHP PECL extensions.
Sets default
.Ev MASTER_SITES ,
.Ev HOMEPAGE ,
.Ev EXTRACT_SUFX ,
.Ev DESTDIRNAME ,
.Ev MODPHP_DO_SAMPLE ,
.Ev MODPHP_DO_PHPIZE ,
.Ev AUTOCONF_VERSION ,
.Ev AUTOMAKE_VERSION ,
.Ev LIBTOOL_FLAGS .
Provides a default
.Ev TEST_TARGET
and
.Ev TEST_FLAGS
unless
.Ev NO_TEST
or a
.Cm do-test
target is defined.
Adds common dependencies to
.Ev RUN_DEPENDS
and
.Ev BUILD_DEPENDS .
Sets a default
.Ev PKGNAME
and appends to
.Ev CATEGORIES .
.It lang/python
Sets
.Ev MODPY_VERSION ,
.Ev MODPY_BIN ,
.Ev MODPY_INCDIR ,
.Ev MODPY_LIBDIR ,
.Ev MODPY_SITEPKG ,
.Ev MODPY_SETUP ,
.Ev MODPY_TEST_DIR ,
.Ev MODPY_TEST_LOCALE ,
.Ev MODPY_WANTLIB ,
.Ev MODPY_LIB_DEPENDS ,
.Ev MODPY_RUN_DEPENDS ,
.Ev MODPY_TEST_DEPENDS ,
.Ev MODPY_BUILD_DEPENDS ,
and
.Ev MODPY_ADJ_FILES .
Appends to
.Ev RUN_DEPENDS
unless
.Ev MODPY_RUNDEP
is set to No.
Appends to
.Ev BUILD_DEPENDS
unless
.Ev MODPY_BUILDDEP
is set to No or
.Ev NO_BUILD
is set to Yes.
Appends to
.Ev TEST_DEPENDS
if
.Ev MODPY_PYTEST
is set to Yes
unless
.Ev MODPY_TESTDEP
is set to No.
Appends
.Ev MODPY_TEST_LOCALE
to
.Ev TEST_ENV .
Changes to the directory specified in
.Ev MODPY_TEST_DIR ,
by default WRKSRC, before running tests.
.Ev MODPY_VERSION
is the default version used by all python modules.
Ports which use the setuptools module should set
.Ev MODPY_SETUPTOOLS
to Yes.
Ports which use the pytest module should set
.Ev MODPY_PYTEST
to Yes.
Arguments can be passed to pytest during
.Cm test
with
.Ev MODPY_PYTEST_ARGS .
All ports that generate egg-info files should set
.Ev MODPY_EGG_VERSION
to the version string used by the
.Fn setup
function in the port's
.Pa setup.py .
Arguments can be passed to setup.py during
.Cm configure
with
.Ev MODPY_SETUP_ARGS .
Extra arguments to the build and install commands can be passed via
.Ev MODPY_DISTUTILS_BUILDARGS
and
.Ev MODPY_DISTUTILS_INSTALLARGS .
If any files have a python shebang line which needs to be replaced
using MODPY_BIN, list them in
.Ev MODPY_ADJ_FILES .
These are prefixed with WRKSRC and replaced automatically
at the end of
.Cm pre-configure .
Also affects
.Ev CATEGORIES ,
.Ev MAKE_ENV ,
.Ev CONFIGURE_ENV ,
and
.Ev SUBST_VARS .
May affect the
.Cm test
target.
If
.Ev MODPY_PI
is set to Yes it will set
.Ev HOMEPAGE
and
.Ev MASTER_SITES .
The subdirectory can be overridden with
.Ev MODPY_PI_DIR .
.Pp
Python 2.x places .pyc files in the same directory as the associated .py file.
Python 3.x places these in a separate __pycache__ directory and uses an
additional suffix.
In some cases, an ABI tag is also used for names of compiled extensions.
The python module defines variables to allow a single PLIST to be
used for both versions.
Generate or update the PLIST using the python3
.Ev FLAVOR ,
then edit it to prefix any lines creating
.Ev MODPY_PYCACHE
directories with
.Ev MODPY_COMMENT .
As python2 and python3 packages should permit being installed together,
it may be necessary to suffix names of common binaries or directories,
or split common files into a subpackage.
If updating the PLIST without using the python3 flavor,
take care not to remove ${MODPY_PYCACHE}, ${MODPY_PYC_MAGIC_TAG}, or
${MODPY_ABI_TAG} variables from the PLIST.
.It lang/ruby
See
.Xr ruby-module 5 .
.It lang/tcl
Sets
.Ev MODTCL_VERSION ,
.Ev MODTCL_BIN ,
.Ev MODTCL_INCDIR ,
.Ev MODTCL_LIBDIR ,
.Ev MODTCL_BUILD_DEPENDS ,
.Ev MODTCL_RUN_DEPENDS ,
.Ev MODTCL_LIB ,
.Ev MODTCL_LIB_DEPENDS ,
and
.Ev MODTCL_CONFIG .
.Ev MODTCL_VERSION
is the default version used by all Tcl ports and may be overridden.
Provides
.Ev MODTCL_TCLSH_ADJ
and
.Ev MODTCL_WISH_ADJ
shell fragments to patch the interpreter path in executable scripts.
Also affects
.Ev CATEGORIES
and
.Ev SUBST_VARS .
.It perl
This module is documented in the main
.Xr bsd.port.mk 5
manpage.
.It security/heimdal
A link from ${LOCALBASE}/heimdal/bin/krb5-config
to
.Xr krb5-config 1
will be put at the front of the path.
Sets
.Ev LIB_DEPENDS
and
.Ev WANTLIB
according to the values of
.Ev MODHEIMDAL_LIB_DEPENDS ,
and
.Ev MODHEIMDAL_WANTLIB .
.It textproc/intltool
Sets
.Ev MODINTLTOOL_OVERRIDE .
.Pa textproc/intltool
is added to
.Ev BUILD_DEPENDS .
.Ev MODINTLTOOL_OVERRIDE
changes the paths of
.Ev INTLTOOL_EXTRACT ,
.Ev INTLTOOL_MERGE
and
.Ev 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
.Ev CONFIGURE_ENV ,
.Ev MAKE_ENV
and
.Ev MAKE_FLAGS
by appending
.Ev MODINTLTOOL_OVERRIDE
to them.
.It www/drupal7
Can be used to install plugins (default), themes if
.Ev MODDRUPAL_THEME
is yes, or languages packs if
.Ev DRUPAL_LANG
is set to the desired language.
.Pp
The module may set or add to default values for
.Ev HOMEPAGE ,
.Ev MASTER_SITES ,
.Ev PREFIX ,
.Ev DISTNAME ,
.Ev DIST_SUBDIR ,
.Ev CATEGORIES ,
.Ev PKGNAME ,
.Ev PKG_ARCH ,
.Ev WRKDIST ,
.Ev RUN_DEPENDS .
Drupal modules normally don't have any build part, just an installation part
that defaults to copying the plugin/theme/language files into the right
location through
.Ev MODDRUPAL_INSTALL .
.Pp
The module sets
.Ev DRUPAL
to drupal7,
.Ev DRUPAL_ROOT
to htdocs/${DRUPAL}
.Ev DRUPAL_MODS
to ${DRUPAL_ROOT}/site/all/modules
.Ev DRUPAL_THEMES
to ${DRUPAL_ROOT}/site/all/themes
and
.Ev DRUPAL_TRANSLATIONS
to ${DRUPAL_ROOT}/profiles/standard/translations.
So, by default, modules and themes are installed for all sites,
and translations are activated at install.
.Pp
.Ev DRUPAL_OWNER , DRUPAL_GROUP
are set to root, daemon, since drupal doesn't need to write
to any file except the files/ directory and the site settings (those
belong to www instead).
.Pp
Most modules are actually separate projects on the drupal site.
If
.Ev MODDRUPAL_PROJECT
is set,
.Ev HOMEPAGE
will lead to the corresponding project.
If
.Ev MODDRUPAL_VERSION
is also set,
.Ev DISTNAME
will default to
.Pa ${MODDRUPAL_PROJECT}-7.x-${MODDRUPAL_VERSION} ,
MODDRUPAL_PKGNAME
will default to
.Pa ${MODDRUPAL_PROJECT}
and
.Ev PKGNAME
will default to
.Pa drupal7-${MODDRUPAL_PKGNAME}-${MODDRUPAL_VERSION} .
.Pp
Translations are handled by setting
.Ev DRUPAL_LANG
to the language letter code, and by setting
.Ev LANGFILES
to a list of module names/version pairs.
.Pp
With drupal7, all translations have been put in separate .po files.
It has been deemed simplest to pack all translations for a given language
into a single package, since translations for non installed modules won't
affect anything.
.It www/mozilla
Sets
.Ev PKGNAME ,
.Ev HOMEPAGE ,
.Ev MASTER_SITES ,
.Ev DISTNAME ,
.Ev USE_GMAKE ,
and
.Ev ONLY_FOR_ARCHS .
.Ev EXTRACT_SUFX
defaults to .tar.bz2.
.Pp
Adds common dependencies to
.Ev LIB_DEPENDS ,
.Ev WANTLIB ,
.Ev RUN_DEPENDS
and
.Ev BUILD_DEPENDS .
Sets common
.Ev CONFIGURE_ARGS ,
.Ev MAKE_ENV
and
.Ev CONFIGURE_ENV .
Sets
.Ev MOB
variable as source directory
and
.Ev MOZ
as target directory within
.Cm do-install .
.Pp
Individual port Makefile must set
.Ev MOZILLA_PROJECT ,
.Ev MOZILLA_CODENAME ,
.Ev MOZILLA_VERSION ,
.Ev MOZILLA_BRANCH ,
.Ev MOZILLA_LIBS
and
.Ev MOZILLA_DATADIRS
variables.
Port can also append values to
.Ev MOZILLA_SUBST_FILES
which contains the list of
files to run
.Ev SUBST_CMD
on during
.Cm pre-configure ,
and
.Ev MOZILLA_AUTOCONF_DIRS
which
contains the list of dirs where
.Ev AUTOCONF
will be run during
.Cm pre-configure .
.It www/pear
Used for PHP PEAR ports.
Sets default
.Ev MASTER_SITES ,
.Ev EXTRACT_SUFX ,
.Ev PKGNAME .
Sets
.Ev PREFIX
to
.Pa /var/www .
Sets
.Ev NO_TEST
unless a
.Cm do-test
target is defined.
Adds common dependencies to
.Ev RUN_DEPENDS
and
.Ev BUILD_DEPENDS ,
sets
.Ev MAKE_FILE
and
.Ev FAKE_FLAGS
appropriately.
Makes
.Ev PEAR_LIBDIR
and
.Ev PEAR_PHPBIN
available for use in the port.
Sets a default
.Ev PKGNAME
and appends to
.Ev CATEGORIES .
.It www/plone
Sets
.Ev MODPLONE_VERSION
and
.Ev MODZOPE_VERSION .
.Ev MODPLONE_VERSION
is the default version used by all Plone ports and may be overridden.
It appends
.Pa www/plone
to
.Ev RUN_DEPENDS
and also sets
.Ev NO_TEST
to Yes.
.It x11/gnome
This module has full support for the
.Ar gnu ,
.Ar simple
and
.Ar cmake
CONFIGURE_STYLE.
.Pp
If both
.Ev GNOME_PROJECT
and
.Ev GNOME_VERSION
are set, this module defines
.Ev DISTNAME ,
.Ev VERSION ,
.Ev MASTER_SITES ,
adds x11/gnome to
.Ev CATEGORIES
and
.Ev EXTRACT_SUFX
will default to .tar.xz if unset.
Unless
.Li NO_BUILD=Yes ,
.Pa textproc/intltool
is also appended to
.Ev MODULES
and when CONFIGURE_STYLE is set to
.Ar gnu
or
.Ar simple ,
.Ev USE_GMAKE
is set to "Yes".
.Pp
When CONFIGURE_STYLE is set to
.Ar gnu
or
.Ar simple ,
if none of
.Ev AUTOCONF_VERSION
nor
.Ev AUTOMAKE_VERSION
are defined, then "--disable-maintainer-mode" is appended to
.Ev CONFIGURE_ARGS .
When CONFIGURE_STYLE is set to
.Ar cmake ,
"-DENABLE_MAINTAINER_MODE=OFF" and -DSYSCONF_INSTALL_DIR=${SYSCONFDIR}
are appended to CONFIGURE_ARGS.
.Pp
MODGNOME_CPPFLAGS and MODGNOME_LDFLAGS can be used to add compiler and linker
flags.
.Li CPPFLAGS="-I${LOCALBASE}/include"
and
.Li LDFLAGS="-L${LOCALBASE}/lib"
are always appended to
.Ev CONFIGURE_ENV .
.Pp
Certain build/run dependencies and configure arguments and environment
can be set by appending desktop-file-utils, docbook, gobject-introspection,
gtk-update-icon-cache, shared-mime-info, vala and/or yelp to
.Ev MODGNOME_TOOLS .
They are disabled otherwise.
If
.Ev MODGNOME_TOOLS
is set to desktop-file-utils,
a dependency on
.Pa devel/desktop-file-utils
is appended to
.Ev MODGNOME_RUN_DEPENDS
and a link to /usr/bin/true is created under
.Pa ${WRKDIR}/bin/desktop-file-validate .
If
.Ev MODGNOME_TOOLS
is set to docbook,
.Pa textproc/docbook-xsl
is appended to
.Ev MODGNOME_BUILD_DEPENDS .
This option is used when the generation of the man pages included in the
source tarball requires docbook XML/SGML/XSL definitions and stylesheets.
If
.Ev MODGNOME_TOOLS
is set to gtk-update-icon-cache, a dependency on
.Pa x11/gtk+3,-guic
is appended to
.Ev MODGNOME_RUN_DEPENDS .
If
.Ev MODGNOME_TOOLS
is set to shared-mime-info, a dependency on
.Pa misc/shared-mime-info
is appended to
.Ev MODGNOME_RUN_DEPENDS
and a link to /usr/bin/true is created under
.Pa ${WRKDIR}/bin/update-mime-database .
If
.Ev MODGNOME_TOOLS
is set to yelp,
.Pa textproc/itstool
and
.Pa x11/gnome/doc-utils
are appended to
.Ev MODGNOME_BUILD_DEPENDS .
Furthermore,
.Pa x11/gnome/yelp
is appended to
.Ev MODGNOME_RUN_DEPENDS
if
.Ev MODGNOME_TOOLS
also contains "desktop-file-utils"
This option is to be used when any files are installed into
.Pa share/gnome/help/
or page files are installed into
.Pa share/help/ .
.Ev MODGNOME_BUILD_DEPENDS
and
.Ev MODGNOME_RUN_DEPENDS
are appended to the
corresponding
.Ev BUILD_DEPENDS
and
.Ev RUN_DEPENDS .
.Pp
Some tools require the following goo in the PLIST:
.Pp
.Ar desktop-file-utils
.Bd -literal -offset indent
@exec %D/bin/update-desktop-database
@unexec-delete %D/bin/update-desktop-database
.Ed
.Pp
.Ar gtk-update-icon-cache
($icon-theme is the theme directory)
.Bd -literal -offset indent
@exec %D/bin/gtk-update-icon-cache -q -t %D/share/icons/$icon-theme
@unexec-delete %D/bin/gtk-update-icon-cache -q -t %D/share/icons/$icon-theme
.Ed
.Pp
.Ar shared-mime-info
.Bd -literal -offset indent
@exec %D/bin/update-mime-database %D/share/mime
@unexec-delete %D/bin/update-mime-database %D/share/mime
.Ed
.It x11/gnustep
.It x11/qt3, x11/qt4 and x11/qt5
All qt* modules share a common
.Ev MODQT_*
namespace for simple ports.
The qt3 module also defines the same variables under
.Ev MODQT3_* ,
the qt4 module also defines the same variables under
.Ev MODQT4_*
and the qt5 module also defines the same variables under
.Ev MODQT5_* ,
to allow ports to use both modules, such as
.Pa print/poppler .
.Pp
Those modules define
.Ev MODQT*_LIBDIR
as the libraries location,
.Ev MODQT*_INCDIR
as the include files location,
.Ev MODQT*_QTDIR
as the global qt directory location,
.Ev MODQT*_CONFIGURE_ARGS
as standard GNU configure-style parameters to locate the include and libraries.
.Pp
The location of Qt-specific tools
.Nm lrelease ,
.Nm moc ,
.Nm qmake
and
.Nm uic
is available through
.Ev MODQT*_LRELEASE ,
.Ev MODQT*_MOC ,
.Ev MODQT*_QMAKE
and
.Ev MODQT*_UIC .
.Ev MODQT*_OVERRIDE_UIC
controls whether the default setup will force a value of
.Ev UIC
or not.
The value of
.Ev MOC
is always forced to ${MODQT*_MOC}.
.Pp
In most cases the
.Pa devel/qmake
module should be used instead of using
.Ev MODQT*_QMAKE
directly.
.Pp
qt4 includes
.Xr pkg-config 1
files under a specific location recorded in
.Ev MODQT_PKG_CONFIG_PATH .
Qt3 requires the use of
.Ev MODQT3_PLUGINS
to correctly locate plugins.
.Pp
The modules add to
.Ev CONFIGURE_ENV , MAKE_ENV
and
.Ev MAKE_FLAGS .
They define appropriate
.Ev MODQT*_LIB_DEPENDS
and
.Ev MODQT*_WANTLIB .
.Pp
Note that Qt 4 and Qt 5 has their code split over several libraries.
For the qt4 module the basic
.Ev WANTLIB
only refers to QtCore, and other libraries should be added as needed.
The qt5 module doesn't set
.Ev MODQT*_WANTLIB
at all.
Also, Qt 5 consists of many so called Qt modules, and qt5 port module
only refers to qtbase Qt 5 module; other Qt modules should be added to
.Ev LIB_DEPENDS ,
.Ev BUILD_DEPENDS
or
.Ev RUN_DEPENDS
manually.
.It x11/tk
Sets
.Ev MODTK_VERSION ,
.Ev MODTK_BIN ,
.Ev MODTK_INCDIR ,
.Ev MODTK_LIBDIR ,
.Ev MODTK_BUILD_DEPENDS ,
.Ev MODTK_RUN_DEPENDS ,
.Ev MODTK_LIB ,
.Ev MODTK_LIB_DEPENDS ,
and
.Ev MODTK_CONFIG .
.Ev MODTK_VERSION
is the default version used by all Tk ports and
may be overridden.
Automatically adds the
.Pa lang/tcl
module, provides a default
.Ev MODTCL_VERSION
to match
.Ev MODTK_VERSION ,
and affects
.Ev CATEGORIES
and
.Ev SUBST_VARS .
Note the
.Ev MODTCL_WISH_ADJ
shell fragment in the
.Pa lang/tcl
module.
.It x11/xfce4
Sets
.Ev DIST_SUBDIR ,
.Ev EXTRACT_SUFX ,
.Ev CONFIGURE_STYLE ,
.Ev CONFIGURE_ENV
and
.Ev USE_GMAKE .
If
.Ev MODXFCE_ICON_CACHE
is set to yes, it adds
.Pa x11/gtk+3,-guic
to
.Ev RUN_DEPENDS .
Unless
.Ev XFCE_NO_SRC
is set,
.Pa textproc/intltool
is added to
.Ev MODULES .
Also affects
.Ev CATEGORIES .
.Pp
Xfce ports can be divided into five categories: core libraries and
applications, goodies, artwork, thunar plugins, and panel plugins.
.Ev HOMEPAGE ,
.Ev MASTER_SITES
and
.Ev DISTNAME
are built using
.Ev XFCE_VERSION
(which defaults to
.Ev XFCE_DESKTOP_VERSION
if not set) and either
.Ev XFCE_PROJECT ,
.Ev XFCE_GOODIE ,
.Ev XFCE_ARTWORK ,
.Ev THUNAR_PLUGIN
or
.Ev 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 ruby-module 5 ,
.Xr ports 7
|