aboutsummaryrefslogtreecommitdiff
path: root/documentation/content/en/books/porters-handbook/uses/_index.adoc
blob: 0985fd6bf652e51990b6b1a27e3f1d8ce496b8e5 (plain) (blame)
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
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
---
title: Chapter 17. Using USES Macros
prev: books/porters-handbook/keeping-up
next: books/porters-handbook/versions
description: USES macros make it easy to declare requirements and settings for a FreeBSD Port
tags: ["uses", "macros", "introduction", "guide"]
showBookMenu: true
weight: 17
path: "/books/porters-handbook/"
---

[[uses]]
= Using `USES` Macros
:doctype: book
:toc: macro
:toclevels: 1
:icons: font
:sectnums:
:sectnumlevels: 6
:sectnumoffset: 17
:partnums:
:source-highlighter: rouge
:experimental:
:images-path: books/porters-handbook/

ifdef::env-beastie[]
ifdef::backend-html5[]
:imagesdir: ../../../../images/{images-path}
endif::[]
ifndef::book[]
include::shared/authors.adoc[]
include::shared/mirrors.adoc[]
include::shared/releases.adoc[]
include::shared/attributes/attributes-{{% lang %}}.adoc[]
include::shared/{{% lang %}}/teams.adoc[]
include::shared/{{% lang %}}/mailing-lists.adoc[]
include::shared/{{% lang %}}/urls.adoc[]
toc::[]
endif::[]
ifdef::backend-pdf,backend-epub3[]
include::../../../../../shared/asciidoctor.adoc[]
endif::[]
endif::[]

ifndef::env-beastie[]
toc::[]
include::../../../../../shared/asciidoctor.adoc[]
endif::[]

[[uses-intro]]
== An Introduction to `USES`

`USES` macros make it easy to declare requirements and settings for a port.
They can add dependencies, change building behavior, add metadata to packages, and so on, all by selecting simple, preset values.

Each section in this chapter describes a possible value for `USES`, along with its possible arguments.
Arguments are appended to the value after a colon (`:`).
Multiple arguments are separated by commas (`,`).

[[uses-intro-ex1]]
.Using Multiple Values
[example]
====
[.programlisting]
....
USES=	bison perl
....
====

[[uses-intro-ex2]]
.Adding an Argument
[example]
====
[.programlisting]
....
USES=	tar:xz
....
====

[[uses-intro-ex3]]
.Adding Multiple Arguments
[example]
====
[.programlisting]
....
USES=	drupal:7,theme
....
====

[[uses-intro-ex4]]
.Mixing it All Together
[example]
====
[.programlisting]
....
USES=	pgsql:9.3+ cpe python:2.7,build
....
====

[[uses-7z]]
== `7z`

Possible arguments: (none), `p7zip`, `partial`

Extract using man:7z[1] instead of man:bsdtar[1] and sets `EXTRACT_SUFX=.7z`.
The `p7zip` option forces a dependency on the `7z` from package:archivers/p7zip[] if the one from the base system is not able to extract the files.
`EXTRACT_SUFX` is not changed if the `partial` option is used, this can be used if the main distribution file does not have a [.filename]#.7z# extension.

[[uses-ada]]
== `ada`

Possible arguments: (none), `5`, `6`

Depends on an Ada-capable compiler, and sets `CC` accordingly.
Defaults to use gcc 5 from ports.
Use the `:_X_` version option to force building with a different version.

[[uses-autoreconf]]
== `autoreconf`

Possible arguments: (none), `build`

Runs `autoreconf`.
It encapsulates the `aclocal`, `autoconf`, `autoheader`, `automake`, `autopoint`, and `libtoolize` commands.
Each command applies to [.filename]#${AUTORECONF_WRKSRC}/configure.ac# or its old name, [.filename]#${AUTORECONF_WRKSRC}/configure.in#.
If [.filename]#configure.ac# defines subdirectories with their own [.filename]#configure.ac# using `AC_CONFIG_SUBDIRS`, `autoreconf` will recursively update those as well.
The `:build` argument only adds build time dependencies on those tools but does not run `autoreconf`.
A port can set `AUTORECONF_WRKSRC` if `WRKSRC` does not contain the path to [.filename]#configure.ac#.

[[uses-blaslapack]]
== `blaslapack`

Possible arguments: (none), `atlas`, `netlib` (default), `gotoblas`, `openblas`

Adds dependencies on Blas / Lapack libraries.

[[uses-bdb]]
== `bdb`

Possible arguments: (none), `48`, `5` (default), `6`

Add dependency on the Berkeley DB library.
Default to package:databases/db5[].
It can also depend on package:databases/db48[] when using the `:48` argument or package:databases/db6[] with `:6`.
It is possible to declare a range of acceptable values, `:48+` finds the highest installed version, and falls back to 4.8 if nothing else is installed.
`INVALID_BDB_VER` can be used to specify versions which do not work with this port.
The framework exposes the following variables to the port:

`BDB_LIB_NAME`::
The name of the Berkeley DB library.
For example, when using package:databases/db5[], it contains `db-5.3`.

`BDB_LIB_CXX_NAME`::
The name of the Berkeley DBC++ library.
For example, when using package:databases/db5[], it contains `db_cxx-5.3`.

`BDB_INCLUDE_DIR`::
The location of the Berkeley DB include directory.
For example, when using package:databases/db5[], it will contain `${LOCALBASE}/include/db5`.

`BDB_LIB_DIR`::
The location of the Berkeley DB library directory.
For example, when using package:databases/db5[], it contains `${LOCALBASE}/lib`.

`BDB_VER`::
The detected Berkeley DB version.
For example, if using `USES=bdb:48+` and Berkeley DB 5 is installed, it contains `5`.

[IMPORTANT]
====
package:databases/db48[] is deprecated and unsupported.
It must not be used by any port.
====

[[uses-bison]]
== `bison`

Possible arguments: (none), `build`, `run`, `both`

Uses package:devel/bison[] By default, with no arguments or with the `build` argument, it implies `bison` is a build-time dependency, `run` implies a run-time dependency, and `both` implies both run-time and build-time dependencies.

[[uses-budgie]]
== `budgie`

Possible arguments: (none)

Provide support for the Budgie desktop environment.
Use `USE_BUDGIE` to select the components needed for the port.
See crossref:special[using-budgie,Using Budgie] for more information.

[[uses-cabal]]
== `cabal`

[IMPORTANT]
====
Ports should not be created for Haskell libraries, see crossref:special[haskell-libs,Haskell Libraries] for more information.
====

Possible arguments: (none), `hpack`, `nodefault`

Sets default values and targets used to build Haskell software using Cabal.
A build dependency on the Haskell compiler port (package:lang/ghc[]) is added.
If there is some other version of GHC already listed in the `BUILD_DEPENDS` variable (for example, package:lang/ghc810[]), it would be used instead.
If the `hpack` argument is given, a build dependency on package:devel/hs-hpack[] is added and `hpack` is invoked at configuration step to
generate .cabal file.
If the `nodefault` argument is given, the framework will not try to pull the main distribution file from the Hackage.
This argument is implicitly added if `USE_GITHUB` or `USE_GITLAB` is present.

The framework provides the following variables:

`CABAL_REVISION`::
Haskell packages hosted on Hackage may have revisions.
Set this knob to an integer number to pull in revised package description.

