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
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
|
.\" $OpenBSD: bsd.port.mk.5,v 1.620 2023/09/07 17:26:14 espie Exp $
.\"
.\" Copyright (c) 2000-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: September 7 2023 $
.Dt BSD.PORT.MK 5
.Os
.Sh NAME
.Nm bsd.port.mk
.Nd ports tree master Makefile fragment
.Sh SYNOPSIS
.Fd .include <bsd.port.mk>
.Sh DESCRIPTION
.Nm
contains the
.Xr ports 7
tree
.Xr make 1
framework, in the form of documented public targets,
variables and paths.
.Pp
The actual
.Nm
file lives under
.Pa ${PORTSDIR}/infrastructure/mk ,
with
.Xr make 1 Ns 's
system include file redirecting to it.
.Pp
Optional parts of this framework have been moved to
.Xr port-modules 5
in an effort to shrink the main file
.Po
see also
.Ev MODULES
.Pc .
.Pp
Identifiers beginning with an underscore
are internal-use only and likely to change without
notice.
.Pp
This documentation contains sections covering targets, variables,
diagnostics, and filenames, ordered in alphabetic order, followed
by a section covering the fake framework, a section covering debug
packages generation, a section explaining flavors and multi-packages,
and a section covering the generation of package information.
.Pp
It ends with sections covering some obsolete targets, variables and files,
outlining conversion
methods from older incarnations of the ports tree or from other
.Bx
variants.
.Pp
.Nm
also uses quite a few helper scripts which live under
.Pa ${PORTSDIR}/infrastructure/bin .
.Pp
Binary package details are mostly covered in
.Xr pkg_create 1
for the packing-list details,
and in
.Xr pkg_add 1
for the installation semantics.
.Pp
Common usage such as building every package in
the system is covered by
.Xr ports 7
and
.Xr bulk 8
instead, with
.Xr packages 7
providing an overview of the result.
.Sh TARGETS
.Bl -tag -width Ds
.It Cm {build,run,all,test}-dir-depends
Print all dependencies for a port in order to build it, run it, build and
run it, or to run regression tests.
The output is formatted as package specification pairs, in a form suitable
for
.Xr tsort 1 .
.Pp
Note that is is possible to obtain reverse dependency information by
using
.Nm show-reverse-deps
from the
.Pa sqlports
package.
.It Cm full-{build,run,all,test}-depends
Print all dependencies a package depends upon for building, running,
or both, as a list of package names, sorted by dependency order with
.Xr tsort 1 ,
most dependent port first.
.It Cm {build,lib,test,run}-depends-list
Print a list of first level package specifications a port depends as
build dependencies, library dependencies, test dependencies or
run dependencies.
.It Cm print-{build,run}-depends
User convenience target that displays the result of
.Cm full-{build,run}-depends
in a more readable way.
.It Cm {pre,do,post}-*
Most standard targets can be specialized according to a given port's needs.
If defined,
the
.Cm pre-*
hook will be invoked before running the normal action;
the
.Cm do-*
hook will be invoked instead of the normal action;
the
.Cm post-*
hook will be invoked after the normal action.
Specialization hooks exist for
.Cm build ,
.Cm configure ,
.Cm distpatch ,
.Cm extract ,
.Cm fake ,
.Cm gen ,
.Cm install ,
.Cm patch ,
.Cm test .
See individual targets for exceptions.
.It Cm all-lib-depends-args
Process the full
.Ev LIB_DEPENDS
list into a form suitable for
.Xr pkg_create 1 ,
see
.Cm print-package-args .
.It Cm build , Cm all
Default target.
Build the port.
Essentially invoke
.Bd -literal
env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \e
-f ${MAKE_FILE} ${ALL_TARGET}
.Ed
.It Cm check-register
Introspection target.
Verify from the ports tree, without building anything, that the current
subpackage will register okay
.Po
see
.Ev PLIST_REPOSITORY
.Pc .
.It Cm check-register-all
Apply
.Cm check-register
to all subpackages of the current port.
.It Cm checkpatch
Check that patches would apply cleanly, but do not modify anything.
.It Cm checksum
Compute a
.Xr sha256 1
digest
of ${CHECKSUMFILES} (files listed in DISTFILES* and PATCHFILES*) and
check it against ${CHECKSUM_FILE}, normally
.Pa distinfo .
In case of a mismatch, running
.Cm checksum
with
.Ev REFETCH Ns = Ns Cm true
will fetch alternative versions of files keyed on their checksum
from the
.Ox
main archive site.
.It Cm clean
Clean ports contents.
By default, it will clean the work directory.
It can be invoked as
make clean='[depends build bulk work fake flavors dist install sub package
packages plist test]'.
.Bl -tag -width packages
.It Va work
Clean work directory.
.It Va bulk
Clean bulk cookie.
.It Va build
Clean the
.Ev WRKBUILD
directory (only useful if
.Ev SEPARATE_BUILD
is set).
.It Va depends
Recurse into dependencies.
.It Va dist
Clean distribution files.
.It Va fake
Clean fake installation directory.
.It Va flavors
Clean all work directories.
.It Va install
Uninstall package.
.It Va package
Remove all copies of package file.
.It Va plist
Remove registered packing-lists of all subpackages.
.It Va test
Clean test cookie.
.It Va sub
With
.Va install
or
.Va package ,
clean subpackages as well.
.It Va packages
Shorthand for
.Sq sub package .
.It Va all
Shorthand for
.Sq work flavors packages plist .
.El
.It Cm clean-depends
Shorthand for
.Ql make clean=depends .
.It Cm configure
Configure the port.
By default,
.Cm configure
creates the ${WRKBUILD} directory (see
.Ev SEPARATE_BUILD ) ,
and runs whatever configuration methods are recorded in
.Ev CONFIGURE_STYLE .
.It Cm distclean
Shorthand for
.Ql make clean=dist .
.It Cm distpatch
Apply distribution patches only.
See
.Cm patch ,
.Ev PATCH_CASES
and
.Ev FIX_CRLF_FILES
for details.
.It Cm dump-vars
Dump the values of all relevant variables in a port, prepended with the
port's FULLPKGPATH.
.Pp
Can be limited to some specific information by setting
.Ev DPB
to nothing or
.Sq fetch .
Mostly used by
.Xr dpb 1
for obtaining vital information from the ports tree.
.It Cm extract
Extract the distribution files under
.Pa ${WRKDIR}
(but see
.Ev EXTRACT_ONLY ,
.Ev FIX_EXTRACT_PERMISSIONS
and
.Ev NO_DEPENDS ) .
Refer to
.Ev EXTRACT_CASES
for a complete description.
Do not use
.Cm pre-extract
and
.Cm do-extract
hooks.
.It Cm fake
Do a fake port installation, that is, simulate the port installation into
the staging area ${WRKINST}.
There is no
.Cm do-fake
and
.Cm post-fake
hooks:
instead
.Cm fake
runs
.Cm pre-fake ,
.Cm pre-install ,
.Cm do-install
and
.Cm post-install .
Override
.Cm pre-install ,
.Cm do-install ,
or
.Cm post-install
to change behavior.
.Pp
There are only a handful of ports that use
.Cm pre-fake :
that hook can be used to finish setting up a
.Pa fake
directory before starting the installation proper.
Stuff run during
.Cm pre-fake
will not register with
.Cm update-plist ,
whereas stuff run during
.Cm pre-install
will be considered part of the installation process.
.Pp
See
.Sx THE FAKE FRAMEWORK
section below.
.It Cm fake-wantlib-args
Check
.Ev WANTLIB
against the list of installed packages and libraries in the ports tree.
See
.Cm print-package-args .
.It Cm fetch
Fetch the list of files in
.Ev DISTFILES*
and
.Ev PATCHFILES*
using ${FETCH_CMD}.
Files are normally retrieved from the list of sites in
.Ev SITES* .
.Pp
Appending
.Sq :0
to
.Sq :9
to an entry will let
${FETCH_CMD} retrieve from
.Ev SITES0
to
.Ev SITES9
instead (deprecated).
.Pp
Preferably, adding a suffix to
.Ev DISTFILES ,
.Ev PATCHFILES ,
.Ev SUPDISTFILES
will switch the site entry to the corresponding
.Ev SITES
variable, e.g.,
.Bd -literal -offset indent
DISTFILES.go = ...
SITES.go = ...
.Ed
.Pp
If the rest of the entry parses as
.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
${FETCH_CMD} will fetch
.Ar url Ns Ar sufx
instead, but store the result as
.Ar filename Ns Ar sufx .
.Pp
Transfers in progress are stored as
.Ar filenamesufx.part
and moved after completion.
.Pp
The actual filesystem paths to all distfiles (resp. patchfiles) after
url/filename substitution, including suffixed sources, is conveniently
stored as
.Ev ALL_DISTFILES
.Po
resp.
.Ev ALL_PATCHFILES
.Pc .
The ports framework uses
.Pa ${DISTDIR}/${DIST_SUBDIR}
(aliased to
.Pa ${FULLDISTDIR} )
to save the ports distribution files and patch files.
.Pp
If you want to fetch a significant number of distfiles quickly, say
all files relevant to a port,
.Cm dpb Fl F
is more efficient.
.Pp
There are no
.Cm {pre,do,post}-fetch
hooks, as this would break
.Xr dpb 1 .
.Pp
See
.Ev ALL_DISTFILES ,
.Ev ALL_PATCHFILES ,
.Ev ALL_SUPDISTFILES ,
.Ev CHECKSUMFILES ,
.Ev DISTDIR ,
.Ev DISTFILES* ,
.Ev DIST_SUBDIR ,
.Ev FETCH_CMD ,
.Ev FETCH_MANUALLY ,
.Ev FULLDISTDIR ,
.Ev MAKESUMFILES ,
.Ev PATCHFILES* ,
.Ev SUPDISTFILES* ,
.Ev REFETCH .
.Ev SITES* ,
.It Cm fetch-all
Like
.Cm fetch ,
but also fetches
.Ev SUPDISTFILES* ,
for use by e.g.,
.Cm makesum .
.It Cm fix-permissions
Ensure permissions are correct when using
.Ev PORTS_PRIVSEP
and/or
.Xr dpb 1 .
.Pp
If necessary, creates directory
.Ev DISTDIR
owned by
.Ev FETCH_USER ,
and creates directories
.Ev LOCKDIR ,
.Ev PACKAGE_REPOSITORY ,
.Ev PLIST_REPOSITORY
and
.Ev WRKOBJDIR
owned by
.Ev BUILD_USER .
.Pp
If these directories already exist,
ownership of their contents is modified to conform to
.Ev PORTS_PRIVSEP
and
.Xr dpb 1
requirements.
.It Cm gen
Generate configure script when needed, either after patching
input files, or from scratch for some ports,
generally using automake, autoconf, autoreconf and similar GNU tools.
This target only has modules
.Po Ev MODxxx_gen Pc
and a
.Ar do-gen
hooks.
Then adjust timestamps to avoid regeneration during build
.Po
see
.Ev REORDER_DEPENDENCIES
.Pc .
.It Cm generate-readmes
Generate READMEs, rc scripts and login.conf.d files from
.Pa ${PKGDIR}
into
.Pa ${WRKINST} .
Run after
.Cm fake
and before
.Cm package
or
.Cm update-plist .
Always rerun, as it is cheap enough.
.It Cm install-depends
Before package installation, install and verify dependencies constructed from
.Ev RUN_DEPENDS , LIB_DEPENDS ,
and
.Ev WANTLIB .
.It Cm install
Install the package after building.
See the description of
.Sx THE FAKE FRAMEWORK
for the non-intuitive details of the way
.Cm {pre,do,post}-install
hooks are actually used by the ports tree.
.It Cm install-all
Install all packages in a multi-packages port.
.It Cm lib-depends-args
Filter
.Ev LIB_DEPENDS
to keep only entries required by
.Ev WANTLIB ,
and output a list of dependencies suitable for
.Xr pkg_create 1 ,
see
.Cm print-package-args .
.It Cm lib-depends-check
Verify that the
.Ev LIB_DEPENDS
and
.Ev WANTLIB
recorded in the port's packages are accurate.
See
.Cm port-lib-depends-check ,
which checks files under the fake staging directory instead,
and thus has faster turn-around.
.It Cm license-check
Check that
.Ev PERMIT_PACKAGE
settings match:
if any dependency has a more restrictive setting, warn about it.
This warning is advisory, because automated license checking cannot
know that some ports were only used for building and did not taint
the current port.
.It Cm lock
Manually obtain a lock on a given directory.
Output must be used to update environment variables.
The lock can be released with
.Cm unlock .
Seldom used, see
.Xr ports 7
for details.
.It Cm makesum
Uses
.Cm fetch-all
to fetch missing ${MAKESUMFILES}
without verifying their digest, then run
.Xr sha256 1
on them that is,
files listed in ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*}.
The result is stored in ${CHECKSUM_FILE}, normally
.Pa distinfo .
Also store the lengths of all files for a quick check during
.Cm fetch ,
.Cm fetch-all .
.It Cm no-lib-depends-args
Degenerate form of
.Cm lib-depends-args
that does not do anything.
See
.Cm print-package-args .
.It Cm no-wantlib-args
Degenerate form of
.Cm wantlib-args
that does not do anything.
See
.Cm print-package-args .
.It Cm package
Build a port package (or packages in a
.Ev MULTI_PACKAGES
case) from the fake installation.
Involves creating packaging information from templates
(see
.Ev COMMENT ,
.Ev SUBST_VARS
among others) and invoking
.Xr pkg_create 1
for each package in the
.Ev MULTI_PACKAGES
list.
If the repository already contains up-to-date packages, they are not rebuilt.
If PLIST_REPOSITORY is set (the default), the resulting packaging
information is compared with existing stuff, and saved if new,
with loud complaints if it changed without a
.Ev REVISION
bump.
.Pp
if
.Ev DEBUG_PACKAGES
is set, some debug information may also be set aside and saved
in
.Pa debug-*
packages transparently.
.Pp
Also note that
.Pa ${PLIST_REPOSITORY}/${MACHINE_ARCH}/history
contains LRU caches for all files
.Po
see
.Xr package 5
.Pc .
Arch-independent packages are created in ${PACKAGE_REPOSITORY}/no-arch,
and copied into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all as needed.
If ${PERMIT_PACKAGE} is set to
.Sq Yes ,
copies built packages into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp, using
hard links if possible.
.It Cm patch
Apply distribution and
.Ox
specific patches.
Because of historical accident,
.Cm patch
does not follow the exact same scheme other standard targets do.
Namely,
.Cm patch
invokes
.Cm pre-patch
(if defined),
.Cm do-patch ,
and
.Cm post-patch ,
but the default
.Cm do-patch
target invokes
.Cm distpatch
directly.
So, if the
.Cm do-patch
target is overridden, it should still begin by calling
.Ql make distpatch ,
before applying
.Ox
specific patches.
Accordingly, the exact sequence of hooks is:
.Cm pre-patch ,
.Cm do-distpatch ,
.Cm post-distpatch ,
.Cm do-patch ,
.Cm post-patch .
If
.Pa ${PATCHDIR}
exists, the files described under
.Ev PATCH_LIST
will be applied under
.Ev WRKDIST .
.It Cm peek-ftp
Connect to the first site in
.Ev SITES ,
in the right directory, and leaves user at
.Xr ftp 1 Ns 's
prompt.
.It Cm pkglocatedb
Top-level target, see
.Xr ports 7 .
.It Cm port-lib-depends-check
Verify that the
.Ev LIB_DEPENDS
and
.Ev WANTLIB
hold all shared libraries used for every package in the port.
See
.Xr library-specs 7 .
This makes use of
.Cm print-plist-with-depends
to avoid actually building the packages, it only needs the
completion of the
.Cm fake
stage, and thus is quicker than
.Cm lib-depends-check ,
unless you already have all binary packages.
.It Cm port-wantlib-args
Resolve
.Ev WANTLIB
against the ports tree itself and system libraries, without looking at built
or installed packages, and writes a list of options suitable for
.Xr pkg_create 1 .
See
.Cm print-package-args .
.It Cm prepare
Before port building, install and verify dependencies constructed from
.Ev BUILD_DEPENDS ,
.Ev LIB_DEPENDS
and
.Ev WANTLIB .
In
.Ev MULTI_PACKAGES
setups,
see
.Sx FLAVORS AND MULTI_PACKAGES .
.It Cm print-package-args
Print all dependency-related information that will be passed as parameters
to
.Xr pkg_create 1 ,
e.g.,
.Fl W Ar wantlib
and
.Fl P Ar depends
lines.
.Pp
Those parameters are generated by
.Cm run-depends-args
for
.Ev RUN_DEPENDENCIES
handling, a form of
.Cm lib-depends-args
for
.Ev LIB_DEPENDS
and
.Ev WANTLIB
interaction,
and a form of
.Cm wantlib-args
for
.Ev WANTLIB
resolution.
.Pp
Variables
.Ev lib_depends_args
and
.Ev wantlib_args
control the exact behavior:
.Ev lib_depends_args
is normally set to
.Cm lib-depends-args ,
but will be set to
.Cm all-lib-depends-args
by
.Cm port-lib-depends-check ,
in order to have access to the full list of LIB_DEPENDS for figuring
out missing WANTLIB.
.Ev wantlib_args
is normally set to
.Cm wantlib-args
but it may be set to
.Cm port-wantlib-args
for introspection purposes,
to
.Cm fake-wantlib-args
to avoid some checks, or to
.Cm no-wantlib-args
to avoid expensive WANTLIB checks entirely.
.It Cm print-update-signature
Print the update signature, as computed using information from the ports tree,
in the same format used for
.Xr pkg_info 1
.Fl S .
.It Cm print-plist
Generate and print a package packing-list from the static information
present in the port.
.It Cm print-plist-all
Iterate over
.Cm print-plist
for all subpackages in a given port.
.It Cm print-plist-all-with-depends
Iterate over
.Cm print-plist-with-depends
for all subpackages in a given port.
.It Cm print-plist-contents
Generate and print package contents from the static information
present in the port.
In contrast with
.Cm print-plist ,
the package contents only consists of files, all tagged with category
markers such as @file.
See
.Xr pkg_create 1 .
.It Cm print-plist-libs
Generate and print the list of static and dynamic libraries present in the port.
See
.Xr pkg_create 1 .
.It Cm print-plist-libs-with-depends
Like
.Cm print-plist-libs ,
but slower.
It also handles
.Ev LIB_DEPENDS ,
.Ev RUN_DEPENDS ,
and
.Ev WANTLIB ,
so that the packing-list has complete dependency information.
.It Cm print-plist-with-depends
Like
.Cm print-plist ,
but slower.
It also handles
.Ev LIB_DEPENDS ,
.Ev RUN_DEPENDS ,
and
.Ev WANTLIB ,
so that the packing-list is complete.
.It Cm rebuild
Force rebuild of the port.
.It Cm regen
Force rebuilding configure scripts using
.Ar gen
steps.
.It Cm reinstall
Force reinstallation of a port, by first cleaning the old installation.
This will obviously not work for software used as dependencies of other
installed software.
In that case,
.Cm update
might do the right thing.
.It Cm repackage
Rebuild the packages of a port after removing existing packages.
.It Cm run-depends-args
Process
.Ev RUN_DEPENDS
and outputs a list of dependencies suitable for
.Xr pkg_create 1 ,
see
.Cm print-package-args .
.It Cm reprepare
Force running the
.Ar prepare
target again.
.It Cm retest
Force running the
.Ar test
target again.
.It Cm show
Invoked as make show=name, show the contents of ${name}.
Invoked as make show="name1 name2 ...",
show the contents of ${name1} ${name2} ...,
one variable value per line.
Mostly used from recursive makes, or to know the contents of another
port's variables without guessing wrongly.
.It Cm show-debug-info
Displays the information that was generated by
.Xr build-debug-info 1 .
.It Cm show-fake-size
Print the size of ${WRKINST}, in kilobytes.
Used by some options of
.Xr dpb 1 ,
suitable for
.Ev BULK_TARGETS .
.It Cm show-indexed
Similar to
.Cm show .
Invoked as make show-indexed=name, show the contents of ${name${SUBPACKAGE}},
or ${name} if the variable
.Ev name
is not
.Ev SUBPACKAGE
dependent.
.It Cm show-list
Similar to
.Cm show .
Shows "list-like" variables, one entry per line.
Mostly useful as a debugging target, since some internal variables may now
exceed
.Dv ARG_MAX .
.It Cm show-prepare-results
Print the list of actual installed packages found out by
.Cm prepare .
.It Cm show-prepare-test-results
Print the list of actual installed packages found out by
.Cm prepare
and
.Cm test-depends .
.It Cm show-required-by
Print the list of
.Xr pkgpath 7
for all ports that will be affected by the
current port changing.
Works by walking the full list of all dependencies of all ports, in reverse.
.Pp
Very slow, prefer installing the
.Pa sqlports
package and using
.Nm show-reverse-deps .
.It Cm show-run-depends
Print all running dependencies for a port, one per-line, without duplicates.
.It Cm subpackage
Build a port package.
Exactly like
.Cm package ,
but affects only one single subpackage in multi-packages ports.
.It Cm show-size
Print the size of the work directory, in kilobytes.
Used by some options of
.Xr dpb 1 ,
suitable for
.Ev BULK_TARGETS .
.It Cm subupdate
Update an existing installation to a newer package, exactly
like
.Cm update ,
but affects only one single subpackage in multi-packages ports.
.It Cm test
Run regression tests for the port.
Essentially depend on a correct build and invoke
.Bd -literal
env -i ${ALL_TEST_ENV} ${MAKE_PROGRAM} ${ALL_TEST_FLAGS} \e
-f ${MAKE_FILE} ${TEST_TARGET} ${TEST_LOG}
.Ed
.Pp
If a port needs some other ports installed to run regression tests,
use
.Ev TEST_DEPENDS .
If a port needs special configuration or build options to enable regression
testing, define a
.Sq test
.Ev FLAVOR .
.It Cm test-depends
Before running regression tests, Install and verify dependencies
constructed from
.Ev TEST_DEPENDS .
.It Cm unlock
Manually release a lock on a given directory.
See
.Cm lock .
.It Cm update-patches
Create or update patches for a port, using
.Xr update-patches 1 .
See
.Ev EDIT_PATCHES .
.It Cm update
Update an existing installation to a newer package:
scan the installation for a package with the same
.Ev FULLPKGPATH ,
and update it using
.Sq pkg_add -r
if a newer package is available.
In multi-packages ports, all relevant packages are updated.
See
.Ev UPDATE_COOKIES_DIR
and
.Ev FORCE_UPDATE
as well.
.Pp
However, see
.Sx CAVEATS
in
.Xr ports 7 :
.Cm update
is always
.Sq best-effort
and will often not work correctly when
updating to a significantly different newer version.
.It Cm update-or-install
Update an installed package or perform a fresh installation,
by using
.Sq pkg_add -r .
Handles one single package in multi-packages ports.
See
.Ev UPDATE_COOKIES_DIR
and
.Ev FORCE_UPDATE
as well.
.It Cm update-or-install-all
Update installed packages or perform a fresh installation,
by using
.Sq pkg_add -r .
Handles all packages in multi-packages ports.
See
.Ev UPDATE_COOKIES_DIR
and
.Ev FORCE_UPDATE
as well.
.It Cm update-plist
Update the packing-lists for a port, using the fake installation and the
existing packing lists, by invoking
.Xr update-plist 1
with the correct parameters, along with
port-specific options
.Po
.Ev UPDATE_PLIST_ARGS
.Pc
and user settings
.Po
.Ev UPDATE_PLIST_OPTS
.Pc .
Also see
.Ev SUBST_VARS
for details about the default handling of variable substitution.
.It Cm verbose-show
Similar to
.Cm show ,
except that it prefixes each value with the variable name, e.g.,
.Li VAR=value .
Also note that it does not show undefined variables, contrary to
.Cm show
which outputs blank lines for these.
.It Cm wantlib-args
Call
.Cm port-wantlib-args
and
.Cm fake-wantlib-args
and compare the results, errors out in case of discrepancies.
See
.Cm print-package-args .
.El
.Sh VARIABLES
Note that some variables are marked as
.Sq User settings ,
which means that individual ports should not modify them,
and that some variables are marked as
.Sq read-only ,
which means that they shouldn't ever be changed.
In a
.Ev MULTI_PACKAGES
setup, some variables have settings specific to a given subpackage.
See
.Sx FLAVORS AND MULTI_PACKAGES .
.Bl -tag -width Ds
.It Ev show
Invoked as make show=name, show the contents of ${name}.
Invoked as make show="name1 name2 ...", show the contents of
${name1} ${name2} ...,
one variable value per line.
.It Ev ALL_DISTFILES
List of all actual files coming from every
.Ev DISTFILES*
setting, after applying the
.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
conversion, occasionally useful for setting
.Ev EXTRACT_ONLY
manually.
Read-only.
.It Ev ALL_FAKE_FLAGS
Flags passed to ${MAKE} invocations during the fake process.
Equals
.Li ${MAKE_FLAGS} ${DESTDIRNAME}=${WRKINST} ${FAKE_FLAGS} .
Read-only.
.It Ev ALL_PATCHFILES
List of all actual files coming from every
.Ev PATCHFILES*
setting, after applying the
.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
conversion.
Read-only.
.It Ev ALL_SUPDISTFILES
List of all actual files coming from every
.Ev SUPDISTFILES*
setting, after applying the
.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
conversion.
Read-only.
.It Ev ALL_TEST_ENV
Environment passed to test.
Equals
.Li ${MAKE_ENV} ${TEST_ENV} .
Read-only.
.It Ev ALL_TEST_FLAGS
Flags passed to ${MAKE} invocations during test.
Equals
.Li ${MAKE_FLAGS} ${TEST_FLAGS} .
Read-only.
.It Ev ALL_TARGET
Target used to build software.
Default is
.Sq all .
Can be set to empty, to yield a package's default target.
.It Ev APM_ARCHS
Set to the list of
.Xr apm 4
architectures.
Read-only.
Use with
.Ev ONLY_FOR_ARCHS .
.It Ev ARCH
Current machine architecture.
Read-only.
.It Ev AUTOCONF
Location of the autoconf binary if needed.
Defaults to autoconf.
.It Ev AUTOCONF_DIR
Where to invoke autoconf or autoreconf if ${CONFIGURE_STYLE} includes
.Sq autoconf
or
.Sq autoreconf ,
respectively.
Defaults to ${WRKSRC}.
.\" AUTOCONF_DIR should probably be a list, and be renamed to AUTOCONF_DIRS ?
.It Ev AUTOCONF_ENV
Environment values that should be passed to all runs of autoconf, automake
and related tools.
Specifically, version numbers and PATH.
Automatically set as soon as
.Ev CONFIGURE_STYLE
is gnu or higher.
.It Ev AUTOCONF_VERSION
Several versions of autoconf may coexist peacefully.
The main autoconf script is a shell wrapper in the
.Pa devel/metaauto
package, and similarly for automake.
Setting
.Ev AUTOCONF_VERSION
along with
.Ev CONFIGURE_STYLE
set to autoconf is the correct way to specify which one to use.
.Ev AUTOCONF_VERSION
defaults to 2.13.
If autoconf must be run manually,
.Ev MODGNU_AUTOCONF_DEPENDS
can be used to specify what packages to depend upon.
.It Ev AUTOHEADER
Location of the autoheader binary.
Defaults to autoheader.
.It Ev AUTOMAKE_VERSION
Several versions of automake may coexist peacefully.
.Ev AUTOMAKE_VERSION
must be set before trying to run automake.
Defaults to 1.4.
.It Ev AUTORECONF
Location of the autoreconf binary and the arguments it is invoked with.
Can be set to
.Sq autogen.sh
if such a script is available.
Defaults to autoreconf --force --install.
.It Ev BASE_PKGPATH
Full
.Xr pkgpath 7
to the current port, taking flavors into account.
See also
.Ev BUILD_PKGPATH ,
which also includes pseudo-flavors.
Read-only.
.It Ev BASELOCALSTATEDIR
User settings.
Base location for system-wide state directory.
Defaults to
.Pa ${VARBASE} .
See
.Ev LOCALSTATEDIR .
.It Ev BASESYSCONFDIR
User settings.
Base location for system-wide configuration files.
Defaults to
.Pa /etc .
See
.Ev SYSCONFDIR .
.It Ev BATCH
User settings.
Set to
.Sq Yes
to avoid ports that require user-interaction.
Use in conjunction with
.Ev INTERACTIVE
to simplify bulk-package builds.
.Pq See IGNORE .
.It Ev BE_ARCHS
Set to the list of big-endian architectures.
Read-only.
Use with
.Ev NOT_FOR_ARCHS
and
.Ev ONLY_FOR_ARCHS .
.It Ev BUILD_DEPENDS
List of other ports the current port needs to build correctly.
Each item has the form
.Sq [pkgspec:]pkgpath[:target] .
.Sq target
defaults to
.Sq install .
The package installed must conform to the
.Sq pkgspec ,
which is by default obtained from the dependent
.Sq pkgpath
.Po
see
.Ev PKGSPEC
.Pc .
If no installation is involved, the infrastructure will still check
that the directory would provide a package conforming to the
.Sq pkgspec .
.Sq pkgpath
is set relative to ${PORTSDIR},
see
.Xr pkgpath 7
for details.
Build dependencies are checked before the
.Cm extract
stage during
.Cm prepare .
.Pp
Build dependencies with a
.Cm patch ,
.Cm configure
or
.Cm build
target will be processed in a subdirectory of the working directory,
specifically, in ${WRKDIR}/some/directory,
with
.Pa some/directory
the directory part of the
.Sq pkgpath .
.It Ev BUILD_ONCE
User settings.
Defaults to
.Sq \&No .
Set to
.Sq Yes
during bulk builds.
.Pp
When
.Ev BUILD_ONCE
is set to
.Sq Yes ,
all
.Ev PSEUDO_FLAVORS
matching
.Sq no_*
will be disabled, unless the special pseudo-flavor
.Sq bootstrap
is also set.
.Pp
This is a bulk build optimisation, automatically set by
.Xr dpb 1 :
to avoid rebuilding the same package several times, a full bulk build will
strip most ports of pseudo-packages variations that remove subpackages.
.Pp
For instance, an individual package may depend on
.Pa databases/db/v4,no_java,no_tcl ,
to avoid bringing a jdk in during a quick build.
Nevertheless, during a full bulk build,
.Pa databases/db/v4
will only be built once, as the pseudo-flavor will be automatically removed.
.Pp
However, the extra
.Sq bootstrap
rule is needed to take build cycles into account.
For instance, the
.Pa x11/gnome/gvfs,-goa
subpackage depends on gnome-online-accounts, which in turn requires
.Pa x11/gnome/gvfs,-main
to build (through its dependencies).
So
.Pa x11/gnome/gvfs
has
.Li PSEUDO_FLAVORS = no_smb no_goa bootstrap
and the GNOME build first builds
.Pa x11/gnome/gvfs,no_smb,no_goa,bootstrap,-main
which is later used to rebuild
.Pa x11/gnome/gvfs .
.It Ev BUILD_PKGPATH
Full
.Xr pkgpath 7
to the current port, taking flavors and pseudo-flavors
into account.
See also
.Ev BASE_PKGPATH ,
which doesn't include pseudo-flavors.
Mostly useful to write dependencies for subpackages like this:
.Li "LIB_DEPENDS-foo=${BUILD_PKGPATH}"
and avoid starting to build a package with some other flavor combination.
See
.Xr pkgpath 7
on the subject of
.Sq pkgpath normalisation .
Read-only.
.It Ev BUILD_PACKAGES
The actual list of packages that will be built, once architecture problems
and pseudo-flavors have been taken into account.
See
.Sx FLAVORS AND MULTI_PACKAGES .
.It Ev BROKEN
Define only for broken ports, set to reason the port is broken.
See also
.Ev NO_IGNORE ,
.Ev TRY_BROKEN .
.It Ev BUILD_USER
User to switch to when using
.Ev PORTS_PRIVSEP ,
defaults to
.Sq _pbuild .
.It Ev BROKEN-<arch>
Define only for ports broken on a given architecture.
Distinct from
.Ev ONLY_FOR_ARCHS
and
.Ev NOT_FOR_ARCHS ,
which are used to mark ports for which support for some architectures
does not exist at all, or is completely obsolete.
.It Ev BSD_INSTALL_{PROGRAM,SCRIPT,DATA,MAN}[_DIR]
Macros passed to make and configure invocations.
Set based on corresponding INSTALL_* variables.
.It Ev BULK
User settings.
If set to
.Sq Yes ,
all successful package builds and installations will clean
their working directories, after invoking
any targets mentioned in BULK_TARGETS,
and commands mentioned in BULK_DO.
Can be set on a per-${PKGPATH} basis.
For instance, setting BULK_misc/screen=No
will override any BULK=Yes passed on the command line.
If set to
.Sq Auto ,
it will apply to dependencies, but not to the current port itself.
See
.Ev BULK_COOKIES_DIR .
Defaults to
.Sq Auto .
.It Ev BULK_COOKIES_DIR
User settings.
Used to store cookies for successful bulk-package builds, defaults to
.Pa ${PORTSDIR}/bulk/${MACHINE_ARCH} .
.It Ev BULK_DO
Commands to run after each bulk package build before cleaning up the
working directory.
Empty defaults.
Can be set on a per-${PKGPATH} basis, e.g.,
BULK_DO_${PKGPATH}=...
.It Ev BULK_FLAGS
Flags to pass to build each target in
.Ev BULK_TARGETS .
.It Ev BULK_TARGETS
Targets to run after each bulk package build before cleaning up the
working directory.
Empty defaults.
Can be set on a per-${PKGPATH} basis, e.g.,
BULK_TARGETS_${PKGPATH}=...
.It Ev BZIP2
Name of the bzip2 binary.
.It Ev CATEGORIES
List of descriptive categories into which this port falls.
Mandatory.
One entry must match the current pkgpath:
.Pa devel/gmake
must belong to the
.Sq devel
category.
.It Ev CCACHE_DIR
Sets the cache directory used when
.Ev USE_CCACHE
is set to yes.
Defaults to ${WRKOBJDIR}/.ccache.
.It Ev CCACHE_ENV
Sets additional environment variables when
.Ev USE_CCACHE
is set to yes.
For instance, to enable verbose logging, set
CCACHE_ENV="CCACHE_LOGFILE=/tmp/ccache.log"
.It Ev CDIAGFLAGS
Flags appended to
.Ev CFLAGS
if
.Ev WARNINGS
is set.
.It Ev CFLAGS
Default flags passed to the compiler for building.
Many ports ignore it.
See also
.Ev COPTS ,
.Ev CDIAGFLAGS .
.It Ev CHECK_LIB_DEPENDS
User settings.
If set to
.Sq Yes ,
every package build will verify that shared libraries are correctly
registered.
This is essentially the same as running
.Ql make lib-depends-check
after each package build.
Defaults to
.Sq \&No ,
as this can be a big performance hit, and also because
.Ev lib-depends-check
doesn't know about library subdirectories or dynamic loading through
.Xr dlopen 3 .
.It Ev CHECKSUMFILES
List of all files that need to be retrieved by
.Cm fetch ,
with
.Ev DIST_SUBDIR
prepended and with the master site selection extension removed.
Read-only.
See also
.Ev MAKESUMFILES .
.It Ev CHECKSUM_FILE
Location for this port's checksums, used by
.Cm checksum ,
.Cm makesum ,
and
.Xr dpb 1 .
Defaults to
.Pa distinfo .
.It Ev CHECKSUM_PACKAGES
User settings.
Choose whether or not to checksum packages while building.
Deposits result in
.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums/${FULLPKGNAME}.sha256 .
Can be set to
.Sq Yes
to compute a checksum for all packages,
or to
.Sq ftp
to compute it only for
.Ev PERMIT_PACKAGE
packages.
Defaults to
.Sq no ,
which does not compute a checksum at all.
.It Ev CHOSEN_COMPILER
Read-only.
Compiler suite chosen by the
.Ev COMPILER
mechanism.
Set to
.Sq irrelevant
to disable
.Ev COMPILER .
.It Ev CLEANDEPENDS
If set to
.Sq Yes ,
the
.Cm clean
target will also clean dependencies.
Can be overridden on a per-${PKGPATH} basis,
by setting CLEANDEPENDS_${PKGPATH}.
.It Ev COMMENT
Short (no more than 60 characters) description of the port, used for
the package and the INDEX.
It should not start with an uppercase letter unless semantically
significant.
.It Ev COMMENT-foo
Same as COMMENT but used for sub package -foo in a multi-package setup.
.It Ev COMMENT-vanilla
Same as COMMENT but used for a flavored package, if the non-flavored comment
is inappropriate.
.It Ev COMMENT-foo-vanilla
Same as COMMENT but used for a sub-, flavored package.
.It Ev COMES_WITH
The first release where the port was made part of the standard
distribution.
If the current
.Ox
version is >= this version then a notice
will be displayed instead of the port being built.
.It Ev COMPILER
Select preferred compiler.
First element in the list that matches will be chosen.
.Bl -tag -width ports-gccxx
.It base-gcc
gcc 4.2 compiler from base
.It base-clang
clang compiler from base
.It gcc3
gcc 3 compiler from base
.It ports-gcc
gcc 8 compiler from ports
(heeds
.Ev MODGCC4_ARCHS
from the module)
.It ports-clang
clang compiler from ports
(heeds
.Ev MODCLANG_ARCHS
from the module)
.El
.Pp
The first compiler that matches criteria will be chosen.
On clang-based architectures, even though gcc is still compiled in base,
.Sq base-gcc
never matches.
.Pp
Defaults to base compilers, e.g.,
.Sq base-clang base-gcc gcc3 .
.Pp
Common reasons for explicitly setting
.Ev COMPILER
will most often be C++11 support, thread-local-storage support (emulated),
atomic operations on some arches, sometimes assembler support, ABI
compatibility with dependent/depending ports, or plain old internal compiler
errors.
.Pp
With
.Ev COMPILER
in effect,
.Ev MODGCC4_ARCHS
and
.Ev MODCLANG_ARCHS
default to
.Sq ${GCC49_ARCHS}
and
.Sq ${LLVM_ARCHS}
respectively.
.Pp
.Ev ONLY_FOR_ARCHS
will also be set if applicable.
.It Ev COMPILER_LANGS
The value of
.Ev COMPILER_LANGS
will be added to the respective module's supported langs.
Defaults to
.Sq c c++ .
Only
.Sq c
and
.Sq c++
are supported by this mechanism.
.Sq fortran
or
.Sq java
still need old modules annotations, so that it's possible
to select, e.g.,
.Sq gfortran
from gcc 8 while having clang from base.
See also
.Ev CHOSEN_COMPILER .
.It Ev COMPILER_LINKS
Used by
.Nm
and compiler
.Ev MODULES
to build scripts in
.Pa ${WRKDIR}/bin
to force setting compiler flags
.Po
.Fl B
is required for clang to find
.Pa ${WRKDIR}/bin/ld
as used by
.Ev USE_WXNEEDED
.Pc
and call
.Ev COMPILER_WRAPPER
if used.
.It Ev COMPILER_WRAPPER
External program used to "wrap" compilers.
Populated automatically by
.Ev USE_CCACHE
or can be set explicitly for other purposes (e.g. distcc).
.It Ev CONFIG_SITE_LIST
Used when
.Li CONFIGURE_STYLE=gnu ,
or with
.Li MODULES += gnu .
List of
.Pa config.site
fragments that will speed up gnu-configure, and prevent it from
preferring various gnu programs, unless
.Ev BUILD_DEPENDS
explicitly ask for them.
Read-only, available for debugging purposes.
.It Ev CLANG_ARCHS, GCC3_ARCHS , GCC4_ARCHS
List of architectures using Clang, GCC 3.3.6 or GCC 4.2.1 as the base compiler.
Read-only.
Use with
.Ev NOT_FOR_ARCHS
or
.Ev ONLY_FOR_ARCHS
to limit ports to architectures where they compile.
.It Ev CONFIGURE_ARGS
Arguments to pass to configure script.
Defaults are empty, except for
GNU-style configure, where prefix and sysconfdir are set.
.It Ev CONFIGURE_ENV
Basic environment passed to configure script (path and libtool setup).
GNU-style configure adds a lot more variables.
.It Ev CONFIGURE_SCRIPT
Set to name of script invoked by the
.Cm configure
target, if appropriate.
Should be either an absolute path, or relative to ${WRKSRC}.
.It Ev CONFIGURE_STYLE
Set to style of configuration that needs to happen.
.Pp
If
.Sq perl ,
assume
.Xr perl 1 Ns 's
.Xr ExtUtils::MakeMaker 3p
style.
Add
.Sq modbuild
to enable
.Xr Module::Build 3p ,
.Sq modbuild tiny
to enable
.Xr Module::Build::Tiny 3p ,
or
.Sq modinst
for
.Xr Module::Install 3p
style.
.Pp
If
.Sq gnu ,
assume
GNU configure style.
Add
.Sq dest
if port does not handle DESTDIR correctly, and needs to be configured to
add DESTDIR to prefixes
.Po
see also
.Ev DESTDIRNAME
.Pc .
Add
.Sq old
if port is an older autoconf port that does not recognize --sysconfdir.
Add
.Sq autoconf
if autoconf needs to be rerun first,
but set
.Sq no-autoheader
to prevent autoheader from running.
Alternatively, add
.Sq autoreconf
to rerun autoconf, automake, and related tools to completely regenerate
the GNU build framework.
.Pp
If
.Sq imake ,
assume port configures using X11 ports Imakefile framework.
Add
.Sq noman
if port has no man pages the Imakefile should try installing.
.Pp
If
.Sq simple ,
there is a configure script, but it does not fit the normal GNU configure
conventions.
.Pp
Extensions may be defined by specific MODULES.
See
.Xr port-modules 5
for details.
.It Ev COPTS
User settings.
Supplementary options appended to ${CFLAGS} for building.
Since most ports ignore the COPTS convention, they are actually told to use
${CFLAGS} ${COPTS} as CFLAGS.
.It Ev CXXDIAGFLAGS
Flags appended to
.Ev CXXFLAGS
if
.Ev WARNINGS
is set.
.It Ev CXXFLAGS
Default flags passed to the C++ compiler for building.
Many ports ignore it.
.It Ev CXXOPTS
User settings.
Supplementary options appended to ${CXXFLAGS} for building.
.It Ev DEBUG_CONFIGURE_ARGS
Supplementary ${CONFIGURE_ARGS}
for enabling the generation of debugging information.
.It Ev DEBUG_PACKAGES
List of ${SUBPACKAGES} for which debug packages should be built "on the side".
Usually set as
.Li DEBUG_PACKAGES=${BUILD_PACKAGES}
for packages where debug information is desirable.
Note the subpackages with
.Li PKG_ARCH=*
will automatically be stripped from that list.
See
.Sx THE DEBUG_PACKAGES INFRASTRUCTURE
below for details.
.It Ev DEBUGINFO_ARCHS
List of archs for which debug information may be provided as extra packages.
Normally only amd64 for performance reasons.
.It Ev DESTDIR
See
.Ev DESTDIRNAME .
.It Ev DESTDIRNAME
Name of variable to set to ${WRKINST} while faking.
Usually DESTDIR.
To be used in the rare cases where a port heeds DESTDIR in a few
directories and needs to be configured with
.Sq gnu dest ,
so that those few directories do not get in the way.
.It Ev DIST_TUPLE
List of distfile templates to use, each consisting of five entries:
.Ar name account project tagname/commithash targetdir .
The template
.Ar name
should be one of
.Sq github ,
.Sq gitlab ,
or
.Sq srht
at the moment
.Po see
.Pa ${PORTSDIR}/db/dist-tuple.pattern ,
additional
.Ev TEMPLATE_DISTFILES.<name>
and
.Ev TEMPLATE_HOMEPAGE.<name>
entries can be added as needed
.Pc .
The components are used to build
.Ev SITES.name
.Ev DISTFILES.name
and (optionally)
.Ev HOMEPAGE .
.Pp
At the end of
.Cm post-extract ,
the files are moved to
.Pa ${WRKDIST}/<targetdir> .
Using
.Sq \&.
for
.Ar targetdir
will disable the move.
.It Ev DISTDIR
User settings.
Directory where all ports distribution files and patchfiles are stashed.
Defaults to
.Pa ${PORTSDIR}/distfiles .
Override if distribution files are stored elsewhere.
Always use
.Ev FULLDISTDIR
to refer to ports' distribution files location, as it takes an eventual
.Ev DIST_SUBDIR
into account.
.It Ev DISTFILES*
The main port's distribution files (the actual software source, except
for binary-only ports).
Will be retrieved from the corresponding SITES* (see
.Cm fetch ) ,
checksummed and extracted (see
.Cm checksum ,
.Cm extract ) .
.Ev DISTFILES
normally holds a list of files, possibly with
.Sq :0
to
.Sq :9
appended to select a different
.Ev SITES .
.Pp
Preferably, adding a suffix to
.Ev DISTFILES ,
will switch the site entry to the corresponding
.Ev SITES
variable, e.g.,
.Bd -literal -offset indent
DISTFILES.go = ...
SITES.go = ...
.Ed
.Pp
Each entry may optionally be of the form
.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
to deal with sites that only offer archives as weird urls, doing the transfer
of
.Ar url Ns Ar sufx
into result file
.Ar filename Ns Ar sufx .
For instance, if
.Bd -literal
DISTFILES = minetest-{minetest/archive/}${V}${EXTRACT_SUFX}
.Ed
.Pp
then
.Cm fetch
will retrieve from url
.Sq minetest/archive/${V}${EXTRACT_SUFX}
into
.Sq minetest-${V}${EXTRACT_SUFX} .
.Pp
If ${DISTFILES*} varies depending on
.Ev FLAVORS
or architecture, use
.Ev SUPDISTFILES*
to ensure distfiles mirroring and
.Cm makesum Ns 's
proper operation.
.Pp
If no
.Ev DISTFILES*
is set and if
.Ev SITES
is not null, then
.Ev DISTFILES
will be set to
.Pa ${DISTNAME}${EXTRACT_SUFX} .
.It Ev DISTNAME
Name used to identify the port.
See
.Ev DISTFILES*
and
.Ev PKGNAME .
.It Ev DISTORIG
Suffix used by
.Cm distpatch
to rename original files.
Defaults to
.Pa .bak.orig .
Distinct from
.Ev PATCHORIG
to avoid confusing
.Cm update-patches .
.It Ev DIST_SUBDIR
Optional subdirectory of ${DISTDIR} where the current port's distribution
files and patchfiles will be located.
See target
.Cm fetch .
.It Ev DPB
Set by the Distributed Ports Builder to only get the information it needs
from
.Cm dump-vars .
.It Ev DPB_LOCKNAME
If set,
.Xr dpb 1
will use this instead of the default
.Ev PKGPATH Ns - Ns
derived name.
This feature comes with large restrictions and shouldn't be used unless
absolutely necessary.
Specifically, it can allow
.Nm dpb
to build several flavors of the same port at the same time,
but beware: under
.Ev MULTI_PACKAGES
and
.Ev PSEUDO_FLAVORS
conditions, if some of these packages are identical across flavors,
this will not work.
This also makes it harder to interact with locks if the names are not obvious.
.It Ev DPB_PROPERTIES
Annotations for the Distributed Ports Builder.
See
.Xr dpb 1
for semantics.
.It Ev DUMMY_PACKAGE
If defined,
.Nm
will provide dummy values for variables mandatory for a minimally functional
port.
Used by the
.Pa sqlports
package and
.Xr dpb 1
to perform introspection and obtain
.Nm Ns 's
default values for variables without needing to access any specific port.
.It Ev ECHO_MSG
User settings.
Used to display
.Sq ===> Configuring for foo
and similar informative messages.
Override to turn off, for instance.
.It Ev ECHO_REORDER
User settings.
Set it to
.Sq echo
to see
.Ev REORDER_DEPENDENCIES
actions.
Silent by default.
.It Ev EDIT_PATCHES
User settings.
If set to
.Sq \&No ,
.Cm update-patches
will not open changed files in an editor.
.It Ev EPOCH
Epoch number of the current package.
Used when the port version is changed but the new version is not regarded by
.Xr packages-specs 7
as being newer.
Once added, it cannot be removed or go backwards.
Defaults to empty (no need for numbering changes), then
numbering starts at 0.
Gets automatically incorporated into
.Ev FULLPKGNAME
as
.Sq v${EPOCH}
to form a full package-name conforming to
.Xr packages-specs 7 .
.It Ev ERRORS
List of errors found while parsing the port's Makefile.
Display the errors before making any target, and if any error starts with
.Qq Fatal : ,
do not make anything.
For instance:
.Bd -literal -offset indent
\&.if !defined(COMMENT)
ERRORS+="Fatal: Missing comment"
\&.endif
.Ed
Porter can add to
.Ev ERRORS ,
for instance to flag erroneous combinations of
.Ev FLAVORS
(but see
.Ev ONLY_FOR_ARCHS
.Ev NOT_FOR_ARCHS
and
.Ev BROKEN
for other common issues).
.Pp
Note that setting fatal errors defeats all introspection mechanisms and breaks
the
.Pa sqlports
package.
.Pp
Tip: if you need to debug a fatal error, you can always override
.Ev ERRORS
on the command line, e.g.,
.Bd -literal -offset indent
make ERRORS= show=<var>
.Ed
.It Ev EXTRACT_CASES
The extraction stage runs a loop under
.Pa ${WRKDIR}
with
.Ev archive
(shell variable) set to each element of
.Ev EXTRACT_ONLY
in order, which is then processed by a case switch: ${EXTRACT_CASES}.
.Pp
.Nm
detects extensions in ${CHECKSUMFILES}
and automatically adds
.Ev BUILD_DEPENDS
and fragments to handle the following archives:
.Pp
.Bl -tag -width archivers/lzip/lunzip -offset indent -compact
.It gzip
tar.gz, tgz
.It tar
tar
.It archivers/bzip2
tar.bz2, tbz2, tbz
.It archivers/xz
tar.xz, tar.lzma, tar.lz
.It archivers/unzip
zip
.It archivers/zstd
tar.zst, tar.zstd
.It converters/rpm2cpio
rpm
.El
.Pp
Other cases not supported directly in
.Nm
can be added, and existing cases can be overridden.
For example the following snippet sets extra conversion flags to unzip,
and adds support for rar:
.Bd -literal
*.zip) ${UNZIP} -Laq ${FULLDISTDIR}/$$archive -d ${WRKDIR};; \\
*.rar) ${LOCALBASE}/bin/unrar x -idq ${DISTDIR}/$$archive;;
.Ed
.It Ev EXTRACT_ONLY
Set to the list of distfiles to actually extract if some distfiles
should not be extracted during the
.Cm do-extract
stage.
Defaults to ${ALL_DISTFILES}, can even be set to empty.
.It Ev EXTRACT_SUFX
Used to set
.Ev DISTFILES
default value to ${DISTNAME}${EXTRACT_SUFX}.
Default value is
.Pa .tar.gz .
.Pp
Note that
.Ev DISTFILES
will only be set in the absence of
.Ev DISTFILES.sufx
as well, or if
.Ev SITES
is not empty.
.It Ev EXTRACT_SUFX.<name>
The
.Ev EXTRACT_SUFX
value for a template defined through
.Ev DIST_TUPLE .
.It Ev EXTRACT_FILES
Set to the list of files to actually extract from distfiles.
Its content is subject to shell evaluation as part of
.Ev EXTRACT_CASES
and passed as
.Ar file ...
argument to
.Xr tar 1
or
.Xr unzip 1 ,
e.g.,
.Xr glob 7
patterns and shell brace expansion may be used.
Empty by default to extract all files.
.It Ev FAKE_FLAGS
Extra flags passed to ${MAKE_PROGRAM} during the
fake invocation.
Empty by default.
Also see
.Ev ALL_FAKE_FLAGS .
.It Ev FAKE_SETUP
List of environment values normally set during fake invocations.
Exposed so that modules may provide their own
.Cm do-install .
Read-only,
see
.Sx THE FAKE FRAMEWORK
section for details.
.It Ev FAKE_TARGET
Target built by ${MAKE_PROGRAM} on fake invocation.
Defaults to ${INSTALL_TARGET}.
.It Ev FAKEOBJDIR
User settings.
If non empty, used as a base for the fake staging area.
The real fake directory ${WRKINST} is created there.
Can be set on a per-${PKGPATH} basis.
For instance, setting FAKEOBJDIR_www/mozilla-firefox=/tmp/obj
will affect only the mozilla-firefox port.
.It Ev FETCH_CMD
User settings.
Command used to fetch distribution files for this port.
Defaults to
.Xr ftp 1 .
Can be used to go through excessively paranoid firewalls.
Note that
.Ev FETCH_CMD
should support a few ftp options, chief among them
being
.Fl C
and
.Fl o Ar dest ,
but also
.Fl m ,
.Fl S ,
.Fl v ,
.Fl V .
Most of these can be no-ops in a FETCH_CMD script,
See
.Pa ${PORTSDIR}/infrastructure/template/fetch_cmd.template
for a skeleton script.
.It Ev FETCH_MANUALLY
Some ports' distfiles cannot be fetched automatically for licensing reasons.
In this case, set
.Ev FETCH_MANUALLY
to a list of strings that will be displayed, one per line, e.g.,
.Bd -literal
FETCH_MANUALLY= "You must fetch foo-1.0.tgz"
FETCH_MANUALLY+="from http://www.fubar.com/ manually,"
FETCH_MANUALLY+="after reading and agreeing to the license."
.Ed
Behaves like
.Ev IS_INTERACTIVE
if some distribution files are missing.
.It Ev FETCH_PACKAGES
User settings, defaults to
.Sq \&No .
Set to
.Xr pkg_add 1
options.
Instruct the
.Cm package
target to download packages missing from the repository from locations in
${PKG_PATH} and place them into
.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache/ ,
only building them if no suitable packages are found.
For instance,
.Bd -literal -offset indent
make FETCH_PACKAGES=
.Ed
.Pp
to use without any options, or
.Bd -literal -offset indent
make FETCH_PACKAGES=-Dsnap
.Ed
.Pp
to use close to release.
.It Ev FILESDIR
Location of other files related to the current port.
Default: files.
.It Ev FETCH_USER
User to use to fetch distfiles when using
.Ev PORTS_PRIVSEP ,
defaults to
.Sq _pfetch .
.It Ev FIX_CLEANUP_PERMISSIONS
If
.Sq Yes ,
restore read, write and directory search permissions for the build user on
.Pa ${WRKDIR}
before running
.Cm clean .
Used for build systems which set paranoid permissions at build time.
Defaults to
.Sq \&No .
.It Ev FIX_CRLF_FILES
Name(s) of files with line endings to correct at the end of
.Cm distpatch .
Sometimes a port will include files with MS-DOS line endings (CR LF).
To avoid problems with patches (especially when sent by email)
these should be converted to LF.
.Nm
changes to WRKDIST before converting files - shell wildcards may be used.
.It Ev FIX_EXTRACT_PERMISSIONS
If
.Sq Yes ,
restore contents of
.Pa ${WRKDIR}
to world-readable at the end of
.Cm extract .
Used for some distfile contents which have paranoid permissions for no reason.
Defaults to
.Sq \&No .
.It Ev FLAVOR
The port's current options.
Set by the user, and tested by the port to activate wanted functionalities.
.It Ev FLAVORS
List of all flavors keywords a port may match.
Used to sort
.Ev FLAVOR
into a canonical order to build the package name,
or to select the packing-list, and as a quick validity check.
See also
.Ev PSEUDO_FLAVORS .
.It Ev FLAVOR_EXT
Canonical list of flavors being set for the current build, dash-separated.
See
.Ev FULLPKGNAME .
.It Ev FORCE_UPDATE
User settings.
If set to
.Sq Yes ,
the
.Cm update
target will always update an installed package,
as soon as its signature differs,
and all dependencies that install packages will
also force an update.
If set to
.Sq hard ,
the
.Cm update
target will also update installed packages even when the signature
did not change.
.It Ev FULLDISTDIR
Complete path to directory where ${DISTFILES*} ${SUPDISTFILES*} and
${PATCHFILES*} will be located, to be used in hand-crafted extraction targets.
Read-only.
.It Ev FULLPKGNAME
Full name of the created package, taking flavors into account.
Defaults to ${PKGNAME}${FLAVOR_EXT}.
See also
.Ev EPOCH
and
.Ev REVISION .
.It Ev FULLPKGPATH
Path to the current port's directory, relative to ${PORTSDIR},
including flavors and subpackages.
See
.Xr pkgpath 7 .
.It Ev GH_*
Simple support for GitHub-hosted projects.
Leave empty for non hosted projects.
Yields a suitable default for
.Ev SITES_GITHUB
and
.Ev DISTNAME .
.Pp
Use
.Ev DIST_TUPLE
for more complicated situations.
.It Ev GH_ACCOUNT
Account name of the GitHub user hosting the project.
.It Ev GH_COMMIT
SHA1 commit id to fetch.
It is an error to specify ${GH_COMMIT} when ${GH_TAGNAME} is specified.
.It Ev GH_DISTFILE
Set by
.Nm
to the generated name of the distribution file.
This can be useful for ports listing multiple
.Ev DISTFILES* .
.It Ev GH_PROJECT
Name of the project on GitHub.
.It Ev GH_TAGNAME
Name of the tag to download.
Setting ${GH_TAGNAME} to master is invalid
and will throw an error.
${WRKDIST} is auto-generated based on the
${GH_TAGNAME} if specified, otherwise ${GH_COMMIT} will be used to generate
${WRKDIST}.
.It Ev GMAKE
Location of the GNU make binary, if needed.
Defaults to gmake.
.It Ev HOMEPAGE
URL to the homepage of the software, if applicable.
.It Ev IGNORE
For ignored ports, set to the reasons for which the port is ignored.
If non-empty, most common targets that do something (e.g.,
.Cm fetch ,
.Cm build ,
.Cm install No ... )
will be ignored.
See also
.Ev BATCH ,
.Ev BROKEN ,
.Ev FETCH_MANUALLY ,
.Ev IGNORE_IS_FATAL ,
.Ev IGNORE_SILENT ,
.Ev INTERACTIVE ,
.Ev IS_INTERACTIVE ,
.Ev NOT_FOR_ARCHS ,
.Ev NO_IGNORE ,
.Ev ONLY_FOR_ARCHS .
.It Ev IGNORE_IS_FATAL
User settings.
If set to
.Sq Yes ,
ignored ports will become fatal errors.
.It Ev IGNORE_SILENT
User settings.
If set to
.Sq Yes ,
do not print anything when ignoring a port.
.It Ev INSTALL_DEBUG_PACKAGES
User settings.
Defaults to
.Sq \&No .
If
.Sq Yes ,
install available debug packages during all install/update targets.
.It Ev INSTALL_{PROGRAM,SCRIPT,DATA,MAN}[_DIR]
Macros to use to install a program, a script, data, or a man page (or the
corresponding directory), respectively.
.It Ev INSTALL_TARGET
Target invoked to install the software, during fake installation.
Default is
.Sq install .
.It Ev INTERACTIVE
User settings.
Set to
.Sq Yes
to skip all non-interactive ports.
Used in conjunction with
.Ev BATCH
to simplify bulk-package builds.
.It Ev IS_INTERACTIVE
Set to
.Sq Yes
if port needs human interaction to build.
.Pp
Note that
.Ev IS_INTERACTIVE
ports won't be built as official packages,
so avoid at all cost.
.Pp
Human intervention should be moved to binary package
installation and/or post-installation configuration instead.
.Pp
Discrete Yes/No choices are better modelled as
.Ev FLAVORS .
.It Ev LE_ARCHS
Set to the list of little-endian architectures.
Read-only.
Use with
.Ev NOT_FOR_ARCHS
and
.Ev ONLY_FOR_ARCHS .
.It Ev LIB_DEPENDS
List of packages used by a port for its library dependencies.
Each item has the form
.Sq [pkgspec:]pkgpath .
Similar to
.Ev BUILD_DEPENDS
and
.Ev RUN_DEPENDS ,
but with specific rules:
.Ev LIB_DEPENDS
always turn into
.Ev BUILD_DEPENDS
.Po
but see
.Sx FLAVORS AND MULTI PACKAGES
.Pc .
.Pp
.Ev LIB_DEPENDS
is also used as a run-time dependency, and recorded in the package as
such, if any of the libraries mentioned in
.Ev WANTLIB
is a shared library that originates within the dependent port.
.Pp
See
.Xr library-specs 7
for more details.
.It Ev lib_depends_args
Controls the behavior of
.Xr pkg_create 1
related targets, see
.Cm print-package-args
for details.
.It Ev LIBCXX
List of standard C++ libraries for the base compiler.
Read-only.
Use in
.Ev WANTLIB .
.It Ev LIBTOOL
Location of the libtool binary.
Default:
.Pa /usr/bin/libtool .
.It Ev LIBTOOL_FLAGS
Arguments to pass to libtool.
If USE_LIBTOOL is set, the environment variable LIBTOOL is set
to ${LIBTOOL} ${LIBTOOL_FLAGS}.
.It Ev LLD_EMUL
As
.Xr ld.lld 1
does not have a default emulation mode,
if it is the linker in-use,
.Ev LLD_EMUL
defaults to the correct option to set the emulation mode;
Otherwise, it stays empty.
Read-only.
Seldom used, as it is only needed to link binary data without using the
compiler.
.It Ev LLVM_ARCHS
Set to the list of architectures where LLVM/Clang could be used,
e.g., via lang/clang port module, see
.Xr port-modules 5 .
Read-only.
Use with
.Ev NOT_FOR_ARCHS
or
.Ev ONLY_FOR_ARCHS .
.It Ev LOCALBASE
where other ports have already been installed.
Default:
.Pa /usr/local .
.It Ev LOCALSTATEDIR
Location for this port's state directory, should always be derived
from
.Ev BASELOCALSTATEDIR ,
which defaults to
.Pa /var .
Passed to gnu configure scripts.
.It Ev LOCKDIR
User settings.
Defaults to
.Pa ${WRKOBJDIR}/locks .
If set, points to a local directory common for all instances of
concurrent ports builds.
.It Ev LOCK_CMD
User settings.
Expands to a command that will acquire a lock, namely
.Xr portlock 1 .
See also
.Xr ports 7 .
.It Ev LOCK_VERBOSE
User settings.
Defaults to
.Sq \&No .
Set to
.Sq Yes
to show every acquire/release lock operation.
.It Ev LP64_ARCHS
Set to the list of 64-bit architectures.
Read-only.
Use with
.Ev NOT_FOR_ARCHS .
.It Ev MAINTAINER
Email address with full name of the port's maintainer.
Defaults to
.Mt ports@openbsd.org .
.It Ev MAKE_ENV
Environment variables passed to make invocations and tests.
Sets at least PATH, PREFIX, LOCALBASE, X11BASE, CFLAGS, TRUEPREFIX, DESTDIR,
and the BSD_INSTALL_* macros.
.It Ev MAKE_FLAGS
Flags used for all make invocations, except for the
.Cm fake
stage, which adds
.Ev FAKE_FLAGS
(see
.Ev ALL_FAKE_FLAGS )
and for the
.Cm test
stage, which adds
.Ev TEST_FLAGS
(see
.Ev ALL_TEST_FLAGS ) .
.It Ev MAKE_FILE
Name of the Makefile used for ports building.
Defaults to Makefile.
Used after changing directory to ${WRKBUILD}.
.It Ev MAKE_JOBS
Number of jobs to use when building the port, normally passed to
.Ev MAKE_PROGRAM
through
.Ev PARALLEL_MAKE_FLAGS .
Mostly set automatically when
.Ev DPB_PROPERTIES
contains
.Sq parallel .
.Pp
Note that
.Xr make 1
still has bugs that may prevent parallel build from working correctly!
.It Ev MAKE_PROGRAM
The make program that is used for building the port.
Set to ${MAKE} or ${GMAKE} depending on USE_GMAKE.
Read-only.
.It Ev MAKEFILE_LIST
Introspection variable, see
.Xr make 1 .
.It Ev MAKESUMFILES
List of all files that need to be retrieved by
.Cm fetch-all ,
with
.Ev DIST_SUBDIR
prepended and with master site selection extension removed.
Read-only.
See also
.Ev CHECKSUMFILES .
.It Ev MESSAGE
File recorded in the package and displayed during installation.
Defaults to ${PKGDIR}/MESSAGE if this file exists.
Leave empty if no message is needed.
.It Ev MISSING_FILES
When
.Ev FETCH_MANUALLY
is set,
.Ev MISSING_FILES
will contain the list of missing distfiles or patchfiles that need to
be fetched manually.
Read-only.
.It Ev MODGNU_CONFIG_GUESS_DIRS
If a port uses config.guess outside WRKSRC, the directories
containing the other copies must be set here.
.It Ev MODPERL_ADJ_FILES
If any files have a Perl shebang line, which needs to be replaced
with
.Dq #!/usr/bin/perl ,
list them in
.Ev MODPERL_ADJ_FILES .
File paths here should be relative to
.Ev WRKSRC .
These files are patched automatically at the end of
.Cm pre-configure .
.It Ev MODPERL_BIN_ADJ
Shell fragment to patch the Perl interpreter path in executable scripts.
Used by
.Ev MODPERL_ADJ_FILES .
.It Ev MODPERL_BUILD_TARGET
Normal content of
.Cm do-build
when
.Ev CONFIGURE_STYLE
uses perl.
Provided as a separate variable if a port wants to override
.Cm do-build
for its own reasons.
.It Ev MODPERL_INSTALL_TARGET
Likewise for
.Cm do-install .
.It Ev MODPERL_TEST_TARGET
Likewise for
.Cm do-test .
.It Ev MODPERL_REGEN_PPPORT
Normally, if ppport.h is present,
it will be regenerated using a current version of
.Xr Devel::PPPort 3p .
Set to the filename under
.Pa ${WRKSRC} ,
or
.Sq \&No
to disable.
Defaults to
.Sq ppport.h .
.It Ev MODULES
External modules mechanism, documented separately.
Modules such as
.Sq imake
and
.Sq gnu
are normally included automatically with the right
.Ev CONFIGURE_STYLE .
Note that it is possible to
.Li CONFIGURE_STYLE = simple ,
.Li MODULES += gnu
to just get the effects of
.Ev CONFIG_SITE
and
.Ev MODGNU_CONFIG_GUESS_DIRS
along with the default
.Ev TEST_TARGET ,
in case the normal GNU configure script was wrapped in a separate script that
takes different arguments.
See
.Xr port-modules 5 .
.It Ev MULTI_PACKAGES
Set to a list of subpackage extensions for ports that create multiple packages.
See
.Sx FLAVORS AND MULTI_PACKAGES
below.
Especially read the part about
.Ev ONLY_FOR_ARCHS
when some of the packages only exist for some architectures.
.It Ev NO_ARCH
Location for arch-independent packages.
Defaults to
.Sq no-arch .
Normally, packages are generated under ${PACKAGE_REPOSITORY}/${MACHINE_ARCH},
except for packages where PKG_ARCH=*, which end up under
${PACKAGE_REPOSITORY}/${NO_ARCH}.
.It Ev NOT_FOR_ARCHS
List of architectures on which this port does not build.
See also
.Ev ONLY_FOR_ARCHS .
.It Ev NO_BUILD
Set to
.Sq Yes
if port does not need any build stage.
.It Ev NO_CCACHE
Set to
.Sq Yes
to prevent ccache from being used when building a certain port,
even when
.Ev USE_CCACHE
is set.
.It Ev NO_CHECKSUM
Set to
.Sq Yes
by
.Xr dpb 1
to avoid
.Cm checksum
entirely,
as
.Xr dpb 1
already deals with checksums internally.
.It Ev NO_DEPENDS
User settings.
Don't verify build of dependencies.
Do not use in any ports Makefile.
This is only meant as a user convenience when, e.g., you just want to browse
through a given port's source and do not wish to trigger the build of
dependencies.
.It Ev NO_IGNORE
User settings.
If set to
.Sq Yes ,
avoid ignoring a port for the usual reasons.
Use, for instance, for fetching all distribution files, or for fixing a
broken port.
See also
.Ev IGNORE
and
.Ev TRY_BROKEN .
.It Ev NO_TEST
Port does not have any regression tests.
Only set to
.Sq Yes
for ports with no regression test.
It should be left alone for ports with empty regression tests, and for
ports with failing tests.
That way, if a subsequent update of a port acquires actual regression tests,
they will be picked up automatically.
.It Ev ONLY_FOR_ARCHS
List of architectures on which this port builds.
Can hold both processor-specific information (e.g., powerpc), and more
specific model information (e.g., macppc).
This is subpackage dependent.
Read the corresponding part of
.Sx FLAVORS AND MULTI_PACKAGES
if some subpackages should only be built on some architectures.
.It Ev OSREV
Revision number of
.Ox .
Read-only.
.It Ev PACKAGE_REPOSITORY
User settings.
Location for built packages.
Defaults to
.Pa ${PORTSDIR}/packages .
See the
.Cm package
target for details.
.It Ev PARALLEL_MAKE_FLAGS
Used when
.Ev DPB_PROPERTIES
contains
.Sq parallel .
Flags to pass to
.Ev MAKE_PROGRAM
to yield a parallel build.
Defaults to
.Li -j${MAKE_JOBS} .
Mostly set to empty by ports that use other mechanisms for setting the number
of jobs.
.It Ev PARALLEL_MAKE_JOBS
User settings.
Value of
.Ev MAKE_JOBS
to use when building manually a port with
.Ev DPB_PROPERTIES
containing
.Sq parallel .
Defaults to the number of online cpus.
.It Ev PATCH
Command to use to apply all patches.
Defaults to
.Pa /usr/bin/patch .
.It Ev PATCHORIG
Suffix used by
.Cm patch
to rename original files, and
.Cm update-patches
to re-generate
.Pa ${PATCHDIR}/${PATCH_LIST}
by looking for files using this suffix.
Defaults to
.Pa .orig.port .
In the unlikely event that one of the ${DISTFILES*} already contains
.Pa .orig.port
files, set this to something else, such as
.Pa .orig.obsdport .
See also
.Cm distpatch ,
.Ev DISTORIG .
.It Ev PATCH_CASES
In the normal
.Cm distpatch
stage (when
.Ev PATCHFILES*
is not empty), this is the contents of a case statement, used to apply
distribution patches.
Fragments are automatically appended to handle gzip'ed, bzip'ed and lzip'ed
patches, so that the default case is more or less equivalent to the following
shell fragment:
.Bd -literal
set -e
cd ${FULLDISTDIR}
for patchfile in ${ALL_PATCHFILES}
do
case $$patchfile in
*.bz2)
${BZIP2} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
*.zst|*.zstd)
zstdcat -c <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
*.Z|*.gz)
${GZIP_CMD} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
*)
${PATCH} ${PATCH_DIST_ARGS} <$$patchfile;;
esac
done
.Ed
.It Ev PATCHDIR
Location for patches applied by the
.Cm patch
target.
Default:
.Pa patches .
.It Ev PATCHFILES*
Files to fetch from the master sites like
.Ev DISTFILES* ,
but serving a different purpose, as they hold distribution patches that
will be applied at the
.Cm patch
stage.
See also
.Ev SUPDISTFILES* .
.It Ev PATCH_ARGS
Full list of options used while applying port's patches.
.It Ev PATCH_CHECK_ONLY
Set to
.Sq Yes
by the
.Cm checkpatch
target.
Don't touch unless the default
.Cm checkpatch
target needs to be redefined.
Ideally, user-defined patch subtargets ought to test checkpatch.
In practice, they don't.
.It Ev PATCH_DEBUG
If set to
.Sq Yes ,
the
.Cm patch
stage will output extra debug information.
This is the default.
.It Ev PATCH_DIST_ARGS
Full list of options used while applying distribution patches.
.It Ev PATCH_DIST_STRIP
Patch option used to strip directory levels while applying distribution
patches.
Defaults to -p0.
.It Ev PATCH_LIST
Wildcard pattern of patches to select under ${PATCHDIR}.
Defaults to patch-*.
Note that filenames ending in .orig, or ~ are never applied.
Note that
.Ev PATCH_LIST
can hold absolute pathnames, for instance to share patches among similar
ports:
.Bd -literal
PATCH_LIST=${PORTSDIR}/x11/kde/libs2/patches/p-* patch-*
.Ed
.Pp
But beware that minor variations will result in
.Cm update-patches
creating useless churn !
.It Ev PATCH_STRIP
Patch option used to strip directory levels while applying port's patches.
Defaults to -p0.
.It Ev PERMIT_DISTFILES , PERMIT_PACKAGE
Set to
.Sq Yes
if the distribution files or the package can be allowed on FTP sites without
legal issues.
Set to reason not to otherwise.
PERMIT_* lines in the Makefile should be preceded with a comment explaining
details about licensing and patents issues the port may have.
Porters must be very thorough in their checks.
In case of doubt, ask.
.Pp
If
.Ev PERMIT_PACKAGE
is set to
.Sq Yes ,
.Ev PERMIT_DISTFILES
will default to
.Sq Yes .
.It Ev PKG_ADD
User settings.
Path to
.Xr pkg_add 1
command, with possible options.
.It Ev PKG_ARCH
Comma-separated list of architectures on which this package may install.
Defaults to ${MACHINE_ARCH},${ARCH}.
.Pp
For instance:
.Ev MACHINE_ARCH Ns = Ns Ar powerpc ,
.Ev ARCH Ns = Ns Ar macppc .
.Pp
Most (if not all packages) will install correctly according to
.Ev MACHINE_ARCH .
.Pp
Use * for arch-independent packages
.Po
see also
.Sx THE DEBUG_PACKAGES INFRASTRUCTURE
.Pc .
.It Ev PKG_ARGS
Special arguments to pass to
.Xr pkg_create 1 ,
in addition to the default ones.
For mips64 and pic libraries, see
.Sx THE GENERATION OF PACKAGE INFORMATION .
.It Ev PKG_CREATE
User settings.
Path to
.Xr pkg_create 1
command, with possible options.
.It Ev PKG_CREATE_NO_CHECKS
Porters switch.
Set to
.Sq Yes
to avoid checking the ports tree when solving
.Ev WANTLIB
.Po
see
.Cm wantlib-args
.Pc .
May result in bogus packages that mix
.Cm @depends
lines obtained from
the ports tree with
.Cm @wantlib
lines that come from the installed system.
Set to
.Sq Warn
to have the differences printed as a warning instead of an error
.Po
the default
.Pc .
.It Ev PKG_DBDIR
User settings.
Path to package installation records.
Defaults to
.Pa /var/db/pkg .
.It Ev PKG_DELETE
User settings.
Path to
.Xr pkg_delete 1
command, with possible options.
.It Ev PKG_INFO
User settings.
Path to
.Xr pkg_info 1
command, with possible options.
.It Ev PKG_TMPDIR
See
.Xr pkg_add 1 .
Normally points to
.Pa /var/tmp ,
as per default.
.It Ev PORTHOME
Setting of env variable
.Ev HOME
for most shell invocations.
Default will trip ports that try to write into $HOME while building:
non-existent
.Pa /${PKGPATH}_writes_to_HOME/ .
.It Ev PORTPATH
Path used by most shell invocations.
Don't override unless really needed.
.It Ev PORTSDIR
Root of the ports tree (default:
.Pa /usr/ports ) .
.It Ev PORTSDIR_PATH
Path used by dependencies and
.Pa bsd.port.subdir.mk
to look up package specifications.
Defaults to
.Pa ${PORTSDIR}:${PORTSDIR}/mystuff .
.It Ev PORTS_PRIVSEP
If set to
.Sq Yes ,
will build ports as
.Ev BUILD_USER
and fetch distfiles
as
.Ev FETCH_USER .
.Pp
To work fully, this does require the ports tree
to be world-readable, and
.Pa ${WRKDIR}
to be world-readable as well
.Po
.Cm update-patches
and friends won't work otherwise
.Pc .
.Pp
Meant to use in concert with
.Xr dpb 1 ,
which uses the same permissions
.Po
see
.Sq THE SECURITY MODEL OF DPB
in
.Xr dpb 1
.Pc .
.Pp
Basically,
.Ev BUILD_USER
must be able to write into
.Pa ${WRKOBJDIR} , ${PACKAGE_REPOSITORY} , ${PLIST_REPOSITORY}
and
.Ev FETCH_USER
must be able to write into
.Pa ${DISTDIR} .
The directories and permissions can be set correctly using
.Cm fix-permissions .
.Pp
The regular user must be allowed to execute commands as
.Ev BUILD_USER
and
.Ev FETCH_USER .
Running commands as another user can be achieved with
.Xr doas 1
by setting
.Ev SUDO=doas
in
.Xr mk.conf 5
and using the following minimal
.Xr doas.conf 5 :
.Bd -literal -offset indent
permit keepenv nopass solene as _pbuild
permit keepenv nopass solene as _pfetch
.Ed
.Pp
It is reasonably safe to allow your user id to run commands as the
.Ev BUILD_USER
or
.Ev FETCH_USER
and using
.Ic nopass
for these can save a lot of password entry, however it is inadvisable
to allow commands like
.Xr pkg_add 1
to run as root without a password.
.Pp
Note that this also means that
.Xr doas 1
must be configured to work within the chroot
created by
.Xr proot 1 .
.Pp
As
.Xr dpb 1
does its own privilege dropping when run as root,
it will automatically override
.Ev PORTS_PRIVSEP .
.Pp
User settings, defaults to
.Sq \&No .
.It Ev PKGDIR
Location for packaging information (packing-list, port description, messages).
.Cm update-plist
may create it.
Must be a valid directory.
Default: pkg.
.It Ev PKGFILE
Full path to the created package for the given subpackage.
Read-only.
.It Ev PKGFILES
Full path to all created packages.
Read-only.
.It Ev PKGNAME
Name of the created package.
Default is ${DISTNAME}.
This does not take flavors into account.
See
.Ev FULLPKGNAME
for that.
Specific revisions and epoch changes should be
handled by
.Ev REVISION
and
.Ev EPOCH
instead.
.It Ev PKGNAMES
Read-only.
List of all package names generated by the port, with
.Ev FLAVORS
and
.Ev BUILD_PACKAGES
taken into account.
Mostly used as
.Ql make show=PKGNAMES
to verify that bumped package names are correct.
.It Ev PKGNAME-foo
Package name for sub-package foo, if the default value
of ${PKGNAME}${SUBPACKAGE} is not appropriate.
.It Ev PKGPATH
Path to the current port's directory, relative to ${PORTSDIR}.
Read-only.
.It Ev PKGPATHS
Read-only.
List of all package paths generated by the port, with
.Ev FLAVORS
and
.Ev MULTI_PACKAGES
taken into account.
Order matches
.Ev PKGNAMES
exactly.
.It Ev PKGSPEC
Default package spec for using this port as a dependency.
Defaults to
.Sq stem-* ,
derived from the
.Ev FULLPKGNAME .
Do not override without very good reasons,
namely software that coexist as different incompatible versions with the
same stem, e.g., already a mess.
Also See the description of
.Fl P
in
.Xr pkg_create 1
.It Ev PKGSTEM
Base for the package name without any version number.
Used in
.Pa READMEs
file names and actual contents, can be overridden for ports
with branches, like php, e.g.,
.Li PKGSTEM-main = php-5.6
.It Ev PLIST_DB
Deprecated, see
.Ev PLIST_REPOSITORY .
.It Ev PLIST_REPOSITORY
User settings.
Base directory used to save generated packing-lists, as persistent information.
Packing-lists are processed by a script,
.Xr register-plist 1 ,
which complains when packing-lists change without a
.Ev REVISION
bump.
It also knows enough about package version numbers when something in the
package or its dependencies goes backward, thus catching
.Ev EPOCH
issues.
This directory is never cleaned during normal operation.
.Ql make clean=plist
should only ever be used during debugging by port maintainers.
Defaults to
.Pa ${PORTSDIR}/plist
.Po
plists actually get saved into
.Pa ${PLIST_REPOSITORY}/${MACHINE_ARCH}
.Pc .
If set to empty, will not register anything: very much unsafe.
.It Ev PORTROACH
Controls the behavior of
.Pa misc/portroach
as documented in detail at
.Lk https://jasperla.github.io/portroach/docs/portroach-portconfig.txt
.It Ev PREFIX
Base directory for the current port installation.
Usually ${LOCALBASE}, though some ports may elect a location under
.Pa ${VARBASE} ,
and some multi-package ports may install under several locations.
Additionally, firmware files generally install under
.Pa ${BASESYSCONFDIR} .
.It Ev PREPARE_CHECK_ONLY
Build settings.
Prevent the
.Cm prepare
stage from installing anything, let it just check dependencies, and
handle [:target] dependencies.
Mostly used by
.Xr dpb 1 ,
which already installs everything before running
.Cm prepare .
.It Ev PROGRESS_METER
User settings.
Defaults to
.Sq Yes .
Forces commands like
.Xr ftp 1
and
.Xr pkg_create 1
to use their progress-meter even in the absence of a terminal.
.It Ev PROPERTIES
List of properties specific to a given machine architecture,
obtained through the inclusion of
.Xr bsd.port.arch.mk 5 .
These can be checked like this
.Bd -literal -offset indent
\&.include <bsd.port.arch.mk>
\&.if ${PROPERTIES:Mapm}
# then add build options specific to apm arches
\&...
\&.if !${PROPERTIES:Mlp64}
# build options specific to lp32 arches
\&...
.Ed
For
.Ev MULTI_PACKAGES
setup, use of
.Ev ONLY_FOR_ARCHS-sub
and
.Ev BUILD_PACKAGES
is generally preferred (and simpler).
Possible properties include
.Bl -tag -width mono
.It apm
architecture possesses suspend (apm) support.
.It be
architecture is big-endian.
.It gccN
gccN architecture.
.It le
architecture is little-endian.
.It lp64
lp64 architecture.
.It llvm
there is
.Pa lang/llvm
support on this architecture.
.It mono
there is
.Pa lang/mono
support on this architecture.
.El
.It Ev PSEUDO_FLAVOR
List of flavors in
.Ev FLAVOR
that are actually pseudo-flavors.
Only for introspection purposes.
Read-only.
.It Ev PSEUDO_FLAVORS
Extra list of flavors that do not register in package names, but are still
used to control build logic, and work directory names.
Its only use should be for disabling part of a multi-packages build,
for instance:
.Bd -literal
FLAVOR=no_gnome make package
.Ed
.Pp
Pseudo-flavors should be named as
.Sq no_something
to disable the build of subpackage
.Sq -something
.Po
and possibly some others, by restricting
.Ev BUILD_PACKAGES
.Pc .
Pseudo-flavors should always be handled through
.Xr bsd.port.arch.mk 5 .
A pseudo-flavor can remove several subpackages through the following
construct.
.Bd -literal -offset indent
# pseudo-flavor no_gui will also remove gtk and gtk3
MULTI_PACKAGES = -main -gtk -gtk3 -gui
# ...
\&.include <bsd.port.arch.mk>
# remove extra build components
\&.if !${BUILD_PACKAGES:M-gui}
BUILD_PACKAGES := ${BUILD_PACKAGES:N-gtk:N-gtk3}
\&.endif
# normal configure setup, e.g.,
\&.if ${BUILD_PACKAGES:M-gtk}
# ...
.Ed
.Pp
Caveat: creation of a separate working directory is mandatory for a
pseudo-flavor.
If, at a later time, a full build with all subpackages is required,
all the work will need to be done again.
.Pp
See also
.Ev BUILD_ONCE .
.It Ev RCDIR
Location for daemon startup scripts.
Defaults to
.Pa /etc/rc.d .
Do not change.
.It Ev REFETCH
User settings.
If set to true,
.Cm checksum
will analyze ${CHECKSUM_FILE}, and try retrieving files with the correct
checksum off
.Lk https://ftp.openbsd.org ,
in the directory
.Pa /pub/OpenBSD/distfiles/$cipher/$value/$file .
.It Ev REGISTER_PLIST_OPTS
User settings.
User options added to
.Xr register-plist 1 .
.It Ev REORDER_DEPENDENCIES
Points to a list of files that specify inter-dependencies for
.Xr make 1 .
If defined, each line of the file is either a comment (starting with #)
or a pair of two files: most_recent older.
At the end of
.Cm post-patch ,
.Xr touch 1
will be used to ensure those files are put in the proper order.
The files are assumed to be under
.Pa ${WRKSRC} .
The notation /file can be used to ask for a recursive search, e.g.,
to make sure that all Makefile.in are up to date.
See
.Pa ${PORTSDIR}/infrastructure/mk/automake.dep
for an example.
.It Ev REPORT_PROBLEM
See
.Xr ports 7 .
.It Ev REPORT_PROBLEM_LOGFILE
See
.Xr ports 7 .
.It Ev REVISION
Revision number of the current package.
Defaults to empty (very first package), then
numbering starts at 0.
Gets automatically incorporated into
.Ev FULLPKGNAME
as
.Sq p${REVISION}
to form a full package-name conforming to
.Xr packages-specs 7 .
.It Ev ROACH_SITES
Selects the correct list of sites corresponding to
.Ev ROACH_URL ,
in order to help portroach.
.It Ev ROACH_URL
The canonical url corresponding to the current port.
Gets deduced from ${DISTFILES} by default, using the first value
or the first entry in ${DISTFILES.sufx} if there's only one suffix.
Conversion rules for
.Ev DISTFILES
are applied to yield only the url part of the distfile.
Set manually if the automatic rules don't find the right one.
.It Ev RUN_DEPENDS
Specification of ports this port needs installed to be functional.
Same format as
.Ev LIB_DEPENDS .
The corresponding packages will be built right before the
.Cm install
stage, and
.Xr pkg_add 1
will take care of installing them.
.It Ev SEPARATE_BUILD
Many GNU configure ports can be built in a directory distinct from the
place they were unpacked.
For some specific ports, this is even mandatory.
Set to
.Sq yes
if this is the case.
The ports infrastructure will generate a separate ${WRKBUILD} directory
in which the port will be configured and built.
Wipe ${WRKBUILD} to start anew, but skipping the extract/patch stage.
.It Ev SETENV
Normally set to
.Li /usr/bin/env -i .
Prepended to every command invocation that requires a clean environment.
Do not override.
.It Ev SHARED_LIBS
List of shared libraries that the port may build, as a list of the form
.Sq libname
.Sq libversion .
Used to set variables of the form
.Ev LIBlibname_VERSION
that are then used for substitution by
.Xr pkg_create 1 .
The porter is responsible for making sure the port uses those version numbers
when shared libraries are built.
.Pp
The intent is that the
.Ox
ports system must have control over shared library versions because of global
changes that may require bumping the major version of every shared library in
the system, or simply because the third party programmers do not understand
the rules for shared library versions, thus breaking the update mechanism.
For that reason it is advised to set libversion to 0.0 when first importing a
port.
.Pp
Porters of software using libtool should make sure
.Ev MAKE_FLAGS
get propagated to the libtool invocations.
.Pp
Most common build systems in the ports tree have been modified
to handle this mechanism correctly.
.It Ev SITE_BACKUP
User settings.
List of sites to try after normal master sites.
Normally includes ${SITE_OPENBSD} and ${SITE_FREEBSD}.
.Po
For now the ports tree is transitioning from
.Ev MASTER_SITES*
to
.Ev SITES*
which means that
.Ev MASTER_SITE_BACKUP
should be set instead until the transition is complete.
.Pc
.It Ev SITE_*
Lists of standard sites to retrieve files from, refer to
.Pa ${PORTSDIR}/infrastructure/db/network.conf
for a complete list.
.Pp
Generally used with the standard
.Xr make 1 Ns 's
.Li ${VARIABLE:=subdir/}
construct to append the relevant subdir at the end of each entry, e.g.,
.Dl SITES = ${SITE_GNU:=cgicc/}
.It Ev SITES
List of primary locations from which distribution files and patchfiles are
retrieved.
See the
.Cm fetch
target for details.
Defaults to ${SITES_GITHUB} for GitHub-hosted projects,
see
.Ev GH_* .
See
.Xr ports 7
for user configuration.
.It Ev SITES*
List of alternate locations from which ${DISTFILES*}, ${PATCHFILES*},
${SUPDISTFILES*} are retrieved.
See
.Cm fetch
for details.
Suffix should start with
.Sq \&.
and be all lowercase for consistency.
.It Ev SITES0 , ... , SITES9
Supplementary locations from which distribution files and patchfiles are
retrieved (deprecated).
.It Ev SKIPDIR
See
.Xr ports 7 .
.It Ev STATIC_PLIST
Normally set to
.Sq yes .
Can be set to no for ports that do not have a static plist.
Do not change without a very good reason.
Note that the only good reason to not have a static plist is for ports such
as
.Pa databases/ports-readmes
which actually build a bunch of files depending on the current ports tree.
This breaks all introspection mechanisms within the ports tree, including
.Pa databases/pkglocatedb
which will not include that port.
.It Ev STARTAFTER
See
.Xr ports 7 .
.It Ev STARTDIR
See
.Xr ports 7 .
.It Ev SUBPACKAGE
Set to the subpackage suffix when building a package in a multi-package port.
Read-only.
Used to test for dependencies or to adjust the package name.
.It Ev SUBST_CMD
A command that can be used to perform
.Ev SUBST_VARS
substitution on arbitrary files.
In normal mode,
.Pp
.Dl ${SUBST_CMD} file1 file2 ...
.Pp
will substitute files in place, creating backup copies of them.
In copy mode,
.Pp
.Dl ${SUBST_CMD} -c src1 dest1 src2 dest2
.Pp
will copy files over while performing the substitution, as suitable for
copying template files over from
.Pa ${FILESDIR}
to
.Pa ${PREFIX} ,
for instance.
This uses
.Xr pkg_subst 1
with suitable parameters.
Read-only.
.Pp
${SUBST_CMD}
can be used like
.Xr install 1 :
.Dl ${SUBST_CMD} Oo Fl g Ar group Oc Oo Fl o Ar owner Oc Oo Fl m Ar mode Oc file...
to set file
.Ar owner ,
.Ar group
and/or
.Ar mode .
.Pp
Note that
.Ev SUBST_CMD
is not really appropriate when variables have subpackage variations, like
.Ev PREFIX
or
.Ev FULLPKGNAME .
Use the appropriate
.Ev SUBST_CMD-sub
instead.
.It Ev SUBST_CMD-sub
.Ev SUBST_CMD
with subpackage-dependent semantics, like packing-list substitution.
It will substitute the right variable depending on the desired subpackage,
e.g.,
.Ev SUBST_CMD-foo
will substitute the value of
.Ev FULLPKGNAME-foo
for
.Li ${FULLPKGNAME} .
.It Ev SUBST_DATA , SUBST_MAN , SUBST_PROGRAM
Specialized versions of
.Ev SUBST_CMD
that use
.Fl c
and appropriate owner/group/mode for data, manpages and programs respectively.
.It Ev SUBST_VARS
Make variables whose values get substituted to create the actual package
information.
Always holds
.Ev ARCH ,
.Ev BASE_PKGPATH ,
.Ev FLAVOR_EXT ,
.Ev FULLPKGNAME ,
.Ev HOMEPAGE ,
.Ev LOCALBASE ,
.Ev MACHINE_ARCH ,
.Ev MAINTAINER ,
.Ev PREFIX ,
.Ev PKGSTEM ,
.Ev RCDIR ,
.Ev SYSCONFDIR ,
.Ev TRUEPREFIX ,
and
.Ev X11BASE .
The special construct
.Sq ${FLAVORS}
can be used in the packing-list to specify the current list of dash
separated flavors the port is compiled with (useful for cross-dependencies
in
.Ev MULTI_PACKAGES ) .
Add other
variables as needed.
.Pp
.Ev TRUEPREFIX
is never passed to
.Xr pkg_create 1
as it is identical to
.Ev PREFIX .
.Pp
By default,
.Xr update-plist 1
is run with the following options:
.Bd -literal -offset indent
update-plist -i ARCH -i BASE_PKGPATH -i FULLPKGNAME
-i FULLPKGPATH -i LOCALSTATEDIR -i MACHINE_ARCH
-s BASE_PKGPATH -s LOCALBASE -s LOCALSTATEDIR -s PREFIX
-s RCDIR -s SYSCONFDIR -s X11BASE
.Ed
.It Ev SUDO
User settings.
If set to
.Xr doas 1
in
.Xr mk.conf 5 ,
the ports tree will only invoke root's privileges for the parts that
really require it.
.It Ev SUPDISTFILES*
Supplementary distribution files for mirroring and creating checksums with
.Cm makesum .
For instance, a port might need architecture-specific files, or have
some flavor that requires more code.
.Ev SUPDISTFILES*
should hold a list of all those distribution files and patchfiles
that are not always needed.
Having an overlap between
.Ev SUPDISTFILES*
and
.Ev DISTFILES* ,
.Ev PATCHFILES*
is admissible, and in fact, expected, as it is much simpler to build
an error-free list of files to retrieve in that way.
See the
.Pa devel/jdk/1.8
port for an example.
.It Ev SYSCONFDIR
Location for this port's configuration files, should always be derived
from
.Ev BASESYSCONFDIR ,
which defaults to
.Pa /etc .
Passed to gnu configure scripts and substituted in packing-lists.
.It Ev TAR
Name of the tar binary.
.It Ev TARGETS
Read-only.
Set to the list of special targets for a port
.Po
.Cm {pre,do,post}-*
and module hooks
.Pc .
Used by introspection tools such as the
.Pa sqlports
package.
.It Ev TEMPLATE_DISTFILES.<name>
Template used to construct
.Ev DISTFILES.name
based on a
.Ev DIST_TUPLE
entry by filling in placeholder strings.
For instance,
.Ev TEMPLATE_DISTFILES.github
defaults to
.Bd -literal
<account>-<project>-{<account>/<project>/archive/<subdir>}<id>.tar.gz
.Ed
.Pp
with
.Li DIST_TUPLE += github foo bar baz qux.
We end up with the following
.Ev DISTFILES.github
entry:
.Bd -literal -offset indent
foo-bar-{foo/bar/archive/ref/tags}baz.tar.gz
.Ed
.Pp
Placeholders
.Sq account ,
.Sq project ,
.Sq id
are self-explanatory.
.Sq subdir
is set automatically by figuring out whether
.Ar id
is a
.Ar tagname
or a
.Ar hash .
.It Ev TEMPLATE_HOMEPAGE.<name>
Template for automatically generated
.Ev HOMEPAGE
when using
.Ev DIST_TUPLE .
Very similar to
.Ev TEMPLATE_DISTFILES.<name> .
.It Ev TEST_DEPENDS
See
.Ev BUILD_DEPENDS
for specification.
Test dependencies are only checked if the
.Cm test
stage is invoked.
.It Ev TEST_ENV
Additional environment variables passed to tests.
Empty by default.
.It Ev TEST_FLAGS
Extra flags passed to ${MAKE_PROGRAM} to run the regression tests.
Empty by default.
.It Ev TEST_IS_INTERACTIVE
Set to
.Sq Yes
if port needs human interaction to run its tests, or set to
.Sq X11
if the tests need an active X11 display to work.
.It Ev TEST_LOG
Command used to log the results of regression tests to TEST_LOGFILE.
Read-only.
.It Ev TEST_LOGFILE
Log file containing the results of regression tests.
.It Ev TEST_TARGET
Target to run regression tests.
Defaults to
.Sq test ,
except for
.Sq perl
and
.Sq gnu
.Ev CONFIGURE_STYLE ,
which default to
.Sq test
and
.Sq check ,
respectively.
.It Ev TRUEPREFIX
Read-only.
Mostly the same as ${PREFIX}, except it never gets ${DESTDIR} prepended
during
.Cm fake .
Refer to
.Sx THE FAKE FRAMEWORK
section for details.
.It Ev TRY_BROKEN
User settings.
If set to
.Sq Yes ,
don't set
.Ev IGNORE
for
.Ev BROKEN
ports, so that we will attempt to build them.
.It Ev UNLOCK_CMD
User settings.
If set, expands to a command that will release a lock.
This lock will reside in
.Pa ${LOCKDIR} .
.It Ev UNMESSAGE
File recorded in the package and displayed during deinstallation.
Defaults to ${PKGDIR}/UNMESSAGE if this file exists.
Leave empty if no message is needed.
.It Ev UNZIP
Name of the unzip binary.
.It Ev UPDATE_COOKIES_DIR
User settings.
Used to store cookies for package updates and defaults to
.Pa ${PORTSDIR}/update/${MACHINE_ARCH} .
If set to empty, will revert to a file under
.Pa ${WRKDIR} .
.It Ev UPDATE_PLIST_ARGS
Tweaks to
.Xr update-plist 1
behavior for some specific ports, such as variable handling.
.It Ev UPDATE_PLIST_OPTS
User settings.
User options added to
.Xr update-plist 1 ,
mostly
.Fl v
for now.
.It Ev USE_CCACHE
User settings.
Set to
.Sq Yes
to use ccache when building ports.
Sets up the build environment so that it is used.
.It Ev USE_GMAKE
Set to
.Sq Yes
if GNU make (${GMAKE}) is needed for correct behavior of this port.
.It Ev USE_GROFF
Set to
.Sq Yes
to use groff to build manpages.
This sets groff as a build dependency, and also tells
.Xr pkg_create 1
to format manpages behind the scene using groff while building packages.
.It Ev USE_LIBTOOL
Defaults to
.Sq Yes .
Set to
.Sq gnu
if the base
.Xr libtool 1
is insufficient and GNU libtool is required.
Set to
.Sq \&No
to disable the use of
.Xr libtool 1
entirely; this should not be set under normal circumstances.
Adds dependencies if necessary, and passes LIBTOOL environment variable to
scripts invocations.
.Pp
Many ports using GNU autoconf need an m4 file from the GNU libtool package
but otherwise work with base
.Xr libtool 1 .
In those cases do not set
.Ev USE_LIBTOOL ,
instead just set
.Li BUILD_DEPENDS = devel/libtool .
.It Ev USE_LLD
Set to
.Sq Yes
or
.Sq \&No
to force the use of
.Xr ld.lld 1
.Po
as opposed to
bfd's
.Xr ld 1
.Pc .
Defaults to the appropriate value for the current architecture
.Po
see
.Ev LLD_ARCHS
in
.Xr bsd.port.arch.mk 5
.Pc .
.It Ev USE_MFS
Set to
.Sq Yes
to build ports under an MFS filesystem
(see
.Xr mount_mfs 8 ) .
Mostly for use by
.Xr dpb 1
and not intended to be a user setting.
See
.Ev WRKOBJDIR_MFS
for configuration.
.It Ev USE_NOEXECONLY
If set to
.Sq Yes ,
writes a wrapper script to ${WRKDIR}/bin/ld in
.Cm patch
adding
.Fl -no-execute-only .
Use when a port does not work with execute-only (unreadable) code sections
which are used by default by the linker on some architectures.
.It Ev USE_WXNEEDED
If set to
.Sq Yes ,
writes a wrapper script to ${WRKDIR}/bin/ld in
.Cm patch
to request that the linker adds an
.Dv PT_OPENBSD_WXNEEDED
ELF section.
Use when a port requires memory mappings that are both executable
and writable and cannot be modified to avoid this.
.It Ev USE_X11
Normally, presence of ${X11BASE} is enforced by default for building ports.
But there is an experimental way to hook the xenocara build into
.Xr dpb 1 ,
which requires knowing whether a port requires X11 to already
be there.
.Pp
The infrastructure mostly sets
.Ev USE_X11
automatically based on
.Ev WANTLIB
values, there are a few ports (about 20) that require X11 components without
any library telltale.
.It Ev VARBASE
User settings.
Base location for ports that install stuff outside of
.Pa ${LOCALBASE} .
Defaults to
.Pa /var .
.It Ev WANTLIB
List of library specifications that a package will need.
May include system and X11 libraries.
See
.Xr library-specs 7
for more details.
.Pp
As a special extension,
.Ev WANTLIB
may include absolute paths, e.g.,
.Pa ${LOCALBASE}/lib/expat=4
to distinguish between base libraries and port libraries.
Use with caution, this is very seldom needed.
.It Ev wantlib_args
Controls the behavior of
.Xr pkg_create 1
related targets, see
.Cm print-package-args
for details.
.It Ev WARNINGS
User settings.
If set to
.Sq Yes ,
add
.Ev CDIAGFLAGS
to
.Ev CFLAGS
and
.Ev CXXDIAGFLAGS
to
.Ev CXXFLAGS .
.It Ev WRKBUILD
Subdirectory of ${WRKDIR} where the actual build occurs.
Defaults to ${WRKSRC}, unless
.Ev SEPARATE_BUILD
is involved, in which case it is set to an appropriate value.
.It Ev WRKCONF
Subdirectory of ${WRKDIR} where the actual configure set occurs.
Defaults to ${WRKBUILD}.
.It Ev WRKDIR
Location where all port activity occurs.
Apart from the actual port, may
hold all kinds of cookies that checkpoint the port's build.
Read-only.
Note that WRKDIR may be a symbolic link.
During ports building,
.Pa ${WRKDIR}/bin
is put at the front of the
.Ev PATH .
.It Ev WRKDIR_LINKNAME
Name of a symbolic link to create within the port directory which will
point to the port's ${WRKDIR}.
Deprecated.
.It Ev WRKDIST
Subdirectory of ${WRKDIR} in which the distribution files normally unpack.
Base for all patches.
Defaults to
.Pa ${WRKDIR}/${DISTNAME} .
Note that WRKDIST may be a symbolic link, if set to ${WRKDIR}.
.It Ev WRKSRC
Subdirectory of ${WRKDIR} where the actual source is.
Base for configuration (default: ${WRKDIST}).
Note that WRKSRC may be a symbolic link, if set to ${WRKDIR}.
.It Ev WRKINST
Subdirectory of ${WRKDIR} used as a staging area for installing the port.
(See
.Cm fake
target).
.It Ev WRKOBJDIR
Used as a base for the actual port working directory.
Defaults to
.Pa ${PORTSDIR}/pobj .
The real working directory ${WRKDIR} is created there.
Can be set on a per-${PKGPATH} basis.
For instance, setting WRKOBJDIR_www/mozilla=/tmp/obj
will affect only the mozilla port.
If explicitly unset (WRKOBJDIR=), the working directory is
created within the port directory.
.It Ev WRKOBJDIR_MFS
Alternate location for the port working directory.
The intent is to use an MFS based filesystem for small ports with
.Xr dpb 1 .
Active when
.Ev USE_MFS
is
.Sq Yes .
Defaults to
.Pa /tmp/pobj .
.It Ev X11BASE
Where X11 has been installed.
Default:
.Pa /usr/X11R6 .
.It Ev XAUTHORITY
Points to a suitable authority file for X11 interactive regression tests.
Defaults to
.Pa ${HOME}/.Xauthority .
.It Ev XMKMF
Invocation of xmkmf for a
.Li CONFIGURE_STYLE=imake
port.
Defaults to xmkmf -a -DPorts.
The -DPorts is specific to
.Ox
and is always appended.
.It Ev YACC
Name of yacc program to pass to GNU-configure, defaults to yacc.
GNU-configure would always try to use bison otherwise, which leads to
unreproducible builds.
Set to bison if needed.
.El
.Sh THE FAKE FRAMEWORK
The
.Cm fake
target is used to install the port under a staging directory first, ready for
packaging by the
.Cm package
target, so that the actual
.Cm install
target will use the binary package instead.
.Pp
Essentially,
.Cm fake
invokes the install process after tweaking a few variables.
.Pp
.Cm fake
first creates a skeleton tree under ${WRKINST}, using
.Xr mkdir 1
.Fl p .
.Pp
A
.Cm pre-fake
target may be used to complete that skeleton tree.
For instance, a few ports may need supplementary stuff to be present (as
it would be installed if the port's dependencies were present).
.Pp
In most cases,
.Cm pre-install
is preferred.
.Pp
If
.Cm {pre,do,post}-install
overrides are present, they are used with some
important changes, listed in
.Ev FAKE_SETUP :
.Bd -literal -offset indent
TRUEPREFIX=${PREFIX}
PREFIX=${WRKINST}${PREFIX}
${DESTDIRNAME}=${WRKINST}
.Ed
.Pp
Essentially, old install targets work transparently, except for a need to
change
.Ev PREFIX
to
.Ev TRUEPREFIX
for symbolic links and similar path lookups.
Specific traditional post install work can be simply removed, as it will
be taken care of by the package itself (for instance, ldconfig, or
texinfo's install-info).
.Pp
If no
.Cm do-install
override is present, the port is installed using
.Bd -literal -offset 2n
env -i ${MAKE_ENV} ${FAKE_SETUP} ${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
.Ed
.Pp
Note that this does set both PREFIX and ${DESTDIRNAME}.
If a port's Makefile both heeds ${DESTDIRNAME},
and references PREFIX explicitly,
FAKE_FLAGS may rectify the problem by setting PREFIX=${PREFIX}
(which will do the right thing, since ${PREFIX} is a
.Xr make 1
construct which will not be seen by the shell).
.Pp
${FAKE_FLAGS} is used to set variables on
.Xr make 1
command line, which will override the port Makefile contents.
Thus, a port that mentions DESTDIR= does not need any patch to work with fake.
.Pp
Files such as
.Pa ${PKGDIR}/README*
or
.Pa ${PKGDIR}/*.rc
get copied to
.Pa ${WRKINST}
right after the end of
.Cm fake ,
during
.Cm generate-readmes
(see the
.Sx FILES
section above for details).
.Sh THE DEBUG_PACKAGES INFRASTRUCTURE
If
.Ev DEBUG_PACKAGES
is not empty, debug packages will be built "on the side".
Since debug information is usually large, this is controlled on a per-arch
basis with
.Ev DEBUGINFO_ARCHS
controlling the behavior (set to amd64 by default).
.Pp
During the normal
.Cm package
target ,
.Xr build-debug-info 1
will be invoked to deduce debug packing-lists from the normal packing-lists,
and some extra makefile rules will be invoked to set aside the debug
information.
.Pp
Then each normal package will have a "shadow" debug-* package built alongside
it, with the exact same package signature, except it will also be tied closely
with the normal package.
.Pp
Figuring out what files contain debug information is entirely achieved through
.Cm @bin ,
.Cm @lib ,
.Cm @so
and
.Cm @static-lib
annotations in the base packing-lists.
.Pp
Debug packages will be produced for all subpackages in
.Ev DEBUG_PACKAGES .
Usually, the heuristics of trimming arch-independent packages
from
.Ev BUILD_PACKAGES
is enough.
In case this still produces empty debug packages, the
.Ev DEBUG_PACKAGES
list should be produced manually.
.Pp
The actual debug packages are not registered through
.Xr register-plist 1
since the information was automatically generated.
.Pp
debug package names and debug package filenames are added to
.Ev PKGNAMES
and
.Ev PKGFILES
respectively for introspection purpose.
.Pp
.Xr egdb 1
from ports can read debug information from a separate file, as long as
the original ELF file was annotated with a debuginfo link.
.Pp
That feature is used to set debug information on the side, in
.Pa .debug/
subdirectories alongside the normal binaries, shared objects and shared
libraries.
.Pp
For static libraries, the information can't be separated, instead the full
static library with debug information is provided in the
.Pa .debug/
subdirectory, while the normal static library gets stripped.
.Sh FLAVORS AND MULTI_PACKAGES
Starting with
.Ox 2.7 ,
each port can generate distinct packages through two orthogonal mechanisms:
.Ev FLAVORS
and
.Ev MULTI_PACKAGES .
.Pp
The current
.Ev MULTI_PACKAGES
mechanism was introduced after
.Ox 4.0 .
.Pp
The arch-dependent part was refined after
.Ox 5.0 .
.Pp
If a port can be compiled with several options, these options
should be turned into
.Ev FLAVORS .
The port maintainer will set
.Ev FLAVORS
to be the list of possible options in the Makefile.
When building the port, the package builder will set
.Li "FLAVOR='option1 option2...'"
to build a specific flavor of the port.
The Makefile should test the value of FLAVOR as follows:
.Bd -literal -offset indent
FLAVOR?=
\&.if ${FLAVOR:Moption1}
# what to do if option1
\&.endif
\&.if ${FLAVOR:Moption2}
# what to do if option2
\&.endif
.Ed
.Pp
.Nm
takes care of a few details, such as generating a distinct work directory for
each flavor, or creating a FULLPKGNAME by adding a dash separated list of
flavors to the base package name.
The order in which
.Ev FLAVOR
is specified does not matter: this dash separated list will be
reordered to match the ordering of
.Ev FLAVORS .
.Pp
It is an error to specify an option in
.Ev FLAVOR
that does not appear in
.Ev FLAVORS ,
to prevent misspellings.
.Pp
In bulk package building, flavors can be specified as a comma
separated list after the package directory, e.g., SUBDIR+=vim,no_x11
.Po
see
.Xr pkgpath 7
.Pc
.Pp
Finally, package information will use templates with the canonical package
extension if they are available: if FLAVOR='option1 option2' and both
COMMENT and COMMENT-option1-option2 are available, COMMENT-option1-option2 will
be used.
.Pp
If one build of a port can generate several distinct packages, set
.Ev MULTI_PACKAGES
accordingly.
Each extension of a
.Ev MULTI_PACKAGES
name should start with a dash, so that they cannot be confused with
.Ev FLAVORS .
In dependency checking and bulk builds, a subpackage can be
specified after a comma, e.g.,
.Li SUBDIR+=quake,-server .
.Ev MULTI_PACKAGES
only affects the actual package building step.
.Pp
If
.Ev MULTI_PACKAGES
is set, the packaging stage happens once for every
subpackage, using subpackage-specific variables.
For instance, if
.Li MULTI_PACKAGES=-main -lib -server ,
.Ev PKG_ARCH-main ,
.Ev PKG_ARCH-lib
and
.Ev PKG_ARCH-server
will be used for the subpackages respectively called
.Ev FULLPKGNAME-main ,
.Ev FULLPKGNAME-lib
and
.Ev FULLPKGNAME-server .
.Pp
All package information is also derived from
templates with SUBPACKAGE appended.
In the preceding example, the packing-list template for FULLPKGNAME-lib
must be in PLIST-lib.
.Pp
The following variables are subpackage dependent:
.Ev COMMENT ,
.Ev PKG_ARCH ,
.Ev PERMIT_PACKAGE ,
.Ev PKGFILE ,
.Ev PKGNAME ,
.Ev PKGSTEM ,
.Ev FULLPKGNAME ,
.Ev REVISION ,
.Ev EPOCH ,
.Ev FULLPKGPATH ,
.Ev RUN_DEPENDS ,
.Ev WANTLIB ,
.Ev LIB_DEPENDS ,
.Ev IGNORE ,
.Ev ONLY_FOR_ARCHS ,
.Ev NOT_FOR_ARCHS ,
.Ev PKG_ARGS ,
.Ev PREFIX ,
.Ev CATEGORIES ,
.Ev MESSAGE ,
.Ev UNMESSAGE ,
.Ev DESCR ,
.Ev PLIST ,
.Ev STATIC_PLIST ,
.Ev PKGSPEC .
.Pp
The usual non-MULTI_PACKAGES variables are simply used as default values
for all subpackages.
So, if you set
.Li "PKG_ARCH=*"
.Li "PKG_ARCH-main=i386"
then
.Ev PKG_ARCH-lib
and
.Ev PKG_ARCH-server
will both be
.Sq * .
.Pp
.Ev WANTLIB
and
.Ev LIB_DEPENDS
are special.
At the beginning of the build, during
.Cm prepare ,
all build dependencies will be checked,
which includes
.Ev LIB_DEPENDS ,
.Ev WANTLIB
for every subpackage.
As an exception, any
.Ev LIB_DEPENDS-sub
that references the current port will be ignored as a build dependency,
in order to avoid recursion.
.Pp
.Ev FULLPKGPATH
and
.Ev FULLPKGNAME
are special as well.
If
.Ev PKGNAME
is <stem>-<version>,
then
.Ev PKGNAME-sub
will be set to
<stem>-sub-<version>
by default, except for
.Ev PKGNAME-main
which has
.Ev PKGNAME
as a default.
Normally,
.Ev FULLPKGPATH-sub
is automatically set to the right value,
but in very rare cases, one may need to override the default:
for instance, if one specific subpackage is not affected by flavor
settings that affect other subpackages, e.g., for include files packs,
then the flavoring part of the fullpkgpath may need to be dropped.
.Pp
In terms of using the port, quite a few targets will have a subpackage
specific subtarget:
invoking
.Cm package
is the same as invoking
.Cm subpackage
for all subpackages,
invoking
.Cm install-all
is the same as invoking
.Cm install
for all subpackages,
and invoking
.Cm update
is the same as invoking
.Cm subupdate
for all subpackages.
.Pp
.Ev ONLY_FOR_ARCHS
and
.Ev NOT_FOR_ARCHS
interact with
.Ev MULTI_PACKAGES
and
.Ev IGNORE .
The infrastructure will automatically filter subpackages
that are not suitable for the current architecture.
Thus,
.Ev MULTI_PACKAGES
should always list all subpackages,
even things not buildable on the current architecture,
for indexing purposes.
.Pp
Starting with
.Ox 5.1 ,
.Xr bsd.port.arch.mk 5
should be used to simplify the handling of
.Ev MULTI_PACKAGES
in arch-dependent setups:
.Pp
Make sure
.Ev MULTI_PACKAGES ,
.Ev ONLY_FOR_ARCHS* ,
and
.Ev PSEUDO_FLAVORS
are defined correctly, then
.Bd -literal -offset indent
\&.include <bsd.port.arch.mk>
.Ed
.Pp
This will compute
.Ev BUILD_PACKAGES ,
the list of actual subpackages to build with the current setup,
by taking arch constraints and pseudo-flavors into account.
Then test
.Ev BUILD_PACKAGES
to set up the right configuration, e.g., to check if
.Ev SUBPACKAGE
.Ar -mono
should be built:
.Bd -literal -offset indent
\&.if ${BUILD_PACKAGES:M-mono}
.Ed
.Pp
The
.Pa lang/gcc/8
or
.Pa print/poppler
ports should provide examples of proper use.
.Pp
Note that
.Xr dpb 1
will break if all subpackages are not properly listed.
.Sh THE GENERATION OF PACKAGE INFORMATION
Starting after
.Ox 4.1
all package information is processed directly by
.Xr pkg_create 1
from templates in ${PKG_DIR}.
.Pp
.Bl -bullet -compact
.It
If not overridden by the user, determine which set of templates to use,
depending on the current SUBPACKAGE and FLAVOR information.
Set PLIST${SUBPACKAGE}, DESCR${SUBPACKAGE}, COMMENT${SUBPACKAGE},
MESSAGE${SUBPACKAGE}, UNMESSAGE${SUBPACKAGE} accordingly.
.It
Generate the actual DESCR, and if needed, MESSAGE, UNMESSAGE,
from the templates in ${DESCR}, ${MESSAGE}, ${UNMESSAGE}, by
substituting the variables in ${SUBST_VARS}, and by substituting
${FLAVORS} with the canonical flavor extension for this port,
e.g., if
.Li FLAVORS=no_map gfx qt2 ,
if
.Li FLAVOR=gfx no_map ,
this is
.Sq -no_map-gfx .
.It
Generate the actual packing-list from the template ${PLIST},
by inserting fragments
and applying the same variable substitutions as other package information.
.El
.Pp
Note that ${COMMENT} is currently not substituted.
.Pp
To avoid substitution, variables can be escaped as follows:
.Li "$\e{PREFIX}"
.Pp
If
.Ev FLAVORS
lists flv, then constructs such as the line
.Li "%%flv%%"
or
.Li "!%%flv%%"
in the packing-list template trigger the inclusion of
.Pa ${PKGDIR}/PFRAG.flv${SUBPACKAGE}
or
.Pa ${PKGDIR}/PFRAG.no-flv${SUBPACKAGE} .
Other fragments can be defined by simply adding
.Li "-Dfrag=1"
or
.Li "-Dfrag=0"
to
.Ev PKG_ARGS .
.Pp
If libraries are built using
.Pa bsd.lib.mk ,
special care should be taken for mips64* architectures,
which do not ever build
.Pa *pic.a
files (all mips code is pic already).
.Nm
automatically adds
.Li "-Dno_mips64=1"
or
.Li "-Dno_mips64=0"
to
.Ev PKG_ARGS ,
and the porter only needs to provide the appropriate fragment.
.Pp
.Xr pkg_add 1
now calls
.Xr ldconfig 8
directly, provided dynamic libraries have been annotated with
.Li "@lib libthingy.so.5.0" .
Adding new directories to the dynamic loader cache has been
deprecated.
It is often better to let libraries be visible as a link
under ${LOCALBASE}.
Having a separate directory is enough to trick
.Xr ld 1
into grabbing the right version.
Libraries used only for
.Xr dlopen 3
do not need to be visible.
Some programs will prefer to use rpath to find their own libraries.
.Pp
The special
.Cm update-plist
target does a fairly good job of automatically generating the packing-list
information.
.Pp
If
.Ev PLIST_REPOSITORY
points to a directory, all packing-lists from packages generated by
.Xr pkg_create 1
during the
.Cm package
stage are saved in
.Pa ${PLIST_REPOSITORY}/${MACHINE_ARCH}
by a script:
.Pa ${PORTSDIR}/infrastructure/bin/register-plist .
This script strips some irrelevant information and normalizes the
packing-list somehow, and compares it to existing information, looking
for relevant changes.
Since a package name must always be changed when the packing-list changes,
any attempt to replace a packing-list of a given name with a different
packing-list will be flagged as an error.
.Pp
In
.Ev MULTI_PACKAGES
mode, there must be separate COMMENT, DESCR, and PLIST
templates for each SUBPACKAGE (and optional distinct MESSAGE, UNMESSAGE
files in a similar way).
This contrasts with the
.Ev FLAVORS
situation, where all these files will automatically default to the
non-flavor version if there is no flavor-specific file around.
.Sh OBSOLETE TARGETS
.Bl -tag -width Ds
.It Cm {build,run,lib}-depends
The dependency mechanism now meshes
.Ev BUILD_DEPENDS , LIB_DEPENDS , RUN_DEPENDS, WANTLIB
and
.Ev MULTI_PACKAGES .
Refer to
.Cm prepare , install-depends , test-depends .
.El
.Sh OBSOLETE VARIABLES
.Bl -tag -width Ds
.It Ev FETCH_BEFORE_ARGS , FETCH_AFTER_ARGS
Set
.Ev FETCH_CMD
to point to a script that does any required special treatment instead.
.It Ev FETCH_DEPENDS
Used to specify dependencies that were needed to fetch files.
It is much easier to mirror locally weird distribution files.
.It Ev NO_EXTRACT
Set EXTRACT_ONLY= instead.
.It Ev NO_WRKDIR
All ports should have a working directory, as this is necessary to store
cookies and keep state.
.It Ev NO_WRKSUBDIR
The same functionality is obtained by setting WRKDIST=${WRKDIR}.
.It Ev OPSYS_VER
Use
.Ev OSREV
instead.
.It Ev PKGNAME
Used to refer to the full package name, has been superseded by
.Ev FULLPKGNAME-foo ,
for
.Ev SUBPACKAGE
-foo.
.Ev PKGNAME
now holds the package name, not taking multi-packages or flavors
into account.
Most ports are not concerned by this change.
.It Ev PLIST_SUBST
From
.Nx
and
.Fx .
Use SUBST_VARS instead.
.Ox
does not allow general substitutions of the form VAR=value, but uses
only a list of variables instead.
Most package files gets transformed, instead of only the packing-list.
.It Ev SCRIPTDIR
Old location for scripts related to the current port.
There is no reason for the semantic distinction, use
.Ev FILESDIR
for those.
.It Ev USE_BZIP2
The framework will automatically detect the presence of
.Pa .tar.bz2
files to extract.
See also
.Ev BZIP2 , EXTRACT_CASES ,
and
.Ev EXTRACT_SUFX .
.It Ev USE_ZIP
The framework will automatically detect the presence of
.Pa .zip
files to extract.
See also
.Ev ZIP , EXTRACT_CASES ,
and
.Ev EXTRACT_SUFX .
.El
.Sh FILES
.Bl -tag -width Ds
.It Pa ../Makefile.inc
Common Makefile fragment for a set of ports, included automatically.
.It Pa /cdrom/distfiles
Default path to a CD-ROM (or other media) full of distribution files.
.It Pa ${PORTSDIR}/distfiles
Default setup of ${DISTDIR}.
.It Pa ${DISTDIR}
Cache of all distribution files.
.It Pa distinfo
Checksum file.
Holds the output of
.Xr cksum 1 ,
using
.Xr sha256 1
for the port's ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*},
as well as the sizes of these files.
.It Pa ${DISTDIR}/${CHECKSUMFILES}
Cache of normal distribution files for a given port.
.It Pa ${DISTDIR}/${MAKESUMFILES}
Cache of all distribution files for a given port.
.It Pa ${PORTSDIR}/infrastructure/mk/*.mk
Actual location of the
.Xr make 1
glue for the ports tree.
.Xr make 1
looks for
.Pa bsd.port.mk
.Po
and
.Pa bsd.port.subdir.mk
.Pc
under
.Pa /usr/share/mk/bsd.port.mk ,
but that file is just a stub that redirects to the real location.
.It Pa ${PKGDIR}/DESCR
Description for the port.
Variables such as ${HOMEPAGE} and ${MAINTAINER} will be expanded
(see SUBST_VARS).
Multi-package ports will use DESCR${SUBPACKAGE}.
.It Pa ${PKGDIR}/README
.Ox
specific documentation for a port, that will be installed as
.Pa ${LOCALBASE}/share/doc/pkg-readmes/${PKGSTEM}
at the end of
.Cm fake .
Variables from
.Ev SUBST_VARS
will be expanded.
Multi-package ports will use
.Pa README${SUBPACKAGE} .
.It Pa ${PKGDIR}/<foo>.login
login.conf.d file for class <foo>.
Will be installed as
.Ar ${PREFIX}/share/examples/login.conf.d/foo
at the end of
.Cm fake .
When a port provides a daemon started by
.Xr rc.d 8
requiring non-default
.Xr login.conf 5
attributes, a sample file should be provided
and used as a template by adding
.Cm @sample /etc/login.conf.d/${ Ns Va class Ns }
to the packing list.
.It Pa ${PKGDIR}/<foo>.rc
Startup script for <foo>.
Will be installed as
.Ar ${RCDIR}/<foo>
at the end of
.Cm fake .
Variables from
.Ev SUBST_VARS
will be expanded.
.It Pa ${PORTSDIR}/plist
Default setup of ${PLIST_REPOSITORY}.
.It Pa ${PORTSDIR}/packages
Default setup of ${PACKAGE_REPOSITORY}.
.It Pa ${PACKAGE_REPOSITORY}/no-arch
Location of arch-independent packages.
.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all
Location of all built packages.
.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache
Location of packages retrieved through the network.
.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums
Location of checksums, see
.Ev CHECKSUM_PACKAGES .
.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom
Location of packages suitable for the CD.
.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp
Location of packages suitable for FTP.
.It Pa ${PORTSDIR}/bulk/${MACHINE_ARCH}
Default setup of ${BULK_COOKIES_DIR}.
.It Pa ${PORTSDIR}/update/${MACHINE_ARCH}
Default setup of ${UPDATE_COOKIES_DIR}.
.It Pa ${PORTSDIR}/mystuff
Extra directory used to store local ports before committing them.
All depend targets will normally look there after the normal lookup fails.
See
.Ev PORTSDIR_PATH .
.El
.Sh DIAGNOSTICS
Note that some of these messages are actually emitted by some other external
commands, but grouped here for convenience: easier to look for in
.Xr dpb 1 Ns 's
logs.
.Pp
See
.Ev ERRORS
for more details about internal diagnostics.
.Bl -diag
.It "/bin/sh: cd .../pkg - No such file or directory"
Emitted during
.Cm generate-readmes .
.Pa ${PKGDIR}
must point to an existing directory, so that
.Nm
can be certain there are no
.Pa MESSAGEs
or
other files pertinent to the package.
.It "===> Building from scratch in ..."
Emitted when a build creates the
.Pa ${WRKDIR}
for a port.
Used by
.Xr dpb 1
to separate clean builds from builds restarted after a crash
for statistics collection.
.It "Discovered old directory in ..."
This message comes from
.Xr update-plist 1 .
A directory was found in the packing-list file mentioned in the diagnostic.
That directory line used to be needed but is no longer,
because it's now accounted for through dependencies.
Indicates the old directory has been removed.
.It "Error: change in plist between ..."
Error message comes from
.Xr register-plist 1 .
.It "Error: duplicate item in packing-list"
Error message comes from
.Xr pkg_create 1 ,
and will result from incorrect packing-lists, such as including several
fragments with the same file, or having incorrect
.Ev PKG_ARGS-sub .
.It "Error: Libraries in packing-lists...and libraries from installed packages don't match"
The ports tree and the installed packages are out-of-sync.
Mixing library information from both sources might produce packages that can't
be installed elsewhere.
Cleanest fix is to update the out-of-date source (e.g., update the ports tree,
or build and install new packages).
Developers may use
.Ev PKG_CREATE_NO_CHECKS
instead, assuming they understand the implications.
See
.Cm print-package-args Pq Cm wantlib-args
for details.
.It "Fatal: can't flavor a SUBDIR"
A dependency mentions top_subdir,flavor.
Flavor would then be ignored, as it is only applied to individual ports.
.It "Fatal: can't subpackage a SUBDIR"
A dependency mentions top_subdir,-sub.
Subpackage would then be ignored, as it is only applied to individual ports.
.It "Fatal: flavor should never start with a digit"
This would utterly confuse
.Xr pkg_add 1 .
See
.Xr packages-specs 7 .
.It "Fatal: inclusion of <file> from <file>"
.Pa bsd.port.mk
or
.Pa bsd.port.subdir.mk
has been included from a
.Ev MODULE
or from
.Pa Makefile.inc ,
resulting in a double inclusion.
This would lead to weird results, such as
.Ev PKG_ARGS
being defined twice.
.It "Fatal: SITES* is not defined but referenced by <file> in <DISTFILES*/PATCHFILES*/SUPDISTFILES*>"
Pretty much self-explanatory.
.It "Fatal: SUBPACKAGES should always begin with -: <offending list>"
That is the only way to differentiate between
.Ev FLAVOR
and
.Ev SUBPACKAGE
in
.Xr pkgpath 7
specifications.
.It "Fatal: building ports requires correctly installed X11"
All file sets of the base OS, including xenocara, must be installed
before building ports.
.It "Fatal: /usr/local/lib/X11/app-defaults should exist and be a symlink"
/usr/local/lib/X11/app-defaults is distributed as a symlink in the
xshare*.tgz file set.
If xenocara was not fully installed before packages were added, it may
have been created as a directory instead.
.It "Fatal: the licensing info for <pkgname> is incomplete..."
Every port must have explicit defines of all
.Ev PERMIT_*
values.
.It "Fatal: Use 'env FLAVOR=flavor make' instead"
Arguments specified after
.Xr make 1
are hardcoded for all recursive sub-makes, and very difficult to override.
Thus,
.Ev FLAVOR
must be specified in the environment instead.
.It "Fatal: Use 'env SUBPACKAGE=-sub make' instead"
Arguments specified after
.Xr make 1
are hardcoded for all recursive sub-makes, and very difficult to override.
Thus,
.Ev SUBPACKAGE
must be specified in the environment instead.
.It "ldconfig: <dir>: No such file or directory"
Usually produced by
.Xr pkg_add 1
running
.Xr ldconfig 8 .
Some tools such as GNU libtool will add directories living under
.Pa ${WRKINST}
to the shared library path during the
.Cm fake
stage.
Of course,
.Xr ldconfig 8
will later complain after the directory no longer exists.
The bogus tool should be fixed to conform to
.Ox
usage.
.It LIB_DEPENDS <spec> not needed for <FULLPKGPATH>
There doesn't seem to be any WANTLIB to match the given LIB_DEPENDS.
Thus, the LIB_DEPENDS won't turn into a @depends line in the created package.
This is often because of confusion between LIB_DEPENDS and RUN_DEPENDS:
RUN_DEPENDS is needed for dlopen'd libraries.
.Pp
Might be intentional sometimes, if some compile flavors create static binaries,
for instance.
Also, will happen for multi-packages, where one sets LIB_DEPENDS to have
a given build dependency (and corresponding WANTLIB for a given SUBPACKAGE).
.Pp
See
.Cm print-package-args Pq Cm lib-depends-args
for details.
.It "Warning: FULLPKGNAME-sub defined but not FULLPKGPATH-sub"
.Ev FULLPKGNAME-sub
has been explicitly defined by the port, instead of relying on the default,
but no value of
.Ev FULLPKGPATH-sub
has been given.
This is often an error.
.It "Warning: no debug-info in ..."
Port uses
.Ev DEBUG_PACKAGES
so the
.Xr build-debug-info 1
script expects debug information on all binaries and libraries.
Most probably, the build machinery for that specific port omitted -g
somewhere, or it runs strips during fake anyway.
It can also occur if
.Ev DEBUG_PACKAGES
includes subpackages with no files holding debug info.
.It "Warning: old style distfiles <files>... found"
See
.Cm fetch
for the newer way.
.It "Warning: symlink(s) point to non existent file."
Warning message comes from
.Xr pkg_create 1 .
The symlink resides in the fake area, under
.Pa ${WRKINST} .
This is only a warning because the symlink may point to a run-time dependency,
which obviously won't exist under
.Pa ${WRKINST}
at the time
.Ql make package
is run.
.It "Warning: @option no-default-conflict with no @conflict"
Warning message comes from
.Xr pkg_create 1 .
Most packages that waive "default-conflict" will have explicit conflict markers
instead.
Otherwise, the package will only conflict with the exact same version, with
some possible
.Ev REVISION
bumps.
Any other version or
.Ev FLAVOR
won't conflict.
This is generally an error, apart from very few ports like
.Pa devel/autoconf/* .
.It "groff produced empty result for <manpage>..."
Warning message comes from
.Xr pkg_create 1 .
Manpages are automatically formatted with
.Xr groff 1
if
.Ev USE_GROFF
is set.
The above message denotes an actual problem while formatting the page,
which should be addressed.
In the meantime,
.Xr pkg_create 1
still produces a package, but leaves the manpage unformatted, in the hope
that something will be able to make sense of it.
.El
.Sh SEE ALSO
.Xr clean-old-distfiles 1 ,
.Xr ftp 1 ,
.Xr pkg_add 1 ,
.Xr pkg_create 1 ,
.Xr OpenBSD::Intro 3p ,
.Xr bsd.port.arch.mk 5 ,
.Xr mk.conf 5 ,
.Xr port-modules 5 ,
.Xr library-specs 7 ,
.Xr mirroring-ports 7 ,
.Xr packages-specs 7 ,
.Xr pkgpath 7 ,
.Xr ports 7
.Sh HISTORY
The ports mechanism originally came from
.Fx .
A lot of additions were taken from
.Nx
over the seminal years.
.Pp
Since 1998, the framework has been systematically cleaned-up and reorganized
to remove bugs.
New features have been carefully introduced, trying hard to avoid
inconsistencies.
.Pp
.Ev FLAVORS ,
.Ev MULTI_PACKAGES ,
.Ev SEPARATE_BUILD
and FAKE are
.Ox
improvements.
Most recent additions do not come from another
.Bx .
.\" Voluntarily undocumented:
.\" AUTOCONF_ENV: probably not needed anyway, should be internal.
.Sh BUGS
.Ev LOCALBASE ,
.Ev X11BASE ,
.Ev BASESYSCONFDIR ,
.Ev VARBASE
and
.Ev PREFIX
are not heeded consistently.
Using anything but the default values has not been heavily tested.
Some ports may not build if you change them.
|