`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 too, which are specified after the `_` symbol.
Automatic generation of the dependency list is supported, see crossref:special[using-cabal,Building Haskell Applications with `cabal`].

`CABAL_FLAGS`::
List of flags to be passed to `cabal-install` during the configuring and building stage.
The flags are passed verbatim.
This variable is usually used to enable or disable flags that are declared in the .cabal file.
Pass `foo` to enable the `foo` flag and `-foo` to disable it.

`CABAL_EXECUTABLES`::
List of executable files installed by the port.
Default value: `${PORTNAME}`.
Consult the .cabal file of the project being ported to get a list of possible
values for this variable. Each value corresponds to an `executable` stanza in the .cabal file.
Items from this list are automatically added to pkg-plist.

`SKIP_CABAL_PLIST`::
If defined, do not add items from `${CABAL_EXECUTABLES}` to pkg-plist.

`opt_USE_CABAL`::
Adds items to `${USE_CABAL}` depending on `opt` option.

`opt_CABAL_EXECUTABLES`::
Adds items to `${CABAL_EXECUTABLES}` depending on `opt` option.

`opt_CABAL_FLAGS`::
If `opt` is enabled, append the value to `${CABAL_FLAGS}`.
Otherwise, append `-value` to disable the flag.
Note that this behavior is slightly different from the plain `CABAL_FLAGS` as it does not accept values starting with `-`.

`CABAL_WRAPPER_SCRIPTS`::
A subset of `${CABAL_EXECUTABLES}` containing Haskell programs to be wrapped into a shell script
that sets `*_datadir` environment variables before running the program.
This also causes the actual Haskell binary to be installed under `libexec/cabal/` directory.
This knob is needed for Haskell programs that install their data files under `share/` directory.

`FOO_DATADIR_VARS`::
List of extra Haskell packages, whose data files should be accessible by the executable named `FOO`.
The executable should be a part of `${CABAL_WRAPPER_SCRIPTS}`.
Haskell packages listed there should not have a version suffix.

`CABAL_PROJECT`::
Some Haskell projects may already have a `cabal.project` file, which is also generated by the ports framework.
If that is the case, use this variable to specify what to do with the original `cabal.project`.
Setting this variable to `remove` will cause the original file to be removed.
Setting this variable to `append` will:
. Move the original file to `cabal.project.${PORTNAME}` during the `extract` stage.
. Concatenate the original `cabal.project.${PORTNAME}` and the generated `cabal.project` into a single file after the `patch` stage.
Using `append` makes it possible to perform patching on the original file before it gets merged.

[[uses-cargo]]
== `cargo`

Possible arguments: (none)

Uses Cargo for configuring, building, and testing.
It can be used to port Rust applications that use the Cargo build system.
For more information see crossref:special[using-cargo,Building Rust Applications with `cargo`].

[[uses-charsetfix]]
== `charsetfix`

Possible arguments: (none)

Prevents the port from installing [.filename]#charset.alias#.
This must be installed only by package:converters/libiconv[].
`CHARSETFIX_MAKEFILEIN` can be set to a path relative to `WRKSRC` if [.filename]#charset.alias# is not installed by [.filename]#${WRKSRC}/Makefile.in#.

[[uses-cmake]]
== `cmake`

Possible arguments: (none), `insource`, `noninja`, `run`, `testing`

Use CMake for configuring the port and generating a build system.

By default an out-of-source build is performed, leaving the sources in `WRKSRC` free from build artifacts.
With the `insource` argument, an in-source build will be performed instead.
This argument should be an exception, used only when a regular out-of-source build does not work.

By default Ninja (package:devel/ninja[]) is used for the build.
In some cases this does not work correctly.
With the `noninja` argument, the build will use regular `make` for builds.
This argument should only be used if a Ninja-based build does not work.

With the `run` argument, a run dependency is registered in addition to a build dependency.

With the `testing` argument, a test-target is added that uses CTest.
When running tests the port will be re-configured for testing and re-built.

For more information see crossref:special[using-cmake,Using `cmake`].

[[uses-compiler]]
== `compiler`

Possible arguments: (none), `env` (default, implicit), `{cpp}17-lang`, `{cpp}14-lang`, `{cpp}11-lang`, `gcc-{cpp}11-lib`, `{cpp}11-lib`, `{cpp}0x`, `c11`, `nestedfct`, `features`

Determines which compiler to use based on any given wishes.
Use `{cpp}17-lang` if the port needs a {cpp}17-capable compiler, `{cpp}14-lang` if the port needs a {cpp}14-capable compiler, `{cpp}11-lang` if the port needs a {cpp}11-capable compiler, `gcc-{cpp}11-lib` if the port needs the `g++` compiler with a {cpp}11 library, or `{cpp}11-lib` if the port needs a {cpp}11-ready standard library.
If the port needs a compiler understanding {cpp}0X, C11 or nested functions, the corresponding parameters should be used.

Use `features` to request a list of features supported by the default compiler.
After including [.filename]#bsd.port.pre.mk# the port can inspect the results using these variables:

* `COMPILER_TYPE`: the default compiler on the system, either gcc or clang
* `ALT_COMPILER_TYPE`: the alternative compiler on the system, either gcc or clang. Only set if two compilers are present in the base system.
* `COMPILER_VERSION`: the first two digits of the version of the default compiler.
* `ALT_COMPILER_VERSION`: the first two digits of the version of the alternative compiler, if present.
* `CHOSEN_COMPILER_TYPE`: the chosen compiler, either gcc or clang
* `COMPILER_FEATURES`: the features supported by the default compiler. It currently lists the {cpp} library.

[[uses-cpe]]
== `cpe`

Possible arguments: (none)

Include Common Platform Enumeration (CPE) information in package manifest as a CPE 2.3 formatted string.
See the https://scap.nist.gov/specifications/cpe/[CPE specification] for details.
To add CPE information to a port, follow these steps:

[.procedure]
. Search for the official CPE entry for the software product either by using the NVD's https://web.nvd.nist.gov/view/cpe/search[CPE search engine] or in the https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz[official CPE dictionary] (warning, very large XML file). _Do not ever make up CPE data._
. Add `cpe` to `USES` and compare the result of `make -V CPE_STR` to the CPE dictionary entry. Continue one step at a time until `make -V CPE_STR` is correct.
. If the product name (second field, defaults to `PORTNAME`) is incorrect, define `CPE_PRODUCT`.
. If the vendor name (first field, defaults to `CPE_PRODUCT`) is incorrect, define `CPE_VENDOR`.
. If the version field (third field, defaults to `PORTVERSION`) is incorrect, define `CPE_VERSION`.
. If the update field (fourth field, defaults to empty) is incorrect, define `CPE_UPDATE`.
. If it is still not correct, check [.filename]#Mk/Uses/cpe.mk# for additional details, or contact the {ports-secteam}.
. Derive as much as possible of the CPE name from existing variables such as `PORTNAME` and `PORTVERSION`. Use variable modifiers to extract the relevant portions from these variables rather than hardcoding the name.
. _Always_ run `make -V CPE_STR` and check the output before committing anything that changes `PORTNAME` or `PORTVERSION` or any other variable which is used to derive `CPE_STR`.

[[uses-cran]]
== `cran`

Possible arguments: (none), `auto-plist`, `compiles`

Uses the Comprehensive R Archive Network.
Specify `auto-plist` to automatically generate [.filename]#pkg-plist#.
Specify `compiles` if the port has code that need to be compiled.

[[uses-desktop-file-utils]]
== `desktop-file-utils`

Possible arguments: (none)

Uses update-desktop-database from package:devel/desktop-file-utils[].
An extra post-install step will be run without interfering with any post-install steps already in the port [.filename]#Makefile#.
A line with <<plist-keywords-desktop-file-utils,`@desktop-file-utils`>> will be added to the plist.

[[uses-desthack]]
== `desthack`

Possible arguments: (none)

Changes the behavior of GNU configure to properly support `DESTDIR` in case the original software does not.

[[uses-display]]
== `display`

Possible arguments: (none), _ARGS_

Set up a virtual display environment.
If the environment variable `DISPLAY` is not set, then Xvfb is added as a build dependency, and `CONFIGURE_ENV` is extended with the port number of the currently running instance of Xvfb.
The _ARGS_ parameter defaults to `install` and controls the phase around which to start and stop the virtual display.

[[uses-dos2unix]]
== `dos2unix`

Possible arguments: (none)

The port has files with line endings in DOS format which need to be converted.
Several variables can be set to control which files will be converted.
The default is to convert _all_ files, including binaries.
See crossref:slow-porting[slow-patch-automatic-replacements,Simple Automatic Replacements] for examples.

* `DOS2UNIX_REGEX`: match file names based on a regular expression.
* `DOS2UNIX_FILES`: match literal file names.
* `DOS2UNIX_GLOB`: match file names based on a glob pattern.
* `DOS2UNIX_WRKSRC`: the directory from which to start the conversions. Defaults to `${WRKSRC}`.

[[uses-drupal]]
== `drupal`

Possible arguments: `7`, `module`, `theme`

Automate installation of a port that is a Drupal theme or module.
Use with the version of Drupal that the port is expecting.
For example, `USES=drupal:7,module` says that this port creates a Drupal 7 module.
A Drupal 7 theme can be specified with `USES=drupal:7,theme`.

[[uses-eigen]]
== `eigen`

Possible arguments: 2, 3, build (default), run

Add dependency on package:math/eigen[].

[[uses-elfctl]]
== `elfctl`

Possible arguments: (none)

Change an ELF binary's feature control note by setting ELF_FEATURES.

[[uses-elfct-ex1]]
.Uses=elfctl
[example]
====
[.programlisting]
....
USES=           elfctl
ELF_FEATURES=	featurelist:path/to/file1 \
		featurelist:path/to/file1 \
		featurelist:path/to/file2
....

====

The format of `featurelist` is described in man:elfctl[1].  The file paths are relative to ${BUILD_WRKSRC}.

[[uses-erlang]]
== `erlang`

Possible arguments: (none), `enc`, `rebar`, `rebar3`

Adds a build and run time dependency on package:lang/erlang[].
Depending on the argument, it adds additional build dependencies. `enc` adds a
dependency on package:devel/erlang-native-compiler[], `rebar` adds a dependency on
package:devel/rebar[] and `rebar3` adds a dependency on package:devel/rebar3[].

In addition, the following variables are available to the port:

* `ERL_APP_NAME`: Erlang app name as installed in Erlang's lib dir (minus version)
* `ERL_APP_ROOT`: Root directory for this Erlang app
* `REBAR_CMD`: Path to the "rebar" command
* `REBAR3_CMD`: Path to the "rebar3" command
* `REBAR_PROFILE`: Rebar profile
* `REBAR_TARGETS`: Rebar target list (usually compile, maybe escriptize)
* `ERL_BUILD_NAME`: Build name for rebar3
* `ERL_BUILD_DEPS`: List of BUILD_DEPENDS in category/portname format
* `ERL_RUN_DEPS`: List of RUN_DEPENDS in category/portname format
* `ERL_DOCS`: List of documentation files and directories

[[uses-fakeroot]]
== `fakeroot`

Possible arguments: (none)

Changes some default behavior of build systems to allow installing as a user.
See https://wiki.debian.org/FakeRoot[] for more information on `fakeroot`.

[[uses-fam]]
== `fam`

Possible arguments: (none), `fam`, `gamin`

Uses a File Alteration Monitor as a library dependency, either package:devel/fam[] or package:devel/gamin[].
End users can set WITH_FAM_SYSTEM to specify their preference.

[[uses-firebird]]
== `firebird`

Possible arguments: (none), `25`

Add a dependency to the client library of the Firebird database.

[[uses-fonts]]
== `fonts`

Possible arguments: (none), `fc`, `fontsdir` (default), `none`

Adds a runtime dependency on tools needed to register fonts.
Depending on the argument, add a `crossref:plist[plist-keywords-fc,@fc] ${FONTSDIR}` line,  `crossref:plist[plist-keywords-fontsdir,@fontsdir] ${FONTSDIR}` line, or no line if the argument is `none`, to the plist.
`FONTSDIR` defaults to [.filename]#${PREFIX}/share/fonts/${FONTNAME}# and `FONTNAME` to `${PORTNAME}`.
Add `FONTSDIR` to `PLIST_SUB` and `SUB_LIST`

[[uses-fortran]]
== `fortran`

Possible arguments: `gcc` (default)

Uses the GNU Fortran compiler.

[[uses-fuse]]
== `fuse`

Possible arguments: `2` (default), `3`

The port will depend on the FUSE library and handle the dependency on the kernel module depending on the version of FreeBSD.

[[uses-gem]]
== `gem`

Possible arguments: (none), `noautoplist`

Handle building with RubyGems.
If `noautoplist` is used, the packing list is not generated automatically.

This implies `USES=ruby`.

[[uses-gettext]]
== `gettext`

Possible arguments: (none)

Deprecated.
Will include both <<uses-gettext-runtime,`gettext-runtime`>> and <<uses-gettext-tools,`gettext-tools`>>.

[[uses-gettext-runtime]]
== `gettext-runtime`

Possible arguments: (none), `lib` (default), `build`, `run`

Uses package:devel/gettext-runtime[].
By default, with no arguments or with the `lib` argument, implies a library dependency on [.filename]#libintl.so#.
`build` and `run` implies, respectively a build-time and a run-time dependency on [.filename]#gettext#.

[[uses-gettext-tools]]
== `gettext-tools`

Possible arguments: (none), `build` (default), `run`

Uses package:devel/gettext-tools[].
By default, with no argument, or with the `build` argument, a build time dependency on [.filename]#msgfmt# is registered.
With the `run` argument, a run-time dependency is registered.

[[uses-ghostscript]]
== `ghostscript`

Possible arguments: _X_, `build`, `run`, `nox11`

A specific version _X_ can be used. Possible versions are `7`, `8`, `9`, and `agpl` (default).
`nox11` indicates that the `-nox11` version of the port is required.
`build` and `run` add build- and run-time dependencies on Ghostscript.
The default is both build- and run-time dependencies.

[[uses-gl]]
== `gl`

Possible arguments: (none)

Provides an easy way to depend on GL components.
The components should be listed in `USE_GL`.
The available components are:

`egl`::
add a library dependency on [.filename]#libEGL.so# from package:graphics/libglvnd[]

`gbm`::
Add a library dependency on [.filename]#libgbm.so# from package:graphics/mesa-libs[]

`gl`::
Add a library dependency on [.filename]#libGL.so# from package:graphics/libglvnd[]

`glesv2`::
Add a library dependency on [.filename]#libGLESv2.so# from package:graphics/libglvnd[]

`glew`::
Add a library dependency on [.filename]#libGLEW.so# from package:graphics/glew[]

`glu`::
Add a library dependency on [.filename]#libGLU.so# from package:graphics/libGLU[]

`glut`::
Add a library dependency on [.filename]#libglut.so# from package:graphics/freeglut[]

`opengl`::
Add a library dependency on [.filename]#libOpenGL.so# from package:graphics/libglvnd[]

[[uses-gmake]]
== `gmake`

Possible arguments: (none)

Uses package:devel/gmake[] as a build-time dependency and sets up the environment to use `gmake` as the default `make` for the build.

[[uses-gnome]]
== `gnome`

Possible arguments: (none)

Provides an easy way to depend on GNOME components.
The components should be listed in `USE_GNOME`.
The available components are:

* `atk`
* `atkmm`
* `cairo`
* `cairomm`
* `dconf`
* `esound`
* `evolutiondataserver3`
* `gconf2`
* `gconfmm26`
* `gdkpixbuf`
* `gdkpixbuf2`
* `glib12`
* `glib20`
* `glibmm`
* `gnomecontrolcenter3`
* `gnomedesktop3`
* `gnomedocutils`
* `gnomemenus3`
* `gnomemimedata`
* `gnomeprefix`
* `gnomesharp20`
* `gnomevfs2`
* `gsound`
* `gtk-update-icon-cache`
* `gtk12`
* `gtk20`
* `gtk30`
* `gtkhtml3`
* `gtkhtml4`
* `gtkmm20`
* `gtkmm24`
* `gtkmm30`
* `gtksharp20`
* `gtksourceview`
* `gtksourceview2`
* `gtksourceview3`
* `gtksourceviewmm3`
* `gvfs`
* `intlhack`
* `intltool`
* `introspection`
* `libartlgpl2`
* `libbonobo`
* `libbonoboui`
* `libgda5`
* `libgda5-ui`
* `libgdamm5`
* `libglade2`
* `libgnome`
* `libgnomecanvas`
* `libgnomekbd`
* `libgnomeprint`
* `libgnomeprintui`
* `libgnomeui`
* `libgsf`
* `libgtkhtml`
* `libgtksourceviewmm`
* `libidl`
* `librsvg2`
* `libsigc++12`
* `libsigc++20`
* `libwnck`
* `libwnck3`
* `libxml++26`
* `libxml2`
* `libxslt`
* `metacity`
* `nautilus3`
* `orbit2`
* `pango`
* `pangomm`
* `pangox-compat`
* `py3gobject3`
* `pygnome2`
* `pygobject`
* `pygobject3`
* `pygtk2`
* `pygtksourceview`
* `referencehack`
* `vte`
* `vte3`

The default dependency is build- and run-time, it can be changed with `:build` or `:run`.
For example:

[.programlisting]
....
USES=		gnome
USE_GNOME=	gnomemenus3:build intlhack
....

See crossref:special[using-gnome,Using GNOME] for more information.

[[uses-go]]
== `go`

[IMPORTANT]
====
Ports should not be created for Go libs, see crossref:special[go-libs,Go Libraries] for more information.
====

Possible arguments: (none), `N.NN`, `N.NN-devel`, `modules`, `no_targets`, `run`

Sets default values and targets used to build Go software.
A build dependency on the Go compiler port is added, port maintainers can set version required.
By default the build is performed in GOPATH mode.
If Go software uses modules, the modules-aware mode can be switched on with `modules` argument.
`no_targets` will setup build environment like `GO_ENV`, `GO_BUILDFLAGS` but skip creating extract and build targets.
`run` will also add a run dependency on the Go compiler port.

The build process is controlled by several variables:

`GO_MODULE`::
The name of the application module as specified by the `module` directive in `go.mod`.
In most cases, this is the only required variable for ports that use Go modules.

`GO_PKGNAME`::
The name of the Go package when building in GOPATH mode.
This is the directory that will be created in `${GOPATH}/src`.
If not set explicitly and `GH_SUBDIR` or `GL_SUBDIR` is present, `GO_PKGNAME` will be inferred from it.
It is not needed when building in modules-aware mode.

`GO_TARGET`::
The packages to build.
The default value is `${GO_PKGNAME}`.
`GO_TARGET` can also be a tuple in the form `package:path` where path can be either a simple filename or a full path starting with `${PREFIX}`.

`GO_TESTTARGET`::
The packages to test.
The default value is `./...` (the current package and all subpackages).

`CGO_CFLAGS`::
Additional `CFLAGS` values to be passed to the C compiler by `go`.

`CGO_LDFLAGS`::
Additional `LDFLAGS` values to be passed to the C compiler by `go`.

`GO_BUILDFLAGS`::
Additional build arguments to be passed to `go build`.

`GO_TESTFLAGS`::
Additional build arguments to be passed to `go test`.

See crossref:special[using-go,Building Go Applications] for usage examples.

[[uses-gperf]]
== `gperf`

Possible arguments: (none)

Add a buildtime dependency on package:devel/gperf[] if `gperf` is not present in the base system.

[[uses-grantlee]]
== `grantlee`

Possible arguments: `5`, `selfbuild`

Handle dependency on Grantlee.
Specify `5` to depend on the Qt5 based version, package:devel/grantlee5[].
`selfbuild` is used internally by package:devel/grantlee5[] to get their versions numbers.

[[uses-groff]]
== `groff`

Possible arguments: `build`, `run`, `both`

Registers a dependency on package:textproc/groff[] if not present in the base system.

[[uses-gssapi]]
== `gssapi`

Possible arguments: (none), `base` (default), `heimdal`, `mit`, `flags`, `bootstrap`

Handle dependencies needed by consumers of the GSS-API.
Only libraries that provide the Kerberos mechanism are available.
By default, or set to `base`, the GSS-API library from the base system is used.
Can also be set to `heimdal` to use package:security/heimdal[], or `mit` to use package:security/krb5[].

When the local Kerberos installation is not in `LOCALBASE`, set `HEIMDAL_HOME` (for `heimdal`) or `KRB5_HOME` (for `krb5`) to the location of the Kerberos installation.

These variables are exported for the ports to use:

* `GSSAPIBASEDIR`
* `GSSAPICPPFLAGS`
* `GSSAPIINCDIR`
* `GSSAPILDFLAGS`
* `GSSAPILIBDIR`
* `GSSAPILIBS`
* `GSSAPI_CONFIGURE_ARGS`

The `flags` option can be given alongside `base`, `heimdal`, or `mit` to automatically add `GSSAPICPPFLAGS`, `GSSAPILDFLAGS`, and `GSSAPILIBS` to `CFLAGS`, `LDFLAGS`, and `LDADD`, respectively.
For example, use `base,flags`.

The `bootstrap` option is a special prefix only for use by package:security/krb5[] and package:security/heimdal[].
For example, use `bootstrap,mit`.

[[uses-gssapi-ex1]]
.Typical Use
[example]
====
[.programlisting]
....
OPTIONS_SINGLE=	GSSAPI
OPTIONS_SINGLE_GSSAPI=	GSSAPI_BASE GSSAPI_HEIMDAL GSSAPI_MIT GSSAPI_NONE

GSSAPI_BASE_USES=	gssapi
GSSAPI_BASE_CONFIGURE_ON=	--with-gssapi=${GSSAPIBASEDIR} ${GSSAPI_CONFIGURE_ARGS}
GSSAPI_HEIMDAL_USES=	gssapi:heimdal
GSSAPI_HEIMDAL_CONFIGURE_ON=	--with-gssapi=${GSSAPIBASEDIR} ${GSSAPI_CONFIGURE_ARGS}
GSSAPI_MIT_USES=	gssapi:mit
GSSAPI_MIT_CONFIGURE_ON=	--with-gssapi=${GSSAPIBASEDIR} ${GSSAPI_CONFIGURE_ARGS}
GSSAPI_NONE_CONFIGURE_ON=	--without-gssapi
....

====

[[uses-gstreamer]]
== `gstreamer`

Possible arguments: (none)

Provides an easy way to depend on GStreamer components.
The components should be listed in `USE_GSTREAMER`.
The available components are:

* `a52dec`
* `aalib`
* `amrnb`
* `amrwbdec`
* `aom`
* `assrender`
* `bad`
* `bs2b`
* `cairo`
* `cdio`
* `cdparanoia`
* `chromaprint`
* `curl`
* `dash`
* `dtls`
* `dts`
* `dv`
* `dvd`
* `dvdread`
* `editing-services`
* `faac`
* `faad`
* `flac`
* `flite`
* `gdkpixbuf`
* `gl`
* `gme`
* `gnonlin`
* `good`
* `gsm`
* `gtk4`
* `gtk`
* `hal`
* `hls`
* `jack`
* `jpeg`
* `kate`
* `kms`
* `ladspa`
* `lame`
* `libav`
* `libcaca`
* `libde265`
* `libmms`
* `libvisual`
* `lv2`
* `mm`
* `modplug`
* `mpeg2dec`
* `mpeg2enc`
* `mpg123`
* `mplex`
* `musepack`
* `neon`
* `ogg`
* `opencv`
* `openexr`
* `openh264`
* `openjpeg`
* `openmpt`
* `opus`
* `pango`
* `png`
* `pulse`
* `qt`
* `resindvd`
* `rsvg`
* `rtmp`
* `shout2`
* `sidplay`
* `smoothstreaming`
* `sndfile`
* `sndio`
* `soundtouch`
* `soup`
* `spandsp`
* `speex`
* `srtp`
* `taglib`
* `theora`
* `ttml`
* `twolame`
* `ugly`
* `v4l2`
* `vorbis`
* `vpx`
* `vulkan`
* `wavpack`
* `webp`
* `webrtcdsp`
* `x264`
* `x265`
* `x`
* `ximagesrc`
* `zbar`

[[uses-horde]]
== `horde`

Possible arguments: (none)

Add buildtime and runtime dependencies on package:devel/pear-channel-horde[].
Other Horde dependencies can be added with `USE_HORDE_BUILD` and `USE_HORDE_RUN`.
See crossref:special[php-horde,Horde Modules] for more information.

[[uses-iconv]]
== `iconv`

Possible arguments: (none), `lib`, `build`, `patch`, `translit`, `wchar_t`

Uses `iconv` functions, either from the port package:converters/libiconv[] as a build-time and run-time dependency, or from the base system.
By default, with no arguments or with the `lib` argument, implies `iconv` with build-time and run-time dependencies.
`build` implies a build-time dependency, and `patch` implies a patch-time dependency.
If the port uses the `WCHAR_T` or `//TRANSLIT` iconv extensions, add the relevant arguments so that the correct iconv is used.
For more information see crossref:special[using-iconv,Using `iconv`].

[[uses-imake]]
== `imake`

Possible arguments: (none), `env`, `notall`, `noman`

Add package:devel/imake[] as a build-time dependency and run `xmkmf -a` during the `configure` stage.
If the `env` argument is given, the `configure` target is not set.
If the `-a` flag is a problem for the port, add the `notall` argument.
If `xmkmf` does not generate a `install.man` target, add the `noman` argument.

[[uses-kde]]
== `kde`

Possible arguments: `5`

Add dependency on KDE components.
See crossref:special[using-kde,Using KDE] for more information.

[[uses-kmod]]
== `kmod`

Possible arguments: (none), `debug`

Fills in the boilerplate for kernel module ports, currently:

* Add `kld` to `CATEGORIES`.
* Set `SSP_UNSAFE`.
* Set `IGNORE` if the kernel sources are not found in `SRC_BASE`.
* Define `KMODDIR` to [.filename]#/boot/modules# by default, add it to `PLIST_SUB` and `MAKE_ENV`, and create it upon installation. If `KMODDIR` is set to [.filename]#/boot/kernel#, it will be rewritten to [.filename]#/boot/modules#. This prevents breaking packages when upgrading the kernel due to [.filename]#/boot/kernel# being renamed to [.filename]#/boot/kernel.old# in the process.
* Handle cross-referencing kernel modules upon installation and deinstallation, using crossref:plist[plist-keywords-kld,`@kld`].
* If the `debug` argument is given, the port can install a debug version of the module into [.filename]#KERN_DEBUGDIR#/[.filename]#KMODDIR#. By default, `KERN_DEBUGDIR` is copied from `DEBUGDIR` and set to [.filename]#/usr/lib/debug#. The framework will take care of creating and removing any required directories.

[[uses-ldap]]
== `ldap`

Possible arguments: (none), <version>, client, server

Registers a dependency on package:net/openldap[].
It uses the specific `<version>` (without the dot notation) if set.
Otherwise it tries to find the currently installed version.
If necessary it falls back to the default version found in `bsd.default-versions.mk`.
`client` specifies a runtime dependency on the client library. This is also the
default.
`server` specifies a runtime dependency on the server.

The following variables can be accessed by the port:

`IGNORE_WITH_OPENLDAP`::
This variable can be defined if the ports does not support one or more versions of OpenLDAP.
`WITH_OPENLDAP_VER`::
User defined variable to set OpenLDAP version.
`OPENLDAP_VER`::
Detected OpenLDAP version.

[[uses-lha]]
== `lha`

Possible arguments: (none)

Set `EXTRACT_SUFX` to `.lzh`

[[uses-libarchive]]
== `libarchive`

Possible arguments: (none)

Registers a dependency on package:archivers/libarchive[].
Any ports depending on libarchive must include `USES=libarchive`.

[[uses-libedit]]
== `libedit`

Possible arguments: (none)

Registers a dependency on package:devel/libedit[].
Any ports depending on libedit must include `USES=libedit`.

[[uses-libtool]]
== `libtool`

Possible arguments: (none), `keepla`, `build`

Patches `libtool` scripts. This must be added to all ports that use `libtool`.
The `keepla` argument can be used to keep [.filename]#.la# files.
Some ports do not ship with their own copy of libtool and need a build time dependency on package:devel/libtool[], use the `:build` argument to add such dependency.

[[uses-linux]]
== `linux`

Possible arguments: `c6`, `c7`

Ports Linux compatibility framework.
Specify `c6` to depend on CentOS 6 packags.
Specify `c7` to depend on CentOS 7 packages. The available packages are:

* `allegro`
* `alsa-plugins-oss`
* `alsa-plugins-pulseaudio`
* `alsalib`
* `atk`
* `avahi-libs`
* `base`
* `cairo`
* `cups-libs`
* `curl`
* `cyrus-sasl2`
* `dbusglib`
* `dbuslibs`
* `devtools`
* `dri`
* `expat`
* `flac`
* `fontconfig`
* `gdkpixbuf2`
* `gnutls`
* `graphite2`
* `gtk2`
* `harfbuzz`
* `jasper`
* `jbigkit`
* `jpeg`
* `libasyncns`
* `libaudiofile`
* `libelf`
* `libgcrypt`
* `libgfortran`
* `libgpg-error`
* `libmng`
* `libogg`
* `libpciaccess`
* `libsndfile`
* `libsoup`
* `libssh2`
* `libtasn1`
* `libthai`
* `libtheora`
* `libv4l`
* `libvorbis`
* `libxml2`
* `mikmod`
* `naslibs`
* `ncurses-base`
* `nspr`
* `nss`
* `openal`
* `openal-soft`
* `openldap`
* `openmotif`
* `openssl`
* `pango`
* `pixman`
* `png`
* `pulseaudio-libs`
* `qt`
* `qt-x11`
* `qtwebkit`
* `scimlibs`
* `sdl12`
* `sdlimage`
* `sdlmixer`
* `sqlite3`
* `tcl85`
* `tcp_wrappers-libs`
* `tiff`
* `tk85`
* `ucl`
* `xorglibs`

[[uses-llvm]]
== `llvm`

Possible arguments: (none), `_XY_`, min=`_XY_`, max=`_XY_`, build, run, lib

Adds a dependency on LLVM.
By default this is a build dependency unless overridden by the `run` or `lib`
options.
The default version is the one set in `LLVM_DEFAULT`. A specific version can be
specified as well. The minimum and maximum versions can be specified with the
`min` and `max` parameters respectively.
The ports framework export the following variables to the port:

`LLVM_VERSION`::
Version chosen from the arguments to llvm.mk
`LLVM_PORT`::
Chosen llvm port
`LLVM_CONFIG`::
llvm-config of the chosen port
`LLVM_LIBLLVM`::
libLLVM.so of the chosen port
`LLVM_PREFIX`::
Installation prefix of the chosen port

[[uses-localbase]]
== `localbase`

Possible arguments: (none), `ldflags`

Ensures that libraries from dependencies in `LOCALBASE` are used instead of the ones from the base system.
Specify `ldflags` to add `-L${LOCALBASE}/lib` to `LDFLAGS` instead of `LIBS`.
Ports that depend on libraries that are also present in the base system should use this.
It is also used internally by a few other `USES`.

[[uses-lua]]
== `lua`

Possible arguments: (none), `_XY_`, `_XY_+`, `-_XY_`, `_XY_-_ZA_`, `module`, `flavors`, `build`, `run`, `env`

Adds a dependency on Lua.
By default this is a library dependency, unless overridden by the `build` and/or `run` option.
The `env` option prevents the addition of any dependency, while still defining all the usual variables.

The default version is set by the usual `DEFAULT_VERSIONS` mechanism, unless a version or range of versions is specified as an argument, for example, `51` or `51-54`.

Applications using Lua are normally built for only a single Lua version.
However, library modules intended to be loaded by Lua code should use the `module` option to build with multiple flavors.

For more information see crossref:special[using-lua,Using Lua].

[[uses-luajit]]
== `luajit`

Possible arguments: (none), `_X_`

Adds a dependency on luajit runtime.
A specific version _X_ can be used. Possible versions are `luajit`, `luajit-devel`, `luajit-openresty`

After including [.filename]#bsd.port.options.mk# or [.filename]#bsd.port.pre.mk# the port can inspect these variables:

`LUAJIT_VER`::
The selected luajit version
`LUAJIT_INCDIR`::
The path to luajit's header files
`LUAJIT_LUAVER`::
Which luajit spec version is selected (2.0 for luajit, else 2.1)

For more information see crossref:special[using-lua,Using Lua].

[[uses-lxqt]]
== `lxqt`

Possible arguments: (none)

Handle dependencies for the LXQt Desktop Environment.
Use `USE_LXQT` to select the components needed for the port.
See crossref:special[using-lxqt,Using LXQt] for more information.

[[uses-magick]]
== `magick`

Possible arguments: (none), `_X_`, `build`, `nox11`, `run`, `test`

Add a library dependency on `ImageMagick`.
A specific version _X_ can be used. Possible versions are `6` and `7` (default).
`nox11` indicates that the `-nox11` version of the port is required.
`build`, `run` and `test` add build-, run-time and test dependencies on ImageMagick.

[[uses-makeinfo]]
== `makeinfo`

Possible arguments: (none)

Add a build-time dependency on `makeinfo` if it is not present in the base system.

[[uses-makeself]]
== `makeself`

Possible arguments: (none)

Indicates that the distribution files are makeself archives and sets the appropriate dependencies.

[[uses-mate]]
== `mate`

Possible arguments: (none)

Provides an easy way to depend on MATE components.
The components should be listed in `USE_MATE`.
The available components are:

* `autogen`
* `caja`
* `common`
* `controlcenter`
* `desktop`
* `dialogs`
* `docutils`
* `icontheme`
* `intlhack`
* `intltool`
* `libmatekbd`
* `libmateweather`
* `marco`
* `menus`
* `notificationdaemon`
* `panel`
* `pluma`
* `polkit`
* `session`
* `settingsdaemon`

The default dependency is build- and run-time, it can be changed with `:build` or `:run`.
For example:

[.programlisting]
....
USES=		mate
USE_MATE=	menus:build intlhack
....

[[uses-meson]]
== `meson`

Possible arguments: (none)

Provide support for Meson based projects.
For more information see crossref:special[using-meson,Using `meson`].

[[uses-metaport]]
== `metaport`

Possible arguments: (none)

Sets the following variables to make it easier to create a metaport: `MASTER_SITES`, `DISTFILES`, `EXTRACT_ONLY`, `NO_BUILD`, `NO_INSTALL`, `NO_MTREE`, `NO_ARCH`.

[[uses-minizip]]
== `minizip`

Possible arguments: (none), `ng`

Adds a library dependency on package:archivers/minizip[] or package:archivers/minizip-ng[] respectively.

[[uses-mysql]]
== `mysql`

Possible arguments: (none), `_version_`, `client` (default), `server`, `embedded`

Provide support for MySQL
If no version is given, try to find the current installed version.
Fall back to the default version, MySQL-5.6.
The possible versions are `55`, `55m`, `55p`, `56`, `56p`, `56w`, `57`, `57p`, `80`, `100m`, `101m`, and `102m`.
The `m` and `p` suffixes are for the MariaDB and Percona variants of MySQL.
`server` and `embedded` add a build- and run-time dependency on the MySQL server.
When using `server` or `embedded`, add `client` to also add a dependency on [.filename]#libmysqlclient.so#.
A port can set `IGNORE_WITH_MYSQL` if some versions are not supported.

The framework sets `MYSQL_VER` to the detected MySQL version.

[[uses-mono]]
== `mono`

Possible arguments: (none), `nuget`

Adds a dependency on the Mono (currently only C#) framework by setting the appropriate dependencies.

Specify `nuget` when the port uses nuget packages.
`NUGET_DEPENDS` needs to be set with the names and versions of the nuget packages in the format `_name_=_version_`.
An optional package origin can be added using `_name_=_version_:_origin_`.

The helper target, `buildnuget`, will output the content of the `NUGET_DEPENDS` based on the provided [.filename]#packages.config#.

[[uses-motif]]
== `motif`

Possible arguments: (none)

Uses package:x11-toolkits/open-motif[] as a library dependency.
End users can set `WANT_LESSTIF` in [.filename]#make.conf# to use
package:x11-toolkits/lesstif[] as dependency instead of package:x11-toolkits/open-motif[].
Similarly setting `WANT_OPEN_MOTIF_DEVEL` in [.filename]#make.conf# will add a
dependency on package:x11-toolkits/open-motif-devel[]

[[uses-ncurses]]
== `ncurses`

Possible arguments: (none), `base`, `port`

Uses ncurses, and causes some useful variables to be set.

[[uses-nextcloud]]
== `nextcloud`

Possible arguments: (none)

Adds support for Nextcloud applications by adding a run time dependency on package:www/nextcloud[].

[[uses-ninja]]
== `ninja`

Possible arguments: (none)

Uses ninja to build the port.

[[uses-nodejs]]
== `nodejs`

Possible arguments: (none), `build`, `run`, `current`, `lts`, `10`, `14`, `16`,
 `17`.

Uses nodejs. Adds a dependency on package:www/node*[]. If a supported version is
specified then `run` and/or `build` must be specified too.

[[uses-objc]]
== `objc`

Possible arguments: (none)

Add objective C dependencies (compiler, runtime library) if the base system does not support it.

[[uses-octave]]
== `octave`

Possible arguments: (none), env

Uses package:math/octave[].
`env` loads only one `OCTAVE_VERSION` environmental variable.

[[uses-openal]]
== `openal`

Possible arguments: `al`, `soft` (default), `si`, `alut`

Uses OpenAL.
The backend can be specified, with the software implementation as the default.
The user can specify a preferred backend with `WANT_OPENAL`.
Valid values for this knob are `soft` (default) and `si`.

[[uses-pathfix]]
== `pathfix`

Possible arguments: (none)

Look for [.filename]#Makefile.in# and [.filename]#configure# in `PATHFIX_WRKSRC` (defaults to `WRKSRC`) and fix common paths to make sure they respect the FreeBSD hierarchy.
For example, it fixes the installation directory of `pkgconfig`'s [.filename]#.pc# files to [.filename]#${PREFIX}/libdata/pkgconfig#.
If the port uses `USES=autoreconf`, [.filename]#Makefile.am# will be added to `PATHFIX_MAKEFILEIN` automatically.

If the port <<uses-cmake,`USES=cmake`>> it will look for [.filename]#CMakeLists.txt# in `PATHFIX_WRKSRC`.
If needed, that default filename can be changed with `PATHFIX_CMAKELISTSTXT`.

[[uses-pear]]
== `pear`

Possible arguments: `env`

Adds a dependency on package:devel/pear[].
It will setup default behavior for software using the PHP Extension and Application Repository.
Using the `env` arguments only sets up the PEAR environment variables.
See crossref:special[php-pear,PEAR Modules] for more information.

[[uses-perl5]]
== `perl5`

Possible arguments: (none)

Depends on Perl. The configuration is done using `USE_PERL5`.

`USE_PERL5` can contain the phases in which to use Perl, can be `extract`, `patch`, `build`, `run`, or `test`.

`USE_PERL5` can also contain `configure`, `modbuild`, or `modbuildtiny` when [.filename]#Makefile.PL#, [.filename]#Build.PL#,
or Module::Build::Tiny's flavor of [.filename]#Build.PL# is required.

`USE_PERL5` defaults to `build run`.
When using `configure`, `modbuild`, or `modbuildtiny`, `build` and `run` are implied.

See crossref:special[using-perl,Using Perl] for more information.

[[uses-pgsql]]
== `pgsql`

Possible arguments: (none), `_X.Y_`, `_X.Y_+`, `_X.Y_-`, `_X.Y_-_Z.A_`

Provide support for PostgreSQL.
Port maintainer can set version required.
Minimum and maximum versions or a range can be specified; for example, `9.0-`, `8.4+`, `8.4-9.2.`

By default, the added dependency will be the client, but if the port requires additional components,
this can be done using `WANT_PGSQL=_component[:target]_`;
for example, `WANT_PGSQL=server:configure pltcl plperl`.
The available components are:

* `client`
* `contrib`
* `docs`
* `pgtcl`
* `plperl`
* `plpython`
* `pltcl`
* `server`

[[uses-php]]
== `php`

Possible arguments: (none), `phpize`, `ext`, `zend`, `build`, `cli`, `cgi`, `mod`, `web`, `embed`, `pecl`, `flavors`, `noflavors`

Provide support for PHP.
Add a runtime dependency on the default PHP version, package:lang/php81[].

`phpize`::
Use to build a PHP extension.
Enables flavors.

`ext`::
Use to build, install and register a PHP extension.
Enables flavors.

`zend`::
Use to build, install and register a Zend extension.
Enables flavors.

`build`::
Set PHP also as a build-time dependency.

`cli`::
Needs the CLI version of PHP.

`cgi`::
Needs the CGI version of PHP.

`mod`::
Needs the Apache module for PHP.

`web`::
Needs the Apache module or the CGI version of PHP.

`embed`::
Needs the embedded library version of PHP.

`pecl`::
Provide defaults for fetching PHP extensions from the PECL repository.
Enables flavors.

`flavors`::
Enable automatic crossref:flavors[flavors-auto-php,PHP flavors] generation.
Flavors will be generated for all PHP versions, except the ones present in <<uses-php-ignore,`IGNORE_WITH_PHP`>>.

`noflavors`::
Disable automatic PHP flavors generation.
_Must only_ be used with extensions provided by PHP itself.

Variables are used to specify which PHP modules are required, as well as which version of PHP are supported.

`USE_PHP`::
The list of required PHP extensions at run-time.
Add `:build` to the extension name to add a build-time dependency.
Example: `pcre xml:build gettext`

[[uses-php-ignore]]
`IGNORE_WITH_PHP`::
The port does not work with PHP of the given version.
For possible values look at the content of `_ALL_PHP_VERSIONS` in [.filename]#Mk/Uses/php.mk#.

When building a PHP or Zend extension with `:ext` or `:zend`, these variables can be set:

`PHP_MODNAME`::
The name of the PHP or Zend extension.
Default value is `${PORTNAME}`.

`PHP_HEADER_DIRS`::
A list of subdirectories from which to install header files.
The framework will always install the header files that are present in the same directory as the extension.

`PHP_MOD_PRIO`::
The priority at which to load the extension.
It is a number between `00` and `99`.
+
For extensions that do not depend on any extension, the priority is automatically set to `20`, for extensions that depend on another extension, the priority is automatically set to `30`.
Some extensions may need to be loaded before every other extension, for example package:www/php56-opcache[].
Some may need to be loaded after an extension with a priority of `30`.
In that case, add `PHP_MOD_PRIO=_XX_` in the port's Makefile. For example:
+
[.programlisting]
....
USES=		php:ext
USE_PHP=	wddx
PHP_MOD_PRIO=	40
....

These variables are available to use in `PKGNAMEPREFIX` or `PKGNAMESUFFIX`:

`PHP_PKGNAMEPREFIX`::
Contains `php_XY_-` where _XY_ is the current flavor's PHP version.
Use with PHP extensions and modules.

`PHP_PKGNAMESUFFIX`::
Contains `-php_XY_` where _XY_ is the current flavor's PHP version.
Use with PHP applications.

`PECL_PKGNAMEPREFIX`::
Contains `php_XY_-pecl-` where _XY_ is the current flavor's PHP version.
Use with PECL modules.

[IMPORTANT]
====
With flavors, all PHP extensions, PECL extensions, PEAR modules _must have_ a different package name,
so they must all use one of these three variables in their `PKGNAMEPREFIX` or `PKGNAMESUFFIX`.
====

[[uses-pkgconfig]]
== `pkgconfig`

Possible arguments: (none), `build` (default), `run`, `both`

Uses package:devel/pkgconf[].
With no arguments or with the `build` argument, it implies `pkg-config` as a build-time dependency.
`run` implies a run-time dependency and `both` implies both run-time and build-time dependencies.

[[uses-pure]]
== `pure`

Possible arguments: (none), `ffi`

Uses package:lang/pure[].
Largely used for building related pure ports.
With the `ffi` argument, it implies package:devel/pure-ffi[] as a run-time dependency.

[[uses-pyqt]]
== `pyqt`

Possible arguments: (none), `4`, `5`

Uses PyQt. If the port is part of PyQT itself, set `PYQT_DIST`.
Use `USE_PYQT` to select the components the port needs.
The available components are:

* `core`
* `dbus`
* `dbussupport`
* `demo`
* `designer`
* `designerplugin`
* `doc`
* `gui`
* `multimedia`
* `network`
* `opengl`
* `qscintilla2`
* `sip`
* `sql`
* `svg`
* `test`
* `webkit`
* `xml`
* `xmlpatterns`

These components are only available with PyQT4:

* `assistant`
* `declarative`
* `help`
* `phonon`
* `script`
* `scripttools`

These components are only available with PyQT5:

* `multimediawidgets`
* `printsupport`
* `qml`
* `serialport`
* `webkitwidgets`
* `widgets`

The default dependency for each component is build- and run-time, to select only build or run, add `_build` or `_run` to the component name. For example:

[.programlisting]
....
USES=		pyqt
USE_PYQT=	core doc_build designer_run
....

[[uses-pytest]]
== `pytest`

Possible arguments: (none), 4

Introduces a new dependency on package:devel/pytest[]. It defines a `do-test`
target which will run the tests properly.
Use the argument to depend on a specific package:devel/pytest[] version.
For ports using package:devel/pytest[] consider using this instead of a specific
`do-test` target.
The framework exposes the following variables to the port:

`PYTEST_ARGS`::
Additional arguments to pytest (defaults to empty).

`PYTEST_IGNORED_TESTS`::
lists of `pytest -k` patterns of tests to ignore (defaults to empty). For tests
which are not expected to pass, such as ones requiring a database access.

`PYTEST_BROKEN_TESTS`::
lists of `pytest -k` patterns of tests to ignore (defaults to empty). For broken
tests which require fixing.

In addition the following variables may be set by the user:

`PYTEST_ENABLE_IGNORED_TESTS`::
Enable tests which are otherwise ignored by `PYTEST_IGNORED_TESTS`.

`PYTEST_ENABLE_BROKEN_TESTS`::
Enable tests which are otherwise ignored by `PYTEST_BROKEN_TESTS`.

`PYTEST_ENABLE_ALL_TESTS`::
Enable tests which are otherwise ignored by `PYTEST_IGNORED_TESTS` and
`PYTEST_BROKEN_TESTS`.


[[uses-python]]
== `python`

Possible arguments: (none), `_X.Y_`, `_X.Y+_`, `_-X.Y_`, `_X.Y-Z.A_`, `patch`, `build`, `run`, `test`

Uses Python. A supported version or version range can be specified.
If Python is only needed at build time, run time or for the tests, it can be set as a build, run or test dependency with `build`, `run`, or `test`.
If Python is also needed during the patch phase, use `patch`.
See crossref:special[using-python, Using Python] for more information.

`PYTHON_NO_DEPENDS=yes` can be used when the variables exported by the framework are needed but a dependency on Python is not.
It can happen when using with <<uses-shebangfix,`USES=shebangfix`>>, and the goal is only to fix the shebangs but not add a dependency on Python.

[[uses-qmail]]
== `qmail`

Possible arguments: (none), `build`, `run`, `both`, `vars`

Uses package:mail/qmail[]. With the `build` argument, it implies `qmail` as a build-time dependency.
`run` implies a run-time dependency.
Using no argument or the `both` argument implies both run-time and build-time dependencies.
`vars` will only set QMAIL variables for the port to use.

[[uses-qmake]]
== `qmake`

Possible arguments: (none), `norecursive`, `outsource`, `no_env`, `no_configure`

Uses QMake for configuring. For more information see crossref:special[using-qmake,Using `qmake`].

[[uses-qt]]
== `qt`

Possible arguments: `5`, `6`, `no_env`

Add dependency on Qt components.
`no_env` is passed directly to `USES= qmake`.
See crossref:special[using-qt,Using Qt] for more information.

[[uses-qt-dist]]
== `qt-dist`

Possible arguments: (none) or `5` and (none) or `6` and (none) or one of `3d`, `5compat`, `base`, `charts`, `connectivity`, `datavis3d`, `declarative`, `doc` `languageserver`, `gamepad`, `graphicaleffects`, `imageformats`, `locat    ion`, `lottie`, `multimedia`, `networkauth`, `positioning`, `quick3d`, `quickcontrols2`, `quickcontrols`, `quicktimeline`, `remoteobjects`, `script`, `scxml    `, `sensors`, `serialbus`, `serialport`, `shadertools`, `speech`, `svg`, `tools`, `translations`, `virtualkeyboard`, `wayland`, `webchannel`, `webengine`, `webglplugin`, `websockets`, `webview`, `x11extras`, `xmlpatterns`.

Provides support for building Qt 5 and Qt 6 components.
It takes care of setting up the appropriate configuration environment for the port to build.

[[qt5-dist-example]]
.Building Qt 5 Components
[example]
====
The port is Qt 5's `networkauth` component, which is part of the `networkauth` distribution file.

[.programlisting]
....
PORTNAME=	networkauth
DISTVERSION=	${QT5_VERSION}

USES=		qt-dist:5
....

====


[[qt6-dist-example]]
.Building Qt 6 Components
[example]
====
The port is Qt 6's `websockets` component, which is part of the `websockets` distribution file.

[.programlisting]
....
PORTNAME=       websockets
PORTVERSION=    ${QT6_VERSION}

USES=           qt-dist:6
....

====

If `PORTNAME` does not match the component name, it can be passed as an argument to `qt-dist`.

[[qt5-dist-example-explicit]]
.Building Qt 5 Components with Different Names
[example]
====
The port is Qt 5's `gui` component, which is part of the `base` distribution file.

[.programlisting]
....
PORTNAME=	gui
DISTVERSION=	${QT5_VERSION}

USES=		qt-dist:5,base
....

====

[[uses-readline]]
== `readline`

Possible arguments: (none), `port`

Uses readline as a library dependency, and sets `CPPFLAGS` and `LDFLAGS` as necessary.
If the `port` argument is used or if readline is not present in the base system, add a dependency on package:devel/readline[]


[[uses-ruby]]
== `ruby`

Possible arguments: (none), `build`, `extconf`, `run`, `setup`

Provide support for Ruby related ports.
`(none)` without arguments adds runtime dependency on package:lang/ruby[].
`build` adds a dependency on package:lang/ruby[] at build time.
`extconf` states that the port uses extconf.rb to configure.
`run` adds a dependency on package:lang/ruby[] at run time. This is also the default.
`setup` states that the port uses setup.rb to configure and build.

The user may have the following variables defined:

`RUBY_VER`::
Alternative short version of ruby in the form of `x.y'.

`RUBY_DEFAULT_VER`::
Set to (e.g.) `2.7` to use `ruby27` as the default version.

`RUBY_ARCH`::
Set the architecture name (e.g. i386-freebsd7).

The following variables are exported to be used by the port:

`RUBY`::
Set to full path of ruby.
If set, the values of the following variables are automatically obtained from
the ruby executable: `RUBY_ARCH`, `RUBY_ARCHLIBDIR`, `RUBY_LIBDIR`,
`RUBY_SITEARCHLIBDIR`, `RUBY_SITELIBDIR`, `RUBY_VER` and `RUBY_VERSION`

`RUBY_VER`::
Set to the alternative short version of ruby in the form of `x.y'.

`RUBY_EXTCONF`::
Set to the alternative name of extconf.rb (default: extconf.rb).

`RUBY_EXTCONF_SUBDIRS`::
Set to list of subdirectories, if multiple modules are included.

`RUBY_SETUP`::
Set to the alternative name of setup.rb (default: setup.rb).


[[uses-samba]]
== `samba`

Possible arguments: `build`, `env`, `lib`, `run`

Handle dependency on Samba.
`env` will not add any dependency and only set up the variables.
`build` and `run` will add build-time and run-time dependency on [.filename]#smbd#. `lib` will add a dependency on [.filename]#libsmbclient.so#.
The variables that are exported are:

`SAMBAPORT`::
The origin of the default Samba port.

`SAMBAINCLUDES`::
The location of the Samba header files.

`SAMBALIBS`::
The directory where the Samba shared libraries are available.

[[uses-scons]]
== `scons`

Possible arguments: (none)

Provide support for the use of package:devel/scons[].
See crossref:special[using-scons,Using `scons`] for more information.

[[uses-shared-mime-info]]
== `shared-mime-info`

Possible arguments: (none)

Uses update-mime-database from package:misc/shared-mime-info[].
This uses will automatically add a post-install step in such a way that the port itself still can specify there own post-install step if needed.
It also add an crossref:plist[plist-keywords-shared-mime-info,`@shared-mime-info`] entry to the plist.

[[uses-shebangfix]]
== `shebangfix`

Possible arguments: (none)

A lot of software uses incorrect locations for script interpreters, most notably [.filename]#/usr/bin/perl# and [.filename]#/bin/bash#.
The shebangfix macro fixes shebang lines in scripts listed in `SHEBANG_REGEX`, `SHEBANG_GLOB`, or `SHEBANG_FILES`.

`SHEBANG_REGEX`::
Contains _one_ extended regular expressions, and is used with the `-iregex` argument of man:find[1].
See <<uses-shebangfix-ex-regex>>.

`SHEBANG_GLOB`::
Contains a list of patterns used with the `-name` argument of man:find[1].
See <<uses-shebangfix-ex-glob>>.

`SHEBANG_FILES`::
Contains a list of files or man:sh[1] globs.
The shebangfix macro is run from `${WRKSRC}`, so `SHEBANG_FILES` can contain paths that are relative to `${WRKSRC}`.
It can also deal with absolute paths if files outside of `${WRKSRC}` require patching.
See <<uses-shebangfix-ex-files>>.

Currently Bash, Java, Ksh, Lua, Perl, PHP, Python, Ruby, Tcl, and Tk are supported by default.

There are three configuration variables:

`SHEBANG_LANG`::
The list of supported interpreters.

`_interp__CMD`::
The path to the command interpreter on FreeBSD.
The default value is `${LOCALBASE}/bin/_interp_`.

`_interp__OLD_CMD`::
The list of wrong invocations of interpreters.
These are typically obsolete paths, or paths used on other operating systems that are incorrect on FreeBSD.
They will be replaced by the correct path in `_interp__CMD`.
+
[NOTE]
====
These will _always_ be part of `_interp__OLD_CMD`: `"/usr/bin/env _interp_" /bin/_interp_ /usr/bin/_interp_ /usr/local/bin/_interp_`.
====
+
[TIP]
====
`_interp__OLD_CMD` contain multiple values.
Any entry with spaces must be quoted.
See <<uses-shebangfix-ex-ksh>>.
====

[IMPORTANT]
====
The fixing of shebangs is done during the `patch` phase.
If scripts are created with incorrect shebangs during the `build` phase, the build process (for example, the [.filename]#configure# script, or the [.filename]#Makefiles#) must be patched or given the right path (for example, with `CONFIGURE_ENV`, `CONFIGURE_ARGS`, `MAKE_ENV`, or `MAKE_ARGS`) to generate the right shebangs.

Correct paths for supported interpreters are available in `_interp__CMD`.
====

[TIP]
====
When used with <<uses-python,`USES=python`>>, and the aim is only to fix the shebangs but a dependency on Python itself is not wanted, use `PYTHON_NO_DEPENDS=yes`.
====

[[uses-shebangfix-ex-lua]]
.Adding Another Interpreter to `USES=shebangfix`
[example]
====
To add another interpreter, set `SHEBANG_LANG`.
For example:

[.programlisting]
....
SHEBANG_LANG=	lua
....

====

[[uses-shebangfix-ex-ksh]]
.Specifying all the Paths When Adding an Interpreter to `USES=shebangfix`
[example]
====
If it was not already defined, and there were no default values for `_interp__OLD_CMD` and `_interp__CMD` the Ksh entry could be defined as:

[.programlisting]
....
SHEBANG_LANG=	ksh
ksh_OLD_CMD=	"/usr/bin/env ksh" /bin/ksh /usr/bin/ksh
ksh_CMD=	${LOCALBASE}/bin/ksh
....

====

[[uses-shebangfix-ex-strange]]
.Adding a Strange Location for an Interpreter
[example]
====
Some software uses strange locations for an interpreter.
For example, an application might expect Python to be located in [.filename]#/opt/bin/python2.7#.
The strange path to be replaced can be declared in the port [.filename]#Makefile#:

[.programlisting]
....
python_OLD_CMD=	/opt/bin/python2.7
....

====

[[uses-shebangfix-ex-regex]]
.`USES=shebangfix` with `SHEBANG_REGEX`
[example]
====
To fix all the files in `${WRKSRC}/scripts` ending in [.filename]#.pl#, [.filename]#.sh#, or [.filename]#.cgi# do:

[.programlisting]
....
USES=	shebangfix
SHEBANG_REGEX=	./scripts/.*\.(sh|pl|cgi)
....

[NOTE]
======
`SHEBANG_REGEX` is used by running `find -E`, which uses modern regular expressions also known as extended regular expressions.
See man:re_format[7] for more information.
======

====

[[uses-shebangfix-ex-glob]]
.`USES=shebangfix` with `SHEBANG_GLOB`
[example]
====
To fix all the files in `${WRKSRC}` ending in [.filename]#.pl# or [.filename]#.sh#, do:

[.programlisting]
....
USES=	shebangfix
SHEBANG_GLOB=	*.sh *.pl
....

====

[[uses-shebangfix-ex-files]]
.`USES=shebangfix` with `SHEBANG_FILES`
[example]
====
To fix the files [.filename]#script/foobar.pl# and [.filename]#script/*.sh# in `${WRKSRC}`, do:

[.programlisting]
....
USES=	shebangfix
SHEBANG_FILES=	scripts/foobar.pl scripts/*.sh
....

====

[[uses-sqlite]]
== `sqlite`

Possible arguments: (none), `2`, `3`

Add a dependency on SQLite.
The default version used is 3, but version 2 is also possible using the `:2` modifier.

[[uses-ssl]]
== `ssl`

Possible arguments: (none), `build`, `run`

Provide support for OpenSSL.
A build- or run-time only dependency can be specified using `build` or `run`.
These variables are available for the port's use, they are also added to `MAKE_ENV`:

`OPENSSLBASE`::
Path to the OpenSSL installation base.

`OPENSSLDIR`::
Path to OpenSSL's configuration files.

`OPENSSLLIB`::
Path to the OpenSSL libraries.

`OPENSSLINC`::
Path to the OpenSSL includes.

`OPENSSLRPATH`::
If defined, the path the linker needs to use to find the OpenSSL libraries.

[TIP]
====
If a port does not build with an OpenSSL flavor, set the `BROKEN_SSL` variable, and possibly the `BROKEN_SSL_REASON__flavor_`:

[.programlisting]
....
BROKEN_SSL=	libressl
BROKEN_SSL_REASON_libressl=	needs features only available in OpenSSL
....

====

[[uses-tar]]
== `tar`

Possible arguments: (none), `Z`, `bz2`, `bzip2`, `lzma`, `tbz`, `tbz2`, `tgz`,
`txz`, `xz`, `zst`, `zstd`

Set `EXTRACT_SUFX` to `.tar`, `.tar.Z`, `.tar.bz2`, `.tar.bz2`, `.tar.lzma`,
`.tbz`, `.tbz2`, `.tgz`, `.txz`, `.tar.xz`, `.tar.zst` or `.tar.zstd`  respectively.

[[uses-tcl]]
== `tcl`

Possible arguments: _version_, `wrapper`, `build`, `run`, `tea`

Add a dependency on Tcl. A specific version can be requested using _version_.
The version can be empty, one or more exact version numbers (currently `84`, `85`, or `86`), or a minimal version number (currently `84+`, `85+` or `86+`).
To only request a non version specific wrapper, use `wrapper`.
A build- or run-time only dependency can be specified using `build` or `run`.
To build the port using the Tcl Extension Architecture, use `tea`.
After including [.filename]#bsd.port.pre.mk# the port can inspect the results using these variables:

* `TCL_VER`: chosen major.minor version of Tcl
* `TCLSH`: full path of the Tcl interpreter
* `TCL_LIBDIR`: path of the Tcl libraries
* `TCL_INCLUDEDIR`: path of the Tcl C header files
* `TK_VER`: chosen major.minor version of Tk
* `WISH`: full path of the Tk interpreter
* `TK_LIBDIR`: path of the Tk libraries
* `TK_INCLUDEDIR`: path of the Tk C header files

[[uses-terminfo]]
== `terminfo`

Possible arguments: (none)

Adds crossref:plist[plist-keywords-terminfo,`@terminfo`] to the [.filename]#plist#.
Use when the port installs [.filename]#*.terminfo# files in [.filename]#${PREFIX}/share/misc#.

[[uses-tex]]
== `tex`

Possible arguments: (none)

Provide support for tex.
Loads all the default variables for TEX related ports and does not add any dependency on any ports.

Variables are used to specify which TEX modules are required.

`USE_TEX`::
The list of required TEX extensions at run-time.
Add `:build` to the extension name to add a build-time dependency, `:run` to add runtime dependency, `:test` for test time dependency, `:extract` for extract time dependency.
Example: `base texmf:build source:run`

Current possible arguments are as follows:

* `base`
* `texmf`
* `source`
* `docs`
* `web2c`
* `kpathsea`
* `ptexenc`
* `basic`
* `tlmgr`
* `texlua`
* `texluajit`
* `synctex`
* `xpdfopen`
* `dvipsk`
* `dvipdfmx`
* `xdvik`
* `gbklatex`
* `formats`
* `tex`
* `latex`
* `pdftex`
* `jadetex`
* `luatex`
* `ptex`
* `xetex`
* `xmltex`
* `texhash`
* `updmap`
* `fmtutil`

[[uses-tk]]
== `tk`

Same as arguments for `tcl`

Small wrapper when using both Tcl and Tk.
The same variables are returned as when using Tcl.

[[uses-uidfix]]
== `uidfix`

Possible arguments: (none)

Changes some default behavior (mostly variables) of the build system to allow installing this port as a normal user.
Try this in the port before using <<uses-fakeroot,USES=fakeroot>> or patching.

[[uses-uniquefiles]]
== `uniquefiles`

Possible arguments: (none), `dirs`

Make files or directories 'unique', by adding a prefix or suffix.
If the `dirs` argument is used, the port needs a prefix (and only a prefix) based on `UNIQUE_PREFIX` for standard directories `DOCSDIR`, `EXAMPLESDIR`, `DATADIR`, `WWWDIR`, `ETCDIR`.
These variables are available for ports:

* `UNIQUE_PREFIX`: The prefix to be used for directories and files. Default: `${PKGNAMEPREFIX}`.
* `UNIQUE_PREFIX_FILES`: A list of files that need to be prefixed. Default: empty.
* `UNIQUE_SUFFIX`: The suffix to be used for files. Default: `${PKGNAMESUFFIX}`.
* `UNIQUE_SUFFIX_FILES`: A list of files that need to be suffixed. Default: empty.

[[uses-vala]]
== `vala`

Possible arguments: `build`, `lib`, `no_depend`

Adds build or library dependencies on package:lang/vala[].
The `no_depend` argument is reserved for package:lang/vala[] itself.

[[uses-varnish]]
== `varnish`

Possible arguments: `4` (default), `6`, `7`

Handle dependencies on Varnish Cache.
Adds a dependency on package:www/varnish*[].

[[uses-webplugin]]
== `webplugin`

Possible arguments: (none), `ARGS`

Automatically create and remove symbolic links for each application that supports the webplugin framework.
`ARGS` can be one of:

* `gecko`: support plug-ins based on Gecko
* `native`: support plug-ins for Gecko, Opera, and WebKit-GTK
* `linux`: support Linux plug-ins
* `all` (default, implicit): support all plug-in types
* (individual entries): support only the browsers listed

These variables can be adjusted:

* `WEBPLUGIN_FILES`: No default, must be set manually. The plug-in files to install.
* `WEBPLUGIN_DIR`: The directory to install the plug-in files to, default [.filename]#PREFIX/lib/browser_plugins/WEBPLUGIN_NAME#. Set this if the port installs plug-in files outside of the default directory to prevent broken symbolic links.
* `WEBPLUGIN_NAME`: The final directory to install the plug-in files into, default `PKGBASE`.

[[uses-xfce]]
== `xfce`

Possible arguments: (none), `gtk2`

Provide support for Xfce related ports.
See crossref:special[using-xfce,Using Xfce] for details.

The `gtk2` argument specifies that the port requires GTK2 support.
It adds additional features provided by some core components, for example, package:x11/libxfce4menu[] and package:x11-wm/xfce4-panel[].

[[uses-xorg]]
== `xorg`

Possible arguments: (none)

Provides an easy way to depend on X.org components.
The components should be listed in `USE_XORG`.
The available components are:

[[using-x11-components]]
.Available X.Org Components
[cols="1,1", frame="none", options="header"]
|===
| Name
| Description

|`dmx`
|DMX extension library

|`fontenc`
|The fontenc Library

|`fontutil`
|Create an index of X font files in a directory

|`ice`
|Inter Client Exchange library for X11

|`libfs`
|The FS library

|`pciaccess`
|Generic PCI access library

|`pixman`
|Low-level pixel manipulation library

|`sm`
|Session Management library for X11

|`x11`
|X11 library

|`xau`
|Authentication Protocol library for X11

|`xaw`
|X Athena Widgets library

|`xaw6`
|X Athena Widgets library

|`xaw7`
|X Athena Widgets library

|`xbitmaps`
|X.Org bitmaps data

|`xcb`
|The X protocol C-language Binding (XCB) library

|`xcomposite`
|X Composite extension library

|`xcursor`
|X client-side cursor loading library

|`xdamage`
|X Damage extension library

|`xdmcp`
|X Display Manager Control Protocol library

|`xext`
|X11 Extension library

|`xfixes`
|X Fixes extension library

|`xfont`
|X font library

|`xfont2`
|X font library

|`xft`
|Client-sided font API for X applications

|`xi`
|X Input extension library

|`xinerama`
|X11 Xinerama library

|`xkbfile`
|XKB file library

|`xmu`
|X Miscellaneous Utilities libraries

|`xmuu`
|X Miscellaneous Utilities libraries

|`xorg-macros`
|X.Org development aclocal macros

|`xorg-server`
|X.Org X server and related programs

|`xorgproto`
|xorg protocol headers

|`xpm`
|X Pixmap library

|`xpresent`
|X Present Extension library

|`xrandr`
|X Resize and Rotate extension library

|`xrender`
|X Render extension library

|`xres`
|X Resource usage library

|`xscrnsaver`
|The XScrnSaver library

|`xshmfence`
|Shared memory 'SyncFence' synchronization primitive

|`xt`
|X Toolkit library

|`xtrans`
|Abstract network code for X

|`xtst`
|X Test extension

|`xv`
|X Video Extension library

|`xvmc`
|X Video Extension Motion Compensation library

|`xxf86dga`
|X DGA Extension

|`xxf86vm`
|X Vidmode Extension
|===

[[uses-xorg-cat]]
== `xorg-cat`

Possible arguments: `app`, `data`, `doc`, `driver`, `font`, `lib`, `proto`, `util`, `xserver` and (none) or one off `autotools` (default), `meson`

Provide support for building Xorg components.
It takes care of setting up common dependencies and an appropriate configuration environment needed.
This is intended only for Xorg components.

The category has to match upstream categories.

The second argument is the build system to use.
autotools is the default, but meson is also supported.

[[uses-zip]]
== `zip`

Possible arguments: (none), `infozip`

Indicates that the distribution files use the ZIP compression algorithm.
For files using the InfoZip algorithm the `infozip` argument must be passed to set the appropriate dependencies.