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
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
|
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE book PUBLIC "-//FreeBSD//DTD DocBook XML V4.5-Based Extension//EN"
"../../../share/xml/freebsd45.dtd">
<!--
The FreeBSD Documentation Project
$FreeBSD$
-->
<book lang='en'>
<bookinfo>
<title>FreeBSD Porter's Handbook</title>
<authorgroup>
<corpauthor>The FreeBSD Documentation Project</corpauthor>
</authorgroup>
<pubdate>April 2000</pubdate>
<copyright>
<year>2000</year>
<year>2001</year>
<year>2002</year>
<year>2003</year>
<year>2004</year>
<year>2005</year>
<year>2006</year>
<year>2007</year>
<year>2008</year>
<year>2009</year>
<year>2010</year>
<year>2011</year>
<year>2012</year>
<holder role="mailto:doc@FreeBSD.org">The FreeBSD Documentation
Project</holder>
</copyright>
&trademarks;
&legalnotice;
<releaseinfo>$FreeBSD$</releaseinfo>
</bookinfo>
<chapter id="why-port">
<title>Introduction</title>
<para>The FreeBSD ports collection is the way almost everyone
installs applications ("ports") on FreeBSD. Like everything
else about FreeBSD, it is primarily a volunteer effort.
It is important to keep this in mind when reading this
document.</para>
<para>In FreeBSD, anyone may submit a new port, or volunteer
to maintain an existing port if it is unmaintained—you
do not need any special commit privileges to do so.</para>
</chapter>
<chapter id="own-port">
<title>Making a New Port Yourself</title>
<para>So, you are interested in making your own port or
upgrading an existing one? Great!</para>
<para>What follows are some guidelines for creating a new port for
FreeBSD. If you want to upgrade an existing port, you should
read this and then read <xref linkend="port-upgrading"/>.</para>
<para>When this document is not sufficiently detailed, you should
refer to <filename>/usr/ports/Mk/bsd.port.mk</filename>, which
all port Makefiles include. Even if you do not hack Makefiles
daily, it is well commented, and you will still gain much
knowledge from it. Additionally, you may send specific
questions to the &a.ports;.</para>
<note>
<para>Only a fraction of the variables
(<makevar><replaceable>VAR</replaceable></makevar>) that can
be overridden are mentioned in this document. Most (if not
all) are documented at the start of
<filename>/usr/ports/Mk/bsd.port.mk</filename>; the others
probably ought to be. Note that this file uses a non-standard
tab setting: <application>Emacs</application> and
<application>Vim</application> should recognize the setting on
loading the file. Both &man.vi.1; and &man.ex.1; can be set
to use the correct value by typing <command>:set
tabstop=4</command> once the file has been loaded.</para>
</note>
<para>
Looking for something easy to start with? Take a look at the
<ulink url="http://wiki.freebsd.org/WantedPorts">list of
requested ports</ulink> and see if you can work on one (or
more).</para>
</chapter>
<chapter id="quick-porting">
<title>Quick Porting</title>
<para>This section tells you how to quickly create a new port. In
many cases, it is not sufficient, so you will have to read
further on into the document.</para>
<para>First, get the original tarball and put it into
<makevar>DISTDIR</makevar>, which defaults to
<filename>/usr/ports/distfiles</filename>.</para>
<note>
<para>The following assumes that the software compiled
out-of-the-box, i.e., there was absolutely no change required
for the port to work on your FreeBSD box. If you needed to
change something, you will have to refer to the next section
too.</para>
</note>
<sect1 id="porting-makefile">
<title>Writing the <filename>Makefile</filename></title>
<para>The minimal <filename>Makefile</filename> would look
something like this:</para>
<programlisting># $FreeBSD$
PORTNAME= oneko
PORTVERSION= 1.1b
CATEGORIES= games
MASTER_SITES= ftp://ftp.cs.columbia.edu/archives/X11R5/contrib/
MAINTAINER= asami@FreeBSD.org
COMMENT= Cat chasing a mouse all over the screen
MAN1= oneko.1
MANCOMPRESSED= yes
USE_IMAKE= yes
.include <bsd.port.mk></programlisting>
<note>
<para>In some cases, the <filename>Makefile</filename> of an
existing port may contain additional lines in the header,
such as the name of the port and the date it was created.
This additional information has been declared obsolete, and
is being phased out.</para>
</note>
<para>See if you can figure it out. Do not worry about the
contents of the <literal>$FreeBSD$</literal>
line, it will be filled in automatically by SVN when the port
is imported to our main ports tree. You can find a more
detailed example in the <link
linkend="porting-samplem">sample Makefile</link>
section.</para>
</sect1>
<sect1 id="porting-desc">
<title>Writing the Description Files</title>
<para>There are two description files that are required for
any port, whether they actually package or not. They are
<filename>pkg-descr</filename> and
<filename>pkg-plist</filename>. Their
<filename>pkg-</filename> prefix distinguishes them from
other files.</para>
<sect2>
<title><filename>pkg-descr</filename></title>
<para>This is a longer description of the port. One to a few
paragraphs concisely explaining what the port does is
sufficient.</para>
<note>
<para>This is <emphasis>not</emphasis> a manual or an
in-depth description on how to use or compile the port!
<emphasis>Please be careful if you are copying from the
<filename>README</filename> or manpage</emphasis>; too
often they are not a concise description of the port or
are in an awkward format (e.g., manpages have justified
spacing). If the ported software has an official WWW
homepage, you should list it here. Prefix
<emphasis>one</emphasis> of the websites with
<literal>WWW:</literal> so that automated tools will work
correctly.</para>
</note>
<para>The following example shows how your
<filename>pkg-descr</filename> should look:</para>
<programlisting>This is a port of oneko, in which a cat chases a poor mouse all over
the screen.
:
(etc.)
WWW: http://www.oneko.org/</programlisting>
</sect2>
<sect2>
<title><filename>pkg-plist</filename></title>
<para>This file lists all the files installed by the port. It
is also called the <quote>packing list</quote> because the
package is generated by packing the files listed here. The
pathnames are relative to the installation prefix (usually
<filename>/usr/local</filename>. If you are using the
<makevar>MAN<replaceable>n</replaceable></makevar> variables
(as you should be), do not list any manpages here. If the
port creates directories during installation, make sure to
add <literal>@dirrm</literal> lines to remove them when the
package is deleted.</para>
<para>Here is a small example:</para>
<programlisting>bin/oneko
lib/X11/app-defaults/Oneko
lib/X11/oneko/cat1.xpm
lib/X11/oneko/cat2.xpm
lib/X11/oneko/mouse.xpm
@dirrm lib/X11/oneko</programlisting>
<para>Refer to the &man.pkg.create.1; manual page for details
on the packing list.</para>
<note>
<para>It is recommended that you keep all the filenames in
this file sorted alphabetically. It will make verifying
the changes when you upgrade the port much easier.</para>
</note>
<note>
<para>Creating a packing list manually can be a very tedious
task. If the port installs a large numbers of files,
<link linkend="plist-autoplist">creating the packing list
automatically</link> might save time.</para>
</note>
<para>There is only one case when
<filename>pkg-plist</filename> can be omitted from a port.
If the port installs just a handful of files, and perhaps
directories, the files and directories may be listed in the
variables <makevar>PLIST_FILES</makevar> and
<makevar>PLIST_DIRS</makevar>, respectively, within the
port's <filename>Makefile</filename>. For instance, we
could get along without <filename>pkg-plist</filename> in
the above <filename>oneko</filename> port by adding the
following lines to the <filename>Makefile</filename>:</para>
<programlisting>PLIST_FILES= bin/oneko \
lib/X11/app-defaults/Oneko \
lib/X11/oneko/cat1.xpm \
lib/X11/oneko/cat2.xpm \
lib/X11/oneko/mouse.xpm
PLIST_DIRS= lib/X11/oneko</programlisting>
<para>Of course, <makevar>PLIST_DIRS</makevar> should be left
unset if a port installs no directories of its own.</para>
<para>The price for this way of listing port's files and
directories is that you cannot use command sequences
described in &man.pkg.create.1;. Therefore, it is suitable
only for simple ports and makes them even simpler. At the
same time, it has the advantage of reducing the number of
files in the ports collection. Please consider using this
technique before you resort to
<filename>pkg-plist</filename>.</para>
<para>Later we will see how <filename>pkg-plist</filename>
and <makevar>PLIST_FILES</makevar> can be used to fulfill
<link linkend="plist">more sophisticated
tasks</link>.</para>
</sect2>
</sect1>
<sect1 id="porting-checksum">
<title>Creating the Checksum File</title>
<para>Just type <command>make makesum</command>. The ports make
rules will automatically generate the file
<filename>distinfo</filename>.</para>
<para>If a file fetched has its checksum changed regularly and
you are certain the source is trusted (i.e., it comes from
manufacturer CDs or documentation generated daily), you should
specify these files in the <makevar>IGNOREFILES</makevar>
variable. Then the checksum is not calculated for that file
when you run <command>make makesum</command>, but set to
<literal>IGNORE</literal>.</para>
</sect1>
<sect1 id="porting-testing">
<title>Testing the Port</title>
<para>You should make sure that the port rules do exactly what
you want them to do, including packaging up the port. These
are the important points you need to verify.</para>
<itemizedlist>
<listitem>
<para><filename>pkg-plist</filename> does not contain
anything not installed by your port</para>
</listitem>
<listitem>
<para><filename>pkg-plist</filename> contains everything
that is installed by your port</para>
</listitem>
<listitem>
<para>Your port can be installed multiple times using the
<maketarget>reinstall</maketarget> target</para>
</listitem>
<listitem>
<para>Your port <link linkend="plist-cleaning">cleans
up</link> after itself upon deinstall</para>
</listitem>
</itemizedlist>
<procedure>
<title>Recommended Test Ordering</title>
<step>
<para><command>make install</command></para>
</step>
<step>
<para><command>make package</command></para>
</step>
<step>
<para><command>make deinstall</command></para>
</step>
<step>
<para><command>pkg_add
<replaceable>package-name</replaceable></command></para>
</step>
<step>
<para><command>make deinstall</command></para>
</step>
<step>
<para><command>make reinstall</command></para>
</step>
<step>
<para><command>make package</command></para>
</step>
<step>
<para><command>make readme</command></para>
</step>
</procedure>
<para>Make sure that there are not any warnings issued in any of
the <maketarget>package</maketarget> and
<maketarget>deinstall</maketarget> stages. After step 3,
check to see if all the new directories are correctly deleted.
Also, try using the software after step 4, to ensure that it
works correctly when installed from a package.</para>
<para>The most thorough way to automate these steps is via
installing the <application>ports tinderbox</application>.
This maintains <literal>jails</literal> in which you can
test all of the above steps without changing the state of
your running system. Please see
<filename>ports/ports-mgmt/tinderbox</filename> for more
information.</para>
</sect1>
<sect1 id="porting-portlint">
<title>Checking Your Port with
<command>portlint</command></title>
<para>Please use <command>portlint</command> to see if your port
conforms to our guidelines. The <filename
role="package">ports-mgmt/portlint</filename> program is
part of the ports collection. In particular, you may want to
check if the <link linkend="porting-samplem">Makefile</link>
is in the right shape and the <link
linkend="porting-pkgname">package</link> is named
appropriately.</para>
</sect1>
<sect1 id="porting-submitting">
<title>Submitting the New Port</title>
<para>Before you submit the new port, make sure you have read
the <link
linkend="porting-dads">DOs and DON'Ts</link> section.</para>
<para>Now that you are happy with your port, the only thing
remaining is to put it in the main &os; ports tree and make
everybody else happy about it too. We do not need your
<filename>work</filename> directory or the
<filename>pkgname.tgz</filename> package, so delete them now.
Next, assuming your port is called oneko,
<command>cd</command> to the directory above where the
<literal>oneko</literal> directory is located, and then type
the following: <command>shar `find oneko` >
oneko.shar</command></para>
<para>Include your <literal>oneko.shar</literal> file in a bug
report and send it with the &man.send-pr.1; program (see
<ulink
url="&url.articles.contributing;/contrib-how.html#CONTRIB-GENERAL">Bug
Reports and General Commentary</ulink> for more information
about &man.send-pr.1;). Be sure to classify the bug report
as category <literal>ports</literal> and class
<literal>change-request</literal> (Do not mark the report
<literal>confidential</literal>!). Also add a short
description of the program you ported to the
<quote>Description</quote> field of the PR (e.g., perhaps a
short version of the <makevar>COMMENT</makevar>), and add
the shar file to the <quote>Fix</quote> field.</para>
<note>
<para>You can make our work a lot easier, if you use a good
description in the synopsis of the problem report. We
prefer something like <quote>New port:
<category>/<portname> <short description of
the port></quote> for new ports. If you stick to this
scheme, the chance that someone will take a look at your PR
soon is much better.</para>
</note>
<para>One more time, <emphasis>do not include the original
source distfile, the <filename>work</filename> directory, or
the package you built with <command>make
package</command></emphasis>; and, do use &man.shar.1; for
new ports, not &man.diff.1;.</para>
<para>After you have submitted your port, please be patient.
Sometimes it can take a few months before a port is included
in &os;, although it might only take a few days. You can
view the list of <ulink
url="http://www.FreeBSD.org/cgi/query-pr-summary.cgi?category=ports">ports
PRs waiting to be committed to &os;</ulink>.</para>
<para>Once we have looked at your port, we will get back to you
if necessary, and put it in the tree. Your name will also
be added to the list of <ulink
url="&url.articles.contributors;/contrib-additional.html">Additional
FreeBSD Contributors</ulink> and other files.</para>
</sect1>
</chapter>
<chapter id="slow">
<title>Slow Porting</title>
<para>Ok, so it was not that simple, and the port required some
modifications to get it to work. In this section, we will
explain, step by step, how to modify it to get it to work with
the ports paradigm.</para>
<sect1 id="slow-work">
<title>How Things Work</title>
<para>First, this is the sequence of events which occurs when
the user first types <command>make</command> in your port's
directory. You may find that having
<filename>bsd.port.mk</filename> in another window while you
read this really helps to understand it.</para>
<para>But do not worry if you do not really understand what
<filename>bsd.port.mk</filename> is doing, not many people
do... <!-- smiley --><emphasis>:-)</emphasis></para>
<procedure>
<step>
<para>The <maketarget>fetch</maketarget> target is run. The
<maketarget>fetch</maketarget> target is responsible for
making sure that the tarball exists locally in
<makevar>DISTDIR</makevar>. If
<maketarget>fetch</maketarget> cannot find the required
files in <makevar>DISTDIR</makevar> it will look up the
URL <makevar>MASTER_SITES</makevar>, which is set in the
Makefile, as well as our main FTP site at <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/"></ulink>,
where we put sanctioned distfiles as backup. It will then
attempt to fetch the named distribution file with
<makevar>FETCH</makevar>, assuming that the requesting
site has direct access to the Internet. If that succeeds,
it will save the file in <makevar>DISTDIR</makevar> for
future use and proceed.</para>
</step>
<step>
<para>The <maketarget>extract</maketarget> target is run.
It looks for your port's distribution file (typically a
<command>gzip</command>ped tarball) in
<makevar>DISTDIR</makevar> and unpacks it into a temporary
subdirectory specified by <makevar>WRKDIR</makevar>
(defaults to <filename>work</filename>).</para>
</step>
<step>
<para>The <maketarget>patch</maketarget> target is run.
First, any patches defined in
<makevar>PATCHFILES</makevar> are applied. Second, if any
patch files named
<filename>patch-<replaceable>*</replaceable></filename>
are found in <makevar>PATCHDIR</makevar> (defaults to the
<filename>files</filename> subdirectory), they are applied
at this time in alphabetical order.</para>
</step>
<step>
<para>The <maketarget>configure</maketarget> target is run.
This can do any one of many different things.</para>
<orderedlist>
<listitem>
<para>If it exists,
<filename>scripts/configure</filename> is run.</para>
</listitem>
<listitem>
<para>If <makevar>HAS_CONFIGURE</makevar> or
<makevar>GNU_CONFIGURE</makevar> is set,
<filename><makevar>WRKSRC</makevar>/configure</filename>
is run.</para>
</listitem>
<listitem>
<para>If <makevar>USE_IMAKE</makevar> is set,
<makevar>XMKMF</makevar> (default: <command>xmkmf
-a</command>) is run.</para>
</listitem>
</orderedlist>
</step>
<step>
<para>The <maketarget>build</maketarget> target is run.
This is responsible for descending into the port's private
working directory (<makevar>WRKSRC</makevar>) and building
it. If <makevar>USE_GMAKE</makevar> is set, GNU
<command>make</command> will be used, otherwise the system
<command>make</command> will be used.</para>
</step>
</procedure>
<para>The above are the default actions. In addition, you can
define targets
<maketarget>pre-<replaceable>something</replaceable></maketarget>
or
<maketarget>post-<replaceable>something</replaceable></maketarget>,
or put scripts with those names, in the
<filename>scripts</filename> subdirectory, and they will be
run before or after the default actions are done.</para>
<para>For example, if you have a
<maketarget>post-extract</maketarget> target defined in your
<filename>Makefile</filename>, and a file
<filename>pre-build</filename> in the
<filename>scripts</filename> subdirectory, the
<maketarget>post-extract</maketarget> target will be called
after the regular extraction actions, and the
<filename>pre-build</filename> script will be executed before
the default build rules are done. It is recommended that you
use <filename>Makefile</filename> targets if the actions are
simple enough, because it will be easier for someone to figure
out what kind of non-default action the port requires.</para>
<para>The default actions are done by the
<filename>bsd.port.mk</filename> targets
<maketarget>do-<replaceable>something</replaceable></maketarget>.
For example, the commands to extract a port are in the target
<maketarget>do-extract</maketarget>. If you are not happy
with the default target, you can fix it by redefining the
<maketarget>do-<replaceable>something</replaceable></maketarget>
target in your <filename>Makefile</filename>.</para>
<note>
<para>The <quote>main</quote> targets (e.g.,
<maketarget>extract</maketarget>,
<maketarget>configure</maketarget>, etc.) do nothing more
than make sure all the stages up to that one are completed
and call the real targets or scripts, and they are not
intended to be changed. If you want to fix the extraction,
fix <maketarget>do-extract</maketarget>, but never ever
change the way <maketarget>extract</maketarget>
operates! Additionally, the target
<maketarget>post-deinstall</maketarget> is invalid and
is not run by the ports infrastructure.</para>
</note>
<para>Now that you understand what goes on when the user types
<command>make</command>, let us go through the recommended
steps to create the perfect port.</para>
</sect1>
<sect1 id="slow-sources">
<title>Getting the Original Sources</title>
<para>Get the original sources (normally) as a compressed
tarball
(<filename><replaceable>foo</replaceable>.tar.gz</filename> or
<filename><replaceable>foo</replaceable>.tar.bz2</filename>)
and copy it into <makevar>DISTDIR</makevar>. Always use
<emphasis>mainstream</emphasis> sources when and where you
can.</para>
<para>You will need to set the variable
<makevar>MASTER_SITES</makevar> to reflect where the original
tarball resides. You will find convenient shorthand
definitions for most mainstream sites in
<filename>bsd.sites.mk</filename>. Please use these
sites—and the associated definitions—if at all
possible, to help avoid the problem of having the same
information repeated over again many times in the source base.
As these sites tend to change over time, this becomes a
maintenance nightmare for everyone involved.</para>
<para>If you cannot find a FTP/HTTP site that is well-connected
to the net, or can only find sites that have irritatingly
non-standard formats, you might want to put a copy on a
reliable FTP or HTTP server that you control (e.g., your home
page).</para>
<para>If you cannot find somewhere convenient and reliable to
put the distfile we can <quote>house</quote> it ourselves on
<hostid>ftp.FreeBSD.org</hostid>; however, this is the
least-preferred solution. The distfile must be placed into
<filename>~/public_distfiles/</filename> of someone's
<hostid>freefall</hostid> account. Ask the person who commits
your port to do this. This person will also set
<makevar>MASTER_SITES</makevar> to
<makevar>MASTER_SITE_LOCAL</makevar> and
<makevar>MASTER_SITE_SUBDIR</makevar> to their
<hostid>freefall</hostid> username.</para>
<para>If your port's distfile changes all the time without any
kind of version update by the author, consider putting the
distfile on your home page and listing it as the first
<makevar>MASTER_SITES</makevar>. If you can, try to talk the
port author out of doing this; it really does help to
establish some kind of source code control. Hosting your own
version will prevent users from getting <errorname>checksum
mismatch</errorname> errors, and also reduce the workload of
maintainers of our FTP site. Also, if there is only one
master site for the port, it is recommended that you house a
backup at your site and list it as the second
<makevar>MASTER_SITES</makevar>.</para>
<para>If your port requires some additional `patches' that are
available on the Internet, fetch them too and put them in
<makevar>DISTDIR</makevar>. Do not worry if they come from a
site other than where you got the main source tarball, we have
a way to handle these situations (see the description of <link
linkend="porting-patchfiles">PATCHFILES</link>
below).</para>
</sect1>
<sect1 id="slow-modifying">
<title>Modifying the Port</title>
<para>Unpack a copy of the tarball in a private directory and
make whatever changes are necessary to get the port to compile
properly under the current version of &os;. Keep
<emphasis>careful track</emphasis> of everything you do, as
you will be automating the process shortly. Everything,
including the deletion, addition, or modification of files
should be doable using an automated script or patch file when
your port is finished.</para>
<para>If your port requires significant user
interaction/customization to compile or install, you should
take a look at one of Larry Wall's classic
<application>Configure</application> scripts and perhaps do
something similar yourself. The goal of the new ports
collection is to make each port as
<quote>plug-and-play</quote> as possible for the end-user
while using a minimum of disk space.</para>
<note>
<para>Unless explicitly stated, patch files, scripts, and
other files you have created and contributed to the &os;
ports collection are assumed to be covered by the standard
BSD copyright conditions.</para>
</note>
</sect1>
<sect1 id="slow-patch">
<title>Patching</title>
<para>In the preparation of the port, files that have been added
or changed can be picked up with a &man.diff.1; for later
feeding to &man.patch.1;. Each patch you wish to apply should
be saved into a file named
<filename>patch-<replaceable>*</replaceable></filename> where
<replaceable>*</replaceable> indicates the pathname of the
file that is patched, such as
<filename>patch-Imakefile</filename> or
<filename>patch-src-config.h</filename>. These files should
be stored in <makevar>PATCHDIR</makevar> (usually
<filename>files/</filename>, from where they will be
automatically applied. All patches must be relative to
<makevar>WRKSRC</makevar> (generally the directory your port's
tarball unpacks itself into, that being where the build is
done). To make fixes and upgrades easier, you should avoid
having more than one patch fix the same file (e.g.,
<filename>patch-file</filename> and
<filename>patch-file2</filename> both changing
<filename><makevar>WRKSRC</makevar>/foobar.c</filename>).
Note that if the path of a patched file contains an underscore
(<literal>_</literal>) character, the patch needs to have two
underscores instead in its name. For example, to patch a file
named <filename>src/freeglut_joystick.c</filename>, the
corresponding patch should be named
<filename>patch-src-freeglut__joystick.c</filename>.</para>
<para>Please only use characters
<literal>[-+._a-zA-Z0-9]</literal> for naming your patches.
Do not use any other characters besides them. Do not name
your patches like <filename>patch-aa</filename> or
<filename>patch-ab</filename> etc, always mention the path and
file name in patch names.</para>
<para>Do not put RCS strings in patches. SVN will mangle them
when we put the files into the ports tree, and when we check
them out again, they will come out different and the patch
will fail. RCS strings are surrounded by dollar
(<literal>$</literal>) signs, and typically start with
<literal>$Id</literal> or
<literal>$RCS</literal>.</para>
<para>Using the recurse (<option>-r</option>) option to
&man.diff.1; to generate patches is fine, but please take a
look at the resulting patches to make sure you do not have any
unnecessary junk in there. In particular, diffs between two
backup files, <filename>Makefile</filename>s when the port
uses <command>Imake</command> or GNU
<command>configure</command>, etc., are unnecessary and should
be deleted. If you had to edit
<filename>configure.in</filename> and run
<command>autoconf</command> to regenerate
<command>configure</command>, do not take the diffs of
<command>configure</command> (it often grows to a few thousand
lines!); define <literal>USE_AUTOTOOLS=autoconf:261</literal>
and take the diffs of
<filename>configure.in</filename>.</para>
<para>Also, try to minimize the amount of non-functional
whitespace changes in your patches. It is common in the Open
Source world for projects to share large amounts of a code
base, but obey different style and indenting rules. If you
take a working piece of functionality from one project to fix
similar areas in another, please be careful: the resulting
line patch may be full of non-functional changes. It not only
increases the size of the SVN repository but makes it hard to
find out what exactly caused the problem and what you changed
at all.</para>
<para>If you had to delete a file, then you can do it in the
<maketarget>post-extract</maketarget> target rather than as
part of the patch.</para>
<para>Simple replacements can be performed directly from the
port <filename>Makefile</filename> using the in-place mode of
&man.sed.1;. This is very useful when you need to patch in a
variable value. Example:</para>
<programlisting>post-patch:
@${REINPLACE_CMD} -e 's|for Linux|for FreeBSD|g' ${WRKSRC}/README
@${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_LIBS}|' ${WRKSRC}/configure</programlisting>
<para>Quite often, there is a situation when the software being
ported, especially if it is primarily developed on &windows;,
uses the CR/LF convention for most of its source files. This
may cause problems with further patching, compiler warnings,
scripts execution (<command>/bin/sh^M</command> not found),
etc. To quickly convert all files from CR/LF to just LF, add
<literal>USE_DOS2UNIX=yes</literal> to the port
<filename>Makefile</filename>. A list of files to convert can
be specified:</para>
<programlisting>USE_DOS2UNIX= util.c util.h</programlisting>
<para>If you want to convert a group of files across
subdirectories, <makevar>DOS2UNIX_REGEX</makevar> can be used.
Its argument is a <command>find</command> compatible regular
expression. More on the format is in &man.re.format.7;. This
option is useful for converting all files of a given
extension, for example all source code files leaving binary
files intact:</para>
<programlisting>USE_DOS2UNIX= yes
DOS2UNIX_REGEX= .*\.(c|cpp|h)</programlisting>
<para>If you want to create a patch file based off of an
existing file, you can copy it with an
<filename>.orig</filename> extension, and then modify the
original one. The <maketarget>makepatch</maketarget> target
will write out an appropriate patch file to the <filename
class="directory">files</filename> directory of the
port.</para>
</sect1>
<sect1 id="slow-configure">
<title>Configuring</title>
<para>Include any additional customization commands in your
<filename>configure</filename> script and save it in the
<filename>scripts</filename> subdirectory. As mentioned
above, you can also do this with <filename>Makefile</filename>
targets and/or scripts with the name
<filename>pre-configure</filename> or
<filename>post-configure</filename>.</para>
</sect1>
<sect1 id="slow-user-input">
<title>Handling User Input</title>
<para>If your port requires user input to build, configure, or
install, you must set <makevar>IS_INTERACTIVE</makevar> in
your <filename>Makefile</filename>. This will allow
<quote>overnight builds</quote> to skip your port if the user
sets the variable <envar>BATCH</envar> in his environment (and
if the user sets the variable <envar>INTERACTIVE</envar>, then
<emphasis>only</emphasis> those ports requiring interaction
are built). This will save a lot of wasted time on the set of
machines that continually build ports (see below).</para>
<para>It is also recommended that if there are reasonable
default answers to the questions, you check the
<makevar>PACKAGE_BUILDING</makevar> variable and turn off the
interactive script when it is set. This will allow us to
build the packages for CDROMs and FTP.</para>
</sect1>
</chapter>
<chapter id="makefile">
<title>Configuring the Makefile</title>
<para>Configuring the <filename>Makefile</filename> is pretty
simple, and again we suggest that you look at existing examples
before starting. Also, there is a <link
linkend="porting-samplem">sample Makefile</link> in this
handbook, so take a look and please follow the ordering of
variables and sections in that template to make your port easier
for others to read.</para>
<para>Now, consider the following problems in sequence as you
design your new <filename>Makefile</filename>:</para>
<sect1 id="makefile-source">
<title>The Original Source</title>
<para>Does it live in <makevar>DISTDIR</makevar> as a standard
<command>gzip</command>ped tarball named something like
<filename>foozolix-1.2.tar.gz</filename>? If so, you can go on
to the next step. If not, you should look at overriding any
of the <makevar>DISTVERSION</makevar>,
<makevar>DISTNAME</makevar>, <makevar>EXTRACT_CMD</makevar>,
<makevar>EXTRACT_BEFORE_ARGS</makevar>,
<makevar>EXTRACT_AFTER_ARGS</makevar>,
<makevar>EXTRACT_SUFX</makevar>, or
<makevar>DISTFILES</makevar> variables, depending on how alien
a format your port's distribution file is.</para>
<para>In the worst case, you can simply create your own
<maketarget>do-extract</maketarget> target to override the
default, though this should be rarely, if ever,
necessary.</para>
</sect1>
<sect1 id="makefile-naming">
<title>Naming</title>
<para>The first part of the port's <filename>Makefile</filename>
names the port, describes its version number, and lists it
in the correct category.</para>
<sect2>
<title><makevar>PORTNAME</makevar> and
<makevar>PORTVERSION</makevar></title>
<para>You should set <makevar>PORTNAME</makevar> to the
base name of your port, and <makevar>PORTVERSION</makevar>
to the version number of the port.</para>
</sect2>
<sect2 id="makefile-naming-revepoch">
<title><makevar>PORTREVISION</makevar> and
<makevar>PORTEPOCH</makevar></title>
<sect3>
<title><makevar>PORTREVISION</makevar></title>
<para>The <makevar>PORTREVISION</makevar> variable is a
monotonically increasing value which is reset to 0 with
every increase of <makevar>PORTVERSION</makevar> (i.e.,
every time a new official vendor release is made), and
appended to the package name if non-zero. Changes to
<makevar>PORTREVISION</makevar> are used by automated
tools (e.g., &man.pkg.version.1;) to highlight the fact
that a new package is available.</para>
<para><makevar>PORTREVISION</makevar> should be increased
each time a change is made to the port which significantly
affects the content or structure of the derived
package.</para>
<para>Examples of when <makevar>PORTREVISION</makevar>
should be bumped:</para>
<itemizedlist>
<listitem>
<para>Addition of patches to correct security
vulnerabilities, bugs, or to add new functionality to
the port.</para>
</listitem>
<listitem>
<para>Changes to the port <filename>Makefile</filename>
to enable or disable compile-time options in the
package.</para>
</listitem>
<listitem>
<para>Changes in the packing list or the install-time
behavior of the package (e.g., change to a script
which generates initial data for the package, like ssh
host keys).</para>
</listitem>
<listitem>
<para>Version bump of a port's shared library dependency
(in this case, someone trying to install the old
package after installing a newer version of the
dependency will fail since it will look for the old
libfoo.x instead of libfoo.(x+1)).</para>
</listitem>
<listitem>
<para>Silent changes to the port distfile which have
significant functional differences, i.e., changes to
the distfile requiring a correction to
<filename>distinfo</filename> with no corresponding
change to <makevar>PORTVERSION</makevar>, where a
<command>diff -ru</command> of the old and new
versions shows non-trivial changes to the code.</para>
</listitem>
</itemizedlist>
<para>Examples of changes which do not require a
<makevar>PORTREVISION</makevar> bump:</para>
<itemizedlist>
<listitem>
<para>Style changes to the port skeleton with no
functional change to what appears in the resulting
package.</para>
</listitem>
<listitem>
<para>Changes to <makevar>MASTER_SITES</makevar> or
other functional changes to the port which do not
affect the resulting package.</para>
</listitem>
<listitem>
<para>Trivial patches to the distfile such as correction
of typos, which are not important enough that users of
the package should go to the trouble of
upgrading.</para>
</listitem>
<listitem>
<para>Build fixes which cause a package to become
compilable where it was previously failing (as long as
the changes do not introduce any functional change on
any other platforms on which the port did previously
build). Since <makevar>PORTREVISION</makevar>
reflects the content of the package, if the package
was not previously buildable then there is no need to
increase <makevar>PORTREVISION</makevar> to mark a
change.</para>
</listitem>
</itemizedlist>
<para>A rule of thumb is to ask yourself whether a change
committed to a port is something which everyone would
benefit from having (either because of an enhancement,
fix, or by virtue that the new package will actually work
at all), and weigh that against that fact that it will
cause everyone who regularly updates their ports tree to
be compelled to update. If yes, the
<makevar>PORTREVISION</makevar> should be bumped.</para>
</sect3>
<sect3>
<title><makevar>PORTEPOCH</makevar></title>
<para>From time to time a software vendor or FreeBSD porter
will do something silly and release a version of their
software which is actually numerically less than the
previous version. An example of this is a port which goes
from foo-20000801 to foo-1.0 (the former will be
incorrectly treated as a newer version since 20000801 is a
numerically greater value than 1).</para>
<para>In situations such as this, the
<makevar>PORTEPOCH</makevar> version should be increased.
If <makevar>PORTEPOCH</makevar> is nonzero it is appended
to the package name as described in section 0 above.
<makevar>PORTEPOCH</makevar> must never be decreased or
reset to zero, because that would cause comparison to a
package from an earlier epoch to fail (i.e., the package
would not be detected as out of date): the new version
number (e.g., <literal>1.0,1</literal> in the above
example) is still numerically less than the previous
version (20000801), but the <literal>,1</literal> suffix
is treated specially by automated tools and found to be
greater than the implied suffix <literal>,0</literal> on
the earlier package.</para>
<para>Dropping or resetting <makevar>PORTEPOCH</makevar>
incorrectly leads to no end of grief; if you do not
understand the above discussion, please keep after it
until you do, or ask questions on the mailing
lists.</para>
<para>It is expected that <makevar>PORTEPOCH</makevar> will
not be used for the majority of ports, and that sensible
use of <makevar>PORTVERSION</makevar> can often preempt it
becoming necessary if a future release of the software
should change the version structure. However, care is
needed by FreeBSD porters when a vendor release is made
without an official version number — such as a code
<quote>snapshot</quote> release. The temptation is to
label the release with the release date, which will cause
problems as in the example above when a new
<quote>official</quote> release is made.</para>
<para>For example, if a snapshot release is made on the date
20000917, and the previous version of the software was
version 1.2, the snapshot release should be given a
<makevar>PORTVERSION</makevar> of 1.2.20000917 or similar,
not 20000917, so that the succeeding release, say 1.3, is
still a numerically greater value.</para>
</sect3>
<sect3>
<title>Example of <makevar>PORTREVISION</makevar> and
<makevar>PORTEPOCH</makevar> Usage</title>
<para>The <literal>gtkmumble</literal> port, version
<literal>0.10</literal>, is committed to the ports
collection:</para>
<programlisting>PORTNAME= gtkmumble
PORTVERSION= 0.10</programlisting>
<para><makevar>PKGNAME</makevar> becomes
<literal>gtkmumble-0.10</literal>.</para>
<para>A security hole is discovered which requires a local
FreeBSD patch. <makevar>PORTREVISION</makevar> is bumped
accordingly.</para>
<programlisting>PORTNAME= gtkmumble
PORTVERSION= 0.10
PORTREVISION= 1</programlisting>
<para><makevar>PKGNAME</makevar> becomes
<literal>gtkmumble-0.10_1</literal></para>
<para>A new version is released by the vendor, numbered
<literal>0.2</literal> (it turns out the author actually
intended <literal>0.10</literal> to actually mean
<literal>0.1.0</literal>, not <quote>what comes after
0.9</quote> - oops, too late now). Since the new minor
version <literal>2</literal> is numerically less than the
previous version <literal>10</literal>, the
<makevar>PORTEPOCH</makevar> must be bumped to manually
force the new package to be detected as
<quote>newer</quote>. Since it is a new vendor release of
the code, <makevar>PORTREVISION</makevar> is reset to 0
(or removed from the
<filename>Makefile</filename>).</para>
<programlisting>PORTNAME= gtkmumble
PORTVERSION= 0.2
PORTEPOCH= 1</programlisting>
<para><makevar>PKGNAME</makevar> becomes
<literal>gtkmumble-0.2,1</literal></para>
<para>The next release is 0.3. Since
<makevar>PORTEPOCH</makevar> never decreases, the version
variables are now:</para>
<programlisting>PORTNAME= gtkmumble
PORTVERSION= 0.3
PORTEPOCH= 1</programlisting>
<para><makevar>PKGNAME</makevar> becomes
<literal>gtkmumble-0.3,1</literal></para>
<note>
<para>If <makevar>PORTEPOCH</makevar> were reset to
<literal>0</literal> with this upgrade, someone who had
installed the <literal>gtkmumble-0.10_1</literal>
package would not detect the
<literal>gtkmumble-0.3</literal> package as newer, since
<literal>3</literal> is still numerically less than
<literal>10</literal>. Remember, this is the whole
point of <makevar>PORTEPOCH</makevar> in the first
place.</para>
</note>
</sect3>
</sect2>
<sect2>
<title><makevar>PKGNAMEPREFIX</makevar> and
<makevar>PKGNAMESUFFIX</makevar></title>
<para>Two optional variables, <makevar>PKGNAMEPREFIX</makevar>
and <makevar>PKGNAMESUFFIX</makevar>, are combined with
<makevar>PORTNAME</makevar> and
<makevar>PORTVERSION</makevar> to form
<makevar>PKGNAME</makevar> as
<literal>${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}</literal>.
Make sure this conforms to our <link
linkend="porting-pkgname">guidelines for a good package
name</link>. In particular, you are
<emphasis>not</emphasis> allowed to use a hyphen
(<literal>-</literal>) in <makevar>PORTVERSION</makevar>.
Also, if the package name has the
<replaceable>language-</replaceable> or the
<replaceable>-compiled.specifics</replaceable> part (see
below), use <makevar>PKGNAMEPREFIX</makevar> and
<makevar>PKGNAMESUFFIX</makevar>, respectively. Do not make
them part of <makevar>PORTNAME</makevar>.</para>
</sect2>
<sect2>
<title><makevar>LATEST_LINK</makevar></title>
<para><makevar>LATEST_LINK</makevar> is used during package
building to determine a shortened name to create links that
can be used by <command>pkg_add -r</command>. This makes it
possible to, for example, install the latest perl version by
running <command>pkg_add -r perl</command> without knowing
the exact version number. This name needs to be unique and
obvious to users.</para>
<para>In some cases, several versions of a program may be
present in the ports collection at the same time. Both the
index build and the package build system need to be able to
see them as different, independent ports, although they may
all have the same <makevar>PORTNAME</makevar>,
<makevar>PKGNAMEPREFIX</makevar>, and even
<makevar>PKGNAMESUFFIX</makevar>. In those cases, the
optional <makevar>LATEST_LINK</makevar> variable should be
set to a different value for all ports except the
<quote>main</quote> one — see the
<filename>lang/gcc46</filename> and
<filename>lang/gcc</filename> ports, and the
<filename>www/apache*</filename> family for examples of its
use. By setting <makevar>NO_LATEST_LINK</makevar>, no link
will be generated, which may be an option for all but the
<quote>main</quote> version. Note that how to choose a
<quote>main</quote> version — <quote>most
popular</quote>, <quote>best supported</quote>,
<quote>least patched</quote>, and so on — is outside
the scope of this handbook's recommendations; we only tell
you how to specify the other ports' versions after you have
picked a <quote>main</quote> one.</para>
</sect2>
<sect2 id="porting-pkgname">
<title>Package Naming Conventions</title>
<para>The following are the conventions you should follow in
naming your packages. This is to have our package directory
easy to scan, as there are already thousands of packages and
users are going to turn away if they hurt their eyes!</para>
<para>The package name should look like
<filename><replaceable><optional>language<optional>_region</optional></optional>-name<optional><optional>-</optional>compiled.specifics</optional>-version.numbers</replaceable></filename>.</para>
<para>The package name is defined as
<literal>${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}</literal>.
Make sure to set the variables to conform to that
format.</para>
<orderedlist>
<listitem>
<para>FreeBSD strives to support the native language of
its users. The <replaceable>language-</replaceable>
part should be a two letter abbreviation of the natural
language defined by ISO-639 if the port is specific to a
certain language. Examples are <literal>ja</literal>
for Japanese, <literal>ru</literal> for Russian,
<literal>vi</literal> for Vietnamese,
<literal>zh</literal> for Chinese, <literal>ko</literal>
for Korean and <literal>de</literal> for German.</para>
<para>If the port is specific to a certain region within
the language area, add the two letter country code as
well. Examples are <literal>en_US</literal> for US
English and <literal>fr_CH</literal> for Swiss
French.</para>
<para>The <replaceable>language-</replaceable> part should
be set in the <makevar>PKGNAMEPREFIX</makevar>
variable.</para>
</listitem>
<listitem>
<para>The first letter of the <filename>name</filename>
part should be lowercase. (The rest of the name may
contain capital letters, so use your own discretion when
you are converting a software name that has some capital
letters in it.) There is a tradition of naming
<literal>Perl 5</literal> modules by prepending
<literal>p5-</literal> and converting the double-colon
separator to a hyphen; for example, the
<literal>Data::Dumper</literal> module becomes
<literal>p5-Data-Dumper</literal>.</para>
</listitem>
<listitem>
<para>Make sure that the port's name and version are
clearly separated and placed into the
<makevar>PORTNAME</makevar> and
<makevar>PORTVERSION</makevar> variables. The only
reason for <makevar>PORTNAME</makevar> to contain a
version part is if the upstream distribution is really
named that way, as in the
<filename>textproc/libxml2</filename> or
<filename>japanese/kinput2-freewnn</filename> ports.
Otherwise, the <makevar>PORTNAME</makevar> should not
contain any version-specific information. It is quite
normal for several ports to have the same
<makevar>PORTNAME</makevar>, as the
<filename>www/apache*</filename> ports do; in that case,
different versions (and different index entries) are
distinguished by the <makevar>PKGNAMEPREFIX</makevar>,
<makevar>PKGNAMESUFFIX</makevar>, and
<makevar>LATEST_LINK</makevar> values.</para>
</listitem>
<listitem>
<para>If the port can be built with different <link
linkend="makefile-masterdir">hardcoded defaults</link>
(usually part of the directory name in a family of
ports), the
<replaceable>-compiled.specifics</replaceable> part
should state the compiled-in defaults (the hyphen is
optional). Examples are paper size and font
units.</para>
<para>The <replaceable>-compiled.specifics</replaceable>
part should be set in the
<makevar>PKGNAMESUFFIX</makevar> variable.</para>
</listitem>
<listitem>
<para>The version string should follow a dash
(<literal>-</literal>) and be a period-separated list of
integers and single lowercase alphabetics. In
particular, it is not permissible to have another dash
inside the version string. The only exception is the
string <literal>pl</literal> (meaning
<quote>patchlevel</quote>), which can be used
<emphasis>only</emphasis> when there are no major and
minor version numbers in the software. If the software
version has strings like <quote>alpha</quote>,
<quote>beta</quote>, <quote>rc</quote>, or
<quote>pre</quote>, take the first letter and put it
immediately after a period. If the version string
continues after those names, the numbers should follow
the single alphabet without an extra period between
them.</para>
<para>The idea is to make it easier to sort ports by
looking at the version string. In particular, make sure
version number components are always delimited by a
period, and if the date is part of the string, use the
<literal>0.0.<replaceable>yyyy</replaceable>.<replaceable>mm</replaceable>.<replaceable>dd</replaceable></literal>
format, not
<literal><replaceable>dd</replaceable>.<replaceable>mm</replaceable>.<replaceable>yyyy</replaceable></literal>
or the non-Y2K compliant
<literal><replaceable>yy</replaceable>.<replaceable>mm</replaceable>.<replaceable>dd</replaceable></literal>
format. It is important to prefix the version with
<literal>0.0.</literal> in case a release with an actual
version number is made, which would of course be
numerically less than
<literal><replaceable>yyyy</replaceable></literal>.</para>
</listitem>
</orderedlist>
<para>Here are some (real) examples on how to convert the name
as called by the software authors to a suitable package
name:</para>
<informaltable frame="none" pgwide="1">
<tgroup cols="6">
<thead>
<row>
<entry>Distribution Name</entry>
<entry><makevar>PKGNAMEPREFIX</makevar></entry>
<entry><makevar>PORTNAME</makevar></entry>
<entry><makevar>PKGNAMESUFFIX</makevar></entry>
<entry><makevar>PORTVERSION</makevar></entry>
<entry>Reason</entry>
</row>
</thead>
<tbody>
<row>
<entry>mule-2.2.2</entry>
<entry>(empty)</entry>
<entry>mule</entry>
<entry>(empty)</entry>
<entry>2.2.2</entry>
<entry>No changes required</entry>
</row>
<row>
<entry>EmiClock-1.0.2</entry>
<entry>(empty)</entry>
<entry>emiclock</entry>
<entry>(empty)</entry>
<entry>1.0.2</entry>
<entry>No uppercase names for single programs</entry>
</row>
<row>
<entry>rdist-1.3alpha</entry>
<entry>(empty)</entry>
<entry>rdist</entry>
<entry>(empty)</entry>
<entry>1.3.a</entry>
<entry>No strings like <literal>alpha</literal>
allowed</entry>
</row>
<row>
<entry>es-0.9-beta1</entry>
<entry>(empty)</entry>
<entry>es</entry>
<entry>(empty)</entry>
<entry>0.9.b1</entry>
<entry>No strings like <literal>beta</literal>
allowed</entry>
</row>
<row>
<entry>mailman-2.0rc3</entry>
<entry>(empty)</entry>
<entry>mailman</entry>
<entry>(empty)</entry>
<entry>2.0.r3</entry>
<entry>No strings like <literal>rc</literal>
allowed</entry>
</row>
<row>
<entry>v3.3beta021.src</entry>
<entry>(empty)</entry>
<entry>tiff</entry>
<entry>(empty)</entry>
<entry>3.3</entry>
<entry>What the heck was that anyway?</entry>
</row>
<row>
<entry>tvtwm</entry>
<entry>(empty)</entry>
<entry>tvtwm</entry>
<entry>(empty)</entry>
<entry>pl11</entry>
<entry>Version string always required</entry>
</row>
<row>
<entry>piewm</entry>
<entry>(empty)</entry>
<entry>piewm</entry>
<entry>(empty)</entry>
<entry>1.0</entry>
<entry>Version string always required</entry>
</row>
<row>
<entry>xvgr-2.10pl1</entry>
<entry>(empty)</entry>
<entry>xvgr</entry>
<entry>(empty)</entry>
<entry>2.10.1</entry>
<entry><literal>pl</literal> allowed only when no
major/minor version numbers</entry>
</row>
<row>
<entry>gawk-2.15.6</entry>
<entry>ja-</entry>
<entry>gawk</entry>
<entry>(empty)</entry>
<entry>2.15.6</entry>
<entry>Japanese language version</entry>
</row>
<row>
<entry>psutils-1.13</entry>
<entry>(empty)</entry>
<entry>psutils</entry>
<entry>-letter</entry>
<entry>1.13</entry>
<entry>Paper size hardcoded at package build
time</entry>
</row>
<row>
<entry>pkfonts</entry>
<entry>(empty)</entry>
<entry>pkfonts</entry>
<entry>300</entry>
<entry>1.0</entry>
<entry>Package for 300dpi fonts</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>If there is absolutely no trace of version information
in the original source and it is unlikely that the original
author will ever release another version, just set the
version string to <literal>1.0</literal> (like the
<literal>piewm</literal> example above). Otherwise, ask the
original author or use the date string
(<literal>0.0.<replaceable>yyyy</replaceable>.<replaceable>mm</replaceable>.<replaceable>dd</replaceable></literal>)
as the version.</para>
</sect2>
</sect1>
<sect1 id="makefile-categories">
<title>Categorization</title>
<sect2>
<title><makevar>CATEGORIES</makevar></title>
<para>When a package is created, it is put under
<filename>/usr/ports/packages/All</filename> and links are
made from one or more subdirectories of
<filename>/usr/ports/packages</filename>. The names of
these subdirectories are specified by the variable
<makevar>CATEGORIES</makevar>. It is intended to make life
easier for the user when he is wading through the pile of
packages on the FTP site or the CDROM. Please take a look
at the <link linkend="porting-categories">current list of
categories</link> and pick the ones that are suitable for
your port.</para>
<para>This list also determines where in the ports tree the
port is imported. If you put more than one category here,
it is assumed that the port files will be put in the
subdirectory with the name in the first category. See <link
linkend="choosing-categories">below</link> for more
discussion about how to pick the right categories.</para>
</sect2>
<sect2 id="porting-categories">
<title>Current List of Categories</title>
<para>Here is the current list of port categories. Those
marked with an asterisk (<literal>*</literal>) are
<emphasis>virtual</emphasis> categories—those that do
not have a corresponding subdirectory in the ports tree.
They are only used as secondary categories, and only for
search purposes.</para>
<note>
<para>For non-virtual categories, you will find a one-line
description in the <makevar>COMMENT</makevar> in that
subdirectory's <filename>Makefile</filename>.</para>
</note>
<informaltable frame="none" pgwide="1">
<tgroup cols="3">
<thead>
<row>
<entry>Category</entry>
<entry>Description</entry>
<entry>Notes</entry>
</row>
</thead>
<tbody>
<row>
<entry><filename>accessibility</filename></entry>
<entry>Ports to help disabled users.</entry>
<entry></entry>
</row>
<row>
<entry><filename>afterstep*</filename></entry>
<entry>Ports to support the <ulink
url="http://www.afterstep.org">AfterStep</ulink>
window manager.</entry>
<entry></entry>
</row>
<row>
<entry><filename>arabic</filename></entry>
<entry>Arabic language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>archivers</filename></entry>
<entry>Archiving tools.</entry>
<entry></entry>
</row>
<row>
<entry><filename>astro</filename></entry>
<entry>Astronomical ports.</entry>
<entry></entry>
</row>
<row>
<entry><filename>audio</filename></entry>
<entry>Sound support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>benchmarks</filename></entry>
<entry>Benchmarking utilities.</entry>
<entry></entry>
</row>
<row>
<entry><filename>biology</filename></entry>
<entry>Biology-related software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>cad</filename></entry>
<entry>Computer aided design tools.</entry>
<entry></entry>
</row>
<row>
<entry><filename>chinese</filename></entry>
<entry>Chinese language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>comms</filename></entry>
<entry>Communication software.</entry>
<entry>Mostly software to talk to your serial
port.</entry>
</row>
<row>
<entry><filename>converters</filename></entry>
<entry>Character code converters.</entry>
<entry></entry>
</row>
<row>
<entry><filename>databases</filename></entry>
<entry>Databases.</entry>
<entry></entry>
</row>
<row>
<entry><filename>deskutils</filename></entry>
<entry>Things that used to be on the desktop before
computers were invented.</entry>
<entry></entry>
</row>
<row>
<entry><filename>devel</filename></entry>
<entry>Development utilities.</entry>
<entry>Do not put libraries here just because they are
libraries—unless they truly do not belong
anywhere else, they should not be in this
category.</entry>
</row>
<row>
<entry><filename>dns</filename></entry>
<entry>DNS-related software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>docs*</filename></entry>
<entry>Meta-ports for FreeBSD documentation.</entry>
<entry></entry>
</row>
<row>
<entry><filename>editors</filename></entry>
<entry>General editors.</entry>
<entry>Specialized editors go in the section for those
tools (e.g., a mathematical-formula editor will go
in <filename>math</filename>).</entry>
</row>
<row>
<entry><filename>elisp*</filename></entry>
<entry>Emacs-lisp ports.</entry>
<entry></entry>
</row>
<row>
<entry><filename>emulators</filename></entry>
<entry>Emulators for other operating systems.</entry>
<entry>Terminal emulators do <emphasis>not</emphasis>
belong here—X-based ones should go to
<filename>x11</filename> and text-based ones to
either <filename>comms</filename> or
<filename>misc</filename>, depending on the exact
functionality.</entry>
</row>
<row>
<entry><filename>finance</filename></entry>
<entry>Monetary, financial and related
applications.</entry>
<entry></entry>
</row>
<row>
<entry><filename>french</filename></entry>
<entry>French language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>ftp</filename></entry>
<entry>FTP client and server utilities.</entry>
<entry>If your port speaks both FTP and HTTP, put it
in <filename>ftp</filename> with a secondary
category of <filename>www</filename>.</entry>
</row>
<row>
<entry><filename>games</filename></entry>
<entry>Games.</entry>
<entry></entry>
</row>
<row>
<entry><filename>geography*</filename></entry>
<entry>Geography-related software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>german</filename></entry>
<entry>German language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>gnome*</filename></entry>
<entry>Ports from the <ulink
url="http://www.gnome.org">GNOME</ulink>
Project.</entry>
<entry></entry>
</row>
<row>
<entry><filename>gnustep*</filename></entry>
<entry>Software related to the GNUstep desktop
environment.</entry>
<entry></entry>
</row>
<row>
<entry><filename>graphics</filename></entry>
<entry>Graphics utilities.</entry>
<entry></entry>
</row>
<row>
<entry><filename>hamradio*</filename></entry>
<entry>Software for amateur radio.</entry>
<entry></entry>
</row>
<row>
<entry><filename>haskell*</filename></entry>
<entry>Software related to the Haskell
language.</entry>
<entry></entry>
</row>
<row>
<entry><filename>hebrew</filename></entry>
<entry>Hebrew language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>hungarian</filename></entry>
<entry>Hungarian language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>ipv6*</filename></entry>
<entry>IPv6 related software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>irc</filename></entry>
<entry>Internet Relay Chat utilities.</entry>
<entry></entry>
</row>
<row>
<entry><filename>japanese</filename></entry>
<entry>Japanese language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>java</filename></entry>
<entry>Software related to the Java™
language.</entry>
<entry>The <filename>java</filename> category must
not be the only one for a port. Save for ports
directly related to the Java language, porters are
also encouraged not to use <filename>java</filename>
as the main category of a port.</entry>
</row>
<row>
<entry><filename>kde*</filename></entry>
<entry>Ports from the <ulink
url="http://www.kde.org">KDE</ulink>
Project.</entry>
<entry></entry>
</row>
<row>
<entry><filename>kld*</filename></entry>
<entry>Kernel loadable modules.</entry>
<entry></entry>
</row>
<row>
<entry><filename>korean</filename></entry>
<entry>Korean language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>lang</filename></entry>
<entry>Programming languages.</entry>
<entry></entry>
</row>
<row>
<entry><filename>linux*</filename></entry>
<entry>Linux applications and support
utilities.</entry>
<entry></entry>
</row>
<row>
<entry><filename>lisp*</filename></entry>
<entry>Software related to the Lisp language.</entry>
<entry></entry>
</row>
<row>
<entry><filename>mail</filename></entry>
<entry>Mail software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>math</filename></entry>
<entry>Numerical computation software and other
utilities for mathematics.</entry>
<entry></entry>
</row>
<row>
<entry><filename>mbone*</filename></entry>
<entry>MBone applications.</entry>
<entry></entry>
</row>
<row>
<entry><filename>misc</filename></entry>
<entry>Miscellaneous utilities</entry>
<entry>Basically things that do not belong anywhere
else. If at all possible, try to find a better
category for your port than <literal>misc</literal>,
as ports tend to get overlooked in here.</entry>
</row>
<row>
<entry><filename>multimedia</filename></entry>
<entry>Multimedia software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>net</filename></entry>
<entry>Miscellaneous networking software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>net-im</filename></entry>
<entry>Instant messaging software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>net-mgmt</filename></entry>
<entry>Networking management software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>net-p2p</filename></entry>
<entry>Peer to peer network applications.</entry>
<entry></entry>
</row>
<row>
<entry><filename>news</filename></entry>
<entry>USENET news software.</entry>
<entry></entry>
</row>
<row>
<entry><filename>palm</filename></entry>
<entry>Software support for the <ulink
url="http://www.palm.com/">Palm™</ulink>
series.</entry>
<entry></entry>
</row>
<row>
<entry><filename>parallel*</filename></entry>
<entry>Applications dealing with parallelism in
computing.</entry>
<entry></entry>
</row>
<row>
<entry><filename>pear*</filename></entry>
<entry>Ports related to the Pear PHP
framework.</entry>
<entry></entry>
</row>
<row>
<entry><filename>perl5*</filename></entry>
<entry>Ports that require
<application>Perl</application> version 5 to
run.</entry>
<entry></entry>
</row>
<row>
<entry><filename>plan9*</filename></entry>
<entry>Various programs from <ulink
url="http://www.cs.bell-labs.com/plan9dist/">Plan9</ulink>.</entry>
<entry></entry>
</row>
<row>
<entry><filename>polish</filename></entry>
<entry>Polish language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>ports-mgmt</filename></entry>
<entry>Ports for managing, installing and developing
FreeBSD ports and packages.</entry>
</row>
<row>
<entry><filename>portuguese</filename></entry>
<entry>Portuguese language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>print</filename></entry>
<entry>Printing software.</entry>
<entry>Desktop publishing tools
(previewers, etc.) belong here too.</entry>
</row>
<row>
<entry><filename>python*</filename></entry>
<entry>Software related to the <ulink
url="http://www.python.org/">Python</ulink>
language.</entry>
<entry></entry>
</row>
<row>
<entry><filename>ruby*</filename></entry>
<entry>Software related to the <ulink
url="http://www.ruby-lang.org/">Ruby</ulink>
language.</entry>
<entry></entry>
</row>
<row>
<entry><filename>rubygems*</filename></entry>
<entry>Ports of <ulink
url="http://www.rubygems.org/">RubyGems</ulink>
packages.</entry>
<entry></entry>
</row>
<row>
<entry><filename>russian</filename></entry>
<entry>Russian language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>scheme*</filename></entry>
<entry>Software related to the Scheme
language.</entry>
<entry></entry>
</row>
<row>
<entry><filename>science</filename></entry>
<entry>Scientific ports that do not fit into other
categories such as <filename>astro</filename>,
<filename>biology</filename> and
<filename>math</filename>.</entry>
<entry></entry>
</row>
<row>
<entry><filename>security</filename></entry>
<entry>Security utilities.</entry>
<entry></entry>
</row>
<row>
<entry><filename>shells</filename></entry>
<entry>Command line shells.</entry>
<entry></entry>
</row>
<row>
<entry><filename>spanish*</filename></entry>
<entry>Spanish language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>sysutils</filename></entry>
<entry>System utilities.</entry>
<entry></entry>
</row>
<row>
<entry><filename>tcl*</filename></entry>
<entry>Ports that use Tcl to run.</entry>
<entry></entry>
</row>
<row>
<entry><filename>textproc</filename></entry>
<entry>Text processing utilities.</entry>
<entry>It does not include desktop publishing tools,
which go to <filename>print</filename>.</entry>
</row>
<row>
<entry><filename>tk*</filename></entry>
<entry>Ports that use Tk to run.</entry>
<entry></entry>
</row>
<row>
<entry><filename>ukrainian</filename></entry>
<entry>Ukrainian language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>vietnamese</filename></entry>
<entry>Vietnamese language support.</entry>
<entry></entry>
</row>
<row>
<entry><filename>windowmaker*</filename></entry>
<entry>Ports to support the WindowMaker window
manager.</entry>
<entry></entry>
</row>
<row>
<entry><filename>www</filename></entry>
<entry>Software related to the World Wide Web.</entry>
<entry>HTML language
support belongs here too.</entry>
</row>
<row>
<entry><filename>x11</filename></entry>
<entry>The X Window System and friends.</entry>
<entry>This category is only for software that
directly supports the window system. Do not put
regular X applications here; most of them should go
into other <filename>x11-*</filename> categories
(see below). If your port <emphasis>is</emphasis>
an X application, define <makevar>USE_XLIB</makevar>
(implied by <makevar>USE_IMAKE</makevar>) and put it
in the appropriate category.</entry>
</row>
<row>
<entry><filename>x11-clocks</filename></entry>
<entry>X11 clocks.</entry>
<entry></entry>
</row>
<row>
<entry><filename>x11-drivers</filename></entry>
<entry>X11 drivers.</entry>
<entry></entry>
</row>
<row>
<entry><filename>x11-fm</filename></entry>
<entry>X11 file managers.</entry>
<entry></entry>
</row>
<row>
<entry><filename>x11-fonts</filename></entry>
<entry>X11 fonts and font utilities.</entry>
<entry></entry>
</row>
<row>
<entry><filename>x11-servers</filename></entry>
<entry>X11 servers.</entry>
<entry></entry>
</row>
<row>
<entry><filename>x11-themes</filename></entry>
<entry>X11 themes.</entry>
<entry></entry>
</row>
<row>
<entry><filename>x11-toolkits</filename></entry>
<entry>X11 toolkits.</entry>
<entry></entry>
</row>
<row>
<entry><filename>x11-wm</filename></entry>
<entry>X11 window managers.</entry>
<entry></entry>
</row>
<row>
<entry><filename>xfce*</filename></entry>
<entry>Ports related to the <ulink
url="http://www.xfce.org/">Xfce</ulink> desktop
environment.</entry>
<entry></entry>
</row>
<row>
<entry><filename>zope*</filename></entry>
<entry><ulink url="http://www.zope.org/">Zope</ulink>
support.</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2>
<sect2 id="choosing-categories">
<title>Choosing the Right Category</title>
<para>As many of the categories overlap, you often have to
choose which of the categories should be the primary
category of your port. There are several rules that govern
this issue. Here is the list of priorities, in decreasing
order of precedence:</para>
<itemizedlist>
<listitem>
<para>The first category must be a physical category (see
<link linkend="porting-categories">above</link>). This
is necessary to make the packaging work. Virtual
categories and physical categories may be intermixed
after that.</para>
</listitem>
<listitem>
<para>Language specific categories always come first. For
example, if your port installs Japanese X11 fonts, then
your <makevar>CATEGORIES</makevar> line would read
<filename>japanese x11-fonts</filename>.</para>
</listitem>
<listitem>
<para>Specific categories are listed before less-specific
ones. For instance, an HTML editor should be listed as
<filename>www editors</filename>, not the other way
around. Also, you should not list
<filename>net</filename> when the port belongs to any of
<filename>irc</filename>, <filename>mail</filename>,
<filename>news</filename>,
<filename>security</filename>, or
<filename>www</filename>, as <filename>net</filename> is
included implicitly.</para>
</listitem>
<listitem>
<para><filename>x11</filename> is used as a secondary
category only when the primary category is a natural
language. In particular, you should not put
<filename>x11</filename> in the category line for X
applications.</para>
</listitem>
<listitem>
<para><application>Emacs</application> modes should be
placed in the same ports category as the application
supported by the mode, not in
<filename>editors</filename>. For example, an
<application>Emacs</application> mode to edit source
files of some programming language should go into
<filename>lang</filename>.</para>
</listitem>
<listitem>
<para>Ports which install loadable kernel modules should
have the virtual category <filename>kld</filename> in
their <makevar>CATEGORIES</makevar> line.</para>
</listitem>
<listitem>
<para><filename>misc</filename> should not appear with any
other non-virtual category. If you have
<literal>misc</literal> with something else in your
<makevar>CATEGORIES</makevar> line, that means you can
safely delete <literal>misc</literal> and just put the
port in that other subdirectory!</para>
</listitem>
<listitem>
<para>If your port truly does not belong anywhere else,
put it in <filename>misc</filename>.</para>
</listitem>
</itemizedlist>
<para>If you are not sure about the category, please put a
comment to that effect in your &man.send-pr.1; submission so
we can discuss it before we import it. If you are a
committer, send a note to the &a.ports; so we can discuss it
first. Too often, new ports are imported to the wrong
category only to be moved right away. This causes
unnecessary and undesirable bloat in the master source
repository.</para>
</sect2>
<sect2 id="proposing-categories">
<title>Proposing a New Category</title>
<para>As the Ports Collection has grown over time, various new
categories have been introduced. New categories can either
be <emphasis>virtual</emphasis> categories—those that
do not have a corresponding subdirectory in the ports
tree— or <emphasis>physical</emphasis>
categories—those that do. The following text
discusses the issues involved in creating a new physical
category so that you can understand them before you propose
one.</para>
<para>Our existing practice has been to avoid creating a new
physical category unless either a large number of ports
would logically belong to it, or the ports that would belong
to it are a logically distinct group that is of limited
general interest (for instance, categories related to spoken
human languages), or preferably both.</para>
<para>The rationale for this is that such a change creates a
<ulink url="&url.articles.committers-guide;/#ports"> fair
amount of work</ulink> for both the committers and also
for all users who track changes to the Ports Collection. In
addition, proposed category changes just naturally seem to
attract controversy. (Perhaps this is because there is no
clear consensus on when a category is <quote>too
big</quote>, nor whether categories should lend themselves
to browsing (and thus what number of categories would be an
ideal number), and so forth.)</para>
<para>Here is the procedure:</para>
<procedure>
<step>
<para>Propose the new category on &a.ports;. You should
include a detailed rationale for the new category,
including why you feel the existing categories are not
sufficient, and the list of existing ports proposed to
move. (If there are new ports pending in
<application>GNATS</application> that would fit this
category, list them too.) If you are the maintainer
and/or submitter, respectively, mention that as it may
help you to make your case.</para>
</step>
<step>
<para>Participate in the discussion.</para>
</step>
<step>
<para>If it seems that there is support for your idea,
file a PR which includes both the rationale and the list
of existing ports that need to be moved. Ideally, this
PR should also include patches for the following:</para>
<itemizedlist>
<listitem>
<para><filename>Makefile</filename>s for the
new ports once they are repocopied</para>
</listitem>
<listitem>
<para><filename>Makefile</filename> for the
new category</para>
</listitem>
<listitem>
<para><filename>Makefile</filename> for the
old ports' categories</para>
</listitem>
<listitem>
<para><filename>Makefile</filename>s for ports
that depend on the old ports</para>
</listitem>
<listitem>
<para>(for extra credit, you can include the other
files that have to change, as per the procedure
in the Committer's Guide.)</para>
</listitem>
</itemizedlist>
</step>
<step>
<para>Since it affects the ports infrastructure and
involves not only performing repo-copies but also
possibly running regression tests on the build cluster,
the PR should be assigned to the &a.portmgr;.</para>
</step>
<step>
<para>If that PR is approved, a committer will need to
follow the rest of the procedure that is <ulink
url="&url.articles.committers-guide;/article.html#PORTS">
outlined in the Committer's Guide</ulink>.</para>
</step>
</procedure>
<para>Proposing a new virtual category should be similar to
the above but much less involved, since no ports will
actually have to move. In this case, the only patches to
include in the PR would be those to add the new category to
the <makevar>CATEGORIES</makevar> of the affected
ports.</para>
</sect2>
<sect2 id="proposing-reorg">
<title>Proposing Reorganizing All the Categories</title>
<para>Occasionally someone proposes reorganizing the
categories with either a 2-level structure, or some other
kind of keyword structure. To date, nothing has come of any
of these proposals because, while they are very easy to
make, the effort involved to retrofit the entire existing
ports collection with any kind of reorganization is daunting
to say the very least. Please read the history of these
proposals in the mailing list archives before you post this
idea; furthermore, you should be prepared to be challenged
to offer a working prototype.</para>
</sect2>
</sect1>
<sect1 id="makefile-distfiles">
<title>The Distribution Files</title>
<para>The second part of the <filename>Makefile</filename>
describes the files that must be downloaded in order to build
the port, and where they can be downloaded from.</para>
<sect2>
<title><makevar>DISTVERSION/DISTNAME</makevar></title>
<para><makevar>DISTNAME</makevar> is the name of the port as
called by the authors of the software.
<makevar>DISTNAME</makevar> defaults to
<literal>${PORTNAME}-${PORTVERSION}</literal>, so override
it only if necessary. <makevar>DISTNAME</makevar> is only
used in two places. First, the distribution file list
(<makevar>DISTFILES</makevar>) defaults to
<makevar>${DISTNAME}</makevar><makevar>${EXTRACT_SUFX}</makevar>.
Second, the distribution file is expected to extract into a
subdirectory named <makevar>WRKSRC</makevar>, which defaults
to
<filename>work/<makevar>${DISTNAME}</makevar></filename>.</para>
<para>Some vendor's distribution names which do not fit into
the <literal>${PORTNAME}-${PORTVERSION}</literal>-scheme can
be handled automatically by setting
<makevar>DISTVERSION</makevar>.
<makevar>PORTVERSION</makevar> and
<makevar>DISTNAME</makevar> will be derived automatically,
but can of course be overridden. The following table lists
some examples:</para>
<informaltable frame="none" pgwide="0">
<tgroup cols="2">
<thead>
<row>
<entry><makevar>DISTVERSION</makevar></entry>
<entry><makevar>PORTVERSION</makevar></entry>
</row>
</thead>
<tbody>
<row>
<entry>0.7.1d</entry>
<entry>0.7.1.d</entry>
</row>
<row>
<entry>10Alpha3</entry>
<entry>10.a3</entry>
</row>
<row>
<entry>3Beta7-pre2</entry>
<entry>3.b7.p2</entry>
</row>
<row>
<entry>8:f_17</entry>
<entry>8f.17</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<note>
<para><makevar>PKGNAMEPREFIX</makevar> and
<makevar>PKGNAMESUFFIX</makevar> do not affect
<makevar>DISTNAME</makevar>. Also note that if
<makevar>WRKSRC</makevar> is equal to
<filename>work/<makevar>${PORTNAME}-${PORTVERSION}</makevar></filename>
while the original source archive is named something other
than
<makevar>${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}</makevar>,
you should probably leave <makevar>DISTNAME</makevar>
alone— you are better off defining
<makevar>DISTFILES</makevar> than having to set both
<makevar>DISTNAME</makevar> and <makevar>WRKSRC</makevar>
(and possibly <makevar>EXTRACT_SUFX</makevar>).</para>
</note>
</sect2>
<sect2>
<title><makevar>MASTER_SITES</makevar></title>
<para>Record the directory part of the FTP/HTTP-URL pointing
at the original tarball in <makevar>MASTER_SITES</makevar>.
Do not forget the trailing slash
(<filename>/</filename>)!</para>
<para>The <command>make</command> macros will try to use this
specification for grabbing the distribution file with
<makevar>FETCH</makevar> if they cannot find it already on
the system.</para>
<para>It is recommended that you put multiple sites on this
list, preferably from different continents. This will
safeguard against wide-area network problems. We are even
planning to add support for automatically determining the
closest master site and fetching from there; having multiple
sites will go a long way towards helping this effort.</para>
<para>If the original tarball is part of one of the popular
archives such as SourceForge, GNU, or Perl CPAN, you may be
able refer to those sites in an easy compact form using
<makevar>MASTER_SITE_<replaceable>*</replaceable></makevar>
(e.g., <makevar>MASTER_SITE_SOURCEFORGE</makevar>,
<makevar>MASTER_SITE_GNU</makevar> and
<makevar>MASTER_SITE_PERL_CPAN</makevar>). Simply set
<makevar>MASTER_SITES</makevar> to one of these variables
and <makevar>MASTER_SITE_SUBDIR</makevar> to the path within
the archive. Here is an example:</para>
<programlisting>MASTER_SITES= ${MASTER_SITE_GNU}
MASTER_SITE_SUBDIR= make</programlisting>
<para>Or you can use a condensed format:</para>
<programlisting>MASTER_SITES= GNU/make</programlisting>
<para>These variables are defined in
<filename>/usr/ports/Mk/bsd.sites.mk</filename>. There are
new entries added all the time, so make sure to check the
latest version of this file before submitting a port.</para>
<para>Several <emphasis>magic</emphasis> macros exist for
popular sites with a predictable directory structure. For
these, just use the abbreviation and the system will try to
guess the correct subdirectory for you.</para>
<programlisting>MASTER_SITES= SF</programlisting>
<para>If the guess is incorrect, it can be overridden as
follows.</para>
<programlisting>MASTER_SITES= SF/stardict/WyabdcRealPeopleTTS/${PORTVERSION}</programlisting>
<para>This can be also written as</para>
<programlisting>MASTER_SITES= SF
MASTER_SITE_SUBDIR= stardict/WyabdcRealPeopleTTS/${PORTVERSION}</programlisting>
<table frame="none">
<title>Popular Magic <makevar>MASTER_SITES</makevar>
Macros</title>
<tgroup cols="2">
<thead>
<row>
<entry>Macro</entry>
<entry>Assumed subdirectory</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>APACHE_JAKARTA</makevar></entry>
<entry><makevar>/dist/jakarta/${PORTNAME:S,-,,/,}/source</makevar></entry>
</row>
<row>
<entry><makevar>BERLIOS</makevar></entry>
<entry><makevar>/${PORTNAME:L}</makevar></entry>
</row>
<row>
<entry><makevar>CHEESESHOP</makevar></entry>
<entry><makevar>/packages/source/source/${DISTNAME:C/(.).*/\1/}/${DISTNAME:C/(.*)-[0-9].*/\1/}</makevar></entry>
</row>
<row>
<entry><makevar>DEBIAN</makevar></entry>
<entry><makevar>/debian/pool/main/${PORTNAME:C/^((lib)?.).*$/\1/}/${PORTNAME}</makevar></entry>
</row>
<row>
<entry><makevar>GCC</makevar></entry>
<entry><makevar>/pub/gcc/releases/${DISTNAME}</makevar></entry>
</row>
<row>
<entry><makevar>GNOME</makevar></entry>
<entry><makevar>/pub/GNOME/sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/}</makevar></entry>
</row>
<row>
<entry><makevar>GNU</makevar></entry>
<entry><makevar>/gnu/${PORTNAME}</makevar></entry>
</row>
<row>
<entry><makevar>MOZDEV</makevar></entry>
<entry><makevar>/pub/mozdev/${PORTNAME:L}</makevar></entry>
</row>
<row>
<entry><makevar>PERL_CPAN</makevar></entry>
<entry><makevar>/pub/CPAN/modules/by-module/${PORTNAME:C/-.*//}</makevar></entry>
</row>
<row>
<entry><makevar>PYTHON</makevar></entry>
<entry><makevar>/ftp/python/${PYTHON_PORTVERSION:C/rc[0-9]//}</makevar></entry>
</row>
<row>
<entry><makevar>RUBYFORGE</makevar></entry>
<entry><makevar>/${PORTNAME:L}</makevar></entry>
</row>
<row>
<entry><makevar>SAVANNAH</makevar></entry>
<entry><makevar>/${PORTNAME:L}</makevar></entry>
</row>
<row>
<entry><makevar>SF</makevar></entry>
<entry><makevar>/project/${PORTNAME:L}/${PORTNAME:L}/${PORTVERSION}</makevar></entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2>
<title><makevar>EXTRACT_SUFX</makevar></title>
<para>If you have one distribution file, and it uses an odd
suffix to indicate the compression mechanism, set
<makevar>EXTRACT_SUFX</makevar>.</para>
<para>For example, if the distribution file was named
<filename>foo.tgz</filename> instead of the more normal
<filename>foo.tar.gz</filename>, you would write:</para>
<programlisting>DISTNAME= foo
EXTRACT_SUFX= .tgz</programlisting>
<para>The <makevar>USE_BZIP2</makevar>,
<makevar>USE_XZ</makevar> and
<makevar>USE_ZIP</makevar> variables automatically set
<makevar>EXTRACT_SUFX</makevar> to
<literal>.tar.bz2</literal>, <literal>.tar.xz</literal>
or <literal>.zip</literal> as necessary. If neither of
these are set then <makevar>EXTRACT_SUFX</makevar>
defaults to <literal>.tar.gz</literal>.</para>
<note>
<para>You never need to set both
<makevar>EXTRACT_SUFX</makevar> and
<makevar>DISTFILES</makevar>.</para>
</note>
</sect2>
<sect2>
<title><makevar>DISTFILES</makevar></title>
<para>Sometimes the names of the files to be downloaded have
no resemblance to the name of the port. For example, it
might be called <filename>source.tar.gz</filename> or
similar. In other cases the application's source code might
be in several different archives, all of which must be
downloaded.</para>
<para>If this is the case, set <makevar>DISTFILES</makevar> to
be a space separated list of all the files that must be
downloaded.</para>
<programlisting>DISTFILES= source1.tar.gz source2.tar.gz</programlisting>
<para>If not explicitly set, <makevar>DISTFILES</makevar>
defaults to
<literal>${DISTNAME}${EXTRACT_SUFX}</literal>.</para>
</sect2>
<sect2>
<title><makevar>EXTRACT_ONLY</makevar></title>
<para>If only some of the <makevar>DISTFILES</makevar> must be
extracted—for example, one of them is the source code,
while another is an uncompressed document—list the
filenames that must be extracted in
<makevar>EXTRACT_ONLY</makevar>.</para>
<programlisting>DISTFILES= source.tar.gz manual.html
EXTRACT_ONLY= source.tar.gz</programlisting>
<para>If <emphasis>none</emphasis> of the
<makevar>DISTFILES</makevar> should be uncompressed then set
<makevar>EXTRACT_ONLY</makevar> to the empty string.</para>
<programlisting>EXTRACT_ONLY=</programlisting>
</sect2>
<sect2 id="porting-patchfiles">
<title><makevar>PATCHFILES</makevar></title>
<para>If your port requires some additional patches that are
available by FTP or HTTP, set <makevar>PATCHFILES</makevar>
to the names of the files and <makevar>PATCH_SITES</makevar>
to the URL of the directory that contains them (the format
is the same as <makevar>MASTER_SITES</makevar>).</para>
<para>If the patch is not relative to the top of the source
tree (i.e., <makevar>WRKSRC</makevar>) because it contains
some extra pathnames, set
<makevar>PATCH_DIST_STRIP</makevar> accordingly. For
instance, if all the pathnames in the patch have an extra
<literal>foozolix-1.0/</literal> in front of the filenames,
then set <literal>PATCH_DIST_STRIP=-p1</literal>.</para>
<para>Do not worry if the patches are compressed; they will be
decompressed automatically if the filenames end with
<filename>.gz</filename> or <filename>.Z</filename>.</para>
<para>If the patch is distributed with some other files, such
as documentation, in a <command>gzip</command>ped tarball,
you cannot just use <makevar>PATCHFILES</makevar>. If that
is the case, add the name and the location of the patch
tarball to <makevar>DISTFILES</makevar> and
<makevar>MASTER_SITES</makevar>. Then, use the
<makevar>EXTRA_PATCHES</makevar> variable to point to those
files and <filename>bsd.port.mk</filename> will
automatically apply them for you. In particular, do
<emphasis>not</emphasis> copy patch files into the
<makevar>PATCHDIR</makevar> directory—that directory
may not be writable.</para>
<note>
<para>The tarball will have been extracted alongside the
regular source by then, so there is no need to explicitly
extract it if it is a regular <command>gzip</command>ped
or <command>compress</command>ed tarball. If you do the
latter, take extra care not to overwrite something that
already exists in that directory. Also, do not forget to
add a command to remove the copied patch in the
<maketarget>pre-clean</maketarget> target.</para>
</note>
</sect2>
<sect2 id="porting-master-sites-n">
<title>Multiple Distribution Files or Patches from Different
Sites and Subdirectories
(<literal>MASTER_SITES:n</literal>)</title>
<para>(Consider this to be a somewhat <quote>advanced
topic</quote>; those new to this document may wish to skip
this section at first).</para>
<para>This section has information on the fetching mechanism
known as both <literal>MASTER_SITES:n</literal> and
<literal>MASTER_SITES_NN</literal>. We will refer to this
mechanism as <literal>MASTER_SITES:n</literal>.</para>
<para>A little background first. OpenBSD has a neat feature
inside the <makevar>DISTFILES</makevar> and
<makevar>PATCHFILES</makevar> variables which allows files
and patches to be postfixed with <literal>:n</literal>
identifiers. Here, <literal>n</literal> can be both
<literal>[0-9]</literal> and denote a group designation.
For example:</para>
<programlisting>DISTFILES= alpha:0 beta:1</programlisting>
<para>In OpenBSD, distribution file <filename>alpha</filename>
will be associated with variable
<makevar>MASTER_SITES0</makevar> instead of our common
<makevar>MASTER_SITES</makevar> and
<filename>beta</filename> with
<makevar>MASTER_SITES1</makevar>.</para>
<para>This is a very interesting feature which can decrease
that endless search for the correct download site.</para>
<para>Just picture 2 files in <makevar>DISTFILES</makevar> and
20 sites in <makevar>MASTER_SITES</makevar>, the sites slow
as hell where <filename>beta</filename> is carried by all
sites in <makevar>MASTER_SITES</makevar>, and
<filename>alpha</filename> can only be found in the 20th
site. It would be such a waste to check all of them if the
maintainer knew this beforehand, would it not? Not a good
start for that lovely weekend!</para>
<para>Now that you have the idea, just imagine more
<makevar>DISTFILES</makevar> and more
<makevar>MASTER_SITES</makevar>. Surely our
<quote>distfiles survey meister</quote> would appreciate the
relief to network strain that this would bring.</para>
<para>In the next sections, information will follow on the
FreeBSD implementation of this idea. We improved a bit on
OpenBSD's concept.</para>
<sect3>
<title>Simplified Information</title>
<para>This section tells you how to quickly prepare fine
grained fetching of multiple distribution files and
patches from different sites and subdirectories. We
describe here a case of simplified
<literal>MASTER_SITES:n</literal> usage. This will be
sufficient for most scenarios. However, if you need
further information, you will have to refer to the next
section.</para>
<para>Some applications consist of multiple distribution
files that must be downloaded from a number of different
sites. For example,
<application>Ghostscript</application> consists of the
core of the program, and then a large number of driver
files that are used depending on the user's printer. Some
of these driver files are supplied with the core, but many
others must be downloaded from a variety of different
sites.</para>
<para>To support this, each entry in
<makevar>DISTFILES</makevar> may be followed by a colon
and a <quote>tag name</quote>. Each site listed in
<makevar>MASTER_SITES</makevar> is then followed by a
colon, and the tag that indicates which distribution files
should be downloaded from this site.</para>
<para>For example, consider an application with the source
split in two parts, <filename>source1.tar.gz</filename>
and <filename>source2.tar.gz</filename>, which must be
downloaded from two different sites. The port's
<filename>Makefile</filename> would include lines like
<xref
linkend="ports-master-sites-n-example-simple-use-one-file-per-site"/>.</para>
<example
id="ports-master-sites-n-example-simple-use-one-file-per-site">
<title>Simplified Use of <literal>MASTER_SITES:n</literal>
with One File Per Site</title>
<programlisting>MASTER_SITES= ftp://ftp.example1.com/:source1 \
ftp://ftp.example2.com/:source2
DISTFILES= source1.tar.gz:source1 \
source2.tar.gz:source2</programlisting>
</example>
<para>Multiple distribution files can have the same tag.
Continuing the previous example, suppose that there was a
third distfile, <filename>source3.tar.gz</filename>, that
should be downloaded from
<hostid>ftp.example2.com</hostid>. The
<filename>Makefile</filename> would then be written like
<xref
linkend="ports-master-sites-n-example-simple-use-more-than-one-file-per-site"/>.</para>
<example
id="ports-master-sites-n-example-simple-use-more-than-one-file-per-site">
<title>Simplified Use of <literal>MASTER_SITES:n</literal>
with More Than One File Per Site</title>
<programlisting>MASTER_SITES= ftp://ftp.example1.com/:source1 \
ftp://ftp.example2.com/:source2
DISTFILES= source1.tar.gz:source1 \
source2.tar.gz:source2 \
source3.tar.gz:source2</programlisting>
</example>
</sect3>
<sect3>
<title>Detailed Information</title>
<para>Okay, so the previous section example did not reflect
your needs? In this section we will explain in detail
how the fine grained fetching mechanism
<literal>MASTER_SITES:n</literal> works and how you can
modify your ports to use it.</para>
<orderedlist>
<listitem>
<para>Elements can be postfixed with
<literal>:<replaceable>n</replaceable></literal> where
<replaceable>n</replaceable> is
<literal>[^:,]+</literal>, i.e.,
<replaceable>n</replaceable> could conceptually be any
alphanumeric string but we will limit it to
<literal>[a-zA-Z_][0-9a-zA-Z_]+</literal> for
now.</para>
<para>Moreover, string matching is case sensitive;
i.e., <literal>n</literal> is different from
<literal>N</literal>.</para>
<para>However, the following words cannot be used for
postfixing purposes since they yield special meaning:
<literal>default</literal>, <literal>all</literal> and
<literal>ALL</literal> (they are used internally in
item <xref
linkend="porting-master-sites-n-what-changes-in-port-targets"/>).
Furthermore, <literal>DEFAULT</literal> is a special
purpose word (check item <xref
linkend="porting-master-sites-n-DEFAULT-group"/>).</para>
</listitem>
<listitem>
<para>Elements postfixed with <literal>:n</literal>
belong to the group <literal>n</literal>,
<literal>:m</literal> belong to group
<literal>m</literal> and so forth.</para>
</listitem>
<listitem id="porting-master-sites-n-DEFAULT-group">
<para>Elements without a postfix are groupless, i.e.,
they all belong to the special group
<literal>DEFAULT</literal>. If you postfix any
elements with <literal>DEFAULT</literal>, you are just
being redundant unless you want to have an element
belonging to both <literal>DEFAULT</literal> and other
groups at the same time (check item <xref
linkend="porting-master-sites-n-comma-operator"/>).</para>
<para>The following examples are equivalent but the
first one is preferred:</para>
<programlisting>MASTER_SITES= alpha</programlisting>
<programlisting>MASTER_SITES= alpha:DEFAULT</programlisting>
</listitem>
<listitem>
<para>Groups are not exclusive, an element may belong to
several different groups at the same time and a group
can either have either several different elements or
none at all. Repeated elements within the same group
will be simply that, repeated elements.</para>
</listitem>
<listitem id="porting-master-sites-n-comma-operator">
<para>When you want an element to belong to several
groups at the same time, you can use the comma
operator (<literal>,</literal>).</para>
<para>Instead of repeating it several times, each time
with a different postfix, we can list several groups
at once in a single postfix. For instance,
<literal>:m,n,o</literal> marks an element that
belongs to group <literal>m</literal>,
<literal>n</literal> and <literal>o</literal>.</para>
<para>All the following examples are equivalent but the
last one is preferred:</para>
<programlisting>MASTER_SITES= alpha alpha:SOME_SITE</programlisting>
<programlisting>MASTER_SITES= alpha:DEFAULT alpha:SOME_SITE</programlisting>
<programlisting>MASTER_SITES= alpha:SOME_SITE,DEFAULT</programlisting>
<programlisting>MASTER_SITES= alpha:DEFAULT,SOME_SITE</programlisting>
</listitem>
<listitem>
<para>All sites within a given group are sorted
according to <makevar>MASTER_SORT_AWK</makevar>. All
groups within <makevar>MASTER_SITES</makevar> and
<makevar>PATCH_SITES</makevar> are sorted as
well.</para>
</listitem>
<listitem id="porting-master-sites-n-group-semantics">
<para>Group semantics can be used in any of the
following variables <makevar>MASTER_SITES</makevar>,
<makevar>PATCH_SITES</makevar>,
<makevar>MASTER_SITE_SUBDIR</makevar>,
<makevar>PATCH_SITE_SUBDIR</makevar>,
<makevar>DISTFILES</makevar>, and
<makevar>PATCHFILES</makevar> according to the
following syntax:</para>
<orderedlist>
<listitem>
<para>All <makevar>MASTER_SITES</makevar>,
<makevar>PATCH_SITES</makevar>,
<makevar>MASTER_SITE_SUBDIR</makevar> and
<makevar>PATCH_SITE_SUBDIR</makevar> elements must
be terminated with the forward slash
<literal>/</literal> character. If any elements
belong to any groups, the group postfix
<literal>:<replaceable>n</replaceable></literal>
must come right after the terminator
<literal>/</literal>. The
<literal>MASTER_SITES:n</literal> mechanism relies
on the existence of the terminator
<literal>/</literal> to avoid confusing elements
where a <literal>:n</literal> is a valid part of
the element with occurrences where
<literal>:n</literal> denotes group
<literal>n</literal>. For compatibility purposes,
since the <literal>/</literal> terminator was not
required before in both
<makevar>MASTER_SITE_SUBDIR</makevar> and
<makevar>PATCH_SITE_SUBDIR</makevar> elements, if
the postfix immediate preceding character is not
a <literal>/</literal> then <literal>:n</literal>
will be considered a valid part of the element
instead of a group postfix even if an element is
postfixed with <literal>:n</literal>. See both
<xref
linkend="ports-master-sites-n-example-detailed-use-master-site-subdir"/>
and <xref
linkend="ports-master-sites-n-example-detailed-use-complete-example-master-sites"/>.</para>
<example
id="ports-master-sites-n-example-detailed-use-master-site-subdir">
<title>Detailed Use of
<literal>MASTER_SITES:n</literal> in
<makevar>MASTER_SITE_SUBDIR</makevar></title>
<programlisting>MASTER_SITE_SUBDIR= old:n new/:NEW</programlisting>
<itemizedlist>
<listitem>
<para>Directories within group
<literal>DEFAULT</literal> ->
old:n</para>
</listitem>
<listitem>
<para>Directories within group
<literal>NEW</literal> -> new</para>
</listitem>
</itemizedlist>
</example>
<example
id="ports-master-sites-n-example-detailed-use-complete-example-master-sites">
<title>Detailed Use of
<literal>MASTER_SITES:n</literal> with Comma
Operator, Multiple Files, Multiple Sites and
Multiple Subdirectories</title>
<programlisting>MASTER_SITES= http://site1/%SUBDIR%/ http://site2/:DEFAULT \
http://site3/:group3 http://site4/:group4 \
http://site5/:group5 http://site6/:group6 \
http://site7/:DEFAULT,group6 \
http://site8/%SUBDIR%/:group6,group7 \
http://site9/:group8
DISTFILES= file1 file2:DEFAULT file3:group3 \
file4:group4,group5,group6 file5:grouping \
file6:group7
MASTER_SITE_SUBDIR= directory-trial:1 directory-n/:groupn \
directory-one/:group6,DEFAULT \
directory</programlisting>
<para>The previous example results in the
following fine grained fetching. Sites are
listed in the exact order they will be
used.</para>
<itemizedlist>
<listitem>
<para><filename>file1</filename> will be
fetched from</para>
<itemizedlist>
<listitem>
<para><makevar>MASTER_SITE_OVERRIDE</makevar></para>
</listitem>
<listitem>
<para>http://site1/directory-trial:1/</para>
</listitem>
<listitem>
<para>http://site1/directory-one/</para>
</listitem>
<listitem>
<para>http://site1/directory/</para>
</listitem>
<listitem>
<para>http://site2/</para>
</listitem>
<listitem>
<para>http://site7/</para>
</listitem>
<listitem>
<para><makevar>MASTER_SITE_BACKUP</makevar></para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para><filename>file2</filename> will be
fetched exactly as
<filename>file1</filename> since they
both belong to the same group</para>
<itemizedlist>
<listitem>
<para><makevar>MASTER_SITE_OVERRIDE</makevar></para>
</listitem>
<listitem>
<para>http://site1/directory-trial:1/</para>
</listitem>
<listitem>
<para>http://site1/directory-one/</para>
</listitem>
<listitem>
<para>http://site1/directory/</para>
</listitem>
<listitem>
<para>http://site2/</para>
</listitem>
<listitem>
<para>http://site7/</para>
</listitem>
<listitem>
<para><makevar>MASTER_SITE_BACKUP</makevar></para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para><filename>file3</filename> will be
fetched from</para>
<itemizedlist>
<listitem>
<para><makevar>MASTER_SITE_OVERRIDE</makevar></para>
</listitem>
<listitem>
<para>http://site3/</para>
</listitem>
<listitem>
<para><makevar>MASTER_SITE_BACKUP</makevar></para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para><filename>file4</filename> will be
fetched from</para>
<itemizedlist>
<listitem>
<para><makevar>MASTER_SITE_OVERRIDE</makevar></para>
</listitem>
<listitem>
<para>http://site4/</para>
</listitem>
<listitem>
<para>http://site5/</para>
</listitem>
<listitem>
<para>http://site6/</para>
</listitem>
<listitem>
<para>http://site7/</para>
</listitem>
<listitem>
<para>http://site8/directory-one/</para>
</listitem>
<listitem>
<para><makevar>MASTER_SITE_BACKUP</makevar></para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para><filename>file5</filename> will be
fetched from</para>
<itemizedlist>
<listitem>
<para><makevar>MASTER_SITE_OVERRIDE</makevar></para>
</listitem>
<listitem>
<para><makevar>MASTER_SITE_BACKUP</makevar></para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para><filename>file6</filename> will be
fetched from</para>
<itemizedlist>
<listitem>
<para><makevar>MASTER_SITE_OVERRIDE</makevar></para>
</listitem>
<listitem>
<para>http://site8/</para>
</listitem>
<listitem>
<para><makevar>MASTER_SITE_BACKUP</makevar></para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</example>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>How do I group one of the special variables from
<filename>bsd.sites.mk</filename>, e.g.,
<makevar>MASTER_SITE_SOURCEFORGE</makevar>?</para>
<para>See <xref
linkend="ports-master-sites-n-example-detailed-use-master-site-sourceforge"/>.</para>
<example
id="ports-master-sites-n-example-detailed-use-master-site-sourceforge">
<title>Detailed Use of
<literal>MASTER_SITES:n</literal> with
<makevar>MASTER_SITE_SOURCEFORGE</makevar></title>
<programlisting>MASTER_SITES= http://site1/ ${MASTER_SITE_SOURCEFORGE:S/$/:sourceforge,TEST/}
DISTFILES= something.tar.gz:sourceforge</programlisting>
</example>
<para><filename>something.tar.gz</filename> will be
fetched from all sites within
<makevar>MASTER_SITE_SOURCEFORGE</makevar>.</para>
</listitem>
<listitem>
<para>How do I use this with <makevar>PATCH*</makevar>
variables?</para>
<para>All examples were done with
<makevar>MASTER*</makevar> variables but they work
exactly the same for <makevar>PATCH*</makevar> ones as
can be seen in <xref
linkend="ports-master-sites-n-example-detailed-use-patch-sites"/>.</para>
<example
id="ports-master-sites-n-example-detailed-use-patch-sites">
<title>Simplified Use of
<literal>MASTER_SITES:n</literal> with
<makevar>PATCH_SITES</makevar></title>
<programlisting>PATCH_SITES= http://site1/ http://site2/:test
PATCHFILES= patch1:test</programlisting>
</example>
</listitem>
</orderedlist>
</sect3>
<sect3>
<title>What Does Change for Ports? What Does Not?</title>
<orderedlist numeration="lowerroman">
<listitem>
<para>All current ports remain the same. The
<literal>MASTER_SITES:n</literal> feature code is only
activated if there are elements postfixed with
<literal>:<replaceable>n</replaceable></literal> like
elements according to the aforementioned syntax rules,
especially as shown in item <xref
linkend="porting-master-sites-n-group-semantics"/>.</para>
</listitem>
<listitem
id="porting-master-sites-n-what-changes-in-port-targets">
<para>The port targets remain the same:
<maketarget>checksum</maketarget>,
<maketarget>makesum</maketarget>,
<maketarget>patch</maketarget>,
<maketarget>configure</maketarget>,
<maketarget>build</maketarget>, etc. With the obvious
exceptions of <maketarget>do-fetch</maketarget>,
<maketarget>fetch-list</maketarget>,
<maketarget>master-sites</maketarget> and
<maketarget>patch-sites</maketarget>.</para>
<itemizedlist>
<listitem>
<para><maketarget>do-fetch</maketarget>: deploys the
new grouping postfixed
<makevar>DISTFILES</makevar> and
<makevar>PATCHFILES</makevar> with their matching
group elements within both
<makevar>MASTER_SITES</makevar> and
<makevar>PATCH_SITES</makevar> which use matching
group elements within both
<makevar>MASTER_SITE_SUBDIR</makevar> and
<makevar>PATCH_SITE_SUBDIR</makevar>. Check <xref
linkend="ports-master-sites-n-example-detailed-use-complete-example-master-sites"/>.</para>
</listitem>
<listitem>
<para><maketarget>fetch-list</maketarget>: works
like old <maketarget>fetch-list</maketarget> with
the exception that it groups just like
<maketarget>do-fetch</maketarget>.</para>
</listitem>
<listitem>
<para><maketarget>master-sites</maketarget> and
<maketarget>patch-sites</maketarget>:
(incompatible with older versions) only return the
elements of group <literal>DEFAULT</literal>; in
fact, they execute targets
<maketarget>master-sites-default</maketarget> and
<maketarget>patch-sites-default</maketarget>
respectively.</para>
<para>Furthermore, using target either
<maketarget>master-sites-all</maketarget> or
<maketarget>patch-sites-all</maketarget> is
preferred to directly checking either
<maketarget>MASTER_SITES</maketarget> or
<maketarget>PATCH_SITES</maketarget>. Also,
directly checking is not guaranteed to work in any
future versions. Check item <xref
linkend="porting-master-sites-n-new-port-targets-master-sites-all"/>
for more information on these new port
targets.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>New port targets</para>
<orderedlist>
<listitem>
<para>There are
<maketarget>master-sites-<replaceable>n</replaceable></maketarget>
and
<maketarget>patch-sites-<replaceable>n</replaceable></maketarget>
targets which will list the elements of the
respective group <replaceable>n</replaceable>
within <makevar>MASTER_SITES</makevar> and
<makevar>PATCH_SITES</makevar> respectively. For
instance, both
<maketarget>master-sites-DEFAULT</maketarget> and
<maketarget>patch-sites-DEFAULT</maketarget> will
return the elements of group
<literal>DEFAULT</literal>,
<maketarget>master-sites-test</maketarget> and
<maketarget>patch-sites-test</maketarget> of group
<literal>test</literal>, and thereon.</para>
</listitem>
<listitem
id="porting-master-sites-n-new-port-targets-master-sites-all">
<para>There are new targets
<maketarget>master-sites-all</maketarget> and
<maketarget>patch-sites-all</maketarget> which do
the work of the old
<maketarget>master-sites</maketarget> and
<maketarget>patch-sites</maketarget> ones. They
return the elements of all groups as if they all
belonged to the same group with the caveat that it
lists as many
<makevar>MASTER_SITE_BACKUP</makevar> and
<makevar>MASTER_SITE_OVERRIDE</makevar> as there
are groups defined within either
<makevar>DISTFILES</makevar> or
<makevar>PATCHFILES</makevar>; respectively for
<maketarget>master-sites-all</maketarget> and
<maketarget>patch-sites-all</maketarget>.</para>
</listitem>
</orderedlist>
</listitem>
</orderedlist>
</sect3>
</sect2>
<sect2>
<title><makevar>DIST_SUBDIR</makevar></title>
<para>Do not let your port clutter
<filename>/usr/ports/distfiles</filename>. If your port
requires a lot of files to be fetched, or contains a file
that has a name that might conflict with other ports (e.g.,
<filename>Makefile</filename>), set
<makevar>DIST_SUBDIR</makevar> to the name of the port
(<literal>${PORTNAME}</literal> or
<literal>${PKGNAMEPREFIX}${PORTNAME}</literal> should work
fine). This will change <makevar>DISTDIR</makevar> from the
default <filename>/usr/ports/distfiles</filename> to
<filename>/usr/ports/distfiles/<makevar>DIST_SUBDIR</makevar></filename>,
and in effect puts everything that is required for your port
into that subdirectory.</para>
<para>It will also look at the subdirectory with the same name
on the backup master site at
<filename>ftp.FreeBSD.org</filename>. (Setting
<makevar>DISTDIR</makevar> explicitly in your
<makevar>Makefile</makevar> will not accomplish this, so
please use <makevar>DIST_SUBDIR</makevar>.)</para>
<note>
<para>This does not affect the
<makevar>MASTER_SITES</makevar> you define in your
<filename>Makefile</filename>.</para>
</note>
</sect2>
<sect2>
<title><makevar>ALWAYS_KEEP_DISTFILES</makevar></title>
<para>If your port uses binary distfiles and has a license
that requires that the source code is provided with packages
distributed in binary form, e.g., GPL,
<makevar>ALWAYS_KEEP_DISTFILES</makevar> will instruct the
&os; build cluster to keep a copy of the files specified in
<makevar>DISTFILES</makevar>. Users of these ports will
generally not need these files, so it is a good idea to only
add the source distfiles to <makevar>DISTFILES</makevar>
when <makevar>PACKAGE_BUILDING</makevar> is defined.</para>
<example
id="ports-master-sites-n-example-always-keep-distfiles">
<title>Use of
<makevar>ALWAYS_KEEP_DISTFILES</makevar></title>
<programlisting>.if defined(PACKAGE_BUILDING)
DISTFILES+= <replaceable>foo.tar.gz</replaceable>
ALWAYS_KEEP_DISTFILES= yes
.endif</programlisting>
</example>
<para>When adding extra files to <makevar>DISTFILES</makevar>,
make sure you also add them to
<filename>distinfo</filename>. Also, the additional files
will normally be extracted into <makevar>WRKDIR</makevar> as
well, which for some ports may lead to undesirable side
effects and require special handling.</para>
</sect2>
</sect1>
<sect1 id="makefile-maintainer">
<title><makevar>MAINTAINER</makevar></title>
<para>Set your mail-address here. Please. <!-- smiley
--><emphasis>:-)</emphasis></para>
<para>Note that only a single address without the comment part
is allowed as a <makevar>MAINTAINER</makevar> value. The
format used should be <literal>user@hostname.domain</literal>.
Please do not include any descriptive text such as your real
name in this entry—that merely confuses
<filename>bsd.port.mk</filename>.</para>
<para>The maintainer is responsible for keeping the port up to
date, and ensuring the port works correctly.
For a detailed description of the responsibilities of a port
maintainer, refer to the <ulink
url="&url.articles.contributing-ports;/maintain-port.html">The
challenge for port maintainers</ulink> section.</para>
<para>Changes to the port will be sent to the maintainer of a
port for review and approval before being committed. If the
maintainer does not respond to an update request after two
weeks (excluding major public holidays), then that is
considered a maintainer timeout, and the update may be made
without explicit maintainer approval. If the maintainer does
not respond within three months, then that maintainer is
considered absent without leave, and can be replaced as the
maintainer of the particular port in question. Exceptions to
this are anything maintained by the &a.portmgr;, or the
&a.security-officer;. No unauthorized commits may ever be
made to ports maintained by those groups.</para>
<para>We reserve the right to modify the maintainer's submission
to better match existing policies and style of the Ports
Collection without explicit blessing from the submitter.
Also, large infrastructural changes can result in a port being
modified without the maintainer's consent. These kinds of
changes will never affect the port's functionality.</para>
<para>The &a.portmgr; reserves the right to revoke or override
anyone's maintainership for any reason, and the
&a.security-officer; reserves the right to revoke or override
maintainership for security reasons.</para>
</sect1>
<sect1 id="makefile-comment">
<title><makevar>COMMENT</makevar></title>
<para>This is a one-line description of the port.
Please respect the following rules:</para>
<orderedlist>
<listitem>
<para>Try to keep the COMMENT value at no longer than 70
characters, as this line will be used by the
&man.pkg.info.1; utility to display a one-line summary
of the port;</para>
</listitem>
<listitem>
<para>Do <emphasis>not</emphasis> include the package
name (or version number of the software);</para>
</listitem>
<listitem>
<para>The comment should begin with a capital and end
without a period;</para>
</listitem>
<listitem>
<para>Do not start with an indefinite article (i.e.,
A or An);</para>
</listitem>
<listitem>
<para>Names are capitalized (for example, Apache,
JavaScript, Perl);</para>
</listitem>
<listitem>
<para>For lists of words, use the Oxford comma (e.g.,
green, red<emphasis>,</emphasis> and blue);</para>
</listitem>
<listitem>
<para>Spell check the text.</para>
</listitem>
</orderedlist>
<para>Here is an example:</para>
<programlisting>COMMENT= Cat chasing a mouse all over the screen</programlisting>
<para>The COMMENT variable should immediately follow the
MAINTAINER variable in the
<filename>Makefile</filename>.</para>
</sect1>
<sect1 id="makefile-portscout">
<title><makevar>PORTSCOUT</makevar></title>
<para><application>Portscout</application> is an automated
distfile check utility for the &os; Ports Collection,
described in detail in
<xref linkend="distfile-survey"/>.</para>
<para>The <makevar>PORTSCOUT</makevar> variable defines
special conditions within which the
<application>Portscout</application> distfile
scanner should be restricted.</para>
<para>Situations where the <makevar>PORTSCOUT</makevar>
variable should be set include:</para>
<itemizedlist>
<listitem>
<para>When distfiles should be ignored, whether for
specific versions, or specific minor revisions. For
example, to exclude version
<replaceable>8.2</replaceable> from distfile version
checks because it is known to be broken, add:</para>
<programlisting>PORTSCOUT= ignore:8.2</programlisting>
</listitem>
<listitem>
<para>When specific versions or specific major and minor
revisions of a distfile should be checked. For
example, if only version
<replaceable>0.6.4</replaceable> should be monitored
because newer versions have compatablity issues with
&os;, add:</para>
<programlisting>PORTSCOUT= limit:^0\.6\.4</programlisting>
</listitem>
<listitem>
<para>When URLs listing the available versions differ
from the download URLs. For example, to limit
distfile version checks to the download page for the
<filename role="package">databases/pgtune</filename>
port, add:</para>
<programlisting>PORTSCOUT= site:http://pgfoundry.org/frs/?group_id=1000416</programlisting>
</listitem>
</itemizedlist>
</sect1>
<sect1 id="makefile-depend">
<title>Dependencies</title>
<para>Many ports depend on other ports. This is a very
convenient feature of most Unix-like operating systems,
including &os;. Multiple ports can share a common dependency,
rather than bundling that dependency with every port or
package that needs it. There are seven variables that can be
used to ensure that all the required bits will be on the
user's machine. There are also some pre-supported dependency
variables for common cases, plus a few more to control the
behavior of dependencies.</para>
<sect2>
<title><makevar>LIB_DEPENDS</makevar></title>
<para>This variable specifies the shared libraries this port
depends on. It is a list of
<replaceable>lib</replaceable>:<replaceable>dir</replaceable><optional><replaceable>:target</replaceable></optional>
tuples where <replaceable>lib</replaceable> is the name of
the shared library, <replaceable>dir</replaceable> is the
directory in which to find it in case it is not available,
and <replaceable>target</replaceable> is the target to call
in that directory. For example,</para>
<programlisting>LIB_DEPENDS= jpeg:${PORTSDIR}/graphics/jpeg</programlisting>
<para>will check for a shared jpeg library with any version,
and descend into the
<filename>graphics/jpeg</filename> subdirectory of your
ports tree to build and install it if it is not found. The
<replaceable>target</replaceable> part can be omitted if it
is equal to <makevar>DEPENDS_TARGET</makevar> (which
defaults to <literal>install</literal>).</para>
<note>
<para>The <replaceable>lib</replaceable> part is a regular
expression which is being looked up in the
<command>ldconfig -r</command> output. Values such as
<literal>intl.9</literal> and
<literal>intl.[5-7]</literal> are allowed. The first
pattern, <literal>intl.9</literal>, will match only
version 9 of intl, while <literal>intl.[5-7]</literal>,
will match any of: <literal>intl.5</literal>,
<literal>intl.6</literal> or
<literal>intl.7</literal>.</para>
</note>
<para>The dependency is checked twice, once from within the
<maketarget>extract</maketarget> target and then from within
the <maketarget>install</maketarget> target. Also, the name
of the dependency is put into the package so that
&man.pkg.add.1; will automatically install it if it is not
on the user's system.</para>
</sect2>
<sect2>
<title><makevar>RUN_DEPENDS</makevar></title>
<para>This variable specifies executables or files this port
depends on during run-time. It is a list of
<replaceable>path</replaceable>:<replaceable>dir</replaceable><optional><replaceable>:target</replaceable></optional>
tuples where <replaceable>path</replaceable> is the name of
the executable or file, <replaceable>dir</replaceable> is
the directory in which to find it in case it is not
available, and <replaceable>target</replaceable> is the
target to call in that directory. If
<replaceable>path</replaceable> starts with a slash
(<literal>/</literal>), it is treated as a file and its
existence is tested with <command>test -e</command>;
otherwise, it is assumed to be an executable, and
<command>which -s</command> is used to determine if the
program exists in the search path.</para>
<para>For example,</para>
<programlisting>RUN_DEPENDS= ${LOCALBASE}/news/bin/innd:${PORTSDIR}/news/inn \
xmlcatmgr:${PORTSDIR}/textproc/xmlcatmgr</programlisting>
<para>will check if the file or directory
<filename>/usr/local/news/bin/innd</filename> exists, and
build and install it from the <filename>news/inn</filename>
subdirectory of the ports tree if it is not found. It will
also see if an executable called
<command>xmlcatmgr</command> is in the search path, and
descend into the <filename>textproc/xmlcatmgr</filename>
subdirectory of your ports tree to build and install it if
it is not found.</para>
<note>
<para>In this case, <command>innd</command> is actually an
executable; if an executable is in a place that is not
expected to be in the search path, you should use the full
pathname.</para>
</note>
<note>
<para>The official search <envar>PATH</envar> used on the
ports build cluster is</para>
<programlisting>/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin</programlisting>
</note>
<para>The dependency is checked from within the
<maketarget>install</maketarget> target. Also, the name of
the dependency is put into the package so that
&man.pkg.add.1; will automatically install it if it is not
on the user's system. The <replaceable>target</replaceable>
part can be omitted if it is the same as
<makevar>DEPENDS_TARGET</makevar>.</para>
<para>A quite common situation is when
<makevar>RUN_DEPENDS</makevar> is literally the same as
<makevar>BUILD_DEPENDS</makevar>, especially if ported
software is written in a scripted language or if it requires
the same build and run-time environment. In this
case, it is both tempting and intuitive to directly
assign one to the other:</para>
<programlisting>RUN_DEPENDS= ${BUILD_DEPENDS}</programlisting>
<para>However, such assignment can pollute run-time
dependencies with entries not defined in the port's original
<makevar>BUILD_DEPENDS</makevar>. This happens because of
&man.make.1;'s lazy evaluation of variable assignment.
Consider a <filename>Makefile</filename> with
<makevar>USE_<replaceable>*</replaceable></makevar>
variables, which are processed by
<filename>ports/Mk/bsd.*.mk</filename> to augment initial
build dependencies. For example,
<literal>USE_GMAKE=yes</literal> adds <filename
role="package">devel/gmake</filename> to
<makevar>BUILD_DEPENDS</makevar>. To prevent such
additional dependencies from polluting
<makevar>RUN_DEPENDS</makevar>, take care to assign with
expansion, i.e., expand the value before assigning it to the
variable:</para>
<programlisting>RUN_DEPENDS:= ${BUILD_DEPENDS}</programlisting>
</sect2>
<sect2>
<title><makevar>BUILD_DEPENDS</makevar></title>
<para>This variable specifies executables or files this port
requires to build. Like <makevar>RUN_DEPENDS</makevar>, it
is a list of
<replaceable>path</replaceable>:<replaceable>dir</replaceable><optional><replaceable>:target</replaceable></optional>
tuples. For example,</para>
<programlisting>BUILD_DEPENDS= unzip:${PORTSDIR}/archivers/unzip</programlisting>
<para>will check for an executable called
<command>unzip</command>, and descend into the
<filename>archivers/unzip</filename> subdirectory of your
ports tree to build and install it if it is not
found.</para>
<note>
<para><quote>build</quote> here means everything from
extraction to compilation. The dependency is checked from
within the <maketarget>extract</maketarget> target. The
<replaceable>target</replaceable> part can be omitted if
it is the same as <makevar>DEPENDS_TARGET</makevar></para>
</note>
</sect2>
<sect2>
<title><makevar>FETCH_DEPENDS</makevar></title>
<para>This variable specifies executables or files this port
requires to fetch. Like the previous two, it is a list of
<replaceable>path</replaceable>:<replaceable>dir</replaceable><optional><replaceable>:target</replaceable></optional>
tuples. For example,</para>
<programlisting>FETCH_DEPENDS= ncftp2:${PORTSDIR}/net/ncftp2</programlisting>
<para>will check for an executable called
<command>ncftp2</command>, and descend into the
<filename>net/ncftp2</filename> subdirectory of your ports
tree to build and install it if it is not found.</para>
<para>The dependency is checked from within the
<maketarget>fetch</maketarget> target. The
<replaceable>target</replaceable> part can be omitted if it
is the same as <makevar>DEPENDS_TARGET</makevar>.</para>
</sect2>
<sect2>
<title><makevar>EXTRACT_DEPENDS</makevar></title>
<para>This variable specifies executables or files this port
requires for extraction. Like the previous, it is a list of
<replaceable>path</replaceable>:<replaceable>dir</replaceable><optional><replaceable>:target</replaceable></optional>
tuples. For example,</para>
<programlisting>EXTRACT_DEPENDS= unzip:${PORTSDIR}/archivers/unzip</programlisting>
<para>will check for an executable called
<command>unzip</command>, and descend into the
<filename>archivers/unzip</filename> subdirectory of your
ports tree to build and install it if it is not
found.</para>
<para>The dependency is checked from within the
<maketarget>extract</maketarget> target. The
<replaceable>target</replaceable> part can be omitted if it
is the same as <makevar>DEPENDS_TARGET</makevar>.</para>
<note>
<para>Use this variable only if the extraction does not
already work (the default assumes <command>gzip</command>)
and cannot be made to work using
<makevar>USE_ZIP</makevar> or <makevar>USE_BZIP2</makevar>
described in <xref linkend="use-vars"/>.</para>
</note>
</sect2>
<sect2>
<title><makevar>PATCH_DEPENDS</makevar></title>
<para>This variable specifies executables or files this port
requires to patch. Like the previous, it is a list of
<replaceable>path</replaceable>:<replaceable>dir</replaceable><optional><replaceable>:target</replaceable></optional>
tuples. For example,</para>
<programlisting>PATCH_DEPENDS= ${NONEXISTENT}:${PORTSDIR}/java/jfc:extract</programlisting>
<para>will descend into the <filename>java/jfc</filename>
subdirectory of your ports tree to extract it.</para>
<para>The dependency is checked from within the
<maketarget>patch</maketarget> target. The
<replaceable>target</replaceable> part can be omitted if it
is the same as <makevar>DEPENDS_TARGET</makevar>.</para>
</sect2>
<sect2 id="use-vars">
<title><makevar>USE_<replaceable>*</replaceable></makevar></title>
<para>Several variables exist to define
common dependencies shared by many ports. Their
use is optional, but helps to reduce the verbosity of
the port <filename>Makefile</filename>s. Each of them is
styled as
<makevar>USE_<replaceable>*</replaceable></makevar>.
These variables may be used only in the port
<filename>Makefile</filename>s and
<filename>ports/Mk/bsd.*.mk</filename>. They are not meant
for user-settable options — use
<makevar>PORT_OPTIONS</makevar> for that purpose.</para>
<note>
<para>It is <emphasis>always</emphasis> incorrect to set any
<makevar>USE_<replaceable>*</replaceable></makevar> in
<filename>/etc/make.conf</filename>. For instance,
setting</para>
<programlisting>USE_GCC=3.4</programlisting>
<para>would add a dependency on gcc34 for every port,
including gcc34 itself!</para>
</note>
<table frame="none">
<title>The
<makevar>USE_<replaceable>*</replaceable></makevar>
Variables</title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Means</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_BZIP2</makevar></entry>
<entry>The port's tarballs are compressed with
<command>bzip2</command>.</entry>
</row>
<row>
<entry><makevar>USE_ZIP</makevar></entry>
<entry>The port's tarballs are compressed with
<command>zip</command>.</entry>
</row>
<row>
<entry><makevar>USE_BISON</makevar></entry>
<entry>The port uses <command>bison</command> for
building.</entry>
</row>
<row>
<entry><makevar>USE_CDRTOOLS</makevar></entry>
<entry>The port requires
<application>cdrecord</application> either from
<filename
role="package">sysutils/cdrtools</filename> or
<filename
role="package">sysutils/cdrtools-cjk</filename>,
according to the user's preference.</entry>
</row>
<row>
<entry><makevar>USE_GCC</makevar></entry>
<entry>The port requires a specific version of
<command>gcc</command> to build. The exact version
can be specified with value such as
<literal>3.4</literal>. The minimal required
version can be specified as <literal>3.4+</literal>.
The <command>gcc</command> from the base system is
used when it satisfies the requested version,
otherwise an appropriate <command>gcc</command> is
compiled from ports and the <makevar>CC</makevar>
and <makevar>CXX</makevar> variables are
adjusted.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>Variables related to <application>gmake</application>
and the <filename>configure</filename> script are described
in <xref linkend="building"/>, while
<application>autoconf</application>,
<application>automake</application> and
<application>libtool</application> are described in
<xref linkend="using-autotools"/>.
<application>Perl</application> related variables are
described in <xref linkend="using-perl"/>. X11 variables
are listed in <xref linkend="using-x11"/>.
<xref linkend="using-gnome"/> deals with GNOME and
<xref linkend="using-kde"/> with KDE related variables.
<xref linkend="using-java"/> documents Java variables, while
<xref linkend="using-php"/> contains information on
<application>Apache</application>,
<application>PHP</application> and PEAR modules.
<application>Python</application> is discussed in
<xref linkend="using-python"/>, while
<application>Ruby</application> in
<xref linkend="using-ruby"/>. <xref linkend="using-sdl"/>
provides variables used for <application>SDL</application>
applications and finally, <xref linkend="using-xfce"/>
contains information on
<application>Xfce</application>.</para>
</sect2>
<sect2>
<title>Minimal Version of a Dependency</title>
<para>A minimal version of a dependency can be specified in
any <makevar>*_DEPENDS</makevar> variable except
<makevar>LIB_DEPENDS</makevar> using the following
syntax:</para>
<programlisting>p5-Spiffy>=0.26:${PORTSDIR}/devel/p5-Spiffy</programlisting>
<para>The first field contains a dependent package name, which
must match the entry in the package database, a comparison
sign, and a package version. The dependency is satisfied if
p5-Spiffy-0.26 or newer is installed on the machine.</para>
</sect2>
<sect2>
<title>Notes on Dependencies</title>
<para>As mentioned above, the default target to call when a
dependency is required is
<maketarget>DEPENDS_TARGET</maketarget>. It defaults to
<literal>install</literal>. This is a user variable; it is
never defined in a port's <filename>Makefile</filename>. If
your port needs a special way to handle a dependency, use
the <literal>:target</literal> part of the
<makevar>*_DEPENDS</makevar> variables instead of redefining
<makevar>DEPENDS_TARGET</makevar>.</para>
<para>When you type <command>make clean</command>, its
dependencies are automatically cleaned too. If you do not
wish this to happen, define the variable
<makevar>NOCLEANDEPENDS</makevar> in your environment. This
may be particularly desirable if the port has something that
takes a long time to rebuild in its dependency list, such as
KDE, GNOME or Mozilla.</para>
<para>To depend on another port unconditionally, use the
variable <makevar>${NONEXISTENT}</makevar> as the first
field of <makevar>BUILD_DEPENDS</makevar> or
<makevar>RUN_DEPENDS</makevar>. Use this only when you need
to get the source of the other port. You can often save
compilation time by specifying the target too. For
instance</para>
<programlisting>BUILD_DEPENDS= ${NONEXISTENT}:${PORTSDIR}/graphics/jpeg:extract</programlisting>
<para>will always descend to the <literal>jpeg</literal> port
and extract it.</para>
</sect2>
<sect2>
<title>Circular Dependencies Are Fatal</title>
<important>
<para>Do not introduce any circular dependencies into the
ports tree!</para>
</important>
<para>The ports building technology does not tolerate circular
dependencies. If you introduce one, you will have someone,
somewhere in the world, whose FreeBSD installation will
break almost immediately, with many others quickly to
follow. These can really be hard to detect; if in doubt,
before you make that change, make sure you have done the
following: <command>cd /usr/ports; make index</command>.
That process can be quite slow on older machines, but you
may be able to save a large number of people—including
yourself— a lot of grief in the process.</para>
</sect2>
<sect2>
<title>Problems Caused by Automatic Dependencies</title>
<para>Dependencies must be declared either explicitly or by
using the <link
linkend="makefile-options">OPTIONS framework</link>.
Using other methods like automatic detection complicates
indexing, which causes problems for port and package
management.</para>
<example>
<title>Wrong Declaration of an Optional Dependency</title>
<programlisting>.include <bsd.port.pre.mk>
.if exists(${LOCALBASE}/bin/foo)
LIB_DEPENDS= bar:${PORTSDIR}/foo/bar
.endif</programlisting>
</example>
<para>The problem with trying to automatically add
dependencies is that files and settings outside an
individual port can change at any time. For example: an
index is built, then a batch of ports are installed. But
one of the ports installs the tested file. The index is now
incorrect, because an installed port unexpectedly has a new
dependency. The index may still be wrong even after
rebuilding if other ports also determine their need for
dependencies based on the existence of other files.</para>
<example>
<title>Correct Declaration of an Optional Dependency</title>
<programlisting>OPTIONS_DEFINE= BAR
BAR_DESC= Enable bar support
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MBAR}
LIB_DEPENDS= bar:${PORTSDIR}/foo/bar
.endif</programlisting>
</example>
<para>Testing option variables is the correct method. It will
not cause inconsistencies in the index of a batch of ports,
provided the options were defined prior to the index build.
Simple scripts can then be used to automate the building,
installation, and updating of these ports and their
packages.</para>
</sect2>
<sect2 id="use-want">
<title><makevar>USE_</makevar> and
<makevar>WANT_</makevar></title>
<para><makevar>USE_</makevar> variables are set by the port
maintainer to define software on which this port depends. A
port that needs Firefox would set</para>
<programlisting>USE_FIREFOX= yes</programlisting>
<para>Some <makevar>USE_</makevar> variables can accept
version numbers or other parameters. For example, a port
that requires Apache 2.2 would set</para>
<programlisting>USE_APACHE= 22</programlisting>
<para>For more control over dependencies in some cases,
<makevar>WANT_</makevar> variables are available to more
precisely specify what is needed. For example, consider the
<filename role="package">mail/squirrelmail</filename> port.
This port needs some PHP modules, which are listed in the
<makevar>USE_PHP</makevar> variable:</para>
<programlisting>USE_PHP= session mhash gettext mbstring pcre openssl xml</programlisting>
<para>Those modules may be available in CLI or web versions,
so the web version is selected with a
<makevar>WANT_</makevar> variable:</para>
<programlisting>WANT_PHP_WEB= yes</programlisting>
<para>Available <makevar>USE_</makevar> and
<makevar>WANT_</makevar> variables are defined in the files
in <filename>/usr/ports/Mk</filename>.</para>
</sect2>
</sect1>
<sect1 id="makefile-masterdir">
<title><makevar>MASTERDIR</makevar></title>
<para>If your port needs to build slightly different versions of
packages by having a variable (for instance, resolution, or
paper size) take different values, create one subdirectory per
package to make it easier for users to see what to do, but try
to share as many files as possible between ports. Typically
you only need a very short <filename>Makefile</filename> in
all but one of the directories if you use variables cleverly.
In the sole <filename>Makefile</filename>, you can use
<makevar>MASTERDIR</makevar> to specify the directory where
the rest of the files are. Also, use a variable as part of
<link
linkend="porting-pkgname"><makevar>PKGNAMESUFFIX</makevar></link>
so the packages will have different names.</para>
<para>This will be best demonstrated by an example. This is
part of <filename>japanese/xdvi300/Makefile</filename>;</para>
<programlisting>PORTNAME= xdvi
PORTVERSION= 17
PKGNAMEPREFIX= ja-
PKGNAMESUFFIX= ${RESOLUTION}
:
# default
RESOLUTION?= 300
.if ${RESOLUTION} != 118 && ${RESOLUTION} != 240 && \
${RESOLUTION} != 300 && ${RESOLUTION} != 400
@${ECHO_MSG} "Error: invalid value for RESOLUTION: \"${RESOLUTION}\""
@${ECHO_MSG} "Possible values are: 118, 240, 300 (default) and 400."
@${FALSE}
.endif</programlisting>
<para><filename role="package">japanese/xdvi300</filename> also
has all the regular patches, package files, etc. If you type
<command>make</command> there, it will take the default value
for the resolution (300) and build the port normally.</para>
<para>As for other resolutions, this is the
<emphasis>entire</emphasis>
<filename>xdvi118/Makefile</filename>:</para>
<programlisting>RESOLUTION= 118
MASTERDIR= ${.CURDIR}/../xdvi300
.include "${MASTERDIR}/Makefile"</programlisting>
<para>(<filename>xdvi240/Makefile</filename> and
<filename>xdvi400/Makefile</filename> are similar). The
<makevar>MASTERDIR</makevar> definition tells
<filename>bsd.port.mk</filename> that the regular set of
subdirectories like <makevar>FILESDIR</makevar> and
<makevar>SCRIPTDIR</makevar> are to be found under
<filename>xdvi300</filename>. The
<literal>RESOLUTION=118</literal> line will override the
<literal>RESOLUTION=300</literal> line in
<filename>xdvi300/Makefile</filename> and the port will be
built with resolution set to 118.</para>
</sect1>
<sect1 id="makefile-manpages">
<title>Man Pages</title>
<para>The <makevar>MAN[1-9LN]</makevar> variables will
automatically add any manpages to
<filename>pkg-plist</filename> (this means you must
<emphasis>not</emphasis> list manpages in the
<filename>pkg-plist</filename>—see <link
linkend="plist-sub">generating PLIST</link> for more). It
also makes the install stage automatically compress or
uncompress manpages depending on the setting of
<makevar>NO_MANCOMPRESS</makevar> in
<filename>/etc/make.conf</filename>.</para>
<para>If your port tries to install multiple names for manpages
using symlinks or hardlinks, you must use the
<makevar>MLINKS</makevar> variable to identify these. The
link installed by your port will be destroyed and recreated by
<filename>bsd.port.mk</filename> to make sure it points to the
correct file. Any manpages listed in MLINKS must not be
listed in the <filename>pkg-plist</filename>.</para>
<para>To specify whether the manpages are compressed upon
installation, use the <makevar>MANCOMPRESSED</makevar>
variable. This variable can take three values,
<literal>yes</literal>, <literal>no</literal> and
<literal>maybe</literal>. <literal>yes</literal> means
manpages are already installed compressed,
<literal>no</literal> means they are not, and
<literal>maybe</literal> means the software already respects
the value of <makevar>NO_MANCOMPRESS</makevar> so
<filename>bsd.port.mk</filename> does not have to do anything
special.</para>
<para><makevar>MANCOMPRESSED</makevar> is automatically set to
<literal>yes</literal> if <makevar>USE_IMAKE</makevar> is set
and <makevar>NO_INSTALL_MANPAGES</makevar> is not set, and to
<literal>no</literal> otherwise. You do not have to
explicitly define it unless the default is not suitable for
your port.</para>
<para>If your port anchors its man tree somewhere other than
<makevar>PREFIX</makevar>, you can use the
<makevar>MANPREFIX</makevar> to set it. Also, if only
manpages in certain sections go in a non-standard place, such
as some <literal>perl</literal> modules ports, you can set
individual man paths using
<makevar>MAN<replaceable>sect</replaceable>PREFIX</makevar>
(where <replaceable>sect</replaceable> is one of
<literal>1-9</literal>, <literal>L</literal> or
<literal>N</literal>).</para>
<para>If your manpages go to language-specific subdirectories,
set the name of the languages to <makevar>MANLANG</makevar>.
The value of this variable defaults to <literal>""</literal>
(i.e., English only).</para>
<para>Here is an example that puts it all together.</para>
<programlisting>MAN1= foo.1
MAN3= bar.3
MAN4= baz.4
MLINKS= foo.1 alt-name.8
MANLANG= "" ja
MAN3PREFIX= ${PREFIX}/share/foobar
MANCOMPRESSED= yes</programlisting>
<para>This states that six files are installed by this
port;</para>
<programlisting>${MANPREFIX}/man/man1/foo.1.gz
${MANPREFIX}/man/ja/man1/foo.1.gz
${PREFIX}/share/foobar/man/man3/bar.3.gz
${PREFIX}/share/foobar/man/ja/man3/bar.3.gz
${MANPREFIX}/man/man4/baz.4.gz
${MANPREFIX}/man/ja/man4/baz.4.gz</programlisting>
<para>Additionally
<filename>${MANPREFIX}/man/man8/alt-name.8.gz</filename> may
or may not be installed by your port. Regardless, a symlink
will be made to join the foo(1) manpage and alt-name(8)
manpage.</para>
<para>If only some manpages are translated, you can use several
variables dynamically created from <makevar>MANLANG</makevar>
content:</para>
<programlisting>MANLANG= "" de ja
MAN1= foo.1
MAN1_EN= bar.1
MAN3_DE= baz.3</programlisting>
<para>This translates into this list of files:</para>
<programlisting>${MANPREFIX}/man/man1/foo.1.gz
${MANPREFIX}/man/de/man1/foo.1.gz
${MANPREFIX}/man/ja/man1/foo.1.gz
${MANPREFIX}/man/man1/bar.1.gz
${MANPREFIX}/man/de/man3/baz.3.gz</programlisting>
</sect1>
<sect1 id="makefile-info">
<title>Info Files</title>
<para>If your package needs to install GNU info files, they
should be listed in the <makevar>INFO</makevar> variable
(without the trailing <literal>.info</literal>), one entry per
document. These files are assumed to be installed to
<filename><makevar>PREFIX</makevar>/<makevar>INFO_PATH</makevar></filename>.
You can change <makevar>INFO_PATH</makevar> if your package
uses a different location. However, this is not recommended.
These entries contain just the path relative to
<filename><makevar>PREFIX</makevar>/<makevar>INFO_PATH</makevar></filename>.
For example, <filename role="package">lang/gcc34</filename>
installs info files to
<filename><makevar>PREFIX</makevar>/<makevar>INFO_PATH</makevar>/gcc34</filename>,
and <makevar>INFO</makevar> will be something like
this:</para>
<programlisting>INFO= gcc34/cpp gcc34/cppinternals gcc34/g77 ...</programlisting>
<para>Appropriate installation/de-installation code will be
automatically added to the temporary
<filename>pkg-plist</filename> before package
registration.</para>
</sect1>
<sect1 id="makefile-options">
<title>Makefile Options</title>
<para>Many applications can be built with optional or differing
configurations. Examples include choice of natural (human)
language, GUI versus command-line, or type of database to
support. Users may need a different configuration than the
default, so the ports system provides hooks the port author
can use to control which variant will be built. Supporting
these options properly will make users happy, and effectively
provide two or more ports for the price of one.</para>
<sect2>
<title>Knobs</title>
<sect3>
<title><makevar>WITH_<replaceable>*</replaceable></makevar>
and
<makevar>WITHOUT_<replaceable>*</replaceable></makevar></title>
<para>These variables are designed to be set by the system
administrator. There are many that are standardized in
the <ulink
url="http://svn.FreeBSD.org/ports/head/KNOBS?view=markup"><filename>ports/KNOBS</filename></ulink>
file.</para>
<para>When creating a port, do not make knob names specific
to a given application. For example in Avahi port, use
<makevar>WITHOUT_MDNS</makevar> instead of
<makevar>WITHOUT_AVAHI_MDNS</makevar>.</para>
<note>
<para>You should not assume that a
<makevar>WITH_<replaceable>*</replaceable></makevar>
necessarily has a corresponding
<makevar>WITHOUT_<replaceable>*</replaceable></makevar>
variable and vice versa. In general, the default is
simply assumed.</para>
</note>
<note>
<para>Unless otherwise specified, these variables are only
tested for being set or not set, rather than being set
to a specific value such as <literal>YES</literal>
or <literal>NO</literal>.</para>
</note>
<table frame="none">
<title>Common
<makevar>WITH_<replaceable>*</replaceable></makevar> and
<makevar>WITHOUT_<replaceable>*</replaceable></makevar>
Variables</title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Means</entry>
</row>
</thead>
<tbody>
<row id="knobs-without-nls">
<entry><makevar>WITHOUT_NLS</makevar></entry>
<entry>If set, says that internationalization is not
needed, which can save compile time. By default,
internationalization is used.</entry>
</row>
<row>
<entry><makevar>WITH_OPENSSL_BASE</makevar></entry>
<entry>Use the version of OpenSSL in the base
system.</entry>
</row>
<row>
<entry><makevar>WITH_OPENSSL_PORT</makevar></entry>
<entry>Installs the version of OpenSSL from
<filename
role="package">security/openssl</filename>, even
if the base is up to date.</entry>
</row>
<row>
<entry><makevar>WITHOUT_X11</makevar></entry>
<entry>Ports that can be built both with and
without X support are normally
built with X support. If this variable is
defined, then the version that does not have X
support will be built instead.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect3>
<sect3>
<title>Knob Naming</title>
<para>Porters should use like-named knobs, both
for the benefit of end-users and to help keep the number
of knob names down. A list of popular knob names can be
found in the <ulink
url="http://svn.FreeBSD.org/ports/head/KNOBS?view=markup"><filename>KNOBS</filename></ulink>
file.</para>
<para>Knob names should reflect what the knob is and does.
When a port has a lib-prefix in the
<makevar>PORTNAME</makevar> the lib-prefix should be
dropped in knob naming.</para>
</sect3>
</sect2>
<sect2>
<title><makevar>OPTIONS</makevar></title>
<sect3>
<title>Background</title>
<para>The <makevar>OPTIONS_*</makevar> variables give the
user installing the port a dialog showing the available
options, and then saves those options to
<filename>/var/db/ports/<makevar>${UNIQUENAME}</makevar>/options</filename>.
The next time the port is built, the options are
reused.</para>
<para>When the user runs <command>make config</command> (or
runs <command>make build</command> for the first time),
the framework checks for
<filename>/var/db/ports/<makevar>${UNIQUENAME}</makevar>/options</filename>.
If that file does not exist, the values of
<makevar>OPTIONS_*</makevar> are used, and a dialog box is
displayed where the options can be enabled or disabled.
Then the <filename>options</filename> file is saved and
the configured variables are used when building the
port.</para>
<para>If a new version of the port adds new
<makevar>OPTIONS</makevar>, the dialog will be presented
to the user with the saved values of old
<makevar>OPTIONS</makevar> prefilled.</para>
<para><command>make showconfig</command> shows the
saved configuration. Use <command>make rmconfig</command>
to remove the saved configuration.</para>
</sect3>
<sect3>
<title>Syntax</title>
<para><makevar>OPTIONS_DEFINE</makevar> contains a list of
<makevar>OPTIONS</makevar> to be used. These are
independent of each other and are not grouped:</para>
<programlisting>OPTIONS_DEFINE= OPT1 OPT2</programlisting>
<para>Once defined, <makevar>OPTIONS</makevar> are
described (optional, but strongly recommended):</para>
<programlisting>OPT1_DESC= Describe OPT1
OPT2_DESC= Describe OPT2
OPT3_DESC= Describe OPT3
OPT4_DESC= Describe OPT4
OPT5_DESC= Describe OPT5
OPT6_DESC= Describe OPT6</programlisting>
<tip>
<para><filename>ports/Mk/bsd.options.desc.mk</filename>
has descriptions for many common
<makevar>OPTIONS</makevar>; there is usually no need
to override these.</para>
</tip>
<tip>
<para>When describing options, view it from the
perspective of the user: <quote>What does it do?</quote>
and <quote>Why would I want to enable this?</quote> Do
not just repeat the name. For example, describing the
<literal>NLS</literal> option as
<quote>include NLS support</quote> does not help the
user, who can already see the option name but may not
know what it means. Describing it as <quote>Native
Language Support via gettext utilities</quote> is
much more helpful.</para>
</tip>
<para><makevar>OPTIONS</makevar> can be grouped as radio
choices, where only one choice from each group is
allowed:</para>
<programlisting>OPTIONS_SINGLE= SG1
OPTIONS_SINGLE_SG1= OPT3 OPT4</programlisting>
<para><makevar>OPTIONS</makevar> can also be grouped as
<quote>multiple-choice</quote> lists, where
<emphasis>at least one</emphasis> option must be
enabled:</para>
<programlisting>OPTIONS_MULTI= MG1
OPTIONS_MULTI_MG1= OPT5 OPT6</programlisting>
<para><makevar>OPTIONS_MULTI</makevar> and
<makevar>OPTIONS_SINGLE</makevar> can also allow zero
choices by including the group in
<makevar>OPTIONS_DEFINE</makevar>:</para>
<programlisting>OPTIONS_DEFINE= MG1
OPTIONS_MULTI= MG1
OPTIONS_MULTI_MG1= OPT5 OPT6</programlisting>
<para>This group then requires at least one
<makevar>OPTION</makevar> from <makevar>MG1</makevar>
only if the new <makevar>MG1</makevar>
<makevar>OPTION</makevar> is selected. Experimentation
is encouraged to ensure that this is understood.</para>
<para><makevar>OPTIONS</makevar> are unset by default,
unless they are listed in
<makevar>OPTIONS_DEFAULT</makevar>:</para>
<programlisting>OPTIONS_DEFAULT= OPT1 OPT3 OPT6</programlisting>
<para><makevar>OPTIONS</makevar> definitions must appear
before the inclusion of
<filename>bsd.port.options.mk</filename>. The
<makevar>PORT_OPTIONS</makevar> variable can only be
tested after the inclusion of
<filename>bsd.port.options.mk</filename>. Inclusion of
<filename>bsd.port.pre.mk</filename> can be used instead,
too, and is still widely used in ports written before the
introduction of <filename>bsd.port.options.mk</filename>.
But be aware that some variables will not work as expected
after the inclusion of
<filename>bsd.port.pre.mk</filename>, typically some
<makevar>USE_*</makevar> flags.</para>
<example id="ports-options-simple-use">
<title>Simple Use of <makevar>OPTIONS</makevar></title>
<programlisting>OPTIONS_DEFINE= FOO BAR
FOO_DESC= Enable option foo
BAR_DESC= Support feature bar
OPTIONS_DEFAULT=FOO
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MFOO}
CONFIGURE_ARGS+=--with-foo
.else
CONFIGURE_ARGS+=--without-foo
.endif
.if ${PORT_OPTIONS:MBAR}
RUN_DEPENDS+= bar:${PORTSDIR}/bar/bar
.endif
.include <bsd.port.mk></programlisting>
</example>
<example id="ports-options-practical-use">
<title>Practical Use of <makevar>OPTIONS</makevar></title>
<programlisting>OPTIONS_DEFINE= EXAMPLES
OPTIONS_SINGLE= BACKEND
OPTIONS_SINGLE_BACKEND= MYSQL PGSQL BDB
OPTIONS_MULTI= AUTH
OPTIONS_MULTI_AUTH= LDAP PAM SSL
EXAMPLES_DESC= Install extra examples
MYSQL_DESC= Use MySQL as backend
PGSQL_DESC= Use PostgreSQL as backend
BDB_DESC= Use Berkeley DB as backend
LDAP_DESC= Build with LDAP authentication support
PAM_DESC= Build with PAM support
SSL_DESC= Build with OpenSSL support
OPTIONS_DEFAULT= PGSQL LDAP SSL
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL= yes
CONFIGURE_ARGS+= --with-postgres
.else
CONFIGURE_ARGS+= --without-postgres
.endif
.if ${PORT_OPTIONS:MICU}
LIB_DEPENDS+= icuuc:${PORTSDIR}/devel/icu
.endif
# Check other OPTIONS
.include <bsd.port.mk></programlisting>
</example>
<example id="ports-options-old-style-use">
<title>Old-Style Use of <makevar>OPTIONS</makevar></title>
<programlisting>OPTIONS= FOO "Enable option foo" On
.include <bsd.port.pre.mk>
.if defined(WITHOUT_FOO)
CONFIGURE_ARGS+= --without-foo
.else
CONFIGURE_ARGS+= --with-foo
.endif
.include <bsd.port.post.mk></programlisting>
</example>
<important>
<para>This method of using <makevar>OPTIONS</makevar>
is deprecated, and will be removed at some point.
Do not use this method for new ports.</para>
</important>
</sect3>
</sect2>
<sect2>
<title>Feature Auto-Activation</title>
<para>When using a GNU configure script, keep an eye on which
optional features are activated by auto-detection.
Explicitly disable optional features you do not wish to be
used by passing respective <literal>--without-xxx</literal>
or <literal>--disable-xxx</literal> in
<makevar>CONFIGURE_ARGS</makevar>.</para>
<example>
<title>Wrong Handling of an Option</title>
<programlisting>.if ${PORT_OPTIONS:MFOO}
LIB_DEPENDS+= foo:${PORTSDIR}/devel/foo
CONFIGURE_ARGS+= --enable-foo
.endif</programlisting>
</example>
<para>In the example above, imagine a library libfoo is
installed on the system. The user does not want this
application to use libfoo, so he toggled the option off in
the <literal>make config</literal> dialog. But the
application's configure script detects the library present
in the system and includes its support in the resulting
executable. Now when the user decides to remove libfoo from
the system, the ports system does not protest (no dependency
on libfoo was recorded) but the application breaks.</para>
<example>
<title>Correct Handling of an Option</title>
<programlisting>.if ${PORT_OPTIONS:MFOO}
LIB_DEPENDS+= foo:${PORTSDIR}/devel/foo
CONFIGURE_ARGS+= --enable-foo
.else
CONFIGURE_ARGS+= --disable-foo
.endif</programlisting>
</example>
<para>In the second example, the library libfoo is explicitly
disabled. The configure script does not enable related
features in the application, despite library's presence in
the system.</para>
</sect2>
</sect1>
<sect1 id="makefile-wrkdir">
<title>Specifying the Working Directory</title>
<para>Each port is extracted in to a working directory, which
must be writable. The ports system defaults to having the
<makevar>DISTFILES</makevar> unpack in to a directory called
<literal>${DISTNAME}</literal>. In other words, if you have
set:</para>
<programlisting>PORTNAME= foo
PORTVERSION= 1.0</programlisting>
<para>then the port's distribution files contain a top-level
directory, <filename>foo-1.0</filename>, and the rest of the
files are located under that directory.</para>
<para>There are a number of variables you can override if that
is not the case.</para>
<sect2>
<title><makevar>WRKSRC</makevar></title>
<para>The variable lists the name of the directory that is
created when the application's distfiles are extracted. If
our previous example extracted into a directory called
<filename>foo</filename> (and not
<filename>foo-1.0</filename>) you would write:</para>
<programlisting>WRKSRC= ${WRKDIR}/foo</programlisting>
<para>or possibly</para>
<programlisting>WRKSRC= ${WRKDIR}/${PORTNAME}</programlisting>
</sect2>
<sect2>
<title><makevar>NO_WRKSUBDIR</makevar></title>
<para>If the port does not extract in to a subdirectory at all
then you should set <makevar>NO_WRKSUBDIR</makevar> to
indicate that.</para>
<programlisting>NO_WRKSUBDIR= yes</programlisting>
</sect2>
</sect1>
<sect1 id="conflicts">
<title>Conflict Handling</title>
<para>There are three different variables to register a conflict
between packages and ports: <makevar>CONFLICTS</makevar>,
<makevar>CONFLICTS_INSTALL</makevar> and
<makevar>CONFLICTS_BUILD</makevar>.</para>
<note>
<para>The conflict variables automatically set the variable
<makevar>IGNORE</makevar>, which is more fully documented
in <xref linkend="dads-noinstall"/>.</para>
</note>
<para>When removing one of several conflicting ports, it is
advisable to retain the <makevar>CONFLICTS</makevar> entries
in those other ports for a few months to cater for users who
only update once in a while.</para>
<sect2>
<title><makevar>CONFLICTS_INSTALL</makevar></title>
<para>If your package cannot coexist with other packages
(because of file conflicts, runtime incompatibilities,
etc.), list the other package names in the
<makevar>CONFLICTS_INSTALL</makevar> variable. You can use
shell globs like <literal>*</literal> and
<literal>?</literal> here. Package names should be
enumerated the same way they appear in
<filename>/var/db/pkg</filename>. Please make sure that
<makevar>CONFLICTS_INSTALL</makevar> does not match this
port's package itself. Otherwise enforcing its installation
with <makevar>FORCE_PKG_REGISTER</makevar> will no longer
work. The CONFLICTS_INSTALL check is done after the build
stage and prior to the install stage.</para>
</sect2>
<sect2>
<title><makevar>CONFLICTS_BUILD</makevar></title>
<para>If your port cannot be built if a certain port is
already installed, list the other port names in the
<makevar>CONFLICTS_BUILD</makevar> variable. You can use
shell globs like <literal>*</literal> and
<literal>?</literal> here. Package names should be
enumerated the same way they appear in
<filename>/var/db/pkg</filename>. The CONFLICTS_BUILD check
is done prior to the build stage. Build conflicts are not
recorded in the resulting package.</para>
</sect2>
<sect2>
<title><makevar>CONFLICTS</makevar></title>
<para>If your port cannot be built if a certain port is
already installed and the resulting package cannot coexist
with the other package, list the other package name in the
<makevar>CONFLICTS</makevar> variable. You can use shell
globs like <literal>*</literal> and <literal>?</literal>
here. Packages names should be enumerated the same way they
appear in <filename>/var/db/pkg</filename>. Please make
sure that <makevar>CONFLICTS_INSTALL</makevar> does not
match this port's package itself. Otherwise enforcing its
installation with <makevar>FORCE_PKG_REGISTER</makevar> will
no longer work. The CONFLICTS check is done prior to the
build stage and prior to the install stage.</para>
</sect2>
</sect1>
<sect1 id="install">
<title>Installing Files</title>
<sect2 id="install-macros">
<title><makevar>INSTALL_*</makevar> Macros</title>
<para>Do use the macros provided in
<filename>bsd.port.mk</filename> to ensure correct modes and
ownership of files in your own
<maketarget>*-install</maketarget> targets.</para>
<itemizedlist>
<listitem>
<para><makevar>INSTALL_PROGRAM</makevar> is a command to
install binary executables.</para>
</listitem>
<listitem>
<para><makevar>INSTALL_SCRIPT</makevar> is a command to
install executable scripts.</para>
</listitem>
<listitem>
<para><makevar>INSTALL_LIB</makevar> is a command to
install shared libraries.</para>
</listitem>
<listitem>
<para><makevar>INSTALL_KLD</makevar> is a command to
install kernel loadable modules. Some architectures
do not like having the modules stripped, so
use this command instead of
<makevar>INSTALL_PROGRAM</makevar>.</para>
</listitem>
<listitem>
<para><makevar>INSTALL_DATA</makevar> is a command to
install sharable data.</para>
</listitem>
<listitem>
<para><makevar>INSTALL_MAN</makevar> is a command to
install manpages and other documentation (it does not
compress anything).</para>
</listitem>
</itemizedlist>
<para>These are basically the <command>install</command>
command with all the appropriate flags.</para>
</sect2>
<sect2 id="install-strip">
<title>Stripping Binaries and Shared Libraries</title>
<para>Do not strip binaries manually unless you have to. All
binaries should be stripped, but the
<makevar>INSTALL_PROGRAM</makevar> macro will install and
strip a binary at the same time (see the next section). The
<makevar>INSTALL_LIB</makevar> macro does the same thing to
shared libraries.</para>
<para>If you need to strip a file, but wish to use neither
<makevar>INSTALL_PROGRAM</makevar> nor
<makevar>INSTALL_LIB</makevar> macros,
<makevar>${STRIP_CMD}</makevar> will strip your program or
shared library. This is typically done within the
<maketarget>post-install</maketarget> target. For
example:</para>
<programlisting>post-install:
${STRIP_CMD} ${PREFIX}/bin/xdl</programlisting>
<para>Use the &man.file.1; command on the installed executable
to check whether the binary is stripped or not. If it does
not say <literal>not stripped</literal>, it is stripped.
Additionally, &man.strip.1; will not strip a previously
stripped program; it will instead exit cleanly.</para>
</sect2>
<sect2 id="install-copytree">
<title>Installing a Whole Tree of Files</title>
<para>Sometimes, there is a need to install a big number of
files, preserving their hierarchical organization, i.e.,
copying over a whole directory tree from
<makevar>WRKSRC</makevar> to a target directory under
<makevar>PREFIX</makevar>.</para>
<para>Two macros exist for this situation. The advantage of
using these macros instead of <command>cp</command> is that
they guarantee proper file ownership and permissions on
target files. The first macro,
<makevar>COPYTREE_BIN</makevar>, will set all the installed
files to be executable, thus being suitable for installing
into <filename><makevar>PREFIX</makevar>/bin</filename>.
The second macro, <makevar>COPYTREE_SHARE</makevar>, does
not set executable permissions on files, and is therefore
suitable for installing files under
<filename><makevar>PREFIX</makevar>/share</filename>
target.</para>
<programlisting>post-install:
${MKDIR} ${EXAMPLESDIR}
(cd ${WRKSRC}/examples/ && ${COPYTREE_SHARE} \* ${EXAMPLESDIR})</programlisting>
<para>This example will install the contents of
<filename>examples</filename> directory in the vendor
distfile to the proper examples location of your
port.</para>
<programlisting>post-install:
${MKDIR} ${DATADIR}/summer
(cd ${WRKSRC}/temperatures/ && ${COPYTREE_SHARE} "June July August" ${DATADIR}/summer/)</programlisting>
<para>And this example will install the data of summer months
to the <filename>summer</filename> subdirectory of a
<filename><makevar>DATADIR</makevar></filename>.</para>
<para>Additional <command>find</command> arguments can be
passed via the third argument to the
<makevar>COPYTREE_*</makevar> macros. For example, to
install all files from the first example except Makefiles,
one can use the following command.</para>
<programlisting>post-install:
${MKDIR} ${EXAMPLESDIR}
(cd ${WRKSRC}/examples/ && \
${COPYTREE_SHARE} \* ${EXAMPLESDIR} "! -name Makefile")</programlisting>
<para>Note that these macros does not add the installed files
to <filename>pkg-plist</filename>. You still need to list
them.</para>
</sect2>
<sect2 id="install-documentation">
<title>Install Additional Documentation</title>
<para>If your software has some documentation other than the
standard man and info pages that you think is useful for the
user, install it under
<filename><makevar>PREFIX</makevar>/share/doc</filename>.
This can be done, like the previous item, in the
<maketarget>post-install</maketarget> target.</para>
<para>Create a new directory for your port. The directory
name should reflect what the port is. This usually means
<makevar>PORTNAME</makevar>. However, if you think the user
might want different versions of the port to be installed at
the same time, you can use the whole
<makevar>PKGNAME</makevar>.</para>
<para>Make the installation dependent on the variable
<makevar>NOPORTDOCS</makevar> so that users can disable it
in <filename>/etc/make.conf</filename>, like this:</para>
<programlisting>post-install:
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_MAN} ${WRKSRC}/docs/xvdocs.ps ${DOCSDIR}
.endif</programlisting>
<para>Here are some handy variables and how they are expanded
by default when usedin the
<filename>Makefile</filename>:</para>
<itemizedlist>
<listitem>
<para><makevar>DATADIR</makevar> gets expanded to
<filename><makevar>PREFIX</makevar>/share/<makevar>PORTNAME</makevar></filename>.</para>
</listitem>
<listitem>
<para><makevar>DATADIR_REL</makevar> gets expanded to
<filename>share/<makevar>PORTNAME</makevar></filename>.</para>
</listitem>
<listitem>
<para><makevar>DOCSDIR</makevar> gets expanded to
<filename><makevar>PREFIX</makevar>/share/doc/<makevar>PORTNAME</makevar></filename>.</para>
</listitem>
<listitem>
<para><makevar>DOCSDIR_REL</makevar> gets expanded to
<filename>share/doc/<makevar>PORTNAME</makevar></filename>.</para>
</listitem>
<listitem>
<para><makevar>EXAMPLESDIR</makevar> gets expanded to
<filename><makevar>PREFIX</makevar>/share/examples/<makevar>PORTNAME</makevar></filename>.</para>
</listitem>
<listitem>
<para><makevar>EXAMPLESDIR_REL</makevar> gets expanded to
<filename>share/examples/<makevar>PORTNAME</makevar></filename>.</para>
</listitem>
</itemizedlist>
<note>
<para><makevar>NOPORTDOCS</makevar> only controls additional
documentation installed in <makevar>DOCSDIR</makevar>. It
does not apply to standard man pages and info pages.
Things installed in <makevar>DATADIR</makevar> and
<makevar>EXAMPLESDIR</makevar> are controlled by
<makevar>NOPORTDATA</makevar> and
<makevar>NOPORTEXAMPLES</makevar>, respectively.</para>
</note>
<para>These variables are exported to
<makevar>PLIST_SUB</makevar>. Their values will appear
there as pathnames relative to
<filename><makevar>PREFIX</makevar></filename> if possible.
That is,
<filename>share/doc/<makevar>PORTNAME</makevar></filename>
will be substituted for <literal>%%DOCSDIR%%</literal> in
the packing list by default, and so on. (See more on
<filename>pkg-plist</filename> substitution <link
linkend="plist-sub">here</link>.)</para>
<para>All conditionally installed documentation files and
directories should be included in
<filename>pkg-plist</filename> with the
<literal>%%PORTDOCS%%</literal> prefix, for example:</para>
<programlisting>%%PORTDOCS%%%%DOCSDIR%%/AUTHORS
%%PORTDOCS%%%%DOCSDIR%%/CONTACT
%%PORTDOCS%%@dirrm %%DOCSDIR%%</programlisting>
<para>As an alternative to enumerating the documentation files
in <filename>pkg-plist</filename>, a port can set the
variable <makevar>PORTDOCS</makevar> to a list of file names
and shell glob patterns to add to the final packing list.
The names will be relative to <makevar>DOCSDIR</makevar>.
Therefore, a port that utilizes <makevar>PORTDOCS</makevar>
and uses a non-default location for its documentation should
set <makevar>DOCSDIR</makevar> accordingly. If a directory
is listed in <makevar>PORTDOCS</makevar> or matched by a
glob pattern from this variable, the entire subtree of
contained files and directories will be registered in the
final packing list. If <makevar>NOPORTDOCS</makevar> is
defined then files and directories listed in
<makevar>PORTDOCS</makevar> would not be installed and
neither would be added to port packing list. Installing the
documentation at <makevar>PORTDOCS</makevar> as shown above
remains up to the port itself. A typical example of
utilizing <makevar>PORTDOCS</makevar> looks as
follows:</para>
<programlisting>PORTDOCS= README.* ChangeLog docs/*</programlisting>
<note>
<para>The equivalents of <makevar>PORTDOCS</makevar> for
files installed under <makevar>DATADIR</makevar> and
<makevar>EXAMPLESDIR</makevar> are
<makevar>PORTDATA</makevar> and
<makevar>PORTEXAMPLES</makevar>, respectively.</para>
<para>You can also use the <filename>pkg-message</filename>
file to display messages upon installation. See <link
linkend="porting-message">the section on using
<filename>pkg-message</filename></link> for details. The
<filename>pkg-message</filename> file does not need to be
added to <filename>pkg-plist</filename>.</para>
</note>
</sect2>
<sect2 id="install-subdirs">
<title>Subdirectories Under <makevar>PREFIX</makevar></title>
<para>Try to let the port put things in the right
subdirectories of <makevar>PREFIX</makevar>. Some ports
lump everything and put it in the subdirectory with the
port's name, which is incorrect. Also, many ports put
everything except binaries, header files and manual pages in
a subdirectory of <filename>lib</filename>, which does not
work well with the BSD paradigm. Many of the files should
be moved to one of the following: <filename>etc</filename>
(setup/configuration files), <filename>libexec</filename>
(executables started internally), <filename>sbin</filename>
(executables for superusers/managers),
<filename>info</filename> (documentation for info browser)
or <filename>share</filename> (architecture independent
files). See &man.hier.7; for details; the rules governing
<filename>/usr</filename> pretty much apply to
<filename>/usr/local</filename> too. The exception are
ports dealing with USENET <quote>news</quote>. They may use
<filename><makevar>PREFIX</makevar>/news</filename> as a
destination for their files.</para>
</sect2>
</sect1>
</chapter>
<chapter id="special">
<title>Special Considerations</title>
<para>There are some more things you have to take into account
when you create a port. This section explains the most common
of those.</para>
<sect1 id="porting-shlibs">
<title>Shared Libraries</title>
<para>If your port installs one or more shared libraries, define
a <makevar>USE_LDCONFIG</makevar> make variable, which will
instruct a <filename>bsd.port.mk</filename> to run
<literal>${LDCONFIG} -m</literal> on the directory
where the new library is installed (usually
<filename><makevar>PREFIX</makevar>/lib</filename>) during
<maketarget>post-install</maketarget> target to register it
into the shared library cache. This variable, when defined,
will also facilitate addition of an appropriate
<literal>@exec /sbin/ldconfig -m</literal> and
<literal>@unexec /sbin/ldconfig -R</literal> pair into your
<filename>pkg-plist</filename> file, so that a user who
installed the package can start using the shared library
immediately and de-installation will not cause the system to
still believe the library is there.</para>
<programlisting>USE_LDCONFIG= yes</programlisting>
<para>If you need, you can override the default directory by
setting the <makevar>USE_LDCONFIG</makevar> value to a list of
directories into which shared libraries are to be installed.
For example if your port installs shared libraries into
<filename><makevar>PREFIX</makevar>/lib/foo</filename> and
<filename><makevar>PREFIX</makevar>/lib/bar</filename>
directories you could use the following in your
<filename>Makefile</filename>:</para>
<programlisting>USE_LDCONFIG= ${PREFIX}/lib/foo ${PREFIX}/lib/bar</programlisting>
<para>Please double-check, often this is not necessary at all or
can be avoided through <literal>-rpath</literal> or setting
<envar>LD_RUN_PATH</envar> during linking (see <filename
role="package">lang/moscow_ml</filename> for an example), or
through a shell-wrapper which sets
<makevar>LD_LIBRARY_PATH</makevar> before invoking the binary,
like <filename role="package">www/seamonkey</filename>
does.</para>
<para>When installing 32-bit libraries on 64-bit system, use
<makevar>USE_LDCONFIG32</makevar> instead.</para>
<para>Try to keep shared library version numbers in the
<filename>libfoo.so.0</filename> format. Our runtime linker
only cares for the major (first) number.</para>
<para>When the major library version number increments in the
update to the new port version, all other ports that link to
the affected library should have their
<makevar>PORTREVISION</makevar> incremented, to force
recompilation with the new library version.</para>
</sect1>
<sect1 id="porting-restrictions">
<title>Ports with Distribution Restrictions</title>
<para>Licenses vary, and some of them place restrictions on how
the application can be packaged, whether it can be sold for
profit, and so on.</para>
<important>
<para>It is your responsibility as a porter to read the
licensing terms of the software and make sure that the
FreeBSD project will not be held accountable for violating
them by redistributing the source or compiled binaries
either via FTP/HTTP or CD-ROM. If in doubt, please contact
the &a.ports;.</para>
</important>
<para>In situations like this, the variables described in the
following sections can be set.</para>
<sect2>
<title><makevar>NO_PACKAGE</makevar></title>
<para>This variable indicates that we may not generate a
binary package of the application. For instance, the
license may disallow binary redistribution, or it may
prohibit distribution of packages created from patched
sources.</para>
<para>However, the port's <makevar>DISTFILES</makevar> may be
freely mirrored on FTP/HTTP. They may also be distributed
on a CD-ROM (or similar media) unless
<makevar>NO_CDROM</makevar> is set as well.</para>
<para><makevar>NO_PACKAGE</makevar> should also be used if the
binary package is not generally useful, and the application
should always be compiled from the source code. For
example, if the application has configuration information
that is site specific hard coded in to it at compile time,
set <makevar>NO_PACKAGE</makevar>.</para>
<para><makevar>NO_PACKAGE</makevar> should be set to a string
describing the reason why the package should not be
generated.</para>
</sect2>
<sect2>
<title><makevar>NO_CDROM</makevar></title>
<para>This variable alone indicates that, although we are
allowed to generate binary packages, we may put neither
those packages nor the port's <makevar>DISTFILES</makevar>
onto a CD-ROM (or similar media) for resale. However, the
binary packages and the port's <makevar>DISTFILES</makevar>
will still be available via FTP/HTTP.</para>
<para> If this variable is set along with
<makevar>NO_PACKAGE</makevar>, then only the port's
<makevar>DISTFILES</makevar> will be available, and only via
FTP/HTTP.</para>
<para><makevar>NO_CDROM</makevar> should be set to a string
describing the reason why the port cannot be redistributed
on CD-ROM. For instance, this should be used if the port's
license is for <quote>non-commercial</quote> use
only.</para>
</sect2>
<sect2>
<title><makevar>NOFETCHFILES</makevar></title>
<para>Files defined in the <makevar>NOFETCHFILES</makevar>
variable are not fetchable from any of the
<makevar>MASTER_SITES</makevar>. An example of such a file
is when the file is supplied on CD-ROM by the vendor.</para>
<para>Tools which check for the availability of these files
on the <makevar>MASTER_SITES</makevar> should ignore these
files and not report about them.</para>
</sect2>
<sect2>
<title><makevar>RESTRICTED</makevar></title>
<para>Set this variable alone if the application's license
permits neither mirroring the application's
<makevar>DISTFILES</makevar> nor distributing the binary
package in any way.</para>
<para><makevar>NO_CDROM</makevar> or
<makevar>NO_PACKAGE</makevar> should not be set along with
<makevar>RESTRICTED</makevar> since the latter variable
implies the former ones.</para>
<para><makevar>RESTRICTED</makevar> should be set to a string
describing the reason why the port cannot be redistributed.
Typically, this indicates that the port contains proprietary
software and that the user will need to manually download
the <makevar>DISTFILES</makevar>, possibly after registering
for the software or agreeing to accept the terms of an
<acronym>EULA</acronym>.</para>
</sect2>
<sect2>
<title><makevar>RESTRICTED_FILES</makevar></title>
<para>When <makevar>RESTRICTED</makevar> or
<makevar>NO_CDROM</makevar> is set, this variable defaults
to <literal>${DISTFILES} ${PATCHFILES}</literal>, otherwise
it is empty. If only some of the distribution files are
restricted, then set this variable to list them.</para>
<para>Note that the port committer should add an entry to
<filename>/usr/ports/LEGAL</filename> for every listed
distribution file, describing exactly what the restriction
entails.</para>
</sect2>
<sect2>
<title>Examples</title>
<para>The preferred way to state "the distfiles for this port
must be fetched manually" is as follows:</para>
<programlisting>.if !exists(${DISTDIR}/${DISTNAME}${EXTRACT_SUFX})
IGNORE= may not be redistributed because of licensing reasons. Please visit <replaceable>some-website</replaceable> to accept their license and download ${DISTFILES} into ${DISTDIR}
.endif</programlisting>
<para>This both informs the user, and sets the proper metadata
on the user's machine for use by automated programs.</para>
<para>Note that this stanza must be preceded by an inclusion
of <filename>bsd.port.pre.mk</filename>.</para>
</sect2>
</sect1>
<sect1 id="building">
<title>Building Mechanisms</title>
<sect2 id="parallel-builds">
<title>Building Ports in Parallel</title>
<para>The &os; ports framework supports parallel building
using multiple <command>make</command> sub-processes, which
allows <acronym>SMP</acronym> systems to utilize all of
their available <acronym>CPU</acronym> power, allowing port
builds to be faster and more effective.</para>
<para>This is achieved by passing <makevar>-jX</makevar> flag
to &man.make.1; running on vendor code. Unfortunately, not
all ports handle parallel building well. Therefore it is
required to explicitly enable this feature by adding
<literal>MAKE_JOBS_SAFE=yes</literal> somewhere below the
dependency declaration section of the
<filename>Makefile</filename>.</para>
<para>Another option for controlling this feature from the
maintainer's point of view is the
<makevar>MAKE_JOBS_UNSAFE=yes</makevar> variable. It is
used when a port is known to be broken with
<makevar>-jX</makevar> and a user forces the use of multi
processor compilations for all ports in
<filename>/etc/make.conf</filename> with the
<literal>FORCE_MAKE_JOBS=yes</literal> variable.</para>
</sect2>
<sect2 id="using-make">
<title><command>make</command>, <command>gmake</command>, and
<command>imake</command></title>
<para>If your port uses <application>GNU make</application>,
set <literal>USE_GMAKE=yes</literal>.</para>
<table frame="none">
<title>Variables for Ports Related to
<application>gmake</application></title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Means</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_GMAKE</makevar></entry>
<entry>The port requires <command>gmake</command> to
build.</entry>
</row>
<row>
<entry><makevar>GMAKE</makevar></entry>
<entry>The full path for <command>gmake</command> if
it is not in the <envar>PATH</envar>.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>If your port is an X application that creates
<filename>Makefile</filename> files from
<filename>Imakefile</filename> files using
<application>imake</application>, then set
<literal>USE_IMAKE=yes</literal>. This will cause the
configure stage to automatically do an <command>xmkmf
-a</command>. If the <option>-a</option> flag is a
problem for your port, set <literal>XMKMF=xmkmf</literal>.
If the port uses <application>imake</application> but does
not understand the <maketarget>install.man</maketarget>
target, <literal>NO_INSTALL_MANPAGES=yes</literal> should be
set.</para>
<para>If your port's source <filename>Makefile</filename> has
something else than <maketarget>all</maketarget> as the main
build target, set <makevar>ALL_TARGET</makevar> accordingly.
Same goes for <maketarget>install</maketarget> and
<makevar>INSTALL_TARGET</makevar>.</para>
</sect2>
<sect2 id="using-configure">
<title><command>configure</command> Script</title>
<para>If your port uses the <command>configure</command>
script to generate <filename>Makefile</filename> files from
<filename>Makefile.in</filename> files, set
<literal>GNU_CONFIGURE=yes</literal>. If you want to give
extra arguments to the <command>configure</command> script
(the default argument is <literal>--prefix=${PREFIX}
--infodir=${PREFIX}/${INFO_PATH}
--mandir=${MANPREFIX}/man
--build=${CONFIGURE_TARGET}</literal>), set those
extra arguments in <makevar>CONFIGURE_ARGS</makevar>. Extra
environment variables can be passed using
<makevar>CONFIGURE_ENV</makevar> variable.</para>
<table frame="none">
<title>Variables for Ports That Use
<command>configure</command></title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Means</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>GNU_CONFIGURE</makevar></entry>
<entry>The port uses <command>configure</command>
script to prepare build.</entry>
</row>
<row>
<entry><makevar>HAS_CONFIGURE</makevar></entry>
<entry>Same as <makevar>GNU_CONFIGURE</makevar>,
except default configure target is not added to
<makevar>CONFIGURE_ARGS</makevar>.</entry>
</row>
<row>
<entry><makevar>CONFIGURE_ARGS</makevar></entry>
<entry>Additional arguments passed to
<command>configure</command> script.</entry>
</row>
<row>
<entry><makevar>CONFIGURE_ENV</makevar></entry>
<entry>Additional environment variables to be set
for <command>configure</command> script run.</entry>
</row>
<row>
<entry><makevar>CONFIGURE_TARGET</makevar></entry>
<entry>Override default configure target. Default
value is
<literal>${MACHINE_ARCH}-portbld-freebsd${OSREL}</literal>.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="using-scons">
<title>Using <command>scons</command></title>
<para>If your port uses <application>SCons</application>,
define <literal>USE_SCONS=yes</literal>.</para>
<table frame="none">
<title>Variables for Ports That Use
<command>scons</command></title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Means</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>SCONS_ARGS</makevar></entry>
<entry>Port specific SCons flags passed to the SCons
environment.</entry>
</row>
<row>
<entry><makevar>SCONS_BUILDENV</makevar></entry>
<entry>Variables to be set in system
environment.</entry>
</row>
<row>
<entry><makevar>SCONS_ENV</makevar></entry>
<entry>Variables to be set in SCons
environment.</entry>
</row>
<row>
<entry><makevar>SCONS_TARGET</makevar></entry>
<entry>Last argument passed to SCons, similar to
<makevar>MAKE_TARGET</makevar>.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>To make third party <filename>SConstruct</filename>
respect everything that is passed to SCons in
<makevar>SCONS_ENV</makevar> (that is, most importantly,
<makevar>CC/CXX/CFLAGS/CXXFLAGS</makevar>), patch the
<filename>SConstruct</filename> so build
<literal>Environment</literal> is constructed like
this:</para>
<programlisting>env = Environment(**ARGUMENTS)</programlisting>
<para>It may be then modified with
<literal>env.Append</literal> and
<literal>env.Replace</literal>.</para>
</sect2>
</sect1>
<sect1 id="using-autotools">
<title>Using GNU Autotools</title>
<sect2 id="using-autotools-introduction">
<title>Introduction</title>
<para>The various GNU autotools provide an abstraction
mechanism for building a piece of software over a wide
variety of operating systems and machine architectures.
Within the Ports Collection, an individual port can make use
of these tools via a simple construct:</para>
<programlisting>USE_AUTOTOOLS= <replaceable>tool</replaceable>:<replaceable>version</replaceable>[:<replaceable>operation</replaceable>] ...</programlisting>
<para>At the time of writing, <replaceable>tool</replaceable>
can be one of <literal>libtool</literal>,
<literal>libltdl</literal>, <literal>autoconf</literal>,
<literal>autoheader</literal>, <literal>automake</literal>
or <literal>aclocal</literal>.</para>
<para><replaceable>version</replaceable> specifies the
particular tool revision to be used (see
<literal>devel/{automake,autoconf,libtool}[0-9]+</literal>
for valid versions).</para>
<para><replaceable>operation</replaceable> is an optional
extension to modify how the tool is used.</para>
<para>Multiple tools can be specified at once, either by
including them all on a single line, or using the
<literal>+=</literal> Makefile construct.</para>
<para>Finally, there is the special tool, called
<literal>autotools</literal>, which is a convenience
function to bring in all available versions of the autotools
to allow for cross-development work. This can also be
accomplished by installing the
<literal>devel/autotools</literal> port.</para>
</sect2>
<sect2 id="using-libtool">
<title><command>libtool</command></title>
<para>Shared libraries using the GNU building framework
usually use <command>libtool</command> to adjust the
compilation and installation of shared libraries to match
the specifics of the underlying operating system. The usual
practice is to use copy of <command>libtool</command>
bundled with the application. In case you need to use
external <command>libtool</command>, you can use the version
provided by The Ports Collection:</para>
<programlisting>USE_AUTOTOOLS= libtool:<replaceable>version</replaceable>[:env]</programlisting>
<para>With no additional operations,
<literal>libtool:<replaceable>version</replaceable></literal>
tells the building framework to patch the configure script
with the system-installed copy of
<command>libtool</command>. The
<makevar>GNU_CONFIGURE</makevar> is implied. Further, a
number of make and shell variables will be assigned for
onward use by the port. See
<filename>bsd.autotools.mk</filename> for details.</para>
<para>With the <literal>:env</literal> operation, only the
environment will be set up.</para>
<para>Finally, <makevar>LIBTOOLFLAGS</makevar> and
<makevar>LIBTOOLFILES</makevar> can be optionally set to
override the most likely arguments to, and files patched by,
<command>libtool</command>. Most ports are unlikely to need
this. See <filename>bsd.autotools.mk</filename> for further
details.</para>
</sect2>
<sect2 id="using-libltdl">
<title><command>libltdl</command></title>
<para>Some ports make use of the <command>libltdl</command>
library package, which is part of the
<command>libtool</command> suite. Use of this library does
not automatically necessitate the use of
<command>libtool</command> itself, so a separate construct
is provided.</para>
<programlisting>USE_AUTOTOOLS= libltdl:<replaceable>version</replaceable></programlisting>
<para>Currently, all this does is to bring in a
<makevar>LIB_DEPENDS</makevar> on the appropriate
<command>libltdl</command> port, and is provided as a
convenience function to help eliminate any dependencies on
the autotools ports outside of the
<makevar>USE_AUTOTOOLS</makevar> framework. There are no
optional operations for this tool.</para>
</sect2>
<sect2 id="using-autoconf">
<title><command>autoconf</command> and
<command>autoheader</command></title>
<para>Some ports do not contain a configure script, but do
contain an autoconf template in the
<filename>configure.ac</filename> file. You can use the
following assignments to let <command>autoconf</command>
create the configure script, and also have
<command>autoheader</command> create template headers for
use by the configure script.</para>
<programlisting>USE_AUTOTOOLS= autoconf:<replaceable>version</replaceable>[:env]</programlisting>
<para>and</para>
<programlisting>USE_AUTOTOOLS= autoheader:<replaceable>version</replaceable></programlisting>
<para>which also implies the use of
<literal>autoconf:<replaceable>version</replaceable></literal>.</para>
<para>Similarly to <command>libtool</command>, the inclusion
of the optional <literal>:env</literal> operation simply
sets up the environment for further use. Without it,
patching and reconfiguration of the port is carried
out.</para>
<para>The additional optional variables
<makevar>AUTOCONF_ARGS</makevar> and
<makevar>AUTOHEADER_ARGS</makevar> can be overridden by the
port <filename>Makefile</filename> if specifically
requested. As with the <command>libtool</command>
equivalents, most ports are unlikely to need this.</para>
</sect2>
<sect2 id="using-automake">
<title><command>automake</command> and
<command>aclocal</command></title>
<para>Some packages only contain
<filename>Makefile.am</filename> files. These have to be
converted into <filename>Makefile.in</filename> files using
<command>automake</command>, and the further processed by
<command>configure</command> to generate an actual
<filename>Makefile</filename>.</para>
<para>Similarly, packages occasionally do not ship with
included <filename>aclocal.m4</filename> files, again
required to build the software. This can be achieved with
<command>aclocal</command>, which scans
<filename>configure.ac</filename> or
<filename>configure.in</filename>.</para>
<para><command>aclocal</command> has a similar relationship to
<command>automake</command> as <command>autoheader</command>
does to <command>autoconf</command>, described in the
previous section. <command>aclocal</command> implies the
use of <command>automake</command>, thus we have:</para>
<programlisting>USE_AUTOTOOLS= automake:<replaceable>version</replaceable>[:<replaceable>env</replaceable>]</programlisting>
<para>and</para>
<programlisting>USE_AUTOTOOLS= aclocal:<replaceable>version</replaceable></programlisting>
<para>which also implies the use of
<literal>automake:<replaceable>version</replaceable></literal>.</para>
<para>Similarly to <command>libtool</command> and
<command>autoconf</command>, the inclusion of the optional
<literal>:env</literal> operation simply sets up the
environment for further use. Without it, reconfiguration of
the port is carried out.</para>
<para>As with <command>autoconf</command> and
<command>autoheader</command>, both
<command>automake</command> and <command>aclocal</command>
have optional argument variables,
<makevar>AUTOMAKE_ARGS</makevar> and
<makevar>ACLOCAL_ARGS</makevar> respectively, which may be
overridden by the port <filename>Makefile</filename> if
required.</para>
</sect2>
</sect1>
<sect1 id="using-pkg-config">
<title>Using <literal>pkg-config</literal></title>
<para>If your ports requires <literal>pkg-config</literal>,
just set <makevar>USE_PKGCONFIG</makevar> to the following
possible values:</para>
<table frame="none">
<title>Values for <makevar>USE_PKGCONFIG</makevar></title>
<tgroup cols="2">
<thead>
<row>
<entry>Definition</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_PKGCONFIG= yes</makevar></entry>
<entry>The ports uses pkg-config only at build
time</entry>
</row>
<row>
<entry><makevar>USE_PKGCONFIG= build</makevar></entry>
<entry>The ports uses pkg-config only at build
time</entry>
</row>
<row>
<entry><makevar>USE_PKGCONFIG= run</makevar></entry>
<entry>The ports uses pkg-config only at run
time</entry>
</row>
<row>
<entry><makevar>USE_PKGCONFIG= both</makevar></entry>
<entry>The ports uses pkg-config both at build and run
time</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="using-gettext">
<title>Using GNU <literal>gettext</literal></title>
<sect2>
<title>Basic Usage</title>
<para>If your port requires <literal>gettext</literal>,
just set <makevar>USE_GETTEXT</makevar> to
<literal>yes</literal>, and your port will grow the
dependency on <filename
role="package">devel/gettext</filename>. The value of
<makevar>USE_GETTEXT</makevar> can also specify the required
version of the <literal>libintl</literal> library, the basic
part of <literal>gettext</literal>, but using this feature
is <emphasis>strongly discouraged</emphasis>: Your port
should work with just the current version of <filename
role="package">devel/gettext</filename>.</para>
<para>A rather common case is a port using
<literal>gettext</literal> and <command>configure</command>.
Generally, GNU <command>configure</command> should be able
to locate <literal>gettext</literal> automatically. If it
ever fails to, hints at the location of
<literal>gettext</literal> can be passed in
<envar>CPPFLAGS</envar> and <envar>LDFLAGS</envar> as
follows:</para>
<programlisting>USE_GETTEXT= yes
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" \
LDFLAGS="${LDFLAGS}"</programlisting>
<para>Of course, the code can be more compact if there are no
more flags to pass to <command>configure</command>:</para>
<programlisting>USE_GETTEXT= yes
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"</programlisting>
</sect2>
<sect2>
<title>Optional Usage</title>
<para>Some software products allow for disabling NLS, e.g.,
through passing <option>--disable-nls</option> to
<command>configure</command>. In that case, your port
should use <literal>gettext</literal> conditionally,
depending on the status of <link
linkend="knobs-without-nls"><makevar>WITHOUT_NLS</makevar></link>.
For ports of low to medium complexity, you can rely on the
following idiom:</para>
<programlisting>GNU_CONFIGURE= yes
.if !defined(WITHOUT_NLS)
USE_GETTEXT= yes
PLIST_SUB+= NLS=""
.else
CONFIGURE_ARGS+= --disable-nls
PLIST_SUB+= NLS="@comment "
.endif</programlisting>
<para>The next item on your to-do list is to arrange so that
the message catalog files are included in the packing list
conditionally. The <filename>Makefile</filename> part of
this task is already provided by the idiom. It is explained
in the section on <link linkend="plist-sub">advanced
<filename>pkg-plist</filename> practices</link>. In a
nutshell, each occurrence of <literal>%%NLS%%</literal> in
<filename>pkg-plist</filename> will be replaced by
<quote><literal>@comment </literal></quote> if NLS is
disabled, or by a null string if NLS is enabled.
Consequently, the lines prefixed by
<literal>%%NLS%%</literal> will become mere comments in the
final packing list if NLS is off; otherwise the prefix will
be just left out. All you need to do now is insert
<literal>%%NLS%%</literal> before each path to a message
catalog file in <filename>pkg-plist</filename>. For
example:</para>
<programlisting>%%NLS%%share/locale/fr/LC_MESSAGES/foobar.mo
%%NLS%%share/locale/no/LC_MESSAGES/foobar.mo</programlisting>
<para>In high complexity cases, you may need to use more
advanced techniques than the recipe given here, such as
<link linkend="plist-dynamic">dynamic packing list
generation</link>.</para>
</sect2>
<sect2>
<title>Handling Message Catalog Directories</title>
<para>There is a point to note about installing message
catalog files. The target directories for them, which
reside under
<filename><makevar>LOCALBASE</makevar>/share/locale</filename>,
should rarely be created and removed by your port. The most
popular languages have their respective directories listed
in <filename>/etc/mtree/BSD.local.dist</filename>; that is,
they are a part of the base system. The directories for
many other languages are governed by the <filename
role="package">devel/gettext</filename> port. You may
want to consult its <filename>pkg-plist</filename> and see
whether your port is going to install a message catalog file
for a unique language.</para>
</sect2>
</sect1>
<sect1 id="using-perl">
<title>Using <application>Perl</application></title>
<para>If <makevar>MASTER_SITES</makevar> is set to
<makevar>MASTER_SITE_PERL_CPAN</makevar>, then the preferred
value of <makevar>MASTER_SITE_SUBDIR</makevar> is the
top-level hierarchy name. For example, the recommended value
for <literal>p5-Module-Name</literal> is
<literal>Module</literal>. The top-level hierarchy can be
examined at <ulink
url="http://cpan.org/modules/by-module/">cpan.org</ulink>.
This keeps the port working when the author of the module
changes.</para>
<para>The exception to this rule is when the relevant directory
does not exist or the distfile does not exist in that
directory. In such case, using author's id as
<makevar>MASTER_SITE_SUBDIR</makevar> is allowed.</para>
<para>All of the tunable knobs below accept either
<literal>YES</literal> or a version string like
<literal>5.8.0+</literal>. <literal>YES</literal> means
that the port can be used with any of the supported
Perl versions. If a port only
works with specific versions of
Perl, it can be indicated with a
version string, specifying a minimum version (e.g.,
<literal>5.7.3+</literal>), a maximum version (e.g.,
<literal>5.8.0-</literal>) or an exact version (e.g.,
<literal>5.8.3</literal>).</para>
<table frame="none">
<title>Variables for Ports That Use
<application>Perl</application></title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_PERL5</makevar></entry>
<entry>The port uses Perl 5
to build and run.</entry>
</row>
<row>
<entry><makevar>USE_PERL5_BUILD</makevar></entry>
<entry>The port uses Perl 5
to build.</entry>
</row>
<row>
<entry><makevar>USE_PERL5_RUN</makevar></entry>
<entry>The port uses Perl 5
to run.</entry>
</row>
<row>
<entry><makevar>PERL</makevar></entry>
<entry>The full path of the Perl 5 interpreter,
either in the system or installed from a port, but
without the version number. Use this if you need to
replace <quote><literal>#!</literal></quote>lines in
scripts.</entry>
</row>
<row>
<entry><makevar>PERL_CONFIGURE</makevar></entry>
<entry>Configure using Perl's MakeMaker. It implies
<makevar>USE_PERL5</makevar>.</entry>
</row>
<row>
<entry><makevar>PERL_MODBUILD</makevar></entry>
<entry>Configure, build and install using Module::Build.
It implies <makevar>PERL_CONFIGURE</makevar>.</entry>
</row>
</tbody>
</tgroup>
<tgroup cols="2">
<thead>
<row>
<entry>Read only variables</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>PERL_VERSION</makevar></entry>
<entry>The full version of Perl
installed (e.g., <literal>5.8.9</literal>).</entry>
</row>
<row>
<entry><makevar>PERL_LEVEL</makevar></entry>
<entry>The installed Perl version as
an integer of the form <literal>MNNNPP</literal>
(e.g., <literal>500809</literal>).</entry>
</row>
<row>
<entry><makevar>PERL_ARCH</makevar></entry>
<entry>Where Perl stores architecture
dependent libraries. Defaults to
<literal>${ARCH}-freebsd</literal>.</entry>
</row>
<row>
<entry><makevar>PERL_PORT</makevar></entry>
<entry>Name of the Perl port that is
installed (e.g., <literal>perl5</literal>).</entry>
</row>
<row>
<entry><makevar>SITE_PERL</makevar></entry>
<entry>Directory name where site specific
Perl packages go. This value is
added to <makevar>PLIST_SUB</makevar>.</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>Ports of Perl modules which do not have an official
website should link to <hostid>cpan.org</hostid> in the WWW
line of <filename>pkg-descr</filename>. The
preferred URL form is
<literal>http://search.cpan.org/dist/Module-Name/</literal>
(including the trailing slash).</para>
</note>
<note>
<para>Do not use <literal>${SITE_PERL}</literal> in dependency
declarations. Doing so assumes that
<filename>bsd.perl.mk</filename> has been included, which is
not always true. Ports depending on this port will have
incorrect dependencies if this port's files move later in an
upgrade. The right way to declare Perl module dependencies
is shown in the example below.</para>
</note>
<example id="use-perl-dependency-example">
<title>Perl Dependency Example</title>
<programlisting>p5-IO-Tee>=0.64:${PORTSDIR}/devel/p5-IO-Tee</programlisting>
</example>
</sect1>
<sect1 id="using-x11">
<title>Using X11</title>
<sect2 id="x11-variables">
<title>X.Org Components</title>
<para>The X11 implementation available in The Ports Collection
is X.Org. If your application depends on X components, set
<makevar>USE_XORG</makevar> to the list of required
components. Available components, at the time of writing,
are:</para>
<para><literal>bigreqsproto compositeproto damageproto dmx
dmxproto dri2proto evieproto fixesproto fontcacheproto
fontenc fontsproto fontutil glproto ice inputproto kbproto
libfs oldx pciaccess pixman printproto randrproto
recordproto renderproto resourceproto scrnsaverproto sm
trapproto videoproto x11 xau xaw xaw6 xaw7 xbitmaps
xcmiscproto xcomposite xcursor xdamage xdmcp xevie xext
xextproto xf86bigfontproto xf86dgaproto xf86driproto
xf86miscproto xf86rushproto xf86vidmodeproto xfixes xfont
xfontcache xft xi xinerama xineramaproto xkbfile xkbui
xmu xmuu xorg-server xp xpm xprintapputil xprintutil
xproto xproxymngproto xrandr xrender xres xscrnsaver xt
xtrans xtrap xtst xv xvmc xxf86dga xxf86misc
xxf86vm</literal>.</para>
<para>Always up-to-date list can be found in
<filename>/usr/ports/Mk/bsd.xorg.mk</filename>.</para>
<para>The Mesa Project is an effort to provide free OpenGL
implementation. You can specify a dependency on various
components of this project with <makevar>USE_GL</makevar>
variable. Valid options are: <literal>glut, glu, glw, glew,
gl</literal> and <literal>linux</literal>. For backwards
compatibility, the value of <literal>yes</literal> maps to
<literal>glu</literal>.</para>
<example id="use-xorg-example">
<title>USE_XORG Example</title>
<programlisting>USE_XORG= xrender xft xkbfile xt xaw
USE_GL= glu</programlisting>
</example>
<para>Some ports define <makevar>USE_XLIB</makevar>, which
makes the port depend on all the 50 or so libraries. This
variable exists for backwards compatibility, as it predates
modular X.Org, and should not be used on new ports.</para>
<table frame="none">
<title>Variables for Ports That Use X</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_XLIB</makevar></entry>
<entry>The port uses the X libraries. Deprecated -
use a list of X.Org components in
<makevar>USE_XORG</makevar> variable
instead.</entry>
</row>
<row>
<entry><makevar>USE_IMAKE</makevar></entry>
<entry>The port uses <command>imake</command>.</entry>
</row>
<row>
<entry><makevar>XMKMF</makevar></entry>
<entry>Set to the path of <command>xmkmf</command> if
not in the <envar>PATH</envar>. Defaults to
<literal>xmkmf -a</literal>.</entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="none">
<title>Variables for Depending on Individual Parts of
X11</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>X_IMAKE_PORT</makevar></entry>
<entry>Port providing <command>imake</command> and
several other utilities used to build X11.</entry>
</row>
<row>
<entry><makevar>X_LIBRARIES_PORT</makevar></entry>
<entry>Port providing X11 libraries.</entry>
</row>
<row>
<entry><makevar>X_CLIENTS_PORT</makevar></entry>
<entry>Port providing X clients.</entry>
</row>
<row>
<entry><makevar>X_SERVER_PORT</makevar></entry>
<entry>Port providing X server.</entry>
</row>
<row>
<entry><makevar>X_FONTSERVER_PORT</makevar></entry>
<entry>Port providing font server.</entry>
</row>
<row>
<entry><makevar>X_PRINTSERVER_PORT</makevar></entry>
<entry>Port providing print server.</entry>
</row>
<row>
<entry><makevar>X_VFBSERVER_PORT</makevar></entry>
<entry>Port providing virtual framebuffer
server.</entry>
</row>
<row>
<entry><makevar>X_NESTSERVER_PORT</makevar></entry>
<entry>Port providing a nested X server.</entry>
</row>
<row>
<entry><makevar>X_FONTS_ENCODINGS_PORT</makevar></entry>
<entry>Port providing encodings for fonts.</entry>
</row>
<row>
<entry><makevar>X_FONTS_MISC_PORT</makevar></entry>
<entry>Port providing miscellaneous bitmap
fonts.</entry>
</row>
<row>
<entry><makevar>X_FONTS_100DPI_PORT</makevar></entry>
<entry>Port providing 100dpi bitmap fonts.</entry>
</row>
<row>
<entry><makevar>X_FONTS_75DPI_PORT</makevar></entry>
<entry>Port providing 75dpi bitmap fonts.</entry>
</row>
<row>
<entry><makevar>X_FONTS_CYRILLIC_PORT</makevar></entry>
<entry>Port providing cyrillic bitmap fonts.</entry>
</row>
<row>
<entry><makevar>X_FONTS_TTF_PORT</makevar></entry>
<entry>Port providing &truetype; fonts.</entry>
</row>
<row>
<entry><makevar>X_FONTS_TYPE1_PORT</makevar></entry>
<entry>Port providing Type1 fonts.</entry>
</row>
<row>
<entry><makevar>X_MANUALS_PORT</makevar></entry>
<entry>Port providing developer oriented manual
pages</entry>
</row>
</tbody>
</tgroup>
</table>
<example id="using-x11-vars">
<title>Using X11-Related Variables</title>
<programlisting># Use some X11 libraries and depend on
# font server as well as cyrillic fonts.
RUN_DEPENDS= ${LOCALBASE}/bin/xfs:${X_FONTSERVER_PORT} \
${LOCALBASE}/lib/X11/fonts/cyrillic/crox1c.pcf.gz:${X_FONTS_CYRILLIC_PORT}
USE_XORG= x11 xpm</programlisting>
</example>
</sect2>
<sect2 id="x11-motif">
<title>Ports That Require Motif</title>
<para>If your port requires a Motif library, define
<makevar>USE_MOTIF</makevar> in the
<filename>Makefile</filename>. Default Motif implementation
is <filename
role="package">x11-toolkits/open-motif</filename>. Users
can choose <filename
role="package">x11-toolkits/lesstif</filename> instead by
setting <makevar>WANT_LESSTIF</makevar> variable.</para>
<para>The <makevar>MOTIFLIB</makevar> variable will be set by
<filename>bsd.port.mk</filename> to reference the
appropriate Motif library. Please patch the source of your
port to use <literal>${MOTIFLIB}</literal> wherever
the Motif library is referenced in the original
<filename>Makefile</filename> or
<filename>Imakefile</filename>.</para>
<para>There are two common cases:</para>
<itemizedlist>
<listitem>
<para>If the port refers to the Motif library as
<literal>-lXm</literal> in its
<filename>Makefile</filename> or
<filename>Imakefile</filename>, simply substitute
<literal>${MOTIFLIB}</literal> for it.</para>
</listitem>
<listitem>
<para>If the port uses <literal>XmClientLibs</literal> in
its <filename>Imakefile</filename>, change it to
<literal>${MOTIFLIB} ${XTOOLLIB}
${XLIB}</literal>.</para>
</listitem>
</itemizedlist>
<para>Note that <makevar>MOTIFLIB</makevar> (usually) expands
to <literal>-L/usr/local/lib -lXm</literal> or
<literal>/usr/local/lib/libXm.a</literal>, so there is no
need to add <literal>-L</literal> or <literal>-l</literal>
in front.</para>
</sect2>
<sect2>
<title>X11 Fonts</title>
<para>If your port installs fonts for the X Window System, put
them in
<filename><makevar>LOCALBASE</makevar>/lib/X11/fonts/local</filename>.</para>
</sect2>
<sect2>
<title>Getting a Fake <envar>DISPLAY</envar> with Xvfb</title>
<para>Some applications require a working X11 display for
compilation to succeed. This pose a problem for machines
that operate headless. When the following variable is used,
the build infrastructure will start the virtual framebuffer
X server. The working <envar>DISPLAY</envar> is then passed
to the build.</para>
<programlisting>USE_DISPLAY= yes</programlisting>
</sect2>
<sect2 id="desktop-entries">
<title>Desktop Entries</title>
<para>Desktop entries (<ulink
url="http://standards.freedesktop.org/desktop-entry-spec/latest/">a
Freedesktop standard</ulink>) provide a way to
automatically adjust desktop features when a new program is
installed, without requiring user intervention. For
example, newly-installed programs automatically appear in
the application menus of compatible desktop environments.
Desktop entries originated in the
<application>GNOME</application> desktop environment, but
are now a standard and also work with
<application>KDE</application> and
<application>Xfce</application>. This bit of automation
provides a real benefit to the user, and desktop entries are
encouraged for applications which can be used in a desktop
environment.</para>
<sect3>
<title>Using Predefined <filename>.desktop</filename>
Files</title>
<para>Ports that include predefined
<filename>*.desktop</filename> files should
include those files in <filename>pkg-plist</filename>
and install them in the
<filename><makevar>$LOCALBASE</makevar>/share/applications</filename>
directory. The <link
linkend="install-macros"><makevar>INSTALL_DATA</makevar>
macro</link> is useful for installing these
files.</para>
</sect3>
<sect3 id="desktop-entries-macro">
<title>Creating Desktop Entries with the
<makevar>DESKTOP_ENTRIES</makevar> Macro</title>
<para>Desktop entries can be easily created for applications
by using the <makevar>DESKTOP_ENTRIES</makevar> variable.
A file named
<filename><replaceable>name</replaceable>.desktop</filename>
will be created, installed, and added to the
<filename>pkg-plist</filename> automatically. Syntax
is:</para>
<programlisting>DESKTOP_ENTRIES= "NAME" "COMMENT" "ICON" "COMMAND" "CATEGORY" StartupNotify</programlisting>
<para>The list of possible categories is available on the
<ulink
url="http://standards.freedesktop.org/menu-spec/latest/apa.html">Freedesktop
website</ulink>. <makevar>StartupNotify</makevar>
indicates whether the application is compatible with
<emphasis>startup notifications</emphasis>. These are
typically a graphic indicator like a clock that appear at
the mouse pointer, menu, or panel to give the user an
indication when a program is starting. A program that is
compatible with startup notifications clears the indicator
after it has started. Programs that are not compatible
with startup notifications would never clear the indicator
(potentially confusing and infuriating the user), and
should have <makevar>StartupNotify</makevar> set to
<literal>false</literal> so the indicator is not shown at
all.</para>
<para>Example:</para>
<programlisting>DESKTOP_ENTRIES= "ToME" "Roguelike game based on JRR Tolkien's work" \
"${DATADIR}/xtra/graf/tome-128.png" \
"tome -v -g" "Application;Game;RolePlaying;" \
false</programlisting>
</sect3>
</sect2>
</sect1>
<sect1 id="using-gnome">
<title>Using GNOME</title>
<para>The FreeBSD/GNOME project uses its own set of variables to
define which GNOME components a particular port uses. A
<ulink
url="http://www.FreeBSD.org/gnome/docs/porting.html">comprehensive
list of these variables</ulink> exists within the
FreeBSD/GNOME project's homepage.</para>
</sect1>
<sect1 id="using-qt">
<title>Using Qt</title>
<sect2 id="qt-common">
<title>Ports That Require Qt</title>
<table frame="none">
<title>Variables for Ports That Use Qt</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_QT_VER</makevar></entry>
<entry>The port uses the Qt toolkit. The only
possible value is <literal>3</literal>.
Appropriate parameters are passed to
<command>configure</command> script and
<command>make</command>.</entry>
</row>
<row>
<entry><makevar>USE_QT4</makevar></entry>
<entry>Specify tool and library dependencies for ports
that use Qt 4. See <link
linkend="qt4-components">Qt 4 component
selection</link> for more details.</entry>
</row>
<row>
<entry><makevar>QT_PREFIX</makevar></entry>
<entry>Set to the path where Qt installed to
(read-only variable).</entry>
</row>
<row>
<entry><makevar>MOC</makevar></entry>
<entry>Set to the path of <command>moc</command>
(read-only variable). Default set according to
<makevar>USE_QT_VER</makevar> value.</entry>
</row>
<row>
<entry><makevar>QTCPPFLAGS</makevar></entry>
<entry>Additional compiler flags passed via
<makevar>CONFIGURE_ENV</makevar> for Qt toolkit.
Default set according to
<makevar>USE_QT_VER</makevar>.</entry>
</row>
<row>
<entry><makevar>QTCFGLIBS</makevar></entry>
<entry>Additional libraries for linking passed via
<makevar>CONFIGURE_ENV</makevar> for Qt toolkit.
Default set according to
<makevar>USE_QT_VER</makevar>.</entry>
</row>
<row>
<entry><makevar>QTNONSTANDARD</makevar></entry>
<entry>Suppress modification of
<makevar>CONFIGURE_ENV</makevar>,
<makevar>CONFIGURE_ARGS</makevar>,
<makevar>CPPFLAGS</makevar> and
<makevar>MAKE_ENV</makevar>.</entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="none">
<title>Additional Variables for Ports That Use Qt
4.x</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>UIC</makevar></entry>
<entry>Set to the path of <command>uic</command>
(read-only variable).</entry>
</row>
<row>
<entry><makevar>QMAKE</makevar></entry>
<entry>Set to the path of <command>qmake</command>
(read-only variable).</entry>
</row>
<row>
<entry><makevar>QMAKESPEC</makevar></entry>
<entry>Set to the path of configuration file for
<command>qmake</command> (read-only
variable).</entry>
</row>
<row>
<entry><makevar>QMAKEFLAGS</makevar></entry>
<entry>Additional flags for
<command>qmake</command>.</entry>
</row>
<row>
<entry><makevar>QT_INCDIR</makevar></entry>
<entry>Set to Qt 4 include directories (read-only
variable).</entry>
</row>
<row>
<entry><makevar>QT_LIBDIR</makevar></entry>
<entry>Set to Qt 4 libraries path (read-only
variable).</entry>
</row>
<row>
<entry><makevar>QT_PLUGINDIR</makevar></entry>
<entry>Set to Qt 4 plugins path (read-only
variable).</entry>
</row>
</tbody>
</tgroup>
</table>
<para>When <makevar>USE_QT_VER</makevar> is set to
<literal>3</literal>, some useful settings are passed to the
<command>configure</command> script:</para>
<programlisting>CONFIGURE_ARGS+= --with-qt-includes=${QT_PREFIX}/include \
--with-qt-libraries=${QT_PREFIX}/lib \
--with-extra-libs=${LOCALBASE}/lib \
--with-extra-includes=${LOCALBASE}/include
CONFIGURE_ENV+= MOC="${MOC}" LIBS="${QTCFGLIBS}" \
QTDIR="${QT_PREFIX}" KDEDIR="${KDE_PREFIX}"
CPPFLAGS+= ${QTCPPFLAGS}</programlisting>
<para>If <makevar>USE_QT4</makevar> is set, the following
settings are deployed:</para>
<programlisting>CONFIGURE_ARGS+= --with-qt-includes=${QT_INCDIR} \
--with-qt-libraries=${QT_LIBDIR} \
--with-extra-libs=${LOCALBASE}/lib \
--with-extra-includes=${LOCALBASE}/include
CONFIGURE_ENV+= MOC="${MOC}" UIC="${UIC}" LIBS="${QTCFGLIBS}" \
QMAKE="${QMAKE}" QMAKESPEC="${QMAKESPEC}" QTDIR="${QT_PREFIX}"
MAKE_ENV+= QMAKESPEC="${QMAKESPEC}"
PLIST_SUB+= QT_INCDIR_REL=${QT_INCDIR_REL} \
QT_LIBDIR_REL=${QT_LIBDIR_REL} \
QT_PLUGINDIR_REL=${QT_PLUGINDIR_REL}</programlisting>
</sect2>
<sect2 id="qt4-components">
<title>Component Selection (Qt 4.x Only)</title>
<para>Individual Qt 4 tool and library dependencies
must be specified in the <makevar>USE_QT4</makevar>
variable. Every component
can be suffixed by either <literal>_build</literal> or
<literal>_run</literal>, the suffix indicating whether the
component should be depended on at buildtime or runtime,
respectively. If unsuffixed, the component will be depended
on at both build- and runtime. Usually, library components
should be specified unsuffixed, tool components should be
specified with the <literal>_build</literal> suffix and
plugin components should be specified with the
<literal>_run</literal> suffix. The most commonly used
components are listed below (all available components are
listed in <makevar>_USE_QT4_ALL</makevar> in
<filename>/usr/ports/Mk/bsd.qt.mk</filename>):</para>
<table frame="none">
<title>Available Qt 4 Library Components</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>corelib</literal></entry>
<entry>core library (can be omitted unless the port
uses nothing but <literal>corelib</literal>)</entry>
</row>
<row>
<entry><literal>gui</literal></entry>
<entry>graphical user interface library</entry>
</row>
<row>
<entry><literal>network</literal></entry>
<entry>network library</entry>
</row>
<row>
<entry><literal>opengl</literal></entry>
<entry>OpenGL library</entry>
</row>
<row>
<entry><literal>qt3support</literal></entry>
<entry>Qt 3 compatibility library</entry>
</row>
<row>
<entry><literal>qtestlib</literal></entry>
<entry>unit testing library</entry>
</row>
<row>
<entry><literal>script</literal></entry>
<entry>script library</entry>
</row>
<row>
<entry><literal>sql</literal></entry>
<entry>SQL library</entry>
</row>
<row>
<entry><literal>xml</literal></entry>
<entry>XML library</entry>
</row>
</tbody>
</tgroup>
</table>
<para>You can determine which libraries the application
depends on, by running <command>ldd</command> on the main
executable after a successful compilation.</para>
<table frame="none">
<title>Available Qt 4 Tool Components</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>moc</literal></entry>
<entry>meta object compiler (needed for almost
every Qt application at buildtime)</entry>
</row>
<row>
<entry><literal>qmake</literal></entry>
<entry>Makefile generator / build utility</entry>
</row>
<row>
<entry><literal>rcc</literal></entry>
<entry>resource compiler (needed if the application
comes with <filename>*.rc</filename> or
<filename>*.qrc</filename> files)</entry>
</row>
<row>
<entry><literal>uic</literal></entry>
<entry>user interface compiler (needed if the
application comes with <filename>*.ui</filename>
files created by Qt Designer - in practice, every Qt
application with a GUI)</entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="none">
<title>Available Qt 4 Plugin Components</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>iconengines</literal></entry>
<entry>SVG icon engine plugin (if the application
ships SVG icons)</entry>
</row>
<row>
<entry><literal>imageformats</literal></entry>
<entry>imageformat plugins for GIF, JPEG, MNG and
SVG (if the application ships image files)</entry>
</row>
</tbody>
</tgroup>
</table>
<example id="qt4-components-example">
<title>Selecting Qt 4 Components</title>
<para>In this example, the ported application uses the Qt 4
graphical user interface library, the Qt 4 core library,
all of the Qt 4 code generation tools and Qt 4's Makefile
generator. Since the <literal>gui</literal> library
implies a dependency on the core library,
<literal>corelib</literal> does not need to be specified.
The Qt 4 code generation tools <literal>moc</literal>,
<literal>uic</literal> and <literal>rcc</literal>, as well
as the Makefile generator <literal>qmake</literal> are
only needed at buildtime, thus they are specified with the
<literal>_build</literal> suffix:</para>
<programlisting>USE_QT4= gui moc_build qmake_build rcc_build uic_build</programlisting>
</example>
</sect2>
<sect2 id="qt-additional">
<title>Additional Considerations</title>
<para>If the application does not provide a
<filename>configure</filename> file but a
<filename>.pro</filename> file, you can use the
following:</para>
<programlisting>HAS_CONFIGURE= yes
do-configure:
@cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} \
${QMAKE} ${QMAKEFLAGS} PREFIX=${PREFIX} texmaker.pro</programlisting>
<para>Note the similarity to the <command>qmake</command> line
from the provided <filename>BUILD.sh</filename> script.
Passing <makevar>CONFIGURE_ENV</makevar> ensures
<command>qmake</command> will see the
<makevar>QMAKESPEC</makevar> variable, without which it
cannot work. <command>qmake</command> generates standard
Makefiles, so it is not necessary to write our own
<maketarget>build</maketarget> target.</para>
<para>Qt applications often are written to be cross-platform
and often X11/Unix is not the platform they are developed
on, which in turn often leads to certain loose ends,
like:</para>
<itemizedlist>
<listitem>
<para><emphasis>Missing additional include
paths.</emphasis> Many applications come with
system tray icon support, but neglect to look for
includes and/or libraries in the X11 directories. You
can tell <command>qmake</command> to add directories to
the include and library search paths via the command
line, for example:</para>
<programlisting>${QMAKE} ${QMAKEFLAGS} PREFIX=${PREFIX} INCLUDEPATH+=${LOCALBASE}/include \
LIBS+=-L${LOCALBASE}/lib sillyapp.pro</programlisting>
</listitem>
<listitem>
<para><emphasis>Bogus installation paths.</emphasis>
Sometimes data such as icons or .desktop files are by
default installed into directories which are not scanned
by XDG-compatible applications. <filename
role="package">editors/texmaker</filename> is an
example for this - look at
<filename>patch-texmaker.pro</filename> in the
<filename>files</filename> directory of that port for a
template on how to remedy this directly in the
<command>qmake</command> project file.</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<sect1 id="using-kde">
<title>Using KDE</title>
<sect2 id="kde-variables">
<title>Variable Definitions (KDE 3.x Only)</title>
<table frame="none">
<title>Variables for Ports That Use KDE 3.x</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_KDELIBS_VER</makevar></entry>
<entry>The port uses KDE libraries. It specifies the
major version of KDE to use and implies
<makevar>USE_QT_VER</makevar> of the appropriate
version. The only possible value is
<literal>3</literal>.</entry>
</row>
<row>
<entry><makevar>USE_KDEBASE_VER</makevar></entry>
<entry>The port uses KDE base. It specifies the major
version of KDE to use and implies
<makevar>USE_QT_VER</makevar> of the appropriate
version. The only possible value is
<literal>3</literal>.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="kde4-variables">
<title>KDE 4 Variable Definitions</title>
<para>If your application depends on KDE 4.x, set
<makevar>USE_KDE4</makevar> to the list of required
components. <literal>_build</literal> and
<literal>_run</literal> suffixes can be used to force
components dependency type (e.g.,
<literal>baseapps_run</literal>). If no suffix is set, a
default dependency type will be used. If you want to force
both types, add the component twice with both suffixes
(e.g., <literal>automoc4_build automoc4_run</literal>). The
most commonly used components are listed below (up-to-date
components are documented at the top of
<filename>/usr/ports/Mk/bsd.kde4.mk</filename>):</para>
<table frame="none">
<title>Available KDE 4 Components</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>kdehier</literal></entry>
<entry>Hierarchy of common KDE directories</entry>
</row>
<row>
<entry><literal>kdelibs</literal></entry>
<entry>KDE Developer Platform</entry>
</row>
<row>
<entry><literal>kdeprefix</literal></entry>
<entry>If set, port will be installed into
<literal>${KDE4_PREFIX}</literal> instead of
<literal>${LOCALBASE}</literal></entry>
</row>
<row>
<entry><literal>sharedmime</literal></entry>
<entry>MIME types database for KDE ports</entry>
</row>
<row>
<entry><literal>automoc4</literal></entry>
<entry>Automatic moc for Qt 4 packages</entry>
</row>
<row>
<entry><literal>akonadi</literal></entry>
<entry>Storage server for KDE-Pim</entry>
</row>
<row>
<entry><literal>soprano</literal></entry>
<entry>Qt 4 RDF framework</entry>
</row>
<row>
<entry><literal>strigi</literal></entry>
<entry>Desktop search daemon</entry>
</row>
<row>
<entry><literal>libkcddb</literal></entry>
<entry>KDE CDDB library</entry>
</row>
<row>
<entry><literal>libkcompactdisc</literal></entry>
<entry>KDE library for interfacing with audio
CDs</entry>
</row>
<row>
<entry><literal>libkdeedu</literal></entry>
<entry>Libraries used by educational
applications</entry>
</row>
<row>
<entry><literal>libkdcraw</literal></entry>
<entry>KDE LibRaw library</entry>
</row>
<row>
<entry><literal>libkexiv2</literal></entry>
<entry>KDE Exiv2 library</entry>
</row>
<row>
<entry><literal>libkipi</literal></entry>
<entry> KDE Image Plugin Interface</entry>
</row>
<row>
<entry><literal>libkonq</literal></entry>
<entry>Konqueror core library</entry>
</row>
<row>
<entry><literal>libksane</literal></entry>
<entry>KDE SANE ("Scanner Access Now Easy")
library</entry>
</row>
<row>
<entry><literal>pimlibs</literal></entry>
<entry>KDE-Pim libraries</entry>
</row>
<row>
<entry><literal>kate</literal></entry>
<entry>Text editor framework</entry>
</row>
<row>
<entry><literal>marble</literal></entry>
<entry>Virtual globe</entry>
</row>
<row>
<entry><literal>okular</literal></entry>
<entry>Universal document viewer</entry>
</row>
<row>
<entry><literal>korundum</literal></entry>
<entry>KDE Ruby bindings</entry>
</row>
<row>
<entry><literal>perlkde</literal></entry>
<entry>KDE Perl bindings</entry>
</row>
<row>
<entry><literal>pykde4</literal></entry>
<entry>KDE Python bindings</entry>
</row>
<row>
<entry><literal>pykdeuic4</literal></entry>
<entry>PyKDE user interface compiler</entry>
</row>
<row>
<entry>smokekde<literal></literal></entry>
<entry>KDE SMOKE libraries</entry>
</row>
</tbody>
</tgroup>
</table>
<para>KDE 4.x ports are installed into
<makevar>KDE4_PREFIX</makevar>, which is
<filename>/usr/local/kde4</filename> currently, to avoid
conflicts with KDE 3.x ports. This is achieved by
specifying the <literal>kdeprefix</literal> component, which
overrides the default <makevar>PREFIX</makevar>. The ports
however respect any <makevar>PREFIX</makevar> set via
<envar>MAKEFLAGS</envar> environment variable and/or
<command>make</command> arguments.</para>
<example id="kde4-components-example">
<title><makevar>USE_KDE4</makevar> Example</title>
<para>This is a simple example for a KDE 4 port.
<makevar>USE_CMAKE</makevar> instructs the port to utilize
<application>CMake</application> — configuration
tool widely spread among KDE 4 projects.
<makevar>USE_KDE4</makevar> brings dependency on KDE
libraries and makes port using
<command>automoc4</command> at build stage.
Required KDE components and other dependencies can be
determined through configure log.
<makevar>USE_KDE4</makevar> does not imply
<makevar>USE_QT4</makevar>. If a port requires some
Qt 4 components, they should be specified in
<makevar>USE_QT4</makevar>.</para>
<programlisting>USE_CMAKE= yes
USE_KDE4= kdelibs kdeprefix automoc4
USE_QT4= moc_build qmake_build rcc_build uic_build</programlisting>
</example>
</sect2>
</sect1>
<sect1 id="using-java">
<title>Using Java</title>
<sect2 id="java-variables">
<title>Variable Definitions</title>
<para>If your port needs a Java™ Development Kit
(JDK™) to either build, run or even extract the
distfile, then it should define
<makevar>USE_JAVA</makevar>.</para>
<para>There are several JDKs in the ports collection, from
various vendors, and in several versions. If your port must
use one of these versions, you can define which one. The
most current version is <filename
role="package">java/jdk16</filename>.</para>
<table frame="none">
<title>Variables Which May be Set by Ports That Use
Java</title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Means</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_JAVA</makevar></entry>
<entry>Should be defined for the remaining variables
to have any effect.</entry>
</row>
<row>
<entry><makevar>JAVA_VERSION</makevar></entry>
<entry>List of space-separated suitable Java versions
for the port. An optional <literal>"+"</literal>
allows you to specify a range of versions (allowed
values:
<literal>1.5[+] 1.6[+] 1.7[+]</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_OS</makevar></entry>
<entry>List of space-separated suitable JDK port
operating systems for the port (allowed values:
<literal>native linux</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_VENDOR</makevar></entry>
<entry>List of space-separated suitable JDK port
vendors for the port (allowed values:
<literal>freebsd bsdjava sun
openjdk</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_BUILD</makevar></entry>
<entry>When set, it means that the selected JDK port
should be added to the build dependencies of the
port.</entry>
</row>
<row>
<entry><makevar>JAVA_RUN</makevar></entry>
<entry>When set, it means that the selected JDK port
should be added to the run dependencies of the
port.</entry>
</row>
<row>
<entry><makevar>JAVA_EXTRACT</makevar></entry>
<entry>When set, it means that the selected JDK port
should be added to the extract dependencies of the
port.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>Below is the list of all settings a port will receive
after setting <makevar>USE_JAVA</makevar>:</para>
<table frame="none">
<title>Variables Provided to Ports That Use Java</title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>JAVA_PORT</makevar></entry>
<entry>The name of the JDK port (e.g.,
<literal>'java/openjdk6'</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_PORT_VERSION</makevar></entry>
<entry>The full version of the JDK port (e.g.,
<literal>'1.6.0'</literal>). If you only need the
first two digits of this version number, use
<makevar>${JAVA_PORT_VERSION:C/^([0-9])\.([0-9])(.*)$/\1.\2/}</makevar>.</entry>
</row>
<row>
<entry><makevar>JAVA_PORT_OS</makevar></entry>
<entry>The operating system used by the JDK port
(e.g., <literal>'native'</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_PORT_VENDOR</makevar></entry>
<entry>The vendor of the JDK port (e.g.,
<literal>'openjdk'</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_PORT_OS_DESCRIPTION</makevar></entry>
<entry>Description of the operating system used by the
JDK port (e.g.,
<literal>'Native'</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_PORT_VENDOR_DESCRIPTION</makevar></entry>
<entry>Description of the vendor of the JDK port
(e.g., <literal>'OpenJDK BSD Porting
Team'</literal>).</entry>
</row>
<row>
<entry><makevar>JAVA_HOME</makevar></entry>
<entry>Path to the installation directory of the JDK
(e.g.,
<filename>'/usr/local/openjdk6'</filename>).</entry>
</row>
<row>
<entry><makevar>JAVAC</makevar></entry>
<entry>Path to the Java compiler to use (e.g.,
<filename>'/usr/local/openjdk6/bin/javac'</filename>).</entry>
</row>
<row>
<entry><makevar>JAR</makevar></entry>
<entry>Path to the <command>jar</command> tool to use
(e.g.,
<filename>'/usr/local/openjdk6/bin/jar'</filename>
or
<filename>'/usr/local/bin/fastjar'</filename>).</entry>
</row>
<row>
<entry><makevar>APPLETVIEWER</makevar></entry>
<entry>Path to the <command>appletviewer</command>
utility (e.g.,
<filename>'/usr/local/openjdk6/bin/appletviewer'</filename>).</entry>
</row>
<row>
<entry><makevar>JAVA</makevar></entry>
<entry>Path to the <command>java</command> executable.
Use this for executing Java programs (e.g.,
<filename>'/usr/local/openjdk6/bin/java'</filename>).</entry>
</row>
<row>
<entry><makevar>JAVADOC</makevar></entry>
<entry>Path to the <command>javadoc</command> utility
program.</entry>
</row>
<row>
<entry><makevar>JAVAH</makevar></entry>
<entry>Path to the <command>javah</command>
program.</entry>
</row>
<row>
<entry><makevar>JAVAP</makevar></entry>
<entry>Path to the <command>javap</command>
program.</entry>
</row>
<row>
<entry><makevar>JAVA_KEYTOOL</makevar></entry>
<entry>Path to the <command>keytool</command> utility
program.</entry>
</row>
<row>
<entry><makevar>JAVA_N2A</makevar></entry>
<entry>Path to the <command>native2ascii</command>
tool.</entry>
</row>
<row>
<entry><makevar>JAVA_POLICYTOOL</makevar></entry>
<entry>Path to the <command>policytool</command>
program.</entry>
</row>
<row>
<entry><makevar>JAVA_SERIALVER</makevar></entry>
<entry>Path to the <command>serialver</command>
utility program.</entry>
</row>
<row>
<entry><makevar>RMIC</makevar></entry>
<entry>Path to the RMI stub/skeleton generator,
<command>rmic</command>.</entry>
</row>
<row>
<entry><makevar>RMIREGISTRY</makevar></entry>
<entry>Path to the RMI registry program,
<command>rmiregistry</command>.</entry>
</row>
<row>
<entry><makevar>RMID</makevar></entry>
<entry>Path to the RMI daemon program
<command>rmid</command>.</entry>
</row>
<row>
<entry><makevar>JAVA_CLASSES</makevar></entry>
<entry>Path to the archive that contains the JDK class
files,
<filename>${JAVA_HOME}/jre/lib/rt.jar</filename>.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>You may use the <literal>java-debug</literal> make
target to get information for debugging your port. It will
display the value of many of the forecited variables.</para>
<para>Additionally, the following constants are defined so all
Java ports may be installed in a consistent way:</para>
<table frame="none">
<title>Constants Defined for Ports That Use Java</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>JAVASHAREDIR</makevar></entry>
<entry>The base directory for everything related to
Java. Default:
<filename>${PREFIX}/share/java</filename>.</entry>
</row>
<row>
<entry><makevar>JAVAJARDIR</makevar></entry>
<entry>The directory where JAR files should be
installed. Default:
<filename>${JAVASHAREDIR}/classes</filename>.</entry>
</row>
<row>
<entry><makevar>JAVALIBDIR</makevar></entry>
<entry>The directory where JAR files installed by
other ports are located. Default:
<filename>${LOCALBASE}/share/java/classes</filename>.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The related entries are defined in both
<makevar>PLIST_SUB</makevar> (documented in
<xref linkend="plist-sub"/>) and
<makevar>SUB_LIST</makevar>.</para>
</sect2>
<sect2 id="java-building-with-ant">
<title>Building with Ant</title>
<para>When the port is to be built using Apache Ant, it has to
define <makevar>USE_ANT</makevar>. Ant is thus considered
to be the sub-make command. When no
<literal>do-build</literal> target is defined by the port, a
default one will be set that simply runs Ant according to
<makevar>MAKE_ENV</makevar>, <makevar>MAKE_ARGS</makevar>
and <makevar>ALL_TARGET</makevar>. This is similar to the
<makevar>USE_GMAKE</makevar> mechanism, which is documented
in <xref linkend="building"/>.</para>
</sect2>
<sect2 id="java-best-practices">
<title>Best Practices</title>
<para>When porting a Java library, your port should install
the JAR file(s) in <filename>${JAVAJARDIR}</filename>, and
everything else under
<filename>${JAVASHAREDIR}/${PORTNAME}</filename> (except for
the documentation, see below). In order to reduce the
packing file size, you may reference the JAR file(s)
directly in the <filename>Makefile</filename>. Just use the
following statement (where <filename>myport.jar</filename>
is the name of the JAR file installed as part of the
port):</para>
<programlisting>PLIST_FILES+= %%JAVAJARDIR%%/myport.jar</programlisting>
<para>When porting a Java application, the port usually
installs everything under a single directory (including its
JAR dependencies). The use of
<filename>${JAVASHAREDIR}/${PORTNAME}</filename> is strongly
encouraged in this regard. It is up the porter to decide
whether the port should install the additional JAR
dependencies under this directory or directly use the
already installed ones (from
<filename>${JAVAJARDIR}</filename>).</para>
<para>Regardless of the type of your port (library or
application), the additional documentation should be
installed in the <link linkend="install-documentation">same
location</link> as for any other port. The JavaDoc tool is
known to produce a different set of files depending on the
version of the JDK that is used. For ports that do not
enforce the use of a particular JDK, it is therefore a
complex task to specify the packing list
(<filename>pkg-plist</filename>). This is one reason why
porters are strongly encouraged to use the
<makevar>PORTDOCS</makevar> macro. Moreover, even if you
can predict the set of files that will be generated by
<command>javadoc</command>, the size of the resulting
<filename>pkg-plist</filename> advocates for the use of
<makevar>PORTDOCS</makevar>.</para>
<para>The default value for <makevar>DATADIR</makevar> is
<filename>${PREFIX}/share/${PORTNAME}</filename>. It is a
good idea to override <makevar>DATADIR</makevar> to
<filename>${JAVASHAREDIR}/${PORTNAME}</filename> for Java
ports. Indeed, <makevar>DATADIR</makevar> is automatically
added to <makevar>PLIST_SUB</makevar> (documented in <xref
linkend="plist-sub"/>) so you may use
<literal>%%DATADIR%%</literal> directly in
<filename>pkg-plist</filename>.</para>
<para>As for the choice of building Java ports from source or
directly installing them from a binary distribution, there
is no defined policy at the time of writing. However,
people from the <ulink
url="http://www.freebsd.org/java/">&os; Java
Project</ulink> encourage porters to have their ports built
from source whenever it is a trivial task.</para>
<para>All the features that have been presented in this
section are implemented in <filename>bsd.java.mk</filename>.
If you ever think that your port needs more sophisticated
Java support, please first have a look at the <ulink
url="http://svn.FreeBSD.org/ports/head/Mk/bsd.java.mk?view=markup">bsd.java.mk
SVN log</ulink> as it usually takes some time
to document the latest features. Then, if you think the
support you are lacking would be beneficial to many other
Java ports, feel free to discuss it on the &a.java;.</para>
<para>Although there is a <literal>java</literal> category for
PRs, it refers to the JDK porting effort from the &os; Java
project. Therefore, you should submit your Java port in the
<literal>ports</literal> category as for any other port,
unless the issue you are trying to resolve is related to
either a JDK implementation or
<filename>bsd.java.mk</filename>.</para>
<para>Similarly, there is a defined policy regarding the
<makevar>CATEGORIES</makevar> of a Java port, which is
detailed in <xref linkend="makefile-categories"/>.</para>
</sect2>
</sect1>
<sect1 id="using-php">
<title>Web Applications, Apache and PHP</title>
<sect2 id="using-apache">
<title>Apache</title>
<table frame="none">
<title>Variables for Ports That Use Apache</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_APACHE</makevar></entry>
<entry>The port requires Apache. Possible values:
<literal>yes</literal> (gets any version),
<literal>20</literal>, <literal>22</literal>,
<literal>20-22</literal>, <literal>20+</literal>,
etc. The default APACHE version is
<literal>22</literal>. More details are available
in <filename>ports/Mk/bsd.apache.mk</filename> and
at <ulink
url="http://wiki.freebsd.org/Apache/">wiki.freebsd.org/Apache/</ulink>.</entry>
</row>
<row>
<entry><makevar>WITH_APACHE2</makevar></entry>
<entry>This variable is deprecated and should
not be used any more.</entry>
</row>
<row>
<entry><makevar>APXS</makevar></entry>
<entry>Full path to the <command>apxs</command>
binary. Can be overridden in your port.</entry>
</row>
<row>
<entry><makevar>HTTPD</makevar></entry>
<entry>Full path to the <command>httpd</command>
binary. Can be overridden in your port.</entry>
</row>
<row>
<entry><makevar>APACHE_VERSION</makevar></entry>
<entry>The version of present Apache installation
(read-only variable). This variable is only
available after inclusion of
<filename>bsd.port.pre.mk</filename>. Possible
values: <literal>20</literal>,
<literal>22</literal>.</entry>
</row>
<row>
<entry><makevar>APACHEMODDIR</makevar></entry>
<entry>Directory for Apache modules. This variable is
automatically expanded in
<filename>pkg-plist</filename>.</entry>
</row>
<row>
<entry><makevar>APACHEINCLUDEDIR</makevar></entry>
<entry>Directory for Apache headers. This variable is
automatically expanded in
<filename>pkg-plist</filename>.</entry>
</row>
<row>
<entry><makevar>APACHEETCDIR</makevar></entry>
<entry>Directory for Apache configuration files. This
variable is automatically expanded in
<filename>pkg-plist</filename>.</entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="none">
<title>Useful Variables for Porting Apache Modules</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>MODULENAME</makevar></entry>
<entry>Name of the module. Default value is
<makevar>PORTNAME</makevar>. Example:
<literal>mod_hello</literal></entry>
</row>
<row>
<entry><makevar>SHORTMODNAME</makevar></entry>
<entry>Short name of the module. Automatically
derived from <makevar>MODULENAME</makevar>, but can
be overridden. Example:
<literal>hello</literal></entry>
</row>
<row>
<entry><makevar>AP_FAST_BUILD</makevar></entry>
<entry>Use <command>apxs</command> to compile and
install the module.</entry>
</row>
<row>
<entry><makevar>AP_GENPLIST</makevar></entry>
<entry>Also automatically creates a
<filename>pkg-plist</filename>.</entry>
</row>
<row>
<entry><makevar>AP_INC</makevar></entry>
<entry>Adds a directory to a header search path during
compilation.</entry>
</row>
<row>
<entry><makevar>AP_LIB</makevar></entry>
<entry>Adds a directory to a library search path
during compilation.</entry>
</row>
<row>
<entry><makevar>AP_EXTRAS</makevar></entry>
<entry>Additional flags to pass to
<command>apxs</command>.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="web-apps">
<title>Web Applications</title>
<para>Web applications should be installed into
<filename><makevar>PREFIX</makevar>/www/<replaceable>appname</replaceable></filename>.
For your convenience, this path is available both in
<filename>Makefile</filename> and in
<filename>pkg-plist</filename> as <makevar>WWWDIR</makevar>,
and the path relative to <makevar>PREFIX</makevar> is
available in <filename>Makefile</filename> as
<makevar>WWWDIR_REL</makevar>.</para>
<para>The user and group of web server process are available
as <makevar>WWWOWN</makevar> and <makevar>WWWGRP</makevar>,
in case you need to change the ownership of some files. The
default values of both are <literal>www</literal>. If you
want different values for your port, use <literal>WWWOWN?=
myuser</literal> notation, to allow user to override it
easily.</para>
<para>Do not depend on Apache unless the web app explicitly
needs Apache. Respect that users may wish to run your web
app on different web server than Apache.</para>
</sect2>
<sect2 id="php-variables">
<title>PHP</title>
<table frame="none">
<title>Variables for Ports That Use PHP</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_PHP</makevar></entry>
<entry>The port requires PHP. The value
<literal>yes</literal> adds a dependency on PHP.
The list of required PHP extensions can be specified
instead. Example: <literal>pcre xml
gettext</literal></entry>
</row>
<row>
<entry><makevar>DEFAULT_PHP_VER</makevar></entry>
<entry>Selects which major version of PHP will be
installed as a dependency when no PHP is installed
yet. Default is <literal>5</literal>. Possible
values: <literal>4</literal>,
<literal>5</literal></entry>
</row>
<row>
<entry><makevar>IGNORE_WITH_PHP</makevar></entry>
<entry>The port does not work with PHP of the given
version. Possible values: <literal>4</literal>,
<literal>5</literal></entry>
</row>
<row>
<entry><makevar>USE_PHPIZE</makevar></entry>
<entry>The port will be built as a PHP
extension.</entry>
</row>
<row>
<entry><makevar>USE_PHPEXT</makevar></entry>
<entry>The port will be treated as a PHP extension,
including installation and registration in the
extension registry.</entry>
</row>
<row>
<entry><makevar>USE_PHP_BUILD</makevar></entry>
<entry>Set PHP as a build dependency.</entry>
</row>
<row>
<entry><makevar>WANT_PHP_CLI</makevar></entry>
<entry>Want the CLI (command line) version of
PHP.</entry>
</row>
<row>
<entry><makevar>WANT_PHP_CGI</makevar></entry>
<entry>Want the CGI version of PHP.</entry>
</row>
<row>
<entry><makevar>WANT_PHP_MOD</makevar></entry>
<entry>Want the Apache module version of PHP.</entry>
</row>
<row>
<entry><makevar>WANT_PHP_SCR</makevar></entry>
<entry>Want the CLI or the CGI version of PHP.</entry>
</row>
<row>
<entry><makevar>WANT_PHP_WEB</makevar></entry>
<entry>Want the Apache module or the CGI version of
PHP.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2>
<title>PEAR Modules</title>
<para>Porting PEAR modules is a very simple process.</para>
<para>Use the variables <makevar>FILES</makevar>,
<makevar>TESTS</makevar>, <makevar>DATA</makevar>,
<makevar>SQLS</makevar>, <makevar>SCRIPTFILES</makevar>,
<makevar>DOCS</makevar> and <makevar>EXAMPLES</makevar> to
list the files you want to install. All listed files will
be automatically installed into the appropriate locations
and added to <filename>pkg-plist</filename>.</para>
<para>Include
<filename>${PORTSDIR}/devel/pear/bsd.pear.mk</filename>
on the last line of the
<filename>Makefile</filename>.</para>
<example id="pear-makefile">
<title>Example Makefile for PEAR Class</title>
<programlisting>PORTNAME= Date
PORTVERSION= 1.4.3
CATEGORIES= devel www pear
MAINTAINER= example@domain.com
COMMENT= PEAR Date and Time Zone Classes
BUILD_DEPENDS= ${PEARDIR}/PEAR.php:${PORTSDIR}/devel/pear-PEAR
RUN_DEPENDS:= ${BUILD_DEPENDS}
FILES= Date.php Date/Calc.php Date/Human.php Date/Span.php \
Date/TimeZone.php
TESTS= test_calc.php test_date_methods_span.php testunit.php \
testunit_date.php testunit_date_span.php wknotest.txt \
bug674.php bug727_1.php bug727_2.php bug727_3.php \
bug727_4.php bug967.php weeksinmonth_4_monday.txt \
weeksinmonth_4_sunday.txt weeksinmonth_rdm_monday.txt \
weeksinmonth_rdm_sunday.txt
DOCS= TODO
_DOCSDIR= .
.include <bsd.port.pre.mk>
.include "${PORTSDIR}/devel/pear/bsd.pear.mk"
.include <bsd.port.post.mk></programlisting>
</example>
</sect2>
</sect1>
<sect1 id="using-python">
<title>Using Python</title>
<para>The Ports Collection supports parallel installation of
multiple Python versions. Ports should make sure to use a
correct <command>python</command> interpreter, according to
the user-settable <makevar>PYTHON_VERSION</makevar> variable.
Most prominently, this means replacing the path to
<command>python</command> executable in scripts with the value
of <makevar>PYTHON_CMD</makevar> variable.</para>
<para>Ports that install files under
<makevar>PYTHON_SITELIBDIR</makevar> should use the
<literal>pyXY-</literal> package name prefix, so their package
name embeds the version of Python they are installed
into.</para>
<programlisting>PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}</programlisting>
<table frame="none">
<title>Most Useful Variables for Ports That Use Python</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_PYTHON</makevar></entry>
<entry>The port needs Python. Minimal required version
can be specified with values such as
<literal>2.6+</literal>. Version ranges can also be
specified, by separating two version numbers with a
dash, e.g.: <literal>2.6-2.7</literal></entry>
</row>
<row>
<entry><makevar>USE_PYDISTUTILS</makevar></entry>
<entry>Use Python distutils for configuring, compiling
and installing. This is required when the port comes
with <filename>setup.py</filename>. This overrides
the <maketarget>do-build</maketarget> and
<maketarget>do-install</maketarget> targets and may
also override <maketarget>do-configure</maketarget> if
<makevar>GNU_CONFIGURE</makevar> is not
defined.</entry>
</row>
<row>
<entry><makevar>PYTHON_PKGNAMEPREFIX</makevar></entry>
<entry>Used as a <makevar>PKGNAMEPREFIX</makevar> to
distinguish packages for different Python versions.
Example: <literal>py24-</literal></entry>
</row>
<row>
<entry><makevar>PYTHON_SITELIBDIR</makevar></entry>
<entry>Location of the site-packages tree, that contains
installation path of Python (usually
<makevar>LOCALBASE</makevar>). The
<makevar>PYTHON_SITELIBDIR</makevar> variable can be
very useful when installing Python modules.</entry>
</row>
<row>
<entry><makevar>PYTHONPREFIX_SITELIBDIR</makevar></entry>
<entry>The PREFIX-clean variant of PYTHON_SITELIBDIR.
Always use <literal>%%PYTHON_SITELIBDIR%%</literal> in
<filename>pkg-plist</filename> when possible. The
default value of
<literal>%%PYTHON_SITELIBDIR%%</literal> is
<literal>lib/python%%PYTHON_VERSION%%/site-packages</literal></entry>
</row>
<row>
<entry><makevar>PYTHON_CMD</makevar></entry>
<entry>Python interpreter command line, including
version number.</entry>
</row>
<row>
<entry><makevar>PYNUMERIC</makevar></entry>
<entry>Dependency line for numeric extension.</entry>
</row>
<row>
<entry><makevar>PYNUMPY</makevar></entry>
<entry>Dependency line for the new numeric extension,
numpy. (PYNUMERIC is deprecated by upstream
vendor).</entry>
</row>
<row>
<entry><makevar>PYXML</makevar></entry>
<entry>Dependency line for XML extension (not needed for
Python 2.0 and higher as it is also in base
distribution).</entry>
</row>
<row>
<entry><makevar>USE_TWISTED</makevar></entry>
<entry>Add dependency on twistedCore. The list of
required components can be specified as a value of
this variable. Example: <literal>web lore pair
flow</literal></entry>
</row>
<row>
<entry><makevar>USE_ZOPE</makevar></entry>
<entry>Add dependency on Zope, a web application
platform. Change Python dependency to Python 2.7.
Set <makevar>ZOPEBASEDIR</makevar> containing a
directory with Zope installation.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>A complete list of available variables can be found in
<filename>/usr/ports/Mk/bsd.python.mk</filename>.</para>
</sect1>
<sect1 id="using-tcl">
<title>Using <application>Tcl/Tk</application></title>
<para>The Ports Collection supports parallel installation of
multiple <application>Tcl/Tk</application> versions. Ports
should try to support at least the default
<application>Tcl/Tk</application> version and higher with the
<makevar>USE_TCL</makevar> and <makevar>USE_TK</makevar>
variables. It is possible to specify the desired version of
<command>tcl</command> with the
<makevar>WITH_TCL_VER</makevar> variable.</para>
<table frame="none">
<title>The Most Useful Variables for Ports That Use
<application>Tcl/Tk</application></title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_TCL</makevar></entry>
<entry>The port depends on the
<application>Tcl</application> library (not the
shell). Minimal required version can be specified
with values such as 84+. Individual unsupported
versions can be specified with the
<makevar>INVALID_TCL_VER</makevar> variable.</entry>
</row>
<row>
<entry><makevar>USE_TCL_BUILD</makevar></entry>
<entry>The port needs <application>Tcl</application>
only during the build time.</entry>
</row>
<row>
<entry><makevar>USE_TCL_WRAPPER</makevar></entry>
<entry>Ports that require the
<application>Tcl</application> shell and do not
require a specific <literal>tclsh</literal> version
should use this new variable. The
<literal>tclsh</literal> wrapper is installed on the
system. The user can specify the desired
<command>tcl</command> shell to use.</entry>
</row>
<row>
<entry><makevar>WITH_TCL_VER</makevar></entry>
<entry>User-defined variable that sets the desired
<application>Tcl</application> version.</entry>
</row>
<row>
<entry><makevar><replaceable>UNIQUENAME</replaceable>_WITH_TCL_VER</makevar></entry>
<entry>Like <makevar>WITH_TCL_VER</makevar>, but
per-port.</entry>
</row>
<row>
<entry><makevar>USE_TCL_THREADS</makevar></entry>
<entry>Require a threaded build of
<application>Tcl/Tk</application>.</entry>
</row>
<row>
<entry><makevar>USE_TK</makevar></entry>
<entry>The port depends on the
<application>Tk</application> library (not the wish
shell). Implies <makevar>USE_TCL</makevar> with the
same value. For more information see the description
of <makevar>USE_TCL</makevar> variable.</entry>
</row>
<row>
<entry><makevar>USE_TK_BUILD</makevar></entry>
<entry>Analog to the <makevar>USE_TCL_BUILD</makevar>
variable.</entry>
</row>
<row>
<entry><makevar>USE_TK_WRAPPER</makevar></entry>
<entry>Analog to the <makevar>USE_TCL_WRAPPER</makevar>
variable.</entry>
</row>
<row>
<entry><makevar>WITH_TK_VER</makevar></entry>
<entry>Analog to the <makevar>WITH_TCL_VER</makevar>
variable and implies <makevar>WITH_TCL_VER</makevar>
of the same value.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>A complete list of available variables can be found in
<filename>/usr/ports/Mk/bsd.tcl.mk</filename>.</para>
</sect1>
<sect1 id="using-emacs">
<title>Using Emacs</title>
<para>This section is yet to be written.</para>
</sect1>
<sect1 id="using-ruby">
<title>Using Ruby</title>
<table frame="none">
<title>Useful Variables for Ports That Use Ruby</title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_RUBY</makevar></entry>
<entry>The port requires Ruby.</entry>
</row>
<row>
<entry><makevar>USE_RUBY_EXTCONF</makevar></entry>
<entry>The port uses <filename>extconf.rb</filename> to
configure.</entry>
</row>
<row>
<entry><makevar>USE_RUBY_SETUP</makevar></entry>
<entry>The port uses <filename>setup.rb</filename> to
configure.</entry>
</row>
<row>
<entry><makevar>RUBY_SETUP</makevar></entry>
<entry>Set to the alternative name of
<filename>setup.rb</filename>. Common value is
<filename>install.rb</filename>.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following table shows the selected variables available
to port authors via the ports infrastructure. These variables
should be used to install files into their proper locations.
Use them in <filename>pkg-plist</filename> as much as
possible. These variables should not be redefined in the
port.</para>
<table frame="none">
<title>Selected Read-Only Variables for Ports That Use
Ruby</title>
<tgroup cols="3">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
<entry>Example value</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>RUBY_PKGNAMEPREFIX</makevar></entry>
<entry>Used as a <makevar>PKGNAMEPREFIX</makevar> to
distinguish packages for different Ruby
versions.</entry>
<entry><literal>ruby18-</literal></entry>
</row>
<row>
<entry><makevar>RUBY_VERSION</makevar></entry>
<entry>Full version of Ruby in the form of
<literal>x.y.z</literal>.</entry>
<entry><literal>1.8.2</literal></entry>
</row>
<row>
<entry><makevar>RUBY_SITELIBDIR</makevar></entry>
<entry>Architecture independent libraries installation
path.</entry>
<entry><literal>/usr/local/lib/ruby/site_ruby/1.8</literal></entry>
</row>
<row>
<entry><makevar>RUBY_SITEARCHLIBDIR</makevar></entry>
<entry>Architecture dependent libraries installation
path.</entry>
<entry><literal>/usr/local/lib/ruby/site_ruby/1.8/amd64-freebsd6</literal></entry>
</row>
<row>
<entry><makevar>RUBY_MODDOCDIR</makevar></entry>
<entry>Module documentation installation path.</entry>
<entry><literal>/usr/local/share/doc/ruby18/patsy</literal></entry>
</row>
<row>
<entry><makevar>RUBY_MODEXAMPLESDIR</makevar></entry>
<entry>Module examples installation path.</entry>
<entry><literal>/usr/local/share/examples/ruby18/patsy</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<para>A complete list of available variables can be found in
<filename>/usr/ports/Mk/bsd.ruby.mk</filename>.</para>
</sect1>
<sect1 id="using-sdl">
<title>Using SDL</title>
<para>The <makevar>USE_SDL</makevar> variable is used to
autoconfigure the dependencies for ports which use an SDL
based library like <filename
role="package">devel/sdl12</filename> and <filename
role="package">x11-toolkits/sdl_gui</filename>.</para>
<para>The following SDL libraries are recognized at the
moment:</para>
<itemizedlist>
<listitem>
<para>sdl: <filename
role="package">devel/sdl12</filename></para>
</listitem>
<listitem>
<para>gfx: <filename
role="package">graphics/sdl_gfx</filename></para>
</listitem>
<listitem>
<para>gui: <filename
role="package">x11-toolkits/sdl_gui</filename></para>
</listitem>
<listitem>
<para>image: <filename
role="package">graphics/sdl_image</filename></para>
</listitem>
<listitem>
<para>ldbad: <filename
role="package">devel/sdl_ldbad</filename></para>
</listitem>
<listitem>
<para>mixer: <filename
role="package">audio/sdl_mixer</filename></para>
</listitem>
<listitem>
<para>mm: <filename
role="package">devel/sdlmm</filename></para>
</listitem>
<listitem>
<para>net: <filename
role="package">net/sdl_net</filename></para>
</listitem>
<listitem>
<para>sound: <filename
role="package">audio/sdl_sound</filename></para>
</listitem>
<listitem>
<para>ttf: <filename
role="package">graphics/sdl_ttf</filename></para>
</listitem>
</itemizedlist>
<para>Therefore, if a port has a dependency on
<filename role="package">net/sdl_net</filename> and
<filename role="package">audio/sdl_mixer</filename>,
the syntax will be:</para>
<programlisting>USE_SDL= net mixer</programlisting>
<para>The dependency <filename
role="package">devel/sdl12</filename>, which is required by
<filename role="package">net/sdl_net</filename> and <filename
role="package">audio/sdl_mixer</filename>, is automatically
added as well.</para>
<para>If you use <makevar>USE_SDL</makevar>, it will
automatically:</para>
<itemizedlist>
<listitem>
<para>Add a dependency on
<application>sdl12-config</application> to
<makevar>BUILD_DEPENDS</makevar></para>
</listitem>
<listitem>
<para>Add the variable <makevar>SDL_CONFIG</makevar> to
<makevar>CONFIGURE_ENV</makevar></para>
</listitem>
<listitem>
<para>Add the dependencies of the selected libraries to the
<makevar>LIB_DEPENDS</makevar></para>
</listitem>
</itemizedlist>
<para>To check whether an SDL library is available, you can do
it with the <makevar>WANT_SDL</makevar> variable:</para>
<programlisting>WANT_SDL= yes
.include <bsd.port.pre.mk>
.if ${HAVE_SDL:Mmixer}!=""
USE_SDL+= mixer
.endif
.include <bsd.port.post.mk></programlisting>
</sect1>
<sect1 id="using-wx">
<title>Using <application>wxWidgets</application></title>
<para>This section describes the status of the
<application>wxWidgets</application> libraries in the ports
tree and its integration with the ports system.</para>
<sect2 id="wx-introduction">
<title>Introduction</title>
<para>There are many versions of the
<application>wxWidgets</application> libraries which
conflict between them (install files under the same name).
In the ports tree this problem has been solved by installing
each version under a different name using version number
suffixes.</para>
<para>The obvious disadvantage of this is that each
application has to be modified to find the expected version.
Fortunately, most of the applications call the
<command>wx-config</command> script to determine the
necessary compiler and linker flags. The script is named
differently for every available version. Majority of
applications respect an environment variable, or accept a
configure argument, to specify which
<command>wx-config</command> script to call. Otherwise they
have to be patched.</para>
</sect2>
<sect2 id="wx-version">
<title>Version Selection</title>
<para>To make your port use a specific version of
<application>wxWidgets</application> there are two variables
available for defining (if only one is defined the other
will be set to a default value):</para>
<table id="wx-ver-sel-table" frame="none">
<title>Variables to Select
<application>wxWidgets</application> Versions</title>
<tgroup cols="3">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
<entry>Default value</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_WX</makevar></entry>
<entry>List of versions the port can use</entry>
<entry>All available versions</entry>
</row>
<row>
<entry><makevar>USE_WX_NOT</makevar></entry>
<entry>List of versions the port can not use</entry>
<entry>None</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following is a list of available
<application>wxWidgets</application> versions and the
corresponding ports in the tree:</para>
<table frame="none">
<title>Available <application>wxWidgets</application>
Versions</title>
<tgroup cols="2">
<thead>
<row>
<entry>Version</entry>
<entry>Port</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>2.4</literal></entry>
<entry><filename
role="package">x11-toolkits/wxgtk24</filename></entry>
</row>
<row>
<entry><literal>2.6</literal></entry>
<entry><filename
role="package">x11-toolkits/wxgtk26</filename></entry>
</row>
<row>
<entry><literal>2.8</literal></entry>
<entry><filename
role="package">x11-toolkits/wxgtk28</filename></entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>The versions starting from <literal>2.5</literal> also
come in Unicode version and are installed by a slave port
named like the normal one plus a
<literal>-unicode</literal> suffix, but this can be
handled with variables (see <xref
linkend="wx-unicode"/>).</para>
</note>
<para>The variables in <xref linkend="wx-ver-sel-table"/> can
be set to one or more of the following combinations
separated by spaces:</para>
<table frame="none">
<title><application>wxWidgets</application> Version
Specifications</title>
<tgroup cols="2">
<thead>
<row>
<entry>Description</entry>
<entry>Example</entry>
</row>
</thead>
<tbody>
<row>
<entry>Single version</entry>
<entry><literal>2.4</literal></entry>
</row>
<row>
<entry>Ascending range</entry>
<entry><literal>2.4+</literal></entry>
</row>
<row>
<entry>Descending range</entry>
<entry><literal>2.6-</literal></entry>
</row>
<row>
<entry>Full range (must be ascending)</entry>
<entry><literal>2.4-2.6</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<para>There are also some variables to select the preferred
versions from the available ones. They can be set to a list
of versions, the first ones will have higher
priority.</para>
<table frame="none">
<title>Variables to Select Preferred
<application>wxWidgets</application> Versions</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Designed for</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>WANT_WX_VER</makevar></entry>
<entry>the port</entry>
</row>
<row>
<entry><makevar>WITH_WX_VER</makevar></entry>
<entry>the user</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="wx-components">
<title>Component Selection</title>
<para>There are other applications that, while not being
<application>wxWidgets</application> libraries, are related
to them. These applications can be specified in the
<makevar>WX_COMPS</makevar> variable. The following
components are available:</para>
<table frame="none">
<title>Available <application>wxWidgets</application>
Components</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
<entry>Version restriction</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>wx</literal></entry>
<entry>main library</entry>
<entry>none</entry>
</row>
<row>
<entry><literal>contrib</literal></entry>
<entry>contributed libraries</entry>
<entry><literal>none</literal></entry>
</row>
<row>
<entry><literal>python</literal></entry>
<entry><application>wxPython</application>
(<application>Python</application> bindings)</entry>
<entry><literal>2.4-2.6</literal></entry>
</row>
<row>
<entry><literal>mozilla</literal></entry>
<entry><application>wxMozilla</application></entry>
<entry><literal>2.4</literal></entry>
</row>
<row>
<entry><literal>svg</literal></entry>
<entry><application>wxSVG</application></entry>
<entry><literal>2.6</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The dependency type can be selected for each component
by adding a suffix separated by a semicolon. If not present
then a default type will be used (see <xref
linkend="wx-def-dep-types"/>). The following types are
available:</para>
<table frame="none">
<title>Available <application>wxWidgets</application>
Dependency Types</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>build</literal></entry>
<entry>Component is required for building, equivalent
to <makevar>BUILD_DEPENDS</makevar></entry>
</row>
<row>
<entry><literal>run</literal></entry>
<entry>Component is required for running, equivalent
to <makevar>RUN_DEPENDS</makevar></entry>
</row>
<row>
<entry><literal>lib</literal></entry>
<entry>Component is required for building and running,
equivalent to <makevar>LIB_DEPENDS</makevar></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The default values for the components are detailed in
the following table:</para>
<table id="wx-def-dep-types" frame="none">
<title>Default <application>wxWidgets</application>
Dependency Types</title>
<tgroup cols="2">
<thead>
<row>
<entry>Component</entry>
<entry>Dependency type</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>wx</literal></entry>
<entry><literal>lib</literal></entry>
</row>
<row>
<entry><literal>contrib</literal></entry>
<entry><literal>lib</literal></entry>
</row>
<row>
<entry><literal>python</literal></entry>
<entry><literal>run</literal></entry>
</row>
<row>
<entry><literal>mozilla</literal></entry>
<entry><literal>lib</literal></entry>
</row>
<row>
<entry><literal>svg</literal></entry>
<entry><literal>lib</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<example id="wx-components-example">
<title>Selecting <application>wxWidgets</application>
Components</title>
<para>The following fragment corresponds to a port which
uses <application>wxWidgets</application> version
<literal>2.4</literal> and its contributed
libraries.</para>
<programlisting>USE_WX= 2.4
WX_COMPS= wx contrib</programlisting>
</example>
</sect2>
<sect2 id="wx-unicode">
<title>Unicode</title>
<para>The <application>wxWidgets</application> library
supports Unicode since version <literal>2.5</literal>. In
the ports tree both versions are available and can be
selected with the following variables:</para>
<table id="wx-unicode-var-table" frame="none">
<title>Variables to Select Unicode in
<application>wxWidgets</application>
Versions</title>
<tgroup cols="3">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
<entry>Designed for</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>WX_UNICODE</makevar></entry>
<entry>The port works <emphasis>only</emphasis> with
the Unicode version</entry>
<entry>the port</entry>
</row>
<row>
<entry><makevar>WANT_UNICODE</makevar></entry>
<entry>The port works with both versions but prefers
the Unicode one</entry>
<entry>the port</entry>
</row>
<row>
<entry><makevar>WITH_UNICODE</makevar></entry>
<entry>The port will use the Unicode version</entry>
<entry>the user</entry>
</row>
<row>
<entry><makevar>WITHOUT_UNICODE</makevar></entry>
<entry>The port will use the normal version if
supported (when <makevar>WX_UNICODE</makevar> is not
defined)</entry>
<entry>the user</entry>
</row>
</tbody>
</tgroup>
</table>
<warning>
<para>Do not use <makevar>WX_UNICODE</makevar> for ports
that can use both Unicode and normal versions. If you
want the port to use Unicode by default define
<makevar>WANT_UNICODE</makevar> instead.</para>
</warning>
</sect2>
<sect2 id="wx-version-detection">
<title>Detecting Installed Versions</title>
<para>To detect an installed version you have to define
<makevar>WANT_WX</makevar>. If you do not set it to a
specific version then the components will have a version
suffix. The <makevar>HAVE_WX</makevar> variable will be
filled after detection.</para>
<example id="wx-ver-det-example">
<title>Detecting Installed
<application>wxWidgets</application> Versions and
Components</title>
<para>The following fragment can be used in a port that uses
<application>wxWidgets</application> if it is installed,
or an option is selected.</para>
<programlisting>WANT_WX= yes
.include <bsd.port.pre.mk>
.if defined(WITH_WX) || !empty(PORT_OPTIONS:MWX) || !empty(HAVE_WX:Mwx-2.4)
USE_WX= 2.4
CONFIGURE_ARGS+= --enable-wx
.endif</programlisting>
<para>The following fragment can be used in a port that
enables <application>wxPython</application> support if it
is installed or if an option is selected, in addition to
<application>wxWidgets</application>, both version
<literal>2.6</literal>.</para>
<programlisting>USE_WX= 2.6
WX_COMPS= wx
WANT_WX= 2.6
.include <bsd.port.pre.mk>
.if defined(WITH_WXPYTHON) || !empty(PORT_OPTIONS:MWXPYTHON) || !empty(HAVE_WX:Mpython)
WX_COMPS+= python
CONFIGURE_ARGS+= --enable-wxpython
.endif</programlisting>
</example>
</sect2>
<sect2 id="wx-defined-variables">
<title>Defined Variables</title>
<para>The following variables are available in the port (after
defining one from
<xref linkend="wx-ver-sel-table"/>).</para>
<table frame="none">
<title>Variables Defined for Ports That Use
<application>wxWidgets</application></title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>WX_CONFIG</makevar></entry>
<entry>The path to the
<application>wxWidgets</application>
<command>wx-config</command> script (with different
name)</entry>
</row>
<row>
<entry><makevar>WXRC_CMD</makevar></entry>
<entry>The path to the
<application>wxWidgets</application>
<command>wxrc</command> program (with different
name)</entry>
</row>
<row>
<entry><makevar>WX_VERSION</makevar></entry>
<entry>The <application>wxWidgets</application>
version that is going to be used (e.g.,
<literal>2.6</literal>)</entry>
</row>
<row>
<entry><makevar>WX_UNICODE</makevar></entry>
<entry>If not defined but Unicode is going to be used
then it will be defined</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="wx-premk">
<title>Processing in
<filename>bsd.port.pre.mk</filename></title>
<para>If you need to use the variables for running commands
right after including <filename>bsd.port.pre.mk</filename>
you need to define <makevar>WX_PREMK</makevar>.</para>
<important>
<para>If you define <makevar>WX_PREMK</makevar>, then the
version, dependencies, components and defined variables
will not change if you modify the
<application>wxWidgets</application> port variables
<emphasis>after</emphasis> including
<filename>bsd.port.pre.mk</filename>.</para>
</important>
<example id="wx-premk-example">
<title>Using <application>wxWidgets</application> Variables
in Commands</title>
<para>The following fragment illustrates the use of
<makevar>WX_PREMK</makevar> by running the
<command>wx-config</command> script to obtain the full
version string, assign it to a variable and pass it to the
program.</para>
<programlisting>USE_WX= 2.4
WX_PREMK= yes
.include <bsd.port.pre.mk>
.if exists(${WX_CONFIG})
VER_STR!= ${WX_CONFIG} --release
PLIST_SUB+= VERSION="${VER_STR}"
.endif</programlisting>
</example>
<note>
<para>The <application>wxWidgets</application> variables can
be safely used in commands when they are inside targets
without the need of <makevar>WX_PREMK</makevar>.</para>
</note>
</sect2>
<sect2 id="wx-additional-config-args">
<title>Additional <command>configure</command>
Arguments</title>
<para>Some GNU <command>configure</command> scripts can not
find <application>wxWidgets</application> with just the
<literal>WX_CONFIG</literal> environment variable set,
requiring additional arguments. The
<makevar>WX_CONF_ARGS</makevar> variable can be used for
provide them.</para>
<table frame="none">
<title>Legal Values for
<makevar>WX_CONF_ARGS</makevar></title>
<tgroup cols="2">
<thead>
<row>
<entry>Possible value</entry>
<entry>Resulting argument</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>absolute</literal></entry>
<entry><literal>--with-wx-config=${WX_CONFIG}</literal></entry>
</row>
<row>
<entry><literal>relative</literal></entry>
<entry><literal>--with-wx=${LOCALBASE}
--with-wx-config=${WX_CONFIG:T}</literal></entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
</sect1>
<sect1 id="using-lua">
<title>Using <application>Lua</application></title>
<para>This section describes the status of the
<application>Lua</application> libraries in the ports tree and
its integration with the ports system.</para>
<sect2 id="lua-introduction">
<title>Introduction</title>
<para>There are many versions of the
<application>Lua</application> libraries and corresponding
interpreters, which conflict between them (install files
under the same name). In the ports tree this problem has
been solved by installing each version under a different
name using version number suffixes.</para>
<para>The obvious disadvantage of this is that each
application has to be modified to find the expected version.
But it can be solved by adding some additional flags to the
compiler and linker.</para>
</sect2>
<sect2 id="lua-version">
<title>Version Selection</title>
<para>To make your port use a specific version of
<application>Lua</application> there are two variables
available for defining (if only one is defined the other
will be set to a default value):</para>
<table id="lua-ver-sel-table" frame="none">
<title>Variables to Select <application>Lua</application>
Versions</title>
<tgroup cols="3">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
<entry>Default value</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_LUA</makevar></entry>
<entry>List of versions the port can use</entry>
<entry>All available versions</entry>
</row>
<row>
<entry><makevar>USE_LUA_NOT</makevar></entry>
<entry>List of versions the port can not use</entry>
<entry>None</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following is a list of available
<application>Lua</application> versions and the
corresponding ports in the tree:</para>
<table frame="none">
<title>Available <application>Lua</application>
Versions</title>
<tgroup cols="2">
<thead>
<row>
<entry>Version</entry>
<entry>Port</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>4.0</literal></entry>
<entry><filename
role="package">lang/lua4</filename></entry>
</row>
<row>
<entry><literal>5.0</literal></entry>
<entry><filename
role="package">lang/lua50</filename></entry>
</row>
<row>
<entry><literal>5.1</literal></entry>
<entry><filename
role="package">lang/lua</filename></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The variables in <xref linkend="lua-ver-sel-table"/> can
be set to one or more of the following combinations
separated by spaces:</para>
<table frame="none">
<title><application>Lua</application> Version
Specifications</title>
<tgroup cols="2">
<thead>
<row>
<entry>Description</entry>
<entry>Example</entry>
</row>
</thead>
<tbody>
<row>
<entry>Single version</entry>
<entry><literal>4.0</literal></entry>
</row>
<row>
<entry>Ascending range</entry>
<entry><literal>5.0+</literal></entry>
</row>
<row>
<entry>Descending range</entry>
<entry><literal>5.0-</literal></entry>
</row>
<row>
<entry>Full range (must be ascending)</entry>
<entry><literal>5.0-5.1</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<para>There are also some variables to select the preferred
versions from the available ones. They can be set to a list
of versions, the first ones will have higher
priority.</para>
<table frame="none">
<title>Variables to Select Preferred
<application>Lua</application> Versions</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Designed for</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>WANT_LUA_VER</makevar></entry>
<entry>the port</entry>
</row>
<row>
<entry><makevar>WITH_LUA_VER</makevar></entry>
<entry>the user</entry>
</row>
</tbody>
</tgroup>
</table>
<example id="lua-version-example">
<title>Selecting the <application>Lua</application>
Version</title>
<para>The following fragment is from a port which can use
<application>Lua</application> version
<literal>5.0</literal> or <literal>5.1</literal>, and uses
<literal>5.0</literal> by default. It can be overridden
by the user with <makevar>WITH_LUA_VER</makevar>.</para>
<programlisting>USE_LUA= 5.0-5.1
WANT_LUA_VER= 5.0</programlisting>
</example>
</sect2>
<sect2 id="lua-components">
<title>Component Selection</title>
<para>There are other applications that, while not being
<application>Lua</application> libraries, are related to
them. These applications can be specified in the
<makevar>LUA_COMPS</makevar> variable. The following
components are available:</para>
<table frame="none">
<title>Available <application>Lua</application>
Components</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
<entry>Version restriction</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>lua</literal></entry>
<entry>main library</entry>
<entry>none</entry>
</row>
<row>
<entry><literal>tolua</literal></entry>
<entry>Library for accessing C/C++ code</entry>
<entry><literal>4.0-5.0</literal></entry>
</row>
<row>
<entry><literal>ruby</literal></entry>
<entry>Ruby bindings</entry>
<entry><literal>4.0-5.0</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>There are more components but they are modules for the
interpreter, not used by applications (only by other
modules).</para>
</note>
<para>The dependency type can be selected for each component
by adding a suffix separated by a semicolon. If not present
then a default type will be used (see <xref
linkend="lua-def-dep-types"/>). The following types are
available:</para>
<table frame="none">
<title>Available <application>Lua</application> Dependency
Types</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>build</literal></entry>
<entry>Component is required for building, equivalent
to <makevar>BUILD_DEPENDS</makevar></entry>
</row>
<row>
<entry><literal>run</literal></entry>
<entry>Component is required for running, equivalent
to <makevar>RUN_DEPENDS</makevar></entry>
</row>
<row>
<entry><literal>lib</literal></entry>
<entry>Component is required for building and running,
equivalent to <makevar>LIB_DEPENDS</makevar></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The default values for the components are detailed in
the following table:</para>
<table id="lua-def-dep-types" frame="none">
<title>Default <application>Lua</application> Dependency
Types</title>
<tgroup cols="2">
<thead>
<row>
<entry>Component</entry>
<entry>Dependency type</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>lua</literal></entry>
<entry><literal>lib</literal> for
<literal>4.0-5.0</literal> (shared) and
<literal>build</literal> for <literal>5.1</literal>
(static)</entry>
</row>
<row>
<entry><literal>tolua</literal></entry>
<entry><literal>build</literal> (static)</entry>
</row>
<row>
<entry><literal>ruby</literal></entry>
<entry><literal>lib</literal> (shared)</entry>
</row>
</tbody>
</tgroup>
</table>
<example id="lua-components-example">
<title>Selecting <application>Lua</application>
Components</title>
<para>The following fragment corresponds to a port which
uses <application>Lua</application> version
<literal>4.0</literal> and its
<application>Ruby</application> bindings.</para>
<programlisting>USE_LUA= 4.0
LUA_COMPS= lua ruby</programlisting>
</example>
</sect2>
<sect2 id="lua-version-detection">
<title>Detecting Installed Versions</title>
<para>To detect an installed version you have to define
<makevar>WANT_LUA</makevar>. If you do not set it to a
specific version then the components will have a version
suffix. The <makevar>HAVE_LUA</makevar> variable will be
filled after detection.</para>
<example id="lua-ver-det-example">
<title>Detecting Installed <application>Lua</application>
Versions and Components</title>
<para>The following fragment can be used in a port that uses
<application>Lua</application> if it is installed, or an
option is selected.</para>
<programlisting>WANT_LUA= yes
.include <bsd.port.pre.mk>
.if defined(WITH_LUA5) || !empty(PORT_OPTIONS:MLUA5) || !empty(HAVE_LUA:Mlua-5.[01])
USE_LUA= 5.0-5.1
CONFIGURE_ARGS+= --enable-lua5
.endif</programlisting>
<para>The following fragment can be used in a port that
enables <application>tolua</application> support if it is
installed or if an option is selected, in addition to
<application>Lua</application>, both version
<literal>4.0</literal>.</para>
<programlisting>USE_LUA= 4.0
LUA_COMPS= lua
WANT_LUA= 4.0
.include <bsd.port.pre.mk>
.if defined(WITH_TOLUA) || !empty(PORT_OPTIONS:MTOLUA) || !empty(HAVE_LUA:Mtolua)
LUA_COMPS+= tolua
CONFIGURE_ARGS+= --enable-tolua
.endif</programlisting>
</example>
</sect2>
<sect2 id="lua-defined-variables">
<title>Defined Variables</title>
<para>The following variables are available in the port (after
defining one from <xref
linkend="lua-ver-sel-table"/>).</para>
<table frame="none">
<title>Variables Defined for Ports That Use
<application>Lua</application></title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>LUA_VER</makevar></entry>
<entry>The <application>Lua</application> version that
is going to be used (e.g.,
<literal>5.1</literal>)</entry>
</row>
<row>
<entry><makevar>LUA_VER_SH</makevar></entry>
<entry>The <application>Lua</application> shared
library major version (e.g.,
<literal>1</literal>)</entry>
</row>
<row>
<entry><makevar>LUA_VER_STR</makevar></entry>
<entry>The <application>Lua</application> version
without the dots (e.g.,
<literal>51</literal>)</entry>
</row>
<row>
<entry><makevar>LUA_PREFIX</makevar></entry>
<entry>The prefix where <application>Lua</application>
(and components) is installed</entry>
</row>
<row>
<entry><makevar>LUA_SUBDIR</makevar></entry>
<entry>The directory under
<filename>${PREFIX}/bin</filename>,
<filename>${PREFIX}/share</filename> and
<filename>${PREFIX}/lib</filename> where
<application>Lua</application> is installed</entry>
</row>
<row>
<entry><makevar>LUA_INCDIR</makevar></entry>
<entry>The directory where
<application>Lua</application> and
<application>tolua</application> header files are
installed</entry>
</row>
<row>
<entry><makevar>LUA_LIBDIR</makevar></entry>
<entry>The directory where
<application>Lua</application> and
<application>tolua</application> libraries are
installed</entry>
</row>
<row>
<entry><makevar>LUA_MODLIBDIR</makevar></entry>
<entry>The directory where
<application>Lua</application> module libraries
(<filename>.so</filename>) are installed</entry>
</row>
<row>
<entry><makevar>LUA_MODSHAREDIR</makevar></entry>
<entry>The directory where
<application>Lua</application> modules
(<filename>.lua</filename>) are installed</entry>
</row>
<row>
<entry><makevar>LUA_PKGNAMEPREFIX</makevar></entry>
<entry>The package name prefix used by
<application>Lua</application> modules</entry>
</row>
<row>
<entry><makevar>LUA_CMD</makevar></entry>
<entry>The path to the <application>Lua</application>
interpreter</entry>
</row>
<row>
<entry><makevar>LUAC_CMD</makevar></entry>
<entry>The path to the <application>Lua</application>
compiler</entry>
</row>
<row>
<entry><makevar>TOLUA_CMD</makevar></entry>
<entry>The path to the
<application>tolua</application> program</entry>
</row>
</tbody>
</tgroup>
</table>
<example id="lua-variables-example">
<title>Telling the Port Where to Find
<application>Lua</application></title>
<para>The following fragment shows how to tell a port that
uses a configure script where the
<application>Lua</application> header files and libraries
are.</para>
<programlisting>USE_LUA= 4.0
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="-I${LUA_INCDIR}" LDFLAGS="-L${LUA_LIBDIR}"</programlisting>
</example>
</sect2>
<sect2 id="lua-premk">
<title>Processing in
<filename>bsd.port.pre.mk</filename></title>
<para>If you need to use the variables for running commands
right after including <filename>bsd.port.pre.mk</filename>
you need to define <makevar>LUA_PREMK</makevar>.</para>
<important>
<para>If you define <makevar>LUA_PREMK</makevar>, then the
version, dependencies, components and defined variables
will not change if you modify the
<application>Lua</application> port variables
<emphasis>after</emphasis> including
<filename>bsd.port.pre.mk</filename>.</para>
</important>
<example id="lua-premk-example">
<title>Using <application>Lua</application> Variables in
Commands</title>
<para>The following fragment illustrates the use of
<makevar>LUA_PREMK</makevar> by running the
<application>Lua</application> interpreter to obtain the
full version string, assign it to a variable and pass it
to the program.</para>
<programlisting>USE_LUA= 5.0
LUA_PREMK= yes
.include <bsd.port.pre.mk>
.if exists(${LUA_CMD})
VER_STR!= ${LUA_CMD} -v
CFLAGS+= -DLUA_VERSION_STRING="${VER_STR}"
.endif</programlisting>
</example>
<note>
<para>The <application>Lua</application> variables can be
safely used in commands when they are inside targets
without the need of <makevar>LUA_PREMK</makevar>.</para>
</note>
</sect2>
</sect1>
<sect1 id="using-xfce">
<title>Using Xfce</title>
<para>The <makevar>USE_XFCE</makevar> variable is used to
autoconfigure the dependencies for ports which use an Xfce
based library or application like <filename
role="package">x11-toolkits/libxfce4gui</filename> and
<filename role="package">x11-wm/xfce4-panel</filename>.</para>
<para>The following Xfce libraries and applications are
recognized at the moment:</para>
<itemizedlist>
<listitem>
<para>libexo: <filename
role="package">x11/libexo</filename></para>
</listitem>
<listitem>
<para>libgui: <filename
role="package">x11-toolkits/libxfce4gui</filename></para>
</listitem>
<listitem>
<para>libutil: <filename
role="package">x11/libxfce4util</filename></para>
</listitem>
<listitem>
<para>libmcs: <filename
role="package">x11/libxfce4mcs</filename></para>
</listitem>
<listitem>
<para>mcsmanager: <filename
role="package">sysutils/xfce4-mcs-manager</filename></para>
</listitem>
<listitem>
<para>panel: <filename
role="package">x11-wm/xfce4-panel</filename></para>
</listitem>
<listitem>
<para>thunar: <filename
role="package">x11-fm/thunar</filename></para>
</listitem>
<listitem>
<para>wm: <filename
role="package">x11-wm/xfce4-wm</filename></para>
</listitem>
<listitem>
<para>xfdev: <filename
role="package">dev/xfce4-dev-tools</filename></para>
</listitem>
</itemizedlist>
<para>The following additional parameters are recognized:</para>
<itemizedlist>
<listitem>
<para>configenv: Use this if your port requires a special
modified <makevar>CONFIGURE_ENV</makevar> to find its
required libraries.</para>
<programlisting>-I${LOCALBASE}/include -L${LOCALBASE}/lib</programlisting>
<para>gets added to CPPFLAGS to
<makevar>CONFIGURE_ENV</makevar>.</para>
</listitem>
</itemizedlist>
<para>Therefore, if a port has a dependency on <filename
role="package">sysutils/xfce4-mcs-manager</filename> and
requires the special CPPFLAGS in its configure environment,
the syntax will be:</para>
<programlisting>USE_XFCE= mcsmanager configenv</programlisting>
</sect1>
<sect1 id="using-mozilla">
<title>Using Mozilla</title>
<table frame="none">
<title>Variables for Ports That Use Mozilla</title>
<tgroup cols="2">
<tbody>
<row>
<entry><makevar>USE_GECKO</makevar></entry>
<entry>Gecko backend the port can handle. Possible
values: <literal>libxul</literal>
(<filename>libxul.so</filename>),
<literal>seamonkey</literal>
(<filename>libgtkembedmoz.so</filename>, deprecated,
should not be used any more).</entry>
</row>
<row>
<entry><makevar>USE_FIREFOX</makevar></entry>
<entry>The port requires Firefox as a runtime
dependency. Possible values: <literal>yes</literal>
(get default version), <literal>40</literal>,
<literal>36</literal>, <literal>35</literal>. Default
dependency is on version
<literal>40</literal>.</entry>
</row>
<row>
<entry><makevar>USE_FIREFOX_BUILD</makevar></entry>
<entry>The port requires Firefox as a buildtime
dependency. Possible values: see USE_FIREFOX. This
automatically sets USE_FIREFOX and assigns the same
value.</entry>
</row>
<row>
<entry><makevar>USE_SEAMONKEY</makevar></entry>
<entry>The port requires SeaMonkey as a runtime
dependency. Possible values: <literal>yes</literal>
(get default version), <literal>20</literal>,
<literal>11</literal> (deprecated, should not be used
any more). Default dependency is on version
<literal>20</literal>.</entry>
</row>
<row>
<entry><makevar>USE_SEAMONKEY_BUILD</makevar></entry>
<entry>The port requires SeaMonkey as a buildtime
dependency. Possible values: see USE_SEAMONKEY. This
automatically sets USE_SEAMONKEY and assigns the same
value.</entry>
</row>
<row>
<entry><makevar>USE_THUNDERBIRD</makevar></entry>
<entry>The port requires Thunderbird as a runtime
dependency. Possible values: <literal>yes</literal>
(get default version), <literal>31</literal>,
<literal>30</literal> (deprecated, should not be used
any more). Default dependency is on version
<literal>31</literal>.</entry>
</row>
<row>
<entry><makevar>USE_THUNDERBIRD_BUILD</makevar></entry>
<entry>The port requires Thunderbird as a buildtime
dependency. Possible values: see USE_THUNDERBIRD.
This automatically sets USE_THUNDERBIRD and assigns
the same value.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>A complete list of available variables can be found in
<filename>/usr/ports/Mk/bsd.gecko.mk</filename>.</para>
</sect1>
<sect1 id="using-databases">
<title>Using Databases</title>
<table frame="none">
<title>Variables for Ports Using Databases</title>
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Means</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>USE_BDB</makevar></entry>
<entry>If variable is set to <literal>yes</literal>,
add dependency on <filename
role="package">databases/db41</filename> port. The
variable may also be set to values: 40, 41, 42, 43,
44, 46, 47, 48, or 51. You can declare a range of
acceptable values, <makevar>USE_BDB</makevar>=42+ will
find the highest installed version, and fall back to
42 if nothing else is installed.</entry>
</row>
<row>
<entry><makevar>USE_MYSQL</makevar></entry>
<entry>If variable is set to <literal>yes</literal>, add
dependency on <filename
role="package">databases/mysql55-client</filename>
port. An associated variable,
<makevar>WANT_MYSQL_VER</makevar>, may be set to
values such as 323, 40, 41, 50, 51, 52, 55, or
60.</entry>
</row>
<row>
<entry><makevar>USE_PGSQL</makevar></entry>
<entry>If set to <literal>yes</literal>, add dependency
on <filename
role="package">databases/postgresql90-client</filename>
port. An associated variable,
<makevar>WANT_PGSQL_VER</makevar>, may be set to
values such as 83, 84, 90, 91 or 92. You can declare
a minimum or maximum value;
<makevar>WANT_PGSQL_VER</makevar>=
<literal> 90+</literal> will cause the
port to depend on a minimum version of 9.0.</entry>
</row>
<row>
<entry><makevar>USE_SQLITE</makevar></entry>
<entry>If variable is set to <literal>yes</literal>, add
dependency on
<filename role="package">databases/sqlite3</filename>
port. The variable may also be set to values: 3,
2.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>More details are available in <ulink
url="http://svn.FreeBSD.org/ports/head/Mk/bsd.database.mk?view=markup">bsd.database.mk</ulink>.</para>
</sect1>
<sect1 id="rc-scripts">
<title>Starting and Stopping Services (<literal>rc</literal>
Scripts)</title>
<para><filename>rc.d</filename> scripts are used to start
services on system startup, and to give administrators a
standard way of stopping, starting and restarting the service.
Ports integrate into the system <filename>rc.d</filename>
framework. Details on its usage can be found in <ulink
url="&url.books.handbook;/configtuning-rcd.html">the rc.d
Handbook chapter</ulink>. Detailed explanation of available
commands is provided in &man.rc.8; and &man.rc.subr.8;.
Finally, there is <ulink url="&url.articles.rc-scripting;">an
article</ulink> on practical aspects of
<filename>rc.d</filename> scripting.</para>
<para>One or more <filename>rc.d</filename> scripts can be
installed:</para>
<programlisting>USE_RC_SUBR= doormand</programlisting>
<para>Scripts must be placed in the <filename>files</filename>
subdirectory and a <literal>.in</literal> suffix must be added
to their filename. Standard <makevar>SUB_LIST</makevar>
expansions will be used for this file. Use of the
<literal>%%PREFIX%%</literal> and
<literal>%%LOCALBASE%%</literal> expansions is strongly
encouraged as well. More on <makevar>SUB_LIST</makevar> in
<link
linkend="using-sub-files">the relevant
section</link>.</para>
<para>Prior to &os; 6.1-RELEASE, integration with
&man.rcorder.8; is available by using
<makevar>USE_RCORDER</makevar> instead of
<makevar>USE_RC_SUBR</makevar>. However, use of this method
is not necessary unless the port has an option to install
itself in the base, or the service needs to run prior to the
<filename>FILESYSTEMS</filename> <filename>rc.d</filename>
script in the base.</para>
<para>As of &os; 6.1-RELEASE, local
<filename>rc.d</filename> scripts (including those installed
by ports) are included in the overall &man.rcorder.8; of the
base system.</para>
<para>Example simple <filename>rc.d</filename> script:</para>
<programlisting>#!/bin/sh
# $FreeBSD$
#
# PROVIDE: doormand
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# doormand_enable (bool): Set to NO by default.
# Set it to YES to enable doormand.
# doormand_config (path): Set to %%PREFIX%%/etc/doormand/doormand.cf
# by default.
. /etc/rc.subr
name=doormand
rcvar=doormand_enable
load_rc_config $name
: ${doormand_enable:="NO"}
: ${doormand_config="%%PREFIX%%/etc/doormand/doormand.cf"}
command=%%PREFIX%%/sbin/${name}
pidfile=/var/run/${name}.pid
command_args="-p $pidfile -f $doormand_config"
run_rc_command "$1"</programlisting>
<para> Unless there is a good reason to start the service
earlier all ports scripts should use</para>
<programlisting>REQUIRE: LOGIN</programlisting>
<para>If the service runs as a particular user (other than root)
this is mandatory.</para>
<programlisting>KEYWORD: shutdown</programlisting>
<para>is included in the script above because the mythical port
we are using as an example starts a service, and should be
shut down cleanly when the system shuts down. If the script
is not starting a persistent service this is not
necessary.</para>
<para>For optional configuration elements the "="
style of default variable assignment is preferable to the
":=" style here, since the former sets a default
value only if the variable is unset, and the latter sets one
if the variable is unset <emphasis>or</emphasis> null. A user
might very well include something like</para>
<programlisting>doormand_flags=""</programlisting>
<para>in their <filename>rc.conf.local</filename> file, and a
variable substitution using ":=" would
inappropriately override the user's intention. The
<literal>_enable</literal> variable is not optional,
and should use the ":" for the default.</para>
<note>
<para>No new scripts should be added with the
<filename>.sh</filename> suffix.</para>
</note>
<sect2>
<title>Stopping Services at Deinstall</title>
<para>It is possible to have a service stopped automatically
as part of the deinstall routine. We advise using this
feature only when it is absolutely necessary to stop a
service before its files go away. Usually, it is up to the
administrator's discretion to decide, whether to stop the
service on deinstall or not. Also note this affects
upgrades, too.</para>
<para>A line like this goes in the
<filename>pkg-plist</filename>:</para>
<programlisting>@stopdaemon doormand</programlisting>
<para>The argument must match the content of
<makevar>USE_RC_SUBR</makevar> variable.</para>
</sect2>
<sect2>
<title>Pre-Commit Checklist</title>
<para>Before contributing a port with an
<filename>rc.d</filename> script, and more importantly,
before committing one, please consult the following
checklist to be sure that it is ready.</para>
<procedure>
<step>
<para>If this is a new file, does it have
<filename>.sh</filename> in the file name? If so that
should be changed to just <filename>file.in</filename>
since new <filename>rc.d</filename> files may not end
with that extension.</para>
</step>
<step>
<para>Does the file have a
<literal>$FreeBSD$</literal> tag?</para>
</step>
<step>
<para>Do the name of the file (minus
<filename>.in</filename>), the
<literal>PROVIDE</literal> line, and
<literal>$</literal><replaceable>name</replaceable>
all match? The file name matching
<literal>PROVIDE</literal> makes debugging easier,
especially for &man.rcorder.8; issues. Matching the
file name and
<literal>$</literal><replaceable>name</replaceable>
makes it easier to figure out which variables are
relevant in <filename>rc.conf[.local]</filename>. The
latter is also what you might call “policy”
for all new scripts, including those in the base
system.</para>
</step>
<step>
<para>Is the <literal>REQUIRE</literal> line set to
<literal>LOGIN</literal>? This is mandatory for scripts
that run as a non-root user. If it runs as root, is
there a good reason for it to run prior to
<literal>LOGIN</literal>? If not, it should run there
so that we can loosely group local scripts to a point in
&man.rcorder.8; after most everything in the base is
already running.</para>
</step>
<step>
<para>Does the script start a persistent service? If so,
it should have <literal>KEYWORD:
shutdown</literal>.</para>
</step>
<step>
<para>Make sure there is no <literal>KEYWORD:
FreeBSD</literal> present. This has not been
necessary or desirable for years. It is also an
indication that the new script was copy/pasted from an
old script, so extra caution should be given to the
review.</para>
</step>
<step>
<para>If the script uses an interpreted language like
<command>perl</command>, <command>python</command>, or
<command>ruby</command>, make certain that
<varname>command_interpreter</varname> is set
appropriately. Otherwise,</para>
<screen>&prompt.root; <userinput>service <replaceable>name</replaceable> stop</userinput></screen>
<para>will probably not work properly. See
&man.service.8; for more information.</para>
</step>
<step>
<para>Have all occurrences of
<filename>/usr/local</filename> been replaced with
<literal>%%PREFIX%%</literal>?</para>
</step>
<step>
<para>Do the default variable assignments come after
<function>load_rc_config</function>?</para>
</step>
<step>
<para>Are there default assignments to empty strings?
They should be removed, but double-check that the option
is documented in the comments at the top of the
file.</para>
</step>
<step>
<para>Are things that are set in variables actually used
in the script?</para>
</step>
<step>
<para>Are options listed in the default
<replaceable>name</replaceable><varname>_flags</varname>
things that are actually mandatory? If so, they should
be in <varname>command_args</varname>. The
<option>-d</option> option is a red flag (pardon the
pun) here, since it is usually the option to
“daemonize” the process, and therefore is
actually mandatory.</para>
</step>
<step>
<para>The
<replaceable>name</replaceable><varname>_flags</varname>
variable should never be included in
<varname>command_args</varname> (and vice versa,
although that error is less common).</para>
</step>
<step>
<para>Does the script execute any code unconditionally?
This is frowned on. Usually these things can/should be
dealt with through a
<function>start_precmd</function>.</para>
</step>
<step>
<para>All boolean tests should utilize the
<function>checkyesno</function> function. No
hand-rolled tests for <literal>[Yy][Ee][Ss]</literal>,
etc.</para>
</step>
<step>
<para>If there is a loop (for example, waiting for
something to start) does it have a counter to terminate
the loop? We do not want the boot to be stuck forever
if there is an error.</para>
</step>
<step>
<para>Does the script create files or directories that
need specific permissions, for example, a
<filename>pid</filename> file that needs to be owned by
the user that runs the process? Rather than the
traditional &man.touch.1;/&man.chown.8;/&man.chmod.1;
routine, consider using &man.install.1; with the proper
command line arguments to do the whole procedure with
one step.</para>
</step>
</procedure>
</sect2>
</sect1>
<sect1 id="users-and-groups">
<title>Adding Users and Groups</title>
<para>Some ports require a certain user to be on the installed
system. Choose a free UID from 50 to 999 and register it
either in <filename>ports/UIDs</filename> (for users) or in
<filename>ports/GIDs</filename> (for groups). Make sure you
do not use a UID already used by the system or other
ports.</para>
<para>Please include a patch against these two files when you
require a new user or group to be created for your
port.</para>
<para>Then you can use <makevar>USERS</makevar> and
<makevar>GROUPS</makevar> variables in your
<filename>Makefile</filename>, and the user will be
automatically created when installing the port.</para>
<programlisting>USERS= pulse
GROUPS= pulse pulse-access pulse-rt</programlisting>
<para>The current list of reserved UIDs and GIDs can be found
in <filename>ports/UIDs</filename> and
<filename>ports/GIDs</filename>.</para>
</sect1>
<sect1 id="requiring-kernel-sources">
<title>Ports That Rely on Kernel Sources</title>
<para>Some ports (such as kernel loadable modules) need the
kernel source files so that the port can compile. Here is the
correct way to determine if the user has them
installed:</para>
<programlisting>.if !exists(${SRC_BASE}/sys/Makefile)
IGNORE= requires kernel sources to be installed
.endif</programlisting>
</sect1>
</chapter>
<chapter id="plist">
<title>Advanced <filename>pkg-plist</filename> Practices</title>
<sect1 id="plist-sub">
<title>Changing <filename>pkg-plist</filename> Based on Make
Variables</title>
<para>Some ports, particularly the <literal>p5-</literal> ports,
need to change their <filename>pkg-plist</filename> depending
on what options they are configured with (or version of
<literal>perl</literal>, in the case of <literal>p5-</literal>
ports). To make this easy, any instances in the
<filename>pkg-plist</filename> of
<literal>%%OSREL%%</literal>, <literal>%%PERL_VER%%</literal>,
and <literal>%%PERL_VERSION%%</literal> will be substituted
for appropriately. The value of <literal>%%OSREL%%</literal>
is the numeric revision of the operating system (e.g.,
<literal>4.9</literal>). <literal>%%PERL_VERSION%%</literal>
and <literal>%%PERL_VER%%</literal> is the full version number
of <command>perl</command> (e.g., <literal>5.8.9</literal>).
Several other
<literal>%%<replaceable>VARS</replaceable>%%</literal> related
to port's documentation files are described in <link
linkend="install-documentation">the relevant
section</link>.</para>
<para>If you need to make other substitutions, you can set the
<makevar>PLIST_SUB</makevar> variable with a list of
<literal><replaceable>VAR</replaceable>=<replaceable>VALUE</replaceable></literal>
pairs and instances of
<literal>%%<replaceable>VAR</replaceable>%%</literal> will be
substituted with <replaceable>VALUE</replaceable> in the
<filename>pkg-plist</filename>.</para>
<para>For instance, if you have a port that installs many files
in a version-specific subdirectory, you can put something
like</para>
<programlisting>OCTAVE_VERSION= 2.0.13
PLIST_SUB= OCTAVE_VERSION=${OCTAVE_VERSION}</programlisting>
<para>in the <filename>Makefile</filename> and use
<literal>%%OCTAVE_VERSION%%</literal> wherever the version
shows up in <filename>pkg-plist</filename>. That way, when
you upgrade the port, you will not have to change dozens (or
in some cases, hundreds) of lines in the
<filename>pkg-plist</filename>.</para>
<para>If your port installs files conditionally on the options
set in the port, the usual way of handling it is prefixing the
<filename>pkg-plist</filename> lines with a
<literal>%%TAG%%</literal> and adding that
<literal>TAG</literal> to the <makevar>PLIST_SUB</makevar>
variable inside the <filename>Makefile</filename> with a
special value of <literal>@comment</literal>, which makes
package tools to ignore the line:</para>
<programlisting>.if defined(WITH_X11)
PLIST_SUB+= X11=""
.else
PLIST_SUB+= X11="@comment "
.endif</programlisting>
<para>and in the <filename>pkg-plist</filename>:</para>
<programlisting>%%X11%%bin/foo-gui</programlisting>
<para>This substitution (as well as addition of any <link
linkend="makefile-manpages">manual pages</link>) will be
done between the <maketarget>pre-install</maketarget> and
<maketarget>do-install</maketarget> targets, by reading from
<filename><makevar>PLIST</makevar></filename> and writing to
<filename><makevar>TMPPLIST</makevar></filename> (default:
<filename><makevar>WRKDIR</makevar>/.PLIST.mktmp</filename>).
So if your port builds
<filename><makevar>PLIST</makevar></filename> on the fly, do
so in or before <maketarget>pre-install</maketarget>. Also,
if your port needs to edit the resulting file, do so in
<maketarget>post-install</maketarget> to a file named
<filename><makevar>TMPPLIST</makevar></filename>.</para>
<para>Another possibility to modify port's packing list is based
on setting the variables <makevar>PLIST_FILES</makevar> and
<makevar>PLIST_DIRS</makevar>. The value of each variable is
regarded as a list of pathnames to write to
<filename><makevar>TMPPLIST</makevar></filename> along with
<filename><makevar>PLIST</makevar></filename> contents. Names
listed in <makevar>PLIST_FILES</makevar> and
<makevar>PLIST_DIRS</makevar> are subject to
<literal>%%<replaceable>VAR</replaceable>%%</literal>
substitution, as described above. Except for that, names from
<makevar>PLIST_FILES</makevar> will appear in the final
packing list unchanged, while <literal>@dirrm</literal> will
be prepended to names from <makevar>PLIST_DIRS</makevar>. To
take effect, <makevar>PLIST_FILES</makevar> and
<makevar>PLIST_DIRS</makevar> must be set before
<filename><makevar>TMPPLIST</makevar></filename> is written,
i.e., in <maketarget>pre-install</maketarget> or
earlier.</para>
</sect1>
<sect1 id="plist-cleaning">
<title>Empty Directories</title>
<sect2 id="plist-dir-cleaning">
<title>Cleaning Up Empty Directories</title>
<para>Do make your ports remove empty directories when they
are de-installed. This is usually accomplished by adding
<literal>@dirrm</literal> lines for all directories that are
specifically created by the port. You need to delete
subdirectories before you can delete parent
directories.</para>
<programlisting> :
lib/X11/oneko/pixmaps/cat.xpm
lib/X11/oneko/sounds/cat.au
:
@dirrm lib/X11/oneko/pixmaps
@dirrm lib/X11/oneko/sounds
@dirrm lib/X11/oneko</programlisting>
<para>However, sometimes <literal>@dirrm</literal> will give
you errors because other ports share the same directory.
You can use <literal>@dirrmtry</literal> to remove only
empty directories without warning.</para>
<programlisting>@dirrmtry share/doc/gimp</programlisting>
<para>This will neither print any error messages nor cause
&man.pkg.delete.1; to exit abnormally even if
<filename><makevar>${PREFIX}</makevar>/share/doc/gimp</filename>
is not empty due to other ports installing some files in
there.</para>
</sect2>
<sect2 id="plist-dir-empty">
<title>Creating Empty Directories</title>
<para>Empty directories created during port installation need
special attention. They will not get created when
installing the package, because packages only store the
files, and &man.pkg.add.1; creates directories for them as
needed. To make sure the empty directory is created when
installing the package, add this line to
<filename>pkg-plist</filename> above the corresponding
<literal>@dirrm</literal> line:</para>
<programlisting>@exec mkdir -p %D/share/foo/templates</programlisting>
</sect2>
</sect1>
<sect1 id="plist-config">
<title>Configuration Files</title>
<para>If your port installs configuration files to
<filename><makevar>PREFIX</makevar>/etc</filename> (or
elsewhere) do <emphasis>not</emphasis> simply list them in the
<filename>pkg-plist</filename>. That will cause
&man.pkg.delete.1; to remove the files carefully edited by
the user, and a re-installation will wipe them out.</para>
<para>Instead, install sample file(s) with a
<filename><replaceable>filename</replaceable>.sample</filename>
suffix. Then copy the sample file to the real configuration
file name, if it does not already exist. On deinstall
delete the configuration file, but only if it is identical
to the <filename>.sample</filename> file.
You need to handle this both in the port
<filename>Makefile</filename>, and in the
<filename>pkg-plist</filename> (for installation from the
package).</para>
<para>Example of the <filename>Makefile</filename> part:</para>
<programlisting>post-install:
@if [ ! -f ${PREFIX}/etc/orbit.conf ]; then \
${CP} -p ${PREFIX}/etc/orbit.conf.sample ${PREFIX}/etc/orbit.conf ; \
fi</programlisting>
<para>For each configuration file, create the following three
lines in <filename>pkg-plist</filename>:</para>
<programlisting>@unexec if cmp -s %D/etc/orbit.conf.sample %D/etc/orbit.conf; then rm -f %D/etc/orbit.conf; fi
etc/orbit.conf.sample
@exec if [ ! -f %D/etc/orbit.conf ] ; then cp -p %D/%F %B/orbit.conf; fi</programlisting>
<para>The order of these lines is important. On deinstallation,
the sample file is compared to the actual configuration file.
If these files are identical, no changes have been made by the
user and the actual file can be safely deleted. Because the
sample file must still exist for the comparison, the
<literal>@unexec</literal> line comes before the sample
configuration file name. On installation, if an actual
configuration file is not already present, the sample file is
copied to the actual file. The sample file must be present
before it can be copied, so the <literal>@exec</literal> line
comes after the sample configuration file name.</para>
<para>To debug any issues, temporarily remove the
<literal>-s</literal> flag to &man.cmp.1; for more
output.</para>
<para>See &man.pkg.create.1; for more information on
<literal>%D</literal> and related substitution markers.</para>
<para>If there is a very good reason not to install a working
configuration file by default, leave the
<literal>@exec</literal> line out of
<filename>pkg-plist</filename> and add a <link
linkend="porting-message">message</link> pointing out that
the user must copy and edit the file before the software will
work.</para>
</sect1>
<sect1 id="plist-dynamic">
<title>Dynamic Versus Static Package List</title>
<para>A <emphasis>static package list</emphasis> is a package
list which is available in the Ports Collection either as a
<filename>pkg-plist</filename> file (with or without variable
substitution), or embedded into the
<filename>Makefile</filename> via
<makevar>PLIST_FILES</makevar> and
<makevar>PLIST_DIRS</makevar>. Even if the contents are
auto-generated by a tool or a target in the Makefile
<emphasis>before</emphasis> the inclusion into the Ports
Collection by a committer, this is still considered a static
list, since it is possible to examine it without having to
download or compile the distfile.</para>
<para>A <emphasis>dynamic package list</emphasis> is a package
list which is generated at the time the port is compiled based
upon the files and directories which are installed. It is not
possible to examine it before the source code of the ported
application is downloaded and compiled, or after running a
<literal>make clean</literal>.</para>
<para>While the use of dynamic package lists is not forbidden,
maintainers should use static package lists wherever possible,
as it enables users to &man.grep.1; through available ports to
discover, for example, which port installs a certain file.
Dynamic lists should be primarily used for complex ports where
the package list changes drastically based upon optional
features of the port (and thus maintaining a static package
list is infeasible), or ports which change the package list
based upon the version of dependent software used (e.g., ports
which generate docs with
<application>Javadoc</application>).</para>
<para>Maintainers who prefer dynamic package lists are
encouraged to add a new target to their port which generates
the <filename>pkg-plist</filename> file so that users may
examine the contents.</para>
</sect1>
<sect1 id="plist-autoplist">
<title>Automated Package List Creation</title>
<para>First, make sure your port is almost complete, with only
<filename>pkg-plist</filename> missing.</para>
<para>Next, create a temporary directory tree into which your
port can be installed, and install any dependencies.</para>
<screen>&prompt.root; <userinput>mkdir /var/tmp/`make -V PORTNAME`</userinput>
&prompt.root; <userinput>mtree -U -f `make -V MTREE_FILE` -d -e -p /var/tmp/`make -V PORTNAME`</userinput>
&prompt.root; <userinput>make depends PREFIX=/var/tmp/`make -V PORTNAME`</userinput></screen>
<para>Store the directory structure in a new file.</para>
<screen>&prompt.root; <userinput>(cd /var/tmp/`make -V PORTNAME` && find -d * -type d) | sort > OLD-DIRS</userinput></screen>
<para>Create an empty <filename>pkg-plist</filename>
file:</para>
<screen>&prompt.root; <userinput>:>pkg-plist</userinput></screen>
<para>If your port honors <makevar>PREFIX</makevar> (which it
should) you can then install the port and create the package
list.</para>
<screen>&prompt.root; <userinput>make install PREFIX=/var/tmp/`make -V PORTNAME`</userinput>
&prompt.root; <userinput>(cd /var/tmp/`make -V PORTNAME` && find -d * \! -type d) | sort > pkg-plist</userinput></screen>
<para>You must also add any newly created directories to the
packing list.</para>
<screen>&prompt.root; <userinput>(cd /var/tmp/`make -V PORTNAME` && find -d * -type d) | sort | comm -13 OLD-DIRS - | sort -r | sed -e 's#^#@dirrm #' >> pkg-plist</userinput></screen>
<para>Finally, you need to tidy up the packing list by hand; it
is not <emphasis>all</emphasis> automated. Manual pages
should be listed in the port's <filename>Makefile</filename>
under <makevar>MAN<replaceable>n</replaceable></makevar>, and
not in the package list. User configuration files should be
removed, or installed as
<filename><replaceable>filename</replaceable>.sample</filename>.
The <filename>info/dir</filename> file should not be listed
and appropriate <filename>install-info</filename> lines should
be added as noted in the <link linkend="makefile-info">info
files</link> section. Any libraries installed by the port
should be listed as specified in the <link
linkend="porting-shlibs">shared libraries</link>
section.</para>
<para>Alternatively, use the <command>plist</command> script in
<filename>/usr/ports/Tools/scripts/</filename> to build the
package list automatically. The <filename>plist</filename>
script is a <application>Ruby</application> script that
automates most of the manual steps outlined in the previous
paragraphs.</para>
<para>The first step is the same as above: take the first three
lines, that is, <command>mkdir</command>,
<command>mtree</command> and <command>make depends</command>.
Then build and install the port:</para>
<screen>&prompt.root; <userinput>make install PREFIX=/var/tmp/`make -V PORTNAME`</userinput></screen>
<para>And let <command>plist</command> create the
<filename>pkg-plist</filename> file:</para>
<screen>&prompt.root; <userinput>/usr/ports/Tools/scripts/plist -Md -m `make -V MTREE_FILE` /var/tmp/`make -V PORTNAME` > pkg-plist</userinput></screen>
<para>The packing list still has to be tidied up by hand as
stated above.</para>
<para>Another tool that might be used to create an initial
<filename>pkg-plist</filename> is <filename
role="package">ports-mgmt/genplist</filename>. As with any
automated tool, the resulting <filename>pkg-plist</filename>
should be checked and manually edited as needed.</para>
</sect1>
</chapter>
<chapter id="pkg-files">
<title>The <filename>pkg-<replaceable>*</replaceable></filename>
Files</title>
<para>There are some tricks we have not mentioned yet about the
<filename>pkg-<replaceable>*</replaceable></filename> files
that come in handy sometimes.</para>
<sect1 id="porting-message">
<title><filename>pkg-message</filename></title>
<para>If you need to display a message to the installer, you may
place the message in <filename>pkg-message</filename>. This
capability is often useful to display additional installation
steps to be taken after a &man.pkg.add.1; or to display
licensing information.</para>
<para>When some lines about the build-time knobs or warnings
have to be displayed, use <makevar>ECHO_MSG</makevar>. The
<filename>pkg-message</filename> file is only for
post-installation steps. Likewise, the distinction between
<makevar>ECHO_MSG</makevar> and <makevar>ECHO_CMD</makevar>
should be kept in mind. The former is for printing
informational text to the screen, while the latter is for
command pipelining:</para>
<programlisting>update-etc-shells:
@${ECHO_MSG} "updating /etc/shells"
@${CP} /etc/shells /etc/shells.bak
@( ${GREP} -v ${PREFIX}/bin/bash /etc/shells.bak; \
${ECHO_CMD} ${PREFIX}/bin/bash) >/etc/shells
@${RM} /etc/shells.bak</programlisting>
<note>
<para>The <filename>pkg-message</filename> file does not need
to be added to <filename>pkg-plist</filename>. Also, it
will not get automatically printed if the user is using the
port, not the package, so you should probably display it
from the <maketarget>post-install</maketarget> target
yourself.</para>
</note>
</sect1>
<sect1 id="pkg-install">
<title><filename>pkg-install</filename></title>
<para>If your port needs to execute commands when the binary
package is installed with &man.pkg.add.1; you can do this via
the <filename>pkg-install</filename> script. This script will
automatically be added to the package, and will be run twice
by &man.pkg.add.1;: the first time as <literal>${SH}
pkg-install ${PKGNAME} PRE-INSTALL</literal> and the
second time as <literal>${SH} pkg-install
${PKGNAME} POST-INSTALL</literal>.
<literal>$2</literal> can be tested to determine which
mode the script is being run in. The
<envar>PKG_PREFIX</envar> environmental variable will be set
to the package installation directory. See &man.pkg.add.1;
for additional information.</para>
<note>
<para>This script is not run automatically if you install the
port with <command>make install</command>. If you are
depending on it being run, you will have to explicitly call
it from your port's <filename>Makefile</filename>, with a
line like <literal>PKG_PREFIX=${PREFIX} ${SH}
${PKGINSTALL} ${PKGNAME}
PRE-INSTALL</literal>.</para>
</note>
</sect1>
<sect1 id="pkg-deinstall">
<title><filename>pkg-deinstall</filename></title>
<para>This script executes when a package is removed.</para>
<para>This script will be run twice by &man.pkg.delete.1;.
The first time as <literal>${SH} pkg-deinstall
${PKGNAME} DEINSTALL</literal> and the second time as
<literal>${SH} pkg-deinstall ${PKGNAME}
POST-DEINSTALL</literal>.</para>
</sect1>
<sect1 id="pkg-req">
<title><filename>pkg-req</filename></title>
<para>If your port needs to determine if it should install or
not, you can create a <filename>pkg-req</filename>
<quote>requirements</quote> script. It will be invoked
automatically at installation/de-installation time to
determine whether or not installation/de-installation should
proceed.</para>
<para>The script will be run at installation time by
&man.pkg.add.1; as
<literal>pkg-req ${PKGNAME} INSTALL</literal>.
At de-installation time it will be run by
&man.pkg.delete.1; as
<literal>pkg-req ${PKGNAME} DEINSTALL</literal>.</para>
</sect1>
<sect1 id="pkg-names">
<title id="porting-pkgfiles">Changing the Names of
<filename>pkg-<replaceable>*</replaceable></filename>
Files</title>
<para>All the names of
<filename>pkg-<replaceable>*</replaceable></filename> files
are defined using variables so you can change them in your
<filename>Makefile</filename> if need be. This is especially
useful when you are sharing the same
<filename>pkg-<replaceable>*</replaceable></filename> files
among several ports or have to write to one of the above files
(see <link linkend="porting-wrkdir">writing to places other
than <makevar>WRKDIR</makevar></link> for why it is a bad
idea to write directly into the
<filename>pkg-<replaceable>*</replaceable></filename>
subdirectory).</para>
<para>Here is a list of variable names and their default values.
(<makevar>PKGDIR</makevar> defaults to
<makevar>${MASTERDIR}</makevar>.)</para>
<informaltable frame="none" pgwide="0">
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Default value</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>DESCR</makevar></entry>
<entry><literal>${PKGDIR}/pkg-descr</literal></entry>
</row>
<row>
<entry><makevar>PLIST</makevar></entry>
<entry><literal>${PKGDIR}/pkg-plist</literal></entry>
</row>
<row>
<entry><makevar>PKGINSTALL</makevar></entry>
<entry><literal>${PKGDIR}/pkg-install</literal></entry>
</row>
<row>
<entry><makevar>PKGDEINSTALL</makevar></entry>
<entry><literal>${PKGDIR}/pkg-deinstall</literal></entry>
</row>
<row>
<entry><makevar>PKGREQ</makevar></entry>
<entry><literal>${PKGDIR}/pkg-req</literal></entry>
</row>
<row>
<entry><makevar>PKGMESSAGE</makevar></entry>
<entry><literal>${PKGDIR}/pkg-message</literal></entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Please change these variables rather than overriding
<makevar>PKG_ARGS</makevar>. If you change
<makevar>PKG_ARGS</makevar>, those files will not correctly be
installed in <filename>/var/db/pkg</filename> upon install
from a port.</para>
</sect1>
<sect1 id="using-sub-files">
<title>Making Use of <makevar>SUB_FILES</makevar> and
<makevar>SUB_LIST</makevar></title>
<para>The <makevar>SUB_FILES</makevar> and
<makevar>SUB_LIST</makevar> variables are useful for dynamic
values in port files, such as the installation
<makevar>PREFIX</makevar> in
<filename>pkg-message</filename>.</para>
<para>The <makevar>SUB_FILES</makevar> variable specifies a list
of files to be automatically modified. Each
<replaceable>file</replaceable> in the
<makevar>SUB_FILES</makevar> list must have a corresponding
<filename><replaceable>file</replaceable>.in</filename>
present in <makevar>FILESDIR</makevar>. A modified version
will be created in <makevar>WRKDIR</makevar>. Files defined
as a value of <makevar>USE_RC_SUBR</makevar> (or the
deprecated <makevar>USE_RCORDER</makevar>) are automatically
added to the <makevar>SUB_FILES</makevar>. For the files
<filename>pkg-message</filename>,
<filename>pkg-install</filename>,
<filename>pkg-deinstall</filename> and
<filename>pkg-req</filename>, the corresponding Makefile
variable is automatically set to point to the processed
version.</para>
<para>The <makevar>SUB_LIST</makevar> variable is a list of
<literal>VAR=VALUE</literal> pairs. For each pair
<literal>%%VAR%%</literal> will get replaced with
<literal>VALUE</literal> in each file listed in
<makevar>SUB_FILES</makevar>. Several common pairs are
automatically defined: <makevar>PREFIX</makevar>,
<makevar>LOCALBASE</makevar>, <makevar>DATADIR</makevar>,
<makevar>DOCSDIR</makevar>, <makevar>EXAMPLESDIR</makevar>.
Any line beginning with <literal>@comment</literal> will be
deleted from resulting files after a variable
substitution.</para>
<para>The following example will replace
<literal>%%ARCH%%</literal> with the system architecture in a
<filename>pkg-message</filename>:</para>
<programlisting>SUB_FILES= pkg-message
SUB_LIST= ARCH=${ARCH}</programlisting>
<para>Note that for this example, the
<filename>pkg-message.in</filename> file must exist in
<makevar>FILESDIR</makevar>.</para>
<para>Example of a good
<filename>pkg-message.in</filename>:</para>
<programlisting>Now it is time to configure this package.
Copy %%PREFIX%%/share/examples/putsy/%%ARCH%%.conf into your home directory
as .putsy.conf and edit it.</programlisting>
</sect1>
</chapter>
<chapter id="testing">
<title>Testing Your Port</title>
<sect1 id="make-describe">
<title>Running <command>make describe</command></title>
<para>Several of the &os; port maintenance tools, such as
&man.portupgrade.1;, rely on a database called
<filename>/usr/ports/INDEX</filename> which keeps track of
such items as port dependencies. <filename>INDEX</filename>
is created by the top-level
<filename>ports/Makefile</filename> via <command>make
index</command>, which descends into each port subdirectory
and executes <command>make describe</command> there. Thus, if
<command>make describe</command> fails in any port, no one can
generate <filename>INDEX</filename>, and many people will
quickly become unhappy.</para>
<note>
<para>It is important to be able to generate this file no
matter what options are present in
<filename>make.conf</filename>, so please avoid doing things
such as using <literal>.error</literal> statements when (for
instance) a dependency is not satisfied. (See <xref
linkend="dads-dot-error"/>.)</para>
</note>
<para>If <command>make describe</command> produces a string
rather than an error message, you are probably safe. See
<filename>bsd.port.mk</filename> for the meaning of the
string produced.</para>
<para>Also note that running a recent version of
<command>portlint</command> (as specified in the next section)
will cause <command>make describe</command> to be run
automatically.</para>
</sect1>
<sect1 id="testing-portlint">
<title>Portlint</title>
<para>Do check your work with <link
linkend="porting-portlint"><command>portlint</command></link>
before you submit or commit it. <command>portlint</command>
warns you about many common errors, both functional and
stylistic. For a new (or repocopied) port, <command>portlint
-A</command> is the most thorough; for an existing port,
<command>portlint -C</command> is sufficient.</para>
<para>Since <command>portlint</command> uses heuristics to
try to figure out errors, it can produce false positive
warnings. In addition, occasionally something that is
flagged as a problem really cannot be done in any other
way due to limitations in the ports framework. When in
doubt, the best thing to do is ask on &a.ports;.</para>
</sect1>
<sect1 id="testing-porttools">
<title>Port Tools</title>
<para>The <filename
role="package">ports-mgmt/porttools</filename> program is
part of the Ports Collection.</para>
<para><command>port</command> is the front-end script, which can
help you simplify the testing job. Whenever you want to test
a new port or update an existing one, you can use
<command>port test</command> to test your port, including the
<link
linkend="testing-portlint"><command>portlint</command></link>
checking. This command also detects and lists any files that
are not listed in <filename>pkg-plist</filename>. See the
following example:</para>
<screen>&prompt.root; <userinput>port test /usr/ports/net/csup</userinput></screen>
</sect1>
<sect1 id="porting-prefix">
<title><makevar>PREFIX</makevar> and
<makevar>DESTDIR</makevar></title>
<para><makevar>PREFIX</makevar> determines where the port will
be installed. It defaults to <filename>/usr/local</filename>,
but can be set by the user to a custom path like
<filename>/opt</filename>. Your port must respect the value
of this variable.</para>
<para><makevar>DESTDIR</makevar>, if set by the user, determines
the complete alternative environment, usually a jail or an
installed system mounted somewhere other than
<filename>/</filename>. A port will actually install into
<filename><makevar>DESTDIR</makevar>/<makevar>PREFIX</makevar></filename>,
and register with the package database in
<filename><makevar>DESTDIR</makevar>/var/db/pkg</filename>.
As <makevar>DESTDIR</makevar> is handled automatically by the
ports infrastructure with &man.chroot.8;, you do not need any
modifications or any extra care to write
<makevar>DESTDIR</makevar>-compliant ports.</para>
<para>The value of <makevar>PREFIX</makevar> will be set to
<makevar>LOCALBASE</makevar> (defaulting to
<filename>/usr/local</filename>). If
<makevar>USE_LINUX_PREFIX</makevar> is set,
<makevar>PREFIX</makevar> will be <makevar>LINUXBASE</makevar>
(defaulting to <filename>/compat/linux</filename>).</para>
<para>Avoiding hard-coded <filename>/usr/local</filename> paths
in the source makes the port much more flexible and able to
cater to the needs of other sites. Often, this can be
accomplished by simply replacing occurrences of
<filename>/usr/local</filename> in the port's various
<filename>Makefile</filename>s with
<literal>${PREFIX}</literal>. This variable is
automatically passed down to every stage of the build and
install processes.</para>
<para>Make sure your application is not installing things in
<filename>/usr/local</filename> instead of
<makevar>PREFIX</makevar>. A quick test for such hard-coded
paths is:</para>
<screen>&prompt.root; <userinput>make clean; make package PREFIX=/var/tmp/`make -V PORTNAME`</userinput></screen>
<para>If anything is installed outside of
<makevar>PREFIX</makevar>, the package creation process will
complain that it cannot find the files.</para>
<para>This test will not find hard-coded paths inside the
port's files, nor will it verify that
<makevar>LOCALBASE</makevar> is being used to correctly refer
to files from other ports. The temporarily-installed port in
<filename>/var/tmp/`make -V PORTNAME`</filename> should be
tested for proper operation to make sure there
are no problems with paths.</para>
<para><makevar>PREFIX</makevar> should not be set explicitly
in a port's <filename>Makefile</filename>. Users installing
the port may have set <makevar>PREFIX</makevar> to a custom
location, and the port should respect that setting.</para>
<para>Refer to programs and files from other ports with the
variables mentioned above, not explicit pathnames. For
instance, if your port requires a macro
<literal>PAGER</literal> to have the full pathname of
<command>less</command>, do not use a literal path of
<filename>/usr/local/bin/less</filename>. Instead, use
<literal>${LOCALBASE}</literal>:</para>
<programlisting>-DPAGER=\"${LOCALBASE}/bin/less\"</programlisting>
<para>The path with <makevar>LOCALBASE</makevar> is more likely
to still work if the system administrator has moved the whole
<filename>/usr/local</filename> tree somewhere else.</para>
</sect1>
<sect1 id="testing-tinderbox">
<title>Tinderbox</title>
<para>If you are an avid ports contributor, you might want to
take a look at <application>Tinderbox</application>. It is a
powerful system for building and testing ports based on the
scripts used on <link
linkend="build-cluster">Pointyhat</link>. You can install
<application>Tinderbox</application> using <filename
role="package">ports-mgmt/tinderbox</filename> port. Be
sure to read supplied documentation since the configuration is
not trivial.</para>
<para>Visit the <ulink
url="http://tinderbox.marcuscom.com/">Tinderbox
website</ulink> for more details.</para>
</sect1>
</chapter>
<chapter id="port-upgrading">
<title>Upgrading an Individual Port</title>
<para>When you notice that a port is out of date compared to the
latest version from the original authors, you should first
ensure that you have the latest port. You can find them in the
<filename>ports/ports-current</filename> directory of the &os;
FTP mirror sites. However, if you are working with more than a
few ports, you will probably find it easier to use
<application>CVSup</application> to keep your whole ports
collection up-to-date, as described in the <ulink
url="&url.books.handbook;/synching.html#CVSUP-CONFIG">Handbook</ulink>.
This will have the added benefit of tracking all the ports'
dependencies.</para>
<para>The next step is to see if there is an update already
pending. To do this, you have two options. There is a
searchable interface to the <ulink
url="http://www.FreeBSD.org/cgi/query-pr-summary.cgi?query">
FreeBSD Problem Report (PR) database</ulink> (also known as
<literal>GNATS</literal>). Select <literal>ports</literal> in
the dropdown, and enter the name of the port.</para>
<para>However, sometimes people forget to put the name of the port
into the Synopsis field in an unambiguous fashion. In that
case, you can try the <link linkend="portsmon"> FreeBSD Ports
Monitoring System</link> (also known as
<literal>portsmon</literal>). This system attempts to classify
port PRs by portname. To search for PRs about a particular
port, use the <ulink
url="http://portsmon.FreeBSD.org/portoverview.py">
Overview of One Port</ulink>.</para>
<para>If there is no pending PR, the next step is to send an email
to the port's maintainer, as shown by <command>make
maintainer</command>. That person may already be working on
an upgrade, or have a reason to not upgrade the port right now
(because of, for example, stability problems of the new
version); you would not want to duplicate their work. Note that
unmaintained ports are listed with a maintainer of
<literal>ports@FreeBSD.org</literal>, which is just the general
ports mailing list, so sending mail there probably will not help
in this case.</para>
<para>If the maintainer asks you to do the upgrade or there is
no maintainer, then you have a chance to help out &os; by
preparing the update yourself! Please do this by using the
&man.diff.1; command in the base system.</para>
<para>To create a suitable <command>diff</command> for a single
patch, copy the file that needs patching to
<replaceable>something.orig</replaceable>, save your changes to
<replaceable>something</replaceable> and then create your
patch:</para>
<informalexample>
<screen>&prompt.user; <userinput>/usr/bin/diff something.orig something > something.diff</userinput></screen>
</informalexample>
<para>Otherwise, you should either use the <command>svn
diff</command> method (<xref linkend="svn-diff"/>) or copy the
contents of the port to an entire different directory and use
the result of the recursive &man.diff.1; output of the new and
old ports directories (e.g., if your modified port directory is
called <filename>superedit</filename> and the original is in our
tree as <filename>superedit.bak</filename>, then save the result
of <command>diff -ruN superedit.bak superedit</command>).
Either unified or context diff is fine, but port committers
generally prefer unified diffs. Note the use of the
<literal>-N</literal> option—this is the accepted way to
force diff to properly deal with the case of new files being
added or old files being deleted. Before sending us the diff,
please examine the output to make sure all the changes make
sense. (In particular, make sure you first clean out the work
directories with <command>make clean</command>).</para>
<para>To simplify common operations with patch files, you can use
<filename>/usr/ports/Tools/scripts/patchtool.py</filename>.
Before using it, please read
<filename>/usr/ports/Tools/scripts/README.patchtool</filename>.</para>
<para>If the port is unmaintained, and you are actively using
it yourself, please consider volunteering to become its
maintainer. &os; has over 4000 ports without maintainers, and
this is an area where more volunteers are always needed. (For a
detailed description of the responsibilities of maintainers,
refer to the section in the <ulink
url="&url.books.developers-handbook;/policies.html#POLICIES-MAINTAINER">
Developer's Handbook</ulink>.)</para>
<para> The best way to send us the diff is by including it via
&man.send-pr.1; (category <literal>ports</literal>). If you are
maintaining the port, be sure to put <literal>[maintainer
update]</literal> at the beginning of your synopsis line and set
the <quote>Class</quote> of your PR to
<literal>maintainer-update</literal>. Otherwise, the
<quote>Class</quote> of your PR should be
<literal>change-request</literal>. Please mention any added or
deleted files in the message, as they have to be explicitly
specified to &man.svn.1; when doing a commit. If the diff is
more than about 20KB, please compress and uuencode it;
otherwise, just include it in the PR as is.</para>
<para>Before you &man.send-pr.1;, you should review the
<ulink url="&url.articles.problem-reports;/pr-writing.html">
Writing the problem report</ulink> section in the Problem
Reports article; it contains far more information about how to
write useful problem reports.</para>
<important>
<para>If your upgrade is motivated by security concerns or a
serious fault in the currently committed port, please notify
the &a.portmgr; to request immediate rebuilding and
redistribution of your port's package. Unsuspecting users
of &man.pkg.add.1; will otherwise continue to install the
old version via <command>pkg_add -r</command> for several
weeks.</para>
</important>
<note>
<para>Once again, please use &man.diff.1; and not &man.shar.1;
to send updates to existing ports! This helps ports
committers understand exactly what is being changed.</para>
</note>
<para>Now that you have done all that, you will want to read about
how to keep up-to-date in <xref linkend="keeping-up"/>.</para>
<sect1 id="svn-diff">
<title>Using <literal>SVN</literal> to Make Patches</title>
<para>If you can, please submit a &man.svn.1; diff; they are
easier to handle than diffs between <quote>new and old</quote>
directories. Plus it is easier for you to see what you have
changed and to update your diff if something is modified in
the Ports Collection from when you started to work on it until
you submit your changes, or if the committer asks you to fix
something.</para>
<screen>&prompt.user; <userinput>cd ~/my_wrkdir</userinput> <co id="my-wrkdir"/>
&prompt.user; <userinput>svn co svn://svn.FreeBSD.org/ports/head/dns/pdnsd</userinput> <co id="svn-FreeBSD-org"/>
&prompt.user; <userinput>cd ~/my_wrkdir/pdnsd</userinput></screen>
<calloutlist>
<callout arearefs="my-wrkdir">
<para>This can be anywhere you want, of course; building
ports is not limited to within <filename
class="directory">/usr/ports/</filename>.</para>
</callout>
<callout arearefs="svn-FreeBSD-org">
<para><ulink
url="http://svn.FreeBSD.org/">svn.FreeBSD.org</ulink>
is a public <literal>SVN</literal> server.</para>
</callout>
</calloutlist>
<para>While in the working directory, make any changes that you
would usually make to the port. If you add or remove a file,
use <command>svn</command> to track these changes:</para>
<screen>&prompt.user; <userinput>svn add new_file</userinput>
&prompt.user; <userinput>svn remove deleted_file</userinput></screen>
<para>Make sure that you check the port using the checklist in
<xref linkend="porting-testing"/> and
<xref linkend="porting-portlint"/>.</para>
<screen>&prompt.user; <userinput>svn status</userinput>
&prompt.user; <userinput>svn update</userinput> <co id="svn-update"/></screen>
<calloutlist>
<callout arearefs="svn-update">
<para>This will try to merge the differences between your
patch and current SVN; watch the output carefully. The
letter in front of each file name indicates what was done
with it. See <xref linkend="table-svn-up"/> for a
complete list.</para>
</callout>
</calloutlist>
<table pgwide="1" frame="none" id="table-svn-up">
<title><literal>SVN</literal> Update File Prefixes</title>
<tgroup cols="2">
<tbody>
<row>
<entry>U</entry>
<entry>The file was updated without problems.</entry>
</row>
<row>
<entry>G</entry>
<entry>The file was updated without problems (you will
only see this when working against a remote
repository).</entry>
</row>
<row>
<entry>M</entry>
<entry>The file had been modified, and was merged
without conflicts.</entry>
</row>
<row>
<entry>C</entry>
<entry>The file had been modified, and was merged with
conflicts.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>If you get <literal>C</literal> as a result of
<command>svn update</command> it means something changed in
the SVN repository and &man.svn.1; was not able to merge your
local changes and those from the repository. It is always a
good idea to inspect the changes anyway, since &man.svn.1;
does not know anything about how a port should be, so it might
(and probably will) merge things that do not make
sense.</para>
<para>The last step is to make a unified &man.diff.1;
of the files against SVN:</para>
<screen>&prompt.user; <userinput>svn diff > ../`basename ${PWD}`.diff</userinput></screen>
<note>
<para>Any files that have been removed should be explicitly
mentioned in the PR, because file removal may not be obvious
to the committer.</para>
</note>
<para>Send your patch following the guidelines in
<xref linkend="port-upgrading"/>.</para>
</sect1>
<sect1 id="moved-and-updating-files">
<title>The Files <filename>UPDATING</filename> and
<filename>MOVED</filename></title>
<para>If upgrading the port requires special steps like
changing configuration files or running a specific program,
you should document this in the file
<filename>/usr/ports/UPDATING</filename>. The format of
an entry in this file is as follows:</para>
<programlisting>YYYYMMDD:
AFFECTS: users of portcategory/portname
AUTHOR: Your name <Your email address>
Special instructions</programlisting>
<para>If you are including exact portmaster or portupgrading
instructions, please make sure to get the shell escaping
right.</para>
<para>The <filename>/usr/ports/MOVED</filename> file is used to
list moved or removed ports. Each line in the file is made
up of the name of the port, where the port was moved to, when,
and why. If the port was removed, the section detailing where
it was moved to can be left blank. Each section must be
separated by the <literal>|</literal> (pipe) character, like
so:</para>
<programlisting>old name|new name (blank for deleted)|date of move|reason</programlisting>
<para>The date should be entered in the form <literal>YYYY-
MM-DD</literal>. New entries should be added to the end
of the file to keep it in chronological order.</para>
<para>If a port was removed but has since been restored,
delete the line in this file that states that it was
removed.</para>
<para>The changes can be validated with
<command>Tools/scripts/MOVEDlint.awk</command>.</para>
</sect1>
</chapter>
<chapter id="security">
<title>Ports Security</title>
<sect1 id="security-intro">
<title>Why Security is So Important</title>
<para>Bugs are occasionally introduced to the software.
Arguably, the most dangerous of them are those opening
security vulnerabilities. From the technical viewpoint,
such vulnerabilities are to be closed by exterminating
the bugs that caused them. However, the policies for
handling mere bugs and security vulnerabilities are
very different.</para>
<para>A typical small bug affects only those users who have
enabled some combination of options triggering the bug.
The developer will eventually release a patch followed
by a new version of the software, free of the bug, but
the majority of users will not take the trouble of upgrading
immediately because the bug has never vexed them. A
critical bug that may cause data loss represents a graver
issue. Nevertheless, prudent users know that a lot of
possible accidents, besides software bugs, are likely to
lead to data loss, and so they make backups of important
data; in addition, a critical bug will be discovered
really soon.</para>
<para>A security vulnerability is all different. First,
it may remain unnoticed for years because often it does
not cause software malfunction. Second, a malicious party
can use it to gain unauthorized access to a vulnerable
system, to destroy or alter sensitive data; and in the
worst case the user will not even notice the harm caused.
Third, exposing a vulnerable system often assists attackers
to break into other systems that could not be compromised
otherwise. Therefore closing a vulnerability alone is
not enough: the audience should be notified of it in most
clear and comprehensive manner, which will allow to
evaluate the danger and take appropriate actions.</para>
</sect1>
<sect1 id="security-fix">
<title>Fixing Security Vulnerabilities</title>
<para>While on the subject of ports and packages, a security
vulnerability may initially appear in the original
distribution or in the port files. In the former case, the
original software developer is likely to release a patch or a
new version instantly, and you will only need to update the
port promptly with respect to the author's fix. If the fix is
delayed for some reason, you should either <link
linkend="dads-noinstall">mark the port as
<makevar>FORBIDDEN</makevar></link> or introduce a patch file
of your own to the port. In the case of a vulnerable port,
just fix the port as soon as possible. In either case, <link
linkend="port-upgrading">the standard procedure for
submitting your change</link> should be followed unless you
have rights to commit it directly to the ports tree.</para>
<important>
<para>Being a ports committer is not enough to commit to
an arbitrary port. Remember that ports usually have
maintainers, whom you should respect.</para>
</important>
<para>Please make sure that the port's revision is bumped
as soon as the vulnerability has been closed.
That is how the users who upgrade installed packages
on a regular basis will see they need to run an update.
Besides, a new package will be built and distributed
over FTP and WWW mirrors, replacing the vulnerable one.
<makevar>PORTREVISION</makevar> should be bumped unless
<makevar>PORTVERSION</makevar> has changed in the course
of correcting the vulnerability. That is you should
bump <makevar>PORTREVISION</makevar> if you have added a
patch file to the port, but you should not if you have updated
the port to the latest software version and thus already
touched <makevar>PORTVERSION</makevar>. Please refer to the
<link linkend="makefile-naming-revepoch">corresponding
section</link> for more information.</para>
</sect1>
<sect1 id="security-notify">
<title>Keeping the Community Informed</title>
<sect2 id="security-notify-vuxml-db">
<title>The VuXML Database</title>
<para>A very important and urgent step to take as early after
a security vulnerability is discovered as possible is to
notify the community of port users about the jeopardy. Such
notification serves two purposes. First, should the danger
be really severe it will be wise to apply an instant
workaround. E.g., stop the affected network service or even
deinstall the port completely until the vulnerability is
closed. Second, a lot of users tend to upgrade installed
packages only occasionally. They will know from the
notification that they <emphasis>must</emphasis> update the
package without delay as soon as a corrected version is
available.</para>
<para>Given the huge number of ports in the tree
a security advisory cannot be issued on each incident
without creating a flood and losing the attention of
the audience when it comes to really serious
matters. Therefore security vulnerabilities found in
ports are recorded in <ulink
url="http://vuxml.freebsd.org/">the FreeBSD VuXML
database</ulink>. The Security Officer Team members
also monitor it for issues requiring their
intervention.</para>
<para>If you have committer rights you can update the VuXML
database by yourself. So you will both help the Security
Officer Team and deliver the crucial information to the
community earlier. However, if you are not a committer,
or you believe you have found an exceptionally severe
vulnerability please do not hesitate to
contact the Security Officer Team directly as described
on the <ulink
url="http://www.freebsd.org/security/#how">FreeBSD
Security Information</ulink> page.</para>
<para>The VuXML database is an
XML document. Its source file <filename>vuln.xml</filename>
is kept right inside the port <filename
role="package">security/vuxml</filename>. Therefore
the file's full pathname will be
<filename><envar>PORTSDIR</envar>/security/vuxml/vuln.xml</filename>.
Each time you discover a security vulnerability in a
port please add an entry for it to that file.
Until you are familiar with VuXML, the best thing you can
do is to find an existing entry fitting your case, then copy
it and use it as a template.</para>
</sect2>
<sect2 id="security-notify-vuxml-intro">
<title>A Short Introduction to VuXML</title>
<para>The full-blown XML format is complex, and far beyond the
scope of this book. However, to gain basic insight on the
structure of a VuXML entry you need only the notion of tags.
XML tag names are enclosed in angle brackets. Each opening
<tag> must have a matching closing </tag>. Tags
may be nested. If nesting, the inner tags must be closed
before the outer ones. There is a hierarchy of tags, i.e.,
more complex rules of nesting them. Sounds very similar to
HTML, doesn't it? The major difference is that XML is
e<emphasis>X</emphasis>tensible, i.e., based on defining
custom tags. Due to its intrinsic structure XML puts
otherwise amorphous data into shape. VuXML is particularly
tailored to mark up descriptions of security
vulnerabilities.</para>
<para>Now let's consider a realistic VuXML entry:</para>
<programlisting><vuln vid="f4bc80f4-da62-11d8-90ea-0004ac98a7b9"> <co id="co-vx-vid"/>
<topic>Several vulnerabilities found in Foo</topic> <co id="co-vx-top"/>
<affects>
<package>
<name>foo</name> <co id="co-vx-nam"/>
<name>foo-devel</name>
<name>ja-foo</name>
<range><ge>1.6</ge><lt>1.9</lt></range> <co id="co-vx-rng"/>
<range><ge>2.*</ge><lt>2.4_1</lt></range>
<range><eq>3.0b1</eq></range>
</package>
<package>
<name>openfoo</name> <co id="co-vx-nm2"/>
<range><lt>1.10_7</lt></range> <co id="co-vx-epo"/>
<range><ge>1.2,1</ge><lt>1.3_1,1</lt></range>
</package>
</affects>
<description>
<body xmlns="http://www.w3.org/1999/xhtml">
<p>J. Random Hacker reports:</p> <co id="co-vx-bdy"/>
<blockquote
cite="http://j.r.hacker.com/advisories/1">
<p>Several issues in the Foo software may be exploited
via carefully crafted QUUX requests. These requests will
permit the injection of Bar code, mumble theft, and the
readability of the Foo administrator account.</p>
</blockquote>
</body>
</description>
<references> <co id="co-vx-ref"/>
<freebsdsa>SA-10:75.foo</freebsdsa> <co id="co-vx-fsa"/>
<freebsdpr>ports/987654</freebsdpr> <co id="co-vx-fpr"/>
<cvename>CAN-2010-0201</cvename> <co id="co-vx-cve"/>
<cvename>CAN-2010-0466</cvename>
<bid>96298</bid> <co id="co-vx-bid"/>
<certsa>CA-2010-99</certsa> <co id="co-vx-cts"/>
<certvu>740169</certvu> <co id="co-vx-ctv"/>
<uscertsa>SA10-99A</uscertsa> <co id="co-vx-ucs"/>
<uscertta>SA10-99A</uscertta> <co id="co-vx-uct"/>
<mlist msgid="201075606@hacker.com">http://marc.theaimsgroup.com/?l=bugtraq&amp;m=203886607825605</mlist> <co id="co-vx-mls"/>
<url>http://j.r.hacker.com/advisories/1</url> <co id="co-vx-url"/>
</references>
<dates>
<discovery>2010-05-25</discovery> <co id="co-vx-dsc"/>
<entry>2010-07-13</entry> <co id="co-vx-ent"/>
<modified>2010-09-17</modified> <co id="co-vx-mod"/>
</dates>
</vuln></programlisting>
<para>The tag names are supposed to be self-explanatory
so we shall take a closer look only at fields you will need
to fill in by yourself:</para>
<calloutlist>
<callout arearefs="co-vx-vid">
<para>This is the top-level tag of a VuXML entry. It has
a mandatory attribute, <literal>vid</literal>,
specifying a universally unique identifier (UUID) for
this entry (in quotes). You should generate a UUID for
each new VuXML entry (and do not forget to substitute it
for the template UUID unless you are writing the entry
from scratch). You can use &man.uuidgen.1; to generate
a VuXML UUID.</para>
</callout>
<callout arearefs="co-vx-top">
<para>This is a one-line description of the issue
found.</para>
</callout>
<callout arearefs="co-vx-nam">
<para>The names of packages affected are listed there.
Multiple names can be given since several packages may
be based on a single master port or software product.
This may include stable and development branches,
localized versions, and slave ports featuring different
choices of important build-time configuration
options.</para>
<important>
<para>It is your responsibility to find all such related
packages when writing a VuXML entry. Keep in mind
that <literal>make search name=foo</literal> is your
friend. The primary points to look for are as
follows:</para>
<itemizedlist>
<listitem>
<para>the <filename>foo-devel</filename> variant
for a <filename>foo</filename> port;</para>
</listitem>
<listitem>
<para>other variants with a suffix like
<literal>-a4</literal> (for print-related
packages), <literal>-without-gui</literal> (for
packages with X support disabled), or
similar;</para>
</listitem>
<listitem>
<para><literal>jp-</literal>,
<literal>ru-</literal>, <literal>zh-</literal>,
and other possible localized variants in the
corresponding national categories of the ports
collection.</para>
</listitem>
</itemizedlist>
</important>
</callout>
<callout arearefs="co-vx-rng">
<para>Affected versions of the package(s) are specified
there as one or more ranges using a combination of
<literal><lt></literal>,
<literal><le></literal>,
<literal><eq></literal>,
<literal><ge></literal>, and
<literal><gt></literal> elements. The version
ranges given should not overlap.</para>
<para>In a range specification, <literal>*</literal>
(asterisk) denotes the smallest version number. In
particular, <literal>2.*</literal> is less than
<literal>2.a</literal>. Therefore an asterisk may be
used for a range to match all possible
<literal>alpha</literal>, <literal>beta</literal>, and
<literal>RC</literal> versions. For instance,
<literal><ge>2.*</ge><lt>3.*</lt></literal>
will selectively match every <literal>2.x</literal>
version while
<literal><ge>2.0</ge><lt>3.0</lt></literal>
will not since the latter misses
<literal>2.r3</literal> and matches
<literal>3.b</literal>.</para>
<para>The above example specifies that affected are
versions from <literal>1.6</literal> to
<literal>1.9</literal> inclusive, versions
<literal>2.x</literal> before <literal>2.4_1</literal>,
and version <literal>3.0b1</literal>.</para>
</callout>
<callout arearefs="co-vx-nm2">
<para>Several related package groups (essentially, ports)
can be listed in the <literal><affected></literal>
section. This can be used if several software products
(say FooBar, FreeBar and OpenBar) grow from the same
code base and still share its bugs and vulnerabilities.
Note the difference from listing multiple names within a
single <package> section.</para>
</callout>
<callout arearefs="co-vx-epo">
<para>The version ranges should allow for
<makevar>PORTEPOCH</makevar> and
<makevar>PORTREVISION</makevar> if applicable. Please
remember that according to the collation rules, a
version with a non-zero <makevar>PORTEPOCH</makevar> is
greater than any version without
<makevar>PORTEPOCH</makevar>, e.g.,
<literal>3.0,1</literal> is greater than
<literal>3.1</literal> or even than
<literal>8.9</literal>.</para>
</callout>
<callout arearefs="co-vx-bdy">
<para>This is a summary of the issue. XHTML is used in
this field. At least enclosing
<literal><p></literal> and
<literal></p></literal> should appear. More
complex mark-up may be used, but only for the sake of
accuracy and clarity: No eye candy please.</para>
</callout>
<callout arearefs="co-vx-ref">
<para>This section contains references to relevant
documents. As many references as apply are
encouraged.</para>
</callout>
<callout arearefs="co-vx-fsa">
<para>This is a <ulink
url="http://www.freebsd.org/security/#adv">FreeBSD
security advisory</ulink>.</para>
</callout>
<callout arearefs="co-vx-fpr">
<para>This is a <ulink
url="http://www.freebsd.org/support.html#gnats">FreeBSD
problem report</ulink>.</para>
</callout>
<callout arearefs="co-vx-cve">
<para>This is a <ulink
url="http://www.cve.mitre.org/">MITRE
CVE</ulink> identifier.</para>
</callout>
<callout arearefs="co-vx-bid">
<para>This is a <ulink
url="http://www.securityfocus.com/bid">SecurityFocus
Bug ID</ulink>.</para>
</callout>
<callout arearefs="co-vx-cts">
<para>This is a
<ulink url="http://www.cert.org/">US-CERT</ulink>
security advisory.</para>
</callout>
<callout arearefs="co-vx-ctv">
<para>This is a <ulink
url="http://www.cert.org/">US-CERT</ulink>
vulnerability note.</para>
</callout>
<callout arearefs="co-vx-ucs">
<para>This is a <ulink
url="http://www.cert.org/">US-CERT</ulink>
Cyber Security Alert.</para>
</callout>
<callout arearefs="co-vx-uct">
<para>This is a <ulink
url="http://www.cert.org/">US-CERT</ulink>
Technical Cyber Security Alert.</para>
</callout>
<callout arearefs="co-vx-mls">
<para>This is a URL to an archived posting in a mailing
list. The attribute <literal>msgid</literal> is
optional and may specify the message ID of the
posting.</para>
</callout>
<callout arearefs="co-vx-url">
<para>This is a generic URL. It should be used only if
none of the other reference categories apply.</para>
</callout>
<callout arearefs="co-vx-dsc">
<para>This is the date when the issue was disclosed
(<replaceable>YYYY-MM-DD</replaceable>).</para>
</callout>
<callout arearefs="co-vx-ent">
<para>This is the date when the entry was added
(<replaceable>YYYY-MM-DD</replaceable>).</para>
</callout>
<callout arearefs="co-vx-mod">
<para>This is the date when any information in the entry
was last modified
(<replaceable>YYYY-MM-DD</replaceable>). New entries
must not include this field. It should be added upon
editing an existing entry.</para>
</callout>
</calloutlist>
</sect2>
<sect2 id="security-notify-vuxml-testing">
<title>Testing Your Changes to the VuXML Database</title>
<para>Assume you just wrote or filled in an entry for a
vulnerability in the package <literal>clamav</literal> that
has been fixed in version <literal>0.65_7</literal>.</para>
<para>As a prerequisite, you need to
<emphasis>install</emphasis> fresh versions of the ports
<filename role="package">ports-mgmt/portaudit</filename>,
<filename role="package">ports-mgmt/portaudit-db</filename>,
and <filename
role="package">security/vuxml</filename>.</para>
<note>
<para>To run <command>packaudit</command> you must have
permission to write to its
<filename><makevar>DATABASEDIR</makevar></filename>,
typically <filename>/var/db/portaudit</filename>.</para>
<para>To use a different directory set the
<filename><makevar>DATABASEDIR</makevar></filename>
environment variable to a different location.</para>
<para>If you are working in a directory other than
<filename>${PORTSDIR}/security/vuxml</filename> set the
<filename><makevar>VUXMLDIR</makevar></filename>
environment variable to the directory where
<filename>vuln.xml</filename> is located.</para>
</note>
<para>First, check whether there already is an entry for this
vulnerability. If there were such an entry, it would match
the previous version of the package,
<literal>0.65_6</literal>:</para>
<screen>&prompt.user; <userinput>packaudit</userinput>
&prompt.user; <userinput>portaudit clamav-0.65_6</userinput></screen>
<para>If there is none found, you have the green light to add
a new entry for this vulnerability.</para>
<screen>&prompt.user; <userinput>cd ${PORTSDIR}/security/vuxml</userinput>
&prompt.user; <userinput>make newentry</userinput></screen>
<para>When you are done verify its syntax and
formatting.</para>
<screen>&prompt.user; <userinput>make validate</userinput></screen>
<note>
<para>You will need at least one of the following packages
installed: <filename
role="package">textproc/libxml2</filename>, <filename
role="package">textproc/jade</filename>.</para>
</note>
<para>Now rebuild the <command>portaudit</command> database
from the VuXML file:</para>
<screen>&prompt.user; <userinput>packaudit</userinput></screen>
<para>To verify that the <literal><affected></literal>
section of your entry will match correct package(s), issue
the following command:</para>
<screen>&prompt.user; <userinput>portaudit -f /usr/ports/INDEX -r <replaceable>uuid</replaceable></userinput></screen>
<note>
<para>Please refer to &man.portaudit.1; for better
understanding of the command syntax.</para>
</note>
<para>Make sure that your entry produces no spurious matches
in the output.</para>
<para>Now check whether the right package versions are matched
by your entry:</para>
<screen>&prompt.user; <userinput>portaudit clamav-0.65_6 clamav-0.65_7</userinput>
Affected package: clamav-0.65_6 (matched by clamav<0.65_7)
Type of problem: clamav remote denial-of-service.
Reference: <http://www.freebsd.org/ports/portaudit/74a9541d-5d6c-11d8-80e3-0020ed76ef5a.html>
1 problem(s) found.</screen>
<para>The former version should match while the
latter one should not.</para>
<para>Finally, verify whether the web page generated from the
VuXML database looks like expected:</para>
<screen>&prompt.user; <userinput>mkdir -p ~/public_html/portaudit</userinput>
&prompt.user; <userinput>packaudit</userinput>
&prompt.user; <userinput>lynx ~/public_html/portaudit/74a9541d-5d6c-11d8-80e3-0020ed76ef5a.html</userinput></screen>
</sect2>
</sect1>
</chapter>
<chapter id="porting-dads">
<title>Dos and Don'ts</title>
<sect1 id="dads-intro">
<title>Introduction</title>
<para>Here is a list of common dos and don'ts that you encounter
during the porting process. You should check your own port
against this list, but you can also check ports in the <ulink
url="http://www.FreeBSD.org/cgi/query-pr-summary.cgi?query">PR
database</ulink> that others have submitted. Submit any
comments on ports you check as described in <ulink
url="&url.articles.contributing;/contrib-how.html#CONTRIB-GENERAL">Bug
Reports and General Commentary</ulink>. Checking ports in the
PR database will both make it faster for us to commit them,
and prove that you know what you are doing.</para>
</sect1>
<sect1 id="porting-wrkdir">
<title><makevar>WRKDIR</makevar></title>
<para>Do not write anything to files outside
<makevar>WRKDIR</makevar>. <makevar>WRKDIR</makevar> is the
only place that is guaranteed to be writable during the port
build (see <ulink
url="&url.books.handbook;/ports-using.html#PORTS-CD">
installing ports from a CDROM</ulink> for an example of
building ports from a read-only tree). If you need to modify
one of the
<filename>pkg-<replaceable>*</replaceable></filename> files,
do so by <link
linkend="porting-pkgfiles">redefining a variable</link>, not
by writing over it.</para>
</sect1>
<sect1 id="porting-wrkdirprefix">
<title><makevar>WRKDIRPREFIX</makevar></title>
<para>Make sure your port honors
<makevar>WRKDIRPREFIX</makevar>. Most ports do not have to
worry about this. In particular, if you are referring to a
<makevar>WRKDIR</makevar> of another port, note that the
correct location is
<filename><makevar>WRKDIRPREFIX</makevar><makevar>PORTSDIR</makevar>/<replaceable>subdir</replaceable>/<replaceable>name</replaceable>/work</filename>
not
<filename><makevar>PORTSDIR</makevar>/<replaceable>subdir</replaceable>/<replaceable>name</replaceable>/work</filename>
or
<filename><makevar>.CURDIR</makevar>/../../<replaceable>subdir</replaceable>/<replaceable>name</replaceable>/work</filename>
or some such.</para>
<para>Also, if you are defining <makevar>WRKDIR</makevar>
yourself, make sure you prepend
<literal>${WRKDIRPREFIX}${.CURDIR}</literal> in
the front.</para>
</sect1>
<sect1 id="porting-versions">
<title>Differentiating Operating Systems and OS Versions</title>
<para>You may come across code that needs modifications or
conditional compilation based upon what version of Unix it is
running under. If you need to make such changes to the code
for conditional compilation, make sure you make the changes as
general as possible so that we can back-port code to older
FreeBSD systems and cross-port to other BSD systems such as
4.4BSD from CSRG, BSD/386, 386BSD, NetBSD, and OpenBSD.</para>
<para>The preferred way to tell 4.3BSD/Reno (1990) and newer
versions of the BSD code apart is by using the
<literal>BSD</literal> macro defined in <ulink
url="http://svnweb.freebsd.org/base/head/sys/sys/param.h?view=markup">sys/param.h</ulink>.
Hopefully that file is already included; if not, add the
code:</para>
<programlisting>#if (defined(__unix__) || defined(unix)) && !defined(USG)
#include <sys/param.h>
#endif</programlisting>
<para>to the proper place in the <filename>.c</filename> file.
We believe that every system that defines these two symbols
has <filename>sys/param.h</filename>. If you find a system
that does not, we would like to know. Please send mail to the
&a.ports;.</para>
<para>Another way is to use the GNU Autoconf style of doing
this:</para>
<programlisting>#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif</programlisting>
<para>Do not forget to add <literal>-DHAVE_SYS_PARAM_H</literal>
to the <makevar>CFLAGS</makevar> in the
<filename>Makefile</filename> for this method.</para>
<para>Once you have <filename>sys/param.h</filename> included,
you may use:</para>
<programlisting>#if (defined(BSD) && (BSD >= 199103))</programlisting>
<para>to detect if the code is being compiled on a 4.3 Net2 code
base or newer (e.g., FreeBSD 1.x, 4.3/Reno, NetBSD 0.9,
386BSD, BSD/386 1.1 and below).</para>
<para>Use:</para>
<programlisting>#if (defined(BSD) && (BSD >= 199306))</programlisting>
<para>to detect if the code is being compiled on a 4.4 code base
or newer (e.g., FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or
above).</para>
<para>The value of the <literal>BSD</literal> macro is
<literal>199506</literal> for the 4.4BSD-Lite2 code base.
This is stated for informational purposes only. It should not
be used to distinguish between versions of FreeBSD based only
on 4.4-Lite versus versions that have merged in changes from
4.4-Lite2. The <literal>__FreeBSD__</literal> macro should be
used instead.</para>
<para>Use sparingly:</para>
<itemizedlist>
<listitem>
<para><literal>__FreeBSD__</literal> is defined in all
versions of FreeBSD. Use it if the change you are making
<emphasis>only</emphasis> affects FreeBSD. Porting
gotchas like the use of <literal>sys_errlist[]</literal>
versus <function>strerror()</function> are Berkeley-isms,
not FreeBSD changes.</para>
</listitem>
<listitem>
<para>In FreeBSD 2.x, <literal>__FreeBSD__</literal> is
defined to be <literal>2</literal>. In earlier versions,
it is <literal>1</literal>. Later versions always bump it
to match their major version number.</para>
</listitem>
<listitem>
<para>If you need to tell the difference between a FreeBSD
1.x system and a FreeBSD 2.x or above system, usually the
right answer is to use the <literal>BSD</literal> macros
described above. If there actually is a FreeBSD specific
change (such as special shared library options when using
<command>ld</command>) then it is OK to use
<literal>__FreeBSD__</literal> and <literal>#if
__FreeBSD__ > 1</literal> to detect a FreeBSD 2.x and
later system. If you need more granularity in detecting
FreeBSD systems since 2.0-RELEASE you can use the
following:</para>
<programlisting>#if __FreeBSD__ >= 2
#include <osreldate.h>
# if __FreeBSD_version >= 199504
/* 2.0.5+ release specific code here */
# endif
#endif</programlisting>
</listitem>
</itemizedlist>
<para>In the hundreds of ports that have been done, there have
only been one or two cases where
<literal>__FreeBSD__</literal> should have been used. Just
because an earlier port screwed up and used it in the wrong
place does not mean you should do so too.</para>
</sect1>
<sect1 id="freebsd-versions">
<title><literal>__FreeBSD_version</literal> Values</title>
<para>Here is a convenient list of
<literal>__FreeBSD_version</literal> values as defined in
<ulink
url="http://svnweb.FreeBSD.org/base/head/sys/sys/param.h?view=markup">sys/param.h</ulink>:</para>
<table frame="none">
<title><literal>__FreeBSD_version</literal> Values</title>
<tgroup cols="3">
<thead>
<row>
<entry>Value</entry>
<entry>Date</entry>
<entry>Release</entry>
</row>
</thead>
<tbody>
<row>
<entry>119411</entry>
<entry></entry>
<entry>2.0-RELEASE</entry>
</row>
<row>
<entry>199501, 199503</entry>
<entry>March 19, 1995</entry>
<entry>2.1-CURRENT</entry>
</row>
<row>
<entry>199504</entry>
<entry>April 9, 1995</entry>
<entry>2.0.5-RELEASE</entry>
</row>
<row>
<entry>199508</entry>
<entry>August 26, 1995</entry>
<entry>2.2-CURRENT before 2.1</entry>
</row>
<row>
<entry>199511</entry>
<entry>November 10, 1995</entry>
<entry>2.1.0-RELEASE</entry>
</row>
<row>
<entry>199512</entry>
<entry>November 10, 1995</entry>
<entry>2.2-CURRENT before 2.1.5</entry>
</row>
<row>
<entry>199607</entry>
<entry>July 10, 1996</entry>
<entry>2.1.5-RELEASE</entry>
</row>
<row>
<entry>199608</entry>
<entry>July 12, 1996</entry>
<entry>2.2-CURRENT before 2.1.6</entry>
</row>
<row>
<entry>199612</entry>
<entry>November 15, 1996</entry>
<entry>2.1.6-RELEASE</entry>
</row>
<row>
<entry>199612</entry>
<entry></entry>
<entry>2.1.7-RELEASE</entry>
</row>
<row>
<entry>220000</entry>
<entry>February 19, 1997</entry>
<entry>2.2-RELEASE</entry>
</row>
<row>
<entry>(not changed)</entry>
<entry></entry>
<entry>2.2.1-RELEASE</entry>
</row>
<row>
<entry>(not changed)</entry>
<entry></entry>
<entry>2.2-STABLE after 2.2.1-RELEASE</entry>
</row>
<row>
<entry>221001</entry>
<entry>April 15, 1997</entry>
<entry>2.2-STABLE after texinfo-3.9</entry>
</row>
<row>
<entry>221002</entry>
<entry>April 30, 1997</entry>
<entry>2.2-STABLE after top</entry>
</row>
<row>
<entry>222000</entry>
<entry>May 16, 1997</entry>
<entry>2.2.2-RELEASE</entry>
</row>
<row>
<entry>222001</entry>
<entry>May 19, 1997</entry>
<entry>2.2-STABLE after 2.2.2-RELEASE</entry>
</row>
<row>
<entry>225000</entry>
<entry>October 2, 1997</entry>
<entry>2.2.5-RELEASE</entry>
</row>
<row>
<entry>225001</entry>
<entry>November 20, 1997</entry>
<entry>2.2-STABLE after 2.2.5-RELEASE</entry>
</row>
<row>
<entry>225002</entry>
<entry>December 27, 1997</entry>
<entry>2.2-STABLE after ldconfig -R merge</entry>
</row>
<row>
<entry>226000</entry>
<entry>March 24, 1998</entry>
<entry>2.2.6-RELEASE</entry>
</row>
<row>
<entry>227000</entry>
<entry>July 21, 1998</entry>
<entry>2.2.7-RELEASE</entry>
</row>
<row>
<entry>227001</entry>
<entry>July 21, 1998</entry>
<entry>2.2-STABLE after 2.2.7-RELEASE</entry>
</row>
<row>
<entry>227002</entry>
<entry>September 19, 1998</entry>
<entry>2.2-STABLE after &man.semctl.2; change</entry>
</row>
<row>
<entry>228000</entry>
<entry>November 29, 1998</entry>
<entry>2.2.8-RELEASE</entry>
</row>
<row>
<entry>228001</entry>
<entry>November 29, 1998</entry>
<entry>2.2-STABLE after 2.2.8-RELEASE</entry>
</row>
<row>
<entry>300000</entry>
<entry>February 19, 1996</entry>
<entry>3.0-CURRENT before &man.mount.2; change</entry>
</row>
<row>
<entry>300001</entry>
<entry>September 24, 1997</entry>
<entry>3.0-CURRENT after &man.mount.2; change</entry>
</row>
<row>
<entry>300002</entry>
<entry>June 2, 1998</entry>
<entry>3.0-CURRENT after &man.semctl.2; change</entry>
</row>
<row>
<entry>300003</entry>
<entry>June 7, 1998</entry>
<entry>3.0-CURRENT after ioctl arg changes</entry>
</row>
<row>
<entry>300004</entry>
<entry>September 3, 1998</entry>
<entry>3.0-CURRENT after ELF conversion</entry>
</row>
<row>
<entry>300005</entry>
<entry>October 16, 1998</entry>
<entry>3.0-RELEASE</entry>
</row>
<row>
<entry>300006</entry>
<entry>October 16, 1998</entry>
<entry>3.0-CURRENT after 3.0-RELEASE</entry>
</row>
<row>
<entry>300007</entry>
<entry>January 22, 1999</entry>
<entry>3.0-STABLE after 3/4 branch</entry>
</row>
<row>
<entry>310000</entry>
<entry>February 9, 1999</entry>
<entry>3.1-RELEASE</entry>
</row>
<row>
<entry>310001</entry>
<entry>March 27, 1999</entry>
<entry>3.1-STABLE after 3.1-RELEASE</entry>
</row>
<row>
<entry>310002</entry>
<entry>April 14, 1999</entry>
<entry>3.1-STABLE after C++ constructor/destructor order
change</entry>
</row>
<row>
<entry>320000</entry>
<entry></entry>
<entry>3.2-RELEASE</entry>
</row>
<row>
<entry>320001</entry>
<entry>May 8, 1999</entry>
<entry>3.2-STABLE</entry>
</row>
<row>
<entry>320002</entry>
<entry>August 29, 1999</entry>
<entry>3.2-STABLE after binary-incompatible IPFW and
socket changes</entry>
</row>
<row>
<entry>330000</entry>
<entry>September 2, 1999</entry>
<entry>3.3-RELEASE</entry>
</row>
<row>
<entry>330001</entry>
<entry>September 16, 1999</entry>
<entry>3.3-STABLE</entry>
</row>
<row>
<entry>330002</entry>
<entry>November 24, 1999</entry>
<entry>3.3-STABLE after adding &man.mkstemp.3;
to libc</entry>
</row>
<row>
<entry>340000</entry>
<entry>December 5, 1999</entry>
<entry>3.4-RELEASE</entry>
</row>
<row>
<entry>340001</entry>
<entry>December 17, 1999</entry>
<entry>3.4-STABLE</entry>
</row>
<row>
<entry>350000</entry>
<entry>June 20, 2000</entry>
<entry>3.5-RELEASE</entry>
</row>
<row>
<entry>350001</entry>
<entry>July 12, 2000</entry>
<entry>3.5-STABLE</entry>
</row>
<row>
<entry>400000</entry>
<entry>January 22, 1999</entry>
<entry>4.0-CURRENT after 3.4 branch</entry>
</row>
<row>
<entry>400001</entry>
<entry>February 20, 1999</entry>
<entry>4.0-CURRENT after change in dynamic linker
handling</entry>
</row>
<row>
<entry>400002</entry>
<entry>March 13, 1999</entry>
<entry>4.0-CURRENT after C++ constructor/destructor
order change</entry>
</row>
<row>
<entry>400003</entry>
<entry>March 27, 1999</entry>
<entry>4.0-CURRENT after functioning
&man.dladdr.3;</entry>
</row>
<row>
<entry>400004</entry>
<entry>April 5, 1999</entry>
<entry>4.0-CURRENT after __deregister_frame_info dynamic
linker bug fix (also 4.0-CURRENT after EGCS 1.1.2
integration)</entry>
</row>
<row>
<entry>400005</entry>
<entry>April 27, 1999</entry>
<entry>4.0-CURRENT after &man.suser.9; API change
(also 4.0-CURRENT after newbus)</entry>
</row>
<row>
<entry>400006</entry>
<entry>May 31, 1999</entry>
<entry>4.0-CURRENT after cdevsw registration
change</entry>
</row>
<row>
<entry>400007</entry>
<entry>June 17, 1999</entry>
<entry>4.0-CURRENT after the addition of so_cred for
socket level credentials</entry>
</row>
<row>
<entry>400008</entry>
<entry>June 20, 1999</entry>
<entry>4.0-CURRENT after the addition of a poll syscall
wrapper to libc_r</entry>
</row>
<row>
<entry>400009</entry>
<entry>July 20, 1999</entry>
<entry>4.0-CURRENT after the change of the kernel's
<literal>dev_t</literal> type to <literal>struct
specinfo</literal> pointer</entry>
</row>
<row>
<entry>400010</entry>
<entry>September 25, 1999</entry>
<entry>4.0-CURRENT after fixing a hole
in &man.jail.2;</entry>
</row>
<row>
<entry>400011</entry>
<entry>September 29, 1999</entry>
<entry>4.0-CURRENT after the <literal>sigset_t</literal>
datatype change</entry>
</row>
<row>
<entry>400012</entry>
<entry>November 15, 1999</entry>
<entry>4.0-CURRENT after the cutover to the GCC 2.95.2
compiler</entry>
</row>
<row>
<entry>400013</entry>
<entry>December 4, 1999</entry>
<entry>4.0-CURRENT after adding pluggable linux-mode
ioctl handlers</entry>
</row>
<row>
<entry>400014</entry>
<entry>January 18, 2000</entry>
<entry>4.0-CURRENT after importing OpenSSL</entry>
</row>
<row>
<entry>400015</entry>
<entry>January 27, 2000</entry>
<entry>4.0-CURRENT after the C++ ABI change in GCC
2.95.2 from -fvtable-thunks to -fno-vtable-thunks by
default</entry>
</row>
<row>
<entry>400016</entry>
<entry>February 27, 2000</entry>
<entry>4.0-CURRENT after importing OpenSSH</entry>
</row>
<row>
<entry>400017</entry>
<entry>March 13, 2000</entry>
<entry>4.0-RELEASE</entry>
</row>
<row>
<entry>400018</entry>
<entry>March 17, 2000</entry>
<entry>4.0-STABLE after 4.0-RELEASE</entry>
</row>
<row>
<entry>400019</entry>
<entry>May 5, 2000</entry>
<entry>4.0-STABLE after the introduction of delayed
checksums.</entry>
</row>
<row>
<entry>400020</entry>
<entry>June 4, 2000</entry>
<entry>4.0-STABLE after merging libxpg4 code into
libc.</entry>
</row>
<row>
<entry>400021</entry>
<entry>July 8, 2000</entry>
<entry>4.0-STABLE after upgrading Binutils to 2.10.0,
ELF branding changes, and tcsh in the base
system.</entry>
</row>
<row>
<entry>410000</entry>
<entry>July 14, 2000</entry>
<entry>4.1-RELEASE</entry>
</row>
<row>
<entry>410001</entry>
<entry>July 29, 2000</entry>
<entry>4.1-STABLE after 4.1-RELEASE</entry>
</row>
<row>
<entry>410002</entry>
<entry>September 16, 2000</entry>
<entry>4.1-STABLE after &man.setproctitle.3; moved from
libutil to libc.</entry>
</row>
<row>
<entry>411000</entry>
<entry>September 25, 2000</entry>
<entry>4.1.1-RELEASE</entry>
</row>
<row>
<entry>411001</entry>
<entry></entry>
<entry>4.1.1-STABLE after 4.1.1-RELEASE</entry>
</row>
<row>
<entry>420000</entry>
<entry>October 31, 2000</entry>
<entry>4.2-RELEASE</entry>
</row>
<row>
<entry>420001</entry>
<entry>January 10, 2001</entry>
<entry>4.2-STABLE after combining libgcc.a and
libgcc_r.a, and associated GCC linkage
changes.</entry>
</row>
<row>
<entry>430000</entry>
<entry>March 6, 2001</entry>
<entry>4.3-RELEASE</entry>
</row>
<row>
<entry>430001</entry>
<entry>May 18, 2001</entry>
<entry>4.3-STABLE after wint_t introduction.</entry>
</row>
<row>
<entry>430002</entry>
<entry>July 22, 2001</entry>
<entry>4.3-STABLE after PCI powerstate API
merge.</entry>
</row>
<row>
<entry>440000</entry>
<entry>August 1, 2001</entry>
<entry>4.4-RELEASE</entry>
</row>
<row>
<entry>440001</entry>
<entry>October 23, 2001</entry>
<entry>4.4-STABLE after d_thread_t introduction.</entry>
</row>
<row>
<entry>440002</entry>
<entry>November 4, 2001</entry>
<entry>4.4-STABLE after mount structure changes (affects
filesystem klds).</entry>
</row>
<row>
<entry>440003</entry>
<entry>December 18, 2001</entry>
<entry>4.4-STABLE after the userland components of smbfs
were imported.</entry>
</row>
<row>
<entry>450000</entry>
<entry>December 20, 2001</entry>
<entry>4.5-RELEASE</entry>
</row>
<row>
<entry>450001</entry>
<entry>February 24, 2002</entry>
<entry>4.5-STABLE after the usb structure element
rename.</entry>
</row>
<row>
<entry>450004</entry>
<entry>April 16, 2002</entry>
<entry>4.5-STABLE after the
<literal>sendmail_enable</literal> &man.rc.conf.5;
variable was made to take the value
<literal>NONE</literal>.</entry>
</row>
<row>
<entry>450005</entry>
<entry>April 27, 2002</entry>
<entry>4.5-STABLE after moving to XFree86 4 by default
for package builds.</entry>
</row>
<row>
<entry>450006</entry>
<entry>May 1, 2002</entry>
<entry>4.5-STABLE after accept filtering was fixed so
that is no longer susceptible to an easy DoS.</entry>
</row>
<row>
<entry>460000</entry>
<entry>June 21, 2002</entry>
<entry>4.6-RELEASE</entry>
</row>
<row>
<entry>460001</entry>
<entry>June 21, 2002</entry>
<entry>4.6-STABLE &man.sendfile.2; fixed to comply with
documentation, not to count any headers sent against
the amount of data to be sent from the file.</entry>
</row>
<row>
<entry>460002</entry>
<entry>July 19, 2002</entry>
<entry>4.6.2-RELEASE</entry>
</row>
<row>
<entry>460100</entry>
<entry>June 26, 2002</entry>
<entry>4.6-STABLE</entry>
</row>
<row>
<entry>460101</entry>
<entry>June 26, 2002</entry>
<entry>4.6-STABLE after MFC of `sed -i'.</entry>
</row>
<row>
<entry>460102</entry>
<entry>September 1, 2002</entry>
<entry>4.6-STABLE after MFC of many new pkg_install
features from the HEAD.</entry>
</row>
<row>
<entry>470000</entry>
<entry>October 8, 2002</entry>
<entry>4.7-RELEASE</entry>
</row>
<row>
<entry>470100</entry>
<entry>October 9, 2002</entry>
<entry>4.7-STABLE</entry>
</row>
<row>
<entry>470101</entry>
<entry>November 10, 2002</entry>
<entry>Start generated __std{in,out,err}p references
rather than __sF. This changes std{in,out,err} from a
compile time expression to a runtime one.</entry>
</row>
<row>
<entry>470102</entry>
<entry>January 23, 2003</entry>
<entry>4.7-STABLE after MFC of mbuf changes to replace
m_aux mbufs by m_tag's</entry>
</row>
<row>
<entry>470103</entry>
<entry>February 14, 2003</entry>
<entry>4.7-STABLE gets OpenSSL 0.9.7</entry>
</row>
<row>
<entry>480000</entry>
<entry>March 30, 2003</entry>
<entry>4.8-RELEASE</entry>
</row>
<row>
<entry>480100</entry>
<entry>April 5, 2003</entry>
<entry>4.8-STABLE</entry>
</row>
<row>
<entry>480101</entry>
<entry>May 22, 2003</entry>
<entry>4.8-STABLE after &man.realpath.3; has been made
thread-safe</entry>
</row>
<row>
<entry>480102</entry>
<entry>August 10, 2003</entry>
<entry>4.8-STABLE 3ware API changes to twe.</entry>
</row>
<row>
<entry>490000</entry>
<entry>October 27, 2003</entry>
<entry>4.9-RELEASE</entry>
</row>
<row>
<entry>490100</entry>
<entry>October 27, 2003</entry>
<entry>4.9-STABLE</entry>
</row>
<row>
<entry>490101</entry>
<entry>January 8, 2004</entry>
<entry>4.9-STABLE after e_sid was added to struct
kinfo_eproc.</entry>
</row>
<row>
<entry>490102</entry>
<entry>February 4, 2004</entry>
<entry>4.9-STABLE after MFC of libmap functionality
for rtld.</entry>
</row>
<row>
<entry>491000</entry>
<entry>May 25, 2004</entry>
<entry>4.10-RELEASE</entry>
</row>
<row>
<entry>491100</entry>
<entry>June 1, 2004</entry>
<entry>4.10-STABLE</entry>
</row>
<row>
<entry>491101</entry>
<entry>August 11, 2004</entry>
<entry>4.10-STABLE after MFC of revision 20040629 of
the package tools</entry>
</row>
<row>
<entry>491102</entry>
<entry>November 16, 2004</entry>
<entry>4.10-STABLE after VM fix dealing with unwiring
of fictitious pages</entry>
</row>
<row>
<entry>492000</entry>
<entry>December 17, 2004</entry>
<entry>4.11-RELEASE</entry>
</row>
<row>
<entry>492100</entry>
<entry>December 17, 2004</entry>
<entry>4.11-STABLE</entry>
</row>
<row>
<entry>492101</entry>
<entry>April 18, 2006</entry>
<entry>4.11-STABLE after adding libdata/ldconfig
directories to mtree files.</entry>
</row>
<row>
<entry>500000</entry>
<entry>March 13, 2000</entry>
<entry>5.0-CURRENT</entry>
</row>
<row>
<entry>500001</entry>
<entry>April 18, 2000</entry>
<entry>5.0-CURRENT after adding addition ELF header
fields, and changing our ELF binary branding
method.</entry>
</row>
<row>
<entry>500002</entry>
<entry>May 2, 2000</entry>
<entry>5.0-CURRENT after kld metadata changes.</entry>
</row>
<row>
<entry>500003</entry>
<entry>May 18, 2000</entry>
<entry>5.0-CURRENT after buf/bio changes.</entry>
</row>
<row>
<entry>500004</entry>
<entry>May 26, 2000</entry>
<entry>5.0-CURRENT after binutils upgrade.</entry>
</row>
<row>
<entry>500005</entry>
<entry>June 3, 2000</entry>
<entry>5.0-CURRENT after merging libxpg4 code into
libc and after TASKQ interface introduction.</entry>
</row>
<row>
<entry>500006</entry>
<entry>June 10, 2000</entry>
<entry>5.0-CURRENT after the addition of AGP
interfaces.</entry>
</row>
<row>
<entry>500007</entry>
<entry>June 29, 2000</entry>
<entry>5.0-CURRENT after Perl upgrade to 5.6.0</entry>
</row>
<row>
<entry>500008</entry>
<entry>July 7, 2000</entry>
<entry>5.0-CURRENT after the update of KAME code to
2000/07 sources.</entry>
</row>
<row>
<entry>500009</entry>
<entry>July 14, 2000</entry>
<entry>5.0-CURRENT after ether_ifattach() and
ether_ifdetach() changes.</entry>
</row>
<row>
<entry>500010</entry>
<entry>July 16, 2000</entry>
<entry>5.0-CURRENT after changing mtree defaults
back to original variant, adding -L to follow
symlinks.</entry>
</row>
<row>
<entry>500011</entry>
<entry>July 18, 2000</entry>
<entry>5.0-CURRENT after kqueue API changed.</entry>
</row>
<row>
<entry>500012</entry>
<entry>September 2, 2000</entry>
<entry>5.0-CURRENT after &man.setproctitle.3; moved from
libutil to libc.</entry>
</row>
<row>
<entry>500013</entry>
<entry>September 10, 2000</entry>
<entry>5.0-CURRENT after the first SMPng commit.</entry>
</row>
<row>
<entry>500014</entry>
<entry>January 4, 2001</entry>
<entry>5.0-CURRENT after <sys/select.h> moved to
<sys/selinfo.h>.</entry>
</row>
<row>
<entry>500015</entry>
<entry>January 10, 2001</entry>
<entry>5.0-CURRENT after combining libgcc.a and
libgcc_r.a, and associated GCC linkage
changes.</entry>
</row>
<row>
<entry>500016</entry>
<entry>January 24, 2001</entry>
<entry>5.0-CURRENT after change allowing libc and libc_r
to be linked together, deprecating -pthread
option.</entry>
</row>
<row>
<entry>500017</entry>
<entry>February 18, 2001</entry>
<entry>5.0-CURRENT after switch from struct ucred to
struct xucred to stabilize kernel-exported API for
mountd et al.</entry>
</row>
<row>
<entry>500018</entry>
<entry>February 24, 2001</entry>
<entry>5.0-CURRENT after addition of CPUTYPE make
variable for controlling CPU-specific
optimizations.</entry>
</row>
<row>
<entry>500019</entry>
<entry>June 9, 2001</entry>
<entry>5.0-CURRENT after moving machine/ioctl_fd.h to
sys/fdcio.h</entry>
</row>
<row>
<entry>500020</entry>
<entry>June 15, 2001</entry>
<entry>5.0-CURRENT after locale names renaming.</entry>
</row>
<row>
<entry>500021</entry>
<entry>June 22, 2001</entry>
<entry>5.0-CURRENT after Bzip2 import.
Also signifies removal of S/Key.</entry>
</row>
<row>
<entry>500022</entry>
<entry>July 12, 2001</entry>
<entry>5.0-CURRENT after SSE support.</entry>
</row>
<row>
<entry>500023</entry>
<entry>September 14, 2001</entry>
<entry>5.0-CURRENT after KSE Milestone 2.</entry>
</row>
<row>
<entry>500024</entry>
<entry>October 1, 2001</entry>
<entry>5.0-CURRENT after d_thread_t,
and moving UUCP to ports.</entry>
</row>
<row>
<entry>500025</entry>
<entry>October 4, 2001</entry>
<entry>5.0-CURRENT after ABI change for descriptor
and creds passing on 64 bit platforms.</entry>
</row>
<row>
<entry>500026</entry>
<entry>October 9, 2001</entry>
<entry>5.0-CURRENT after moving to XFree86 4 by default
for package builds, and after the new libc strnstr()
function was added.</entry>
</row>
<row>
<entry>500027</entry>
<entry>October 10, 2001</entry>
<entry>5.0-CURRENT after the new libc strcasestr()
function was added.</entry>
</row>
<row>
<entry>500028</entry>
<entry>December 14, 2001</entry>
<entry>5.0-CURRENT after the userland components of
smbfs were imported.</entry>
</row>
<row>
<entry>(not changed)</entry>
<entry></entry>
<entry>5.0-CURRENT after the new C99 specific-width
integer types were added.</entry>
</row>
<row>
<entry>500029</entry>
<entry>January 29, 2002</entry>
<entry>5.0-CURRENT after a change was made in the return
value of &man.sendfile.2;.</entry>
</row>
<row>
<entry>500030</entry>
<entry>February 15, 2002</entry>
<entry>5.0-CURRENT after the introduction of the
type <literal>fflags_t</literal>, which is the
appropriate size for file flags.</entry>
</row>
<row>
<entry>500031</entry>
<entry>February 24, 2002</entry>
<entry>5.0-CURRENT after the usb structure element
rename.</entry>
</row>
<row>
<entry>500032</entry>
<entry>March 16, 2002</entry>
<entry>5.0-CURRENT after the introduction of
Perl 5.6.1.</entry>
</row>
<row>
<entry>500033</entry>
<entry>April 3, 2002</entry>
<entry>5.0-CURRENT after the
<literal>sendmail_enable</literal> &man.rc.conf.5;
variable was made to take the value
<literal>NONE</literal>.</entry>
</row>
<row>
<entry>500034</entry>
<entry>April 30, 2002</entry>
<entry>5.0-CURRENT after mtx_init() grew a third
argument.</entry>
</row>
<row>
<entry>500035</entry>
<entry>May 13, 2002</entry>
<entry>5.0-CURRENT with Gcc 3.1.</entry>
</row>
<row>
<entry>500036</entry>
<entry>May 17, 2002</entry>
<entry>5.0-CURRENT without Perl in /usr/src</entry>
</row>
<row>
<entry>500037</entry>
<entry>May 29, 2002</entry>
<entry>5.0-CURRENT after the addition of
&man.dlfunc.3;</entry>
</row>
<row>
<entry>500038</entry>
<entry>July 24, 2002</entry>
<entry>5.0-CURRENT after the types of some struct
sockbuf members were changed and the structure was
reordered.</entry>
</row>
<row>
<entry>500039</entry>
<entry>September 1, 2002</entry>
<entry>5.0-CURRENT after GCC 3.2.1 import.
Also after headers stopped using
_BSD_FOO_T_ and started using _FOO_T_DECLARED.
This value can also be used as a conservative
estimate of the start of &man.bzip2.1; package
support.</entry>
</row>
<row>
<entry>500040</entry>
<entry>September 20, 2002</entry>
<entry>5.0-CURRENT after various changes to disk
functions were made in the name of removing dependency
on disklabel structure internals.</entry>
</row>
<row>
<entry>500041</entry>
<entry>October 1, 2002</entry>
<entry>5.0-CURRENT after the addition of
&man.getopt.long.3; to libc.</entry>
</row>
<row>
<entry>500042</entry>
<entry>October 15, 2002</entry>
<entry>5.0-CURRENT after Binutils 2.13 upgrade, which
included new FreeBSD emulation, vec, and output
format.</entry>
</row>
<row>
<entry>500043</entry>
<entry>November 1, 2002</entry>
<entry>5.0-CURRENT after adding weak pthread_XXX stubs
to libc, obsoleting libXThrStub.so.
5.0-RELEASE.</entry>
</row>
<row>
<entry>500100</entry>
<entry>January 17, 2003</entry>
<entry>5.0-CURRENT after branching for
RELENG_5_0</entry>
</row>
<row>
<entry>500101</entry>
<entry>February 19, 2003</entry>
<entry><sys/dkstat.h> is empty and should
not be included.</entry>
</row>
<row>
<entry>500102</entry>
<entry>February 25, 2003</entry>
<entry>5.0-CURRENT after the d_mmap_t interface
change.</entry>
</row>
<row>
<entry>500103</entry>
<entry>February 26, 2003</entry>
<entry>5.0-CURRENT after taskqueue_swi changed to run
without Giant, and taskqueue_swi_giant added to run
with Giant.</entry>
</row>
<row>
<entry>500104</entry>
<entry>February 27, 2003</entry>
<entry>cdevsw_add() and cdevsw_remove() no
longer exists.
Appearance of MAJOR_AUTO allocation facility.</entry>
</row>
<row>
<entry>500105</entry>
<entry>March 4, 2003</entry>
<entry>5.0-CURRENT after new cdevsw initialization
method.</entry>
</row>
<row>
<entry>500106</entry>
<entry>March 8, 2003</entry>
<entry>devstat_add_entry() has been replaced by
devstat_new_entry()</entry>
</row>
<row>
<entry>500107</entry>
<entry>March 15, 2003</entry>
<entry>Devstat interface change; see sys/sys/param.h
1.149</entry>
</row>
<row>
<entry>500108</entry>
<entry>March 15, 2003</entry>
<entry>Token-Ring interface changes.</entry>
</row>
<row>
<entry>500109</entry>
<entry>March 25, 2003</entry>
<entry>Addition of vm_paddr_t.</entry>
</row>
<row>
<entry>500110</entry>
<entry>March 28, 2003</entry>
<entry>5.0-CURRENT after &man.realpath.3; has been made
thread-safe</entry>
</row>
<row>
<entry>500111</entry>
<entry>April 9, 2003</entry>
<entry>5.0-CURRENT after &man.usbhid.3; has been synced
with NetBSD</entry>
</row>
<row>
<entry>500112</entry>
<entry>April 17, 2003</entry>
<entry>5.0-CURRENT after new NSS implementation
and addition of POSIX.1 getpw*_r, getgr*_r
functions</entry>
</row>
<row>
<entry>500113</entry>
<entry>May 2, 2003</entry>
<entry>5.0-CURRENT after removal of the old rc
system.</entry>
</row>
<row>
<entry>501000</entry>
<entry>June 4, 2003</entry>
<entry>5.1-RELEASE.</entry>
</row>
<row>
<entry>501100</entry>
<entry>June 2, 2003</entry>
<entry>5.1-CURRENT after branching for
RELENG_5_1.</entry>
</row>
<row>
<entry>501101</entry>
<entry>June 29, 2003</entry>
<entry>5.1-CURRENT after correcting the semantics of
sigtimedwait(2) and sigwaitinfo(2).</entry>
</row>
<row>
<entry>501102</entry>
<entry>July 3, 2003</entry>
<entry>5.1-CURRENT after adding the lockfunc and
lockfuncarg fields to
&man.bus.dma.tag.create.9;.</entry>
</row>
<row>
<entry>501103</entry>
<entry>July 31, 2003</entry>
<entry>5.1-CURRENT after GCC 3.3.1-pre 20030711 snapshot
integration.</entry>
</row>
<row>
<entry>501104</entry>
<entry>August 5, 2003</entry>
<entry>5.1-CURRENT 3ware API changes to twe.</entry>
</row>
<row>
<entry>501105</entry>
<entry>August 17, 2003</entry>
<entry>5.1-CURRENT dynamically-linked /bin and /sbin
support and movement of libraries to /lib.</entry>
</row>
<row>
<entry>501106</entry>
<entry>September 8, 2003</entry>
<entry>5.1-CURRENT after adding kernel support for
Coda 6.x.</entry>
</row>
<row>
<entry>501107</entry>
<entry>September 17, 2003</entry>
<entry>5.1-CURRENT after 16550 UART constants moved from
<filename><dev/sio/sioreg.h></filename> to
<filename><dev/ic/ns16550.h></filename>.
Also when libmap functionality was unconditionally
supported by rtld.</entry>
</row>
<row>
<entry>501108</entry>
<entry>September 23, 2003</entry>
<entry>5.1-CURRENT after PFIL_HOOKS API update</entry>
</row>
<row>
<entry>501109</entry>
<entry>September 27, 2003</entry>
<entry>5.1-CURRENT after adding kiconv(3)</entry>
</row>
<row>
<entry>501110</entry>
<entry>September 28, 2003</entry>
<entry>5.1-CURRENT after changing default operations
for open and close in cdevsw</entry>
</row>
<row>
<entry>501111</entry>
<entry>October 16, 2003</entry>
<entry>5.1-CURRENT after changed layout of
cdevsw</entry>
</row>
<row>
<entry>501112</entry>
<entry>October 16, 2003</entry>
<entry> 5.1-CURRENT after adding kobj multiple
inheritance</entry>
</row>
<row>
<entry>501113</entry>
<entry>October 31, 2003</entry>
<entry> 5.1-CURRENT after the if_xname change in
struct ifnet</entry>
</row>
<row>
<entry>501114</entry>
<entry>November 16, 2003</entry>
<entry> 5.1-CURRENT after changing /bin and /sbin to
be dynamically linked</entry>
</row>
<row>
<entry>502000</entry>
<entry>December 7, 2003</entry>
<entry>5.2-RELEASE</entry>
</row>
<row>
<entry>502010</entry>
<entry>February 23, 2004</entry>
<entry>5.2.1-RELEASE</entry>
</row>
<row>
<entry>502100</entry>
<entry>December 7, 2003</entry>
<entry>5.2-CURRENT after branching for
RELENG_5_2</entry>
</row>
<row>
<entry>502101</entry>
<entry>December 19, 2003</entry>
<entry>5.2-CURRENT after __cxa_atexit/__cxa_finalize
functions were added to libc.</entry>
</row>
<row>
<entry>502102</entry>
<entry>January 30, 2004</entry>
<entry>5.2-CURRENT after change of default thread
library from libc_r to libpthread.</entry>
</row>
<row>
<entry>502103</entry>
<entry>February 21, 2004</entry>
<entry>5.2-CURRENT after device driver API
megapatch.</entry>
</row>
<row>
<entry>502104</entry>
<entry>February 25, 2004</entry>
<entry>5.2-CURRENT after getopt_long_only()
addition.</entry>
</row>
<row>
<entry>502105</entry>
<entry>March 5, 2004</entry>
<entry>5.2-CURRENT after NULL is made into ((void *)0)
for C, creating more warnings.</entry>
</row>
<row>
<entry>502106</entry>
<entry>March 8, 2004</entry>
<entry>5.2-CURRENT after pf is linked to the build and
install.</entry>
</row>
<row>
<entry>502107</entry>
<entry>March 10, 2004</entry>
<entry>5.2-CURRENT after time_t is changed to a
64-bit value on sparc64.</entry>
</row>
<row>
<entry>502108</entry>
<entry>March 12, 2004</entry>
<entry>5.2-CURRENT after Intel C/C++ compiler support in
some headers and execve(2) changes to be more strictly
conforming to POSIX.</entry>
</row>
<row>
<entry>502109</entry>
<entry>March 22, 2004</entry>
<entry>5.2-CURRENT after the introduction of the
bus_alloc_resource_any API</entry>
</row>
<row>
<entry>502110</entry>
<entry>March 27, 2004</entry>
<entry>5.2-CURRENT after the addition of UTF-8
locales</entry>
</row>
<row>
<entry>502111</entry>
<entry>April 11, 2004</entry>
<entry>5.2-CURRENT after the removal of the getvfsent(3)
API</entry>
</row>
<row>
<entry>502112</entry>
<entry>April 13, 2004</entry>
<entry>5.2-CURRENT after the addition of the .warning
directive for make.</entry>
</row>
<row>
<entry>502113</entry>
<entry>June 4, 2004</entry>
<entry>5.2-CURRENT after ttyioctl() was made mandatory
for serial drivers.</entry>
</row>
<row>
<entry>502114</entry>
<entry>June 13, 2004</entry>
<entry>5.2-CURRENT after import of the ALTQ
framework.</entry>
</row>
<row>
<entry>502115</entry>
<entry>June 14, 2004</entry>
<entry>5.2-CURRENT after changing sema_timedwait(9) to
return 0 on success and a non-zero error code on
failure.</entry>
</row>
<row>
<entry>502116</entry>
<entry>June 16, 2004</entry>
<entry>5.2-CURRENT after changing kernel dev_t to be
pointer to struct cdev *.</entry>
</row>
<row>
<entry>502117</entry>
<entry>June 17, 2004</entry>
<entry>5.2-CURRENT after changing kernel udev_t to
dev_t.</entry>
</row>
<row>
<entry>502118</entry>
<entry>June 17, 2004</entry>
<entry>5.2-CURRENT after adding support for
CLOCK_VIRTUAL and CLOCK_PROF to clock_gettime(2) and
clock_getres(2).</entry>
</row>
<row>
<entry>502119</entry>
<entry>June 22, 2004</entry>
<entry>5.2-CURRENT after changing network interface
cloning overhaul.</entry>
</row>
<row>
<entry>502120</entry>
<entry>July 2, 2004</entry>
<entry>5.2-CURRENT after the update of the package tools
to revision 20040629.</entry>
</row>
<row>
<entry>502121</entry>
<entry>July 9, 2004</entry>
<entry>5.2-CURRENT after marking Bluetooth code as
non-i386 specific.</entry>
</row>
<row>
<entry>502122</entry>
<entry>July 11, 2004</entry>
<entry>5.2-CURRENT after the introduction of the KDB
debugger framework, the conversion of DDB into a
backend and the introduction of the GDB
backend.</entry>
</row>
<row>
<entry>502123</entry>
<entry>July 12, 2004</entry>
<entry>5.2-CURRENT after change to make VFS_ROOT take a
struct thread argument as does vflush. Struct
kinfo_proc now has a user data pointer. The switch of
the default X implementation to
<literal>xorg</literal> was also made at this
time.</entry>
</row>
<row>
<entry>502124</entry>
<entry>July 24, 2004</entry>
<entry>5.2-CURRENT after the change to separate the way
ports rc.d and legacy scripts are started.</entry>
</row>
<row>
<entry>502125</entry>
<entry>July 28, 2004</entry>
<entry>5.2-CURRENT after the backout of the previous
change.</entry>
</row>
<row>
<entry>502126</entry>
<entry>July 31, 2004</entry>
<entry>5.2-CURRENT after the removal of
kmem_alloc_pageable() and the import of gcc
3.4.2.</entry>
</row>
<row>
<entry>502127</entry>
<entry>August 2, 2004</entry>
<entry>5.2-CURRENT after changing the UMA kernel
API to allow ctors/inits to fail.</entry>
</row>
<row>
<entry>502128</entry>
<entry>August 8, 2004</entry>
<entry>5.2-CURRENT after the change of the
vfs_mount signature as well as global replacement of
PRISON_ROOT with SUSER_ALLOWJAIL for the suser(9)
API.</entry>
</row>
<row>
<entry>503000</entry>
<entry>August 23, 2004</entry>
<entry>5.3-BETA/RC before the pfil API change</entry>
</row>
<row>
<entry>503001</entry>
<entry>September 22, 2004</entry>
<entry>5.3-RELEASE</entry>
</row>
<row>
<entry>503100</entry>
<entry>October 16, 2004</entry>
<entry>5.3-STABLE after branching for RELENG_5_3</entry>
</row>
<row>
<entry>503101</entry>
<entry>December 3, 2004</entry>
<entry>5.3-STABLE after addition of glibc style
&man.strftime.3; padding options.</entry>
</row>
<row>
<entry>503102</entry>
<entry>February 13, 2005</entry>
<entry>5.3-STABLE after OpenBSD's nc(1) import
MFC.</entry>
</row>
<row>
<entry>503103</entry>
<entry>February 27, 2005</entry>
<entry>5.4-PRERELEASE after the MFC of the fixes in
<filename><src/include/stdbool.h></filename> and
<filename><src/sys/i386/include/_types.h></filename>
for using the GCC-compatibility of the Intel C/C++
compiler.</entry>
</row>
<row>
<entry>503104</entry>
<entry>February 28, 2005</entry>
<entry>5.4-PRERELEASE after the MFC of the change of
ifi_epoch from wall clock time to uptime.</entry>
</row>
<row>
<entry>503105</entry>
<entry>March 2, 2005</entry>
<entry>5.4-PRERELEASE after the MFC of the fix of
EOVERFLOW check in vswprintf(3).</entry>
</row>
<row>
<entry>504000</entry>
<entry>April 3, 2005</entry>
<entry>5.4-RELEASE.</entry>
</row>
<row>
<entry>504100</entry>
<entry>April 3, 2005</entry>
<entry>5.4-STABLE after branching for RELENG_5_4</entry>
</row>
<row>
<entry>504101</entry>
<entry>May 11, 2005</entry>
<entry>5.4-STABLE after increasing the default
thread stacksizes</entry>
</row>
<row>
<entry>504102</entry>
<entry>June 24, 2005</entry>
<entry>5.4-STABLE after the addition of sha256</entry>
</row>
<row>
<entry>504103</entry>
<entry>October 3, 2005</entry>
<entry>5.4-STABLE after the MFC of if_bridge</entry>
</row>
<row>
<entry>504104</entry>
<entry>November 13, 2005</entry>
<entry>5.4-STABLE after the MFC of bsdiff and
portsnap</entry>
</row>
<row>
<entry>504105</entry>
<entry>January 17, 2006</entry>
<entry>5.4-STABLE after MFC of ldconfig_local_dirs
change.</entry>
</row>
<row>
<entry>505000</entry>
<entry>May 12, 2006</entry>
<entry>5.5-RELEASE.</entry>
</row>
<row>
<entry>505100</entry>
<entry>May 12, 2006</entry>
<entry>5.5-STABLE after branching for RELENG_5_5</entry>
</row>
<row>
<entry>600000</entry>
<entry>August 18, 2004</entry>
<entry>6.0-CURRENT</entry>
</row>
<row>
<entry>600001</entry>
<entry>August 27, 2004</entry>
<entry>6.0-CURRENT after permanently enabling PFIL_HOOKS
in the kernel.</entry>
</row>
<row>
<entry>600002</entry>
<entry>August 30, 2004</entry>
<entry>6.0-CURRENT after initial addition of
ifi_epoch to struct if_data. Backed out after a
few days. Do not use this value.</entry>
</row>
<row>
<entry>600003</entry>
<entry>September 8, 2004</entry>
<entry>6.0-CURRENT after the re-addition of the
ifi_epoch member of struct if_data.</entry>
</row>
<row>
<entry>600004</entry>
<entry>September 29, 2004</entry>
<entry>6.0-CURRENT after addition of the struct inpcb
argument to the pfil API.</entry>
</row>
<row>
<entry>600005</entry>
<entry>October 5, 2004</entry>
<entry>6.0-CURRENT after addition of the "-d
DESTDIR" argument to newsyslog.</entry>
</row>
<row>
<entry>600006</entry>
<entry>November 4, 2004</entry>
<entry>6.0-CURRENT after addition of glibc style
&man.strftime.3; padding options.</entry>
</row>
<row>
<entry>600007</entry>
<entry>December 12, 2004</entry>
<entry>6.0-CURRENT after addition of 802.11 framework
updates.</entry>
</row>
<row>
<entry>600008</entry>
<entry>January 25, 2005</entry>
<entry>6.0-CURRENT after changes to VOP_*VOBJECT()
functions and introduction of MNTK_MPSAFE flag for
Giantfree filesystems.</entry>
</row>
<row>
<entry>600009</entry>
<entry>February 4, 2005</entry>
<entry>6.0-CURRENT after addition of the cpufreq
framework and drivers.</entry>
</row>
<row>
<entry>600010</entry>
<entry>February 6, 2005</entry>
<entry>6.0-CURRENT after importing OpenBSD's
nc(1).</entry>
</row>
<row>
<entry>600011</entry>
<entry>February 12, 2005</entry>
<entry>6.0-CURRENT after removing semblance of SVID2
<literal>matherr()</literal> support.</entry>
</row>
<row>
<entry>600012</entry>
<entry>February 15, 2005</entry>
<entry>6.0-CURRENT after increase of default thread
stacks' size.</entry>
</row>
<row>
<entry>600013</entry>
<entry>February 19, 2005</entry>
<entry>6.0-CURRENT after fixes in
<filename><src/include/stdbool.h></filename> and
<filename><src/sys/i386/include/_types.h></filename>
for using the GCC-compatibility of the Intel C/C++
compiler.</entry>
</row>
<row>
<entry>600014</entry>
<entry>February 21, 2005</entry>
<entry>6.0-CURRENT after EOVERFLOW checks in
vswprintf(3) fixed.</entry>
</row>
<row>
<entry>600015</entry>
<entry>February 25, 2005</entry>
<entry>6.0-CURRENT after changing the struct if_data
member, ifi_epoch, from wall clock time to
uptime.</entry>
</row>
<row>
<entry>600016</entry>
<entry>February 26, 2005</entry>
<entry>6.0-CURRENT after LC_CTYPE disk format
changed.</entry>
</row>
<row>
<entry>600017</entry>
<entry>February 27, 2005</entry>
<entry>6.0-CURRENT after NLS catalogs disk format
changed.</entry>
</row>
<row>
<entry>600018</entry>
<entry>February 27, 2005</entry>
<entry>6.0-CURRENT after LC_COLLATE disk format
changed.</entry>
</row>
<row>
<entry>600019</entry>
<entry>February 28, 2005</entry>
<entry>Installation of acpica includes into
/usr/include.</entry>
</row>
<row>
<entry>600020</entry>
<entry>March 9, 2005</entry>
<entry>Addition of MSG_NOSIGNAL flag to send(2)
API.</entry>
</row>
<row>
<entry>600021</entry>
<entry>March 17, 2005</entry>
<entry>Addition of fields to cdevsw</entry>
</row>
<row>
<entry>600022</entry>
<entry>March 21, 2005</entry>
<entry>Removed gtar from base system.</entry>
</row>
<row>
<entry>600023</entry>
<entry>April 13, 2005</entry>
<entry>LOCAL_CREDS, LOCAL_CONNWAIT socket options added
to unix(4).</entry>
</row>
<row>
<entry>600024</entry>
<entry>April 19, 2005</entry>
<entry>&man.hwpmc.4; and related tools added to
6.0-CURRENT.</entry>
</row>
<row>
<entry>600025</entry>
<entry>April 26, 2005</entry>
<entry>struct icmphdr added to 6.0-CURRENT.</entry>
</row>
<row>
<entry>600026</entry>
<entry>May 3, 2005</entry>
<entry>pf updated to 3.7.</entry>
</row>
<row>
<entry>600027</entry>
<entry>May 6, 2005</entry>
<entry>Kernel libalias and ng_nat introduced.</entry>
</row>
<row>
<entry>600028</entry>
<entry>May 13, 2005</entry>
<entry>POSIX ttyname_r(3) made available through
unistd.h and libc.</entry>
</row>
<row>
<entry>600029</entry>
<entry>May 29, 2005</entry>
<entry>6.0-CURRENT after libpcap updated to v0.9.1 alpha
096.</entry>
</row>
<row>
<entry>600030</entry>
<entry>June 5, 2005</entry>
<entry>6.0-CURRENT after importing NetBSD's
if_bridge(4).</entry>
</row>
<row>
<entry>600031</entry>
<entry>June 10, 2005</entry>
<entry>6.0-CURRENT after struct ifnet was broken out
of the driver softcs.</entry>
</row>
<row>
<entry>600032</entry>
<entry>July 11, 2005</entry>
<entry>6.0-CURRENT after the import of libpcap
v0.9.1.</entry>
</row>
<row>
<entry>600033</entry>
<entry>July 25, 2005</entry>
<entry>6.0-STABLE after bump of all shared library
versions that had not been changed since
RELENG_5.</entry>
</row>
<row>
<entry>600034</entry>
<entry>August 13, 2005</entry>
<entry>6.0-STABLE after credential argument is added to
dev_clone event handler. 6.0-RELEASE.</entry>
</row>
<row>
<entry>600100</entry>
<entry>November 1, 2005</entry>
<entry>6.0-STABLE after 6.0-RELEASE</entry>
</row>
<row>
<entry>600101</entry>
<entry>December 21, 2005</entry>
<entry>6.0-STABLE after incorporating scripts from the
local_startup directories into the base
&man.rcorder.8;.</entry>
</row>
<row>
<entry>600102</entry>
<entry>December 30, 2005</entry>
<entry>6.0-STABLE after updating the ELF types and
constants.</entry>
</row>
<row>
<entry>600103</entry>
<entry>January 15, 2006</entry>
<entry>6.0-STABLE after MFC of pidfile(3) API.</entry>
</row>
<row>
<entry>600104</entry>
<entry>January 17, 2006</entry>
<entry>6.0-STABLE after MFC of ldconfig_local_dirs
change.</entry>
</row>
<row>
<entry>600105</entry>
<entry>February 26, 2006</entry>
<entry>6.0-STABLE after NLS catalog support of
csh(1).</entry>
</row>
<row>
<entry>601000</entry>
<entry>May 6, 2006</entry>
<entry>6.1-RELEASE</entry>
</row>
<row>
<entry>601100</entry>
<entry>May 6, 2006</entry>
<entry>6.1-STABLE after 6.1-RELEASE.</entry>
</row>
<row>
<entry>601101</entry>
<entry>June 22, 2006</entry>
<entry>6.1-STABLE after the import of csup.</entry>
</row>
<row>
<entry>601102</entry>
<entry>July 11, 2006</entry>
<entry>6.1-STABLE after the iwi(4) update.</entry>
</row>
<row>
<entry>601103</entry>
<entry>July 17, 2006</entry>
<entry>6.1-STABLE after the resolver update to
BIND9, and exposure of reentrant version of
netdb functions.</entry>
</row>
<row>
<entry>601104</entry>
<entry>August 8, 2006</entry>
<entry>6.1-STABLE after DSO (dynamic shared
objects) support has been enabled in
OpenSSL.</entry>
</row>
<row>
<entry>601105</entry>
<entry>September 2, 2006</entry>
<entry>6.1-STABLE after 802.11 fixups changed the
api for the IEEE80211_IOC_STA_INFO ioctl.</entry>
</row>
<row>
<entry>602000</entry>
<entry>November 15, 2006</entry>
<entry>6.2-RELEASE</entry>
</row>
<row>
<entry>602100</entry>
<entry>September 15, 2006</entry>
<entry>6.2-STABLE after 6.2-RELEASE.</entry>
</row>
<row>
<entry>602101</entry>
<entry>December 12, 2006</entry>
<entry>6.2-STABLE after the addition of Wi-Spy
quirk.</entry>
</row>
<row>
<entry>602102</entry>
<entry>December 28, 2006</entry>
<entry>6.2-STABLE after pci_find_extcap()
addition.</entry>
</row>
<row>
<entry>602103</entry>
<entry>January 16, 2007</entry>
<entry>6.2-STABLE after MFC of dlsym change to look for
a requested symbol both in specified dso and its
implicit dependencies.</entry>
</row>
<row>
<entry>602104</entry>
<entry>January 28, 2007</entry>
<entry>6.2-STABLE after MFC of ng_deflate(4) and
ng_pred1(4) netgraph nodes and new compression and
encryption modes for ng_ppp(4) node.</entry>
</row>
<row>
<entry>602105</entry>
<entry>February 20, 2007</entry>
<entry>6.2-STABLE after MFC of BSD licensed version of
&man.gzip.1; ported from NetBSD.</entry>
</row>
<row>
<entry>602106</entry>
<entry>March 31, 2007</entry>
<entry>6.2-STABLE after MFC of PCI MSI and MSI-X
support.</entry>
</row>
<row>
<entry>602107</entry>
<entry>April 6, 2007</entry>
<entry>6.2-STABLE after MFC of ncurses 5.6 and wide
character support.</entry>
</row>
<row>
<entry>602108</entry>
<entry>April 11, 2007</entry>
<entry>6.2-STABLE after MFC of CAM 'SG' peripheral
device, which implements a subset of Linux SCSI SG
passthrough device API.</entry>
</row>
<row>
<entry>602109</entry>
<entry>April 17, 2007</entry>
<entry>6.2-STABLE after MFC of readline 5.2 patchset
002.</entry>
</row>
<row>
<entry>602110</entry>
<entry>May 2, 2007</entry>
<entry>6.2-STABLE after MFC of pmap_invalidate_cache(),
pmap_change_attr(), pmap_mapbios(),
pmap_mapdev_attr(), and pmap_unmapbios() for amd64 and
i386.</entry>
</row>
<row>
<entry>602111</entry>
<entry>June 11, 2007</entry>
<entry>6.2-STABLE after MFC of BOP_BDFLUSH and caused
breakage of the filesystem modules KBI.</entry>
</row>
<row>
<entry>602112</entry>
<entry>September 21, 2007</entry>
<entry>6.2-STABLE after libutil(3) MFC's.</entry>
</row>
<row>
<entry>602113</entry>
<entry>October 25, 2007</entry>
<entry>6.2-STABLE after MFC of wide and single byte
ctype separation. Newly compiled binary that
references to ctype.h may require a new symbol,
__mb_sb_limit, which is not available on older
systems.</entry>
</row>
<row>
<entry>602114</entry>
<entry>October 30, 2007</entry>
<entry>6.2-STABLE after ctype ABI forward compatibility
restored.</entry>
</row>
<row>
<entry>602115</entry>
<entry>November 21, 2007</entry>
<entry>6.2-STABLE after back out of wide and single byte
ctype separation.</entry>
</row>
<row>
<entry>603000</entry>
<entry>November 25, 2007</entry>
<entry>6.3-RELEASE</entry>
</row>
<row>
<entry>603100</entry>
<entry>November 25, 2007</entry>
<entry>6.3-STABLE after 6.3-RELEASE.</entry>
</row>
<row>
<entry>603101</entry>
<entry>December 7, 2007</entry>
<entry>6.3-STABLE after fixing
multibyte type support in bit macro.</entry>
</row>
<row>
<entry>603102</entry>
<entry>April 24, 2008</entry>
<entry>6.3-STABLE after adding l_sysid to struct
flock.</entry>
</row>
<row>
<entry>603103</entry>
<entry>May 27, 2008</entry>
<entry>6.3-STABLE after MFC of the
<function>memrchr</function> function.</entry>
</row>
<row>
<entry>603104</entry>
<entry>June 15, 2008</entry>
<entry>6.3-STABLE after MFC of support for
<literal>:u</literal> variable modifier in
make(1).</entry>
</row>
<row>
<entry>604000</entry>
<entry>October 4, 2008</entry>
<entry>6.4-RELEASE</entry>
</row>
<row>
<entry>604100</entry>
<entry>October 4, 2008</entry>
<entry>6.4-STABLE after 6.4-RELEASE.</entry>
</row>
<row>
<entry>700000</entry>
<entry>July 11, 2005</entry>
<entry>7.0-CURRENT.</entry>
</row>
<row>
<entry>700001</entry>
<entry>July 23, 2005</entry>
<entry>7.0-CURRENT after bump of all shared library
versions that had not been changed since
RELENG_5.</entry>
</row>
<row>
<entry>700002</entry>
<entry>August 13, 2005</entry>
<entry>7.0-CURRENT after credential argument is added to
dev_clone event handler.</entry>
</row>
<row>
<entry>700003</entry>
<entry>August 25, 2005</entry>
<entry>7.0-CURRENT after memmem(3) is added to
libc.</entry>
</row>
<row>
<entry>700004</entry>
<entry>October 30, 2005</entry>
<entry>7.0-CURRENT after solisten(9) kernel arguments
are modified to accept a backlog parameter.</entry>
</row>
<row>
<entry>700005</entry>
<entry>November 11, 2005</entry>
<entry>7.0-CURRENT after IFP2ENADDR() was changed to
return a pointer to IF_LLADDR().</entry>
</row>
<row>
<entry>700006</entry>
<entry>November 11, 2005</entry>
<entry>7.0-CURRENT after addition of
<literal>if_addr</literal> member to <literal>struct
ifnet</literal> and IFP2ENADDR() removal.</entry>
</row>
<row>
<entry>700007</entry>
<entry>December 2, 2005</entry>
<entry>7.0-CURRENT after incorporating scripts from the
local_startup directories into the base
&man.rcorder.8;.</entry>
</row>
<row>
<entry>700008</entry>
<entry>December 5, 2005</entry>
<entry>7.0-CURRENT after removal of MNT_NODEV mount
option.</entry>
</row>
<row>
<entry>700009</entry>
<entry>December 19, 2005</entry>
<entry>7.0-CURRENT after ELF-64 type changes and symbol
versioning.</entry>
</row>
<row>
<entry>700010</entry>
<entry>December 20, 2005</entry>
<entry>7.0-CURRENT after addition of hostb and vgapci
drivers, addition of pci_find_extcap(), and changing
the AGP drivers to no longer map the aperture.</entry>
</row>
<row>
<entry>700011</entry>
<entry>December 31, 2005</entry>
<entry>7.0-CURRENT after tv_sec was made time_t on
all platforms but Alpha.</entry>
</row>
<row>
<entry>700012</entry>
<entry>January 8, 2006</entry>
<entry>7.0-CURRENT after ldconfig_local_dirs
change.</entry>
</row>
<row>
<entry>700013</entry>
<entry>January 12, 2006</entry>
<entry>7.0-CURRENT after changes to
<filename>/etc/rc.d/abi</filename> to support
<filename>/compat/linux/etc/ld.so.cache</filename>
being a symlink in a readonly filesystem.</entry>
</row>
<row>
<entry>700014</entry>
<entry>January 26, 2006</entry>
<entry>7.0-CURRENT after pts import.</entry>
</row>
<row>
<entry>700015</entry>
<entry>March 26, 2006</entry>
<entry>7.0-CURRENT after the introduction of version 2
of &man.hwpmc.4;'s ABI.</entry>
</row>
<row>
<entry>700016</entry>
<entry>April 22, 2006</entry>
<entry>7.0-CURRENT after addition of &man.fcloseall.3;
to libc.</entry>
</row>
<row>
<entry>700017</entry>
<entry>May 13, 2006</entry>
<entry>7.0-CURRENT after removal of ip6fw.</entry>
</row>
<row>
<entry>700018</entry>
<entry>July 15, 2006</entry>
<entry>7.0-CURRENT after import of snd_emu10kx.</entry>
</row>
<row>
<entry>700019</entry>
<entry>July 29, 2006</entry>
<entry>7.0-CURRENT after import of OpenSSL
0.9.8b.</entry>
</row>
<row>
<entry>700020</entry>
<entry>September 3, 2006</entry>
<entry>7.0-CURRENT after addition of bus_dma_get_tag
function</entry>
</row>
<row>
<entry>700021</entry>
<entry>September 4, 2006</entry>
<entry>7.0-CURRENT after libpcap 0.9.4 and tcpdump 3.9.4
import.</entry>
</row>
<row>
<entry>700022</entry>
<entry>September 9, 2006</entry>
<entry>7.0-CURRENT after dlsym change to look for a
requested symbol both in specified dso and its
implicit dependencies.</entry>
</row>
<row>
<entry>700023</entry>
<entry>September 23, 2006</entry>
<entry>7.0-CURRENT after adding new sound IOCTLs for the
OSSv4 mixer API.</entry>
</row>
<row>
<entry>700024</entry>
<entry>September 28, 2006</entry>
<entry>7.0-CURRENT after import of OpenSSL
0.9.8d.</entry>
</row>
<row>
<entry>700025</entry>
<entry>November 11, 2006</entry>
<entry>7.0-CURRENT after the addition of libelf.</entry>
</row>
<row>
<entry>700026</entry>
<entry>November 26, 2006</entry>
<entry>7.0-CURRENT after major changes on sound
sysctls.</entry>
</row>
<row>
<entry>700027</entry>
<entry>November 30, 2006</entry>
<entry>7.0-CURRENT after the addition of Wi-Spy
quirk.</entry>
</row>
<row>
<entry>700028</entry>
<entry>December 15, 2006</entry>
<entry>7.0-CURRENT after the addition of sctp calls to
libc</entry>
</row>
<row>
<entry>700029</entry>
<entry>January 26, 2007</entry>
<entry>7.0-CURRENT after the GNU &man.gzip.1;
implementation was replaced with a BSD licensed
version ported from NetBSD.</entry>
</row>
<row>
<entry>700030</entry>
<entry>February 7, 2007</entry>
<entry>7.0-CURRENT after the removal of IPIP tunnel
encapsulation (VIFF_TUNNEL) from the IPv4 multicast
forwarding code.</entry>
</row>
<row>
<entry>700031</entry>
<entry>February 23, 2007</entry>
<entry>7.0-CURRENT after the modification of
bus_setup_intr() (newbus).</entry>
</row>
<row>
<entry>700032</entry>
<entry>March 2, 2007</entry>
<entry>7.0-CURRENT after the inclusion of ipw(4) and
iwi(4) firmware.</entry>
</row>
<row>
<entry>700033</entry>
<entry>March 9, 2007</entry>
<entry>7.0-CURRENT after the inclusion of ncurses wide
character support.</entry>
</row>
<row>
<entry>700034</entry>
<entry>March 19, 2007</entry>
<entry>7.0-CURRENT after changes to how insmntque(),
getnewvnode(), and vfs_hash_insert() work.</entry>
</row>
<row>
<entry>700035</entry>
<entry>March 26, 2007</entry>
<entry>7.0-CURRENT after addition of a notify mechanism
for CPU frequency changes.</entry>
</row>
<row>
<entry>700036</entry>
<entry>April 6, 2007</entry>
<entry>7.0-CURRENT after import of the ZFS
filesystem.</entry>
</row>
<row>
<entry>700037</entry>
<entry>April 8, 2007</entry>
<entry>7.0-CURRENT after addition of CAM 'SG' peripheral
device, which implements a subset of Linux SCSI SG
passthrough device API.</entry>
</row>
<row>
<entry>700038</entry>
<entry>April 30, 2007</entry>
<entry>7.0-CURRENT after changing &man.getenv.3;,
&man.putenv.3;, &man.setenv.3; and &man.unsetenv.3; to
be POSIX conformant.</entry>
</row>
<row>
<entry>700039</entry>
<entry>May 1, 2007</entry>
<entry>7.0-CURRENT after the changes in 700038 were
backed out.</entry>
</row>
<row>
<entry>700040</entry>
<entry>May 10, 2007</entry>
<entry>7.0-CURRENT after the addition of &man.flopen.3;
to libutil.</entry>
</row>
<row>
<entry>700041</entry>
<entry>May 13, 2007</entry>
<entry>7.0-CURRENT after enabling symbol versioning, and
changing the default thread library to libthr.</entry>
</row>
<row>
<entry>700042</entry>
<entry>May 19, 2007</entry>
<entry>7.0-CURRENT after the import of gcc
4.2.0.</entry>
</row>
<row>
<entry>700043</entry>
<entry>May 21, 2007</entry>
<entry>7.0-CURRENT after bump of all shared library
versions that had not been changed since
RELENG_6.</entry>
</row>
<row>
<entry>700044</entry>
<entry>June 7, 2007</entry>
<entry>7.0-CURRENT after changing the argument for
vn_open()/VOP_OPEN() from file descriptor index to the
struct file *.</entry>
</row>
<row>
<entry>700045</entry>
<entry>June 10, 2007</entry>
<entry>7.0-CURRENT after changing &man.pam.nologin.8; to
provide an account management function instead of an
authentication function to the PAM framework.</entry>
</row>
<row>
<entry>700046</entry>
<entry>June 11, 2007</entry>
<entry>7.0-CURRENT after updated 802.11 wireless
support.</entry>
</row>
<row>
<entry>700047</entry>
<entry>June 11, 2007</entry>
<entry>7.0-CURRENT after adding TCP LRO interface
capabilities.</entry>
</row>
<row>
<entry>700048</entry>
<entry>June 12, 2007</entry>
<entry>7.0-CURRENT after
RFC 3678 API support added to the IPv4 stack.
Legacy RFC 1724 behavior of the IP_MULTICAST_IF
ioctl has now been removed; 0.0.0.0/8 may no longer
be used to specify an interface index.
struct ipmreqn should be used instead.</entry>
</row>
<row>
<entry>700049</entry>
<entry>July 3, 2007</entry>
<entry>7.0-CURRENT after importing pf from OpenBSD
4.1</entry>
</row>
<row>
<entry>(not changed)</entry>
<entry></entry>
<entry>7.0-CURRENT after adding IPv6 support for
FAST_IPSEC, deleting KAME IPSEC, and renaming
FAST_IPSEC to IPSEC.</entry>
</row>
<row>
<entry>700050</entry>
<entry>July 4, 2007</entry>
<entry>7.0-CURRENT after converting setenv/putenv/etc.
calls from traditional BSD to POSIX.</entry>
</row>
<row>
<entry>700051</entry>
<entry>July 4, 2007</entry>
<entry>7.0-CURRENT after adding new mmap/lseek/etc
syscalls.</entry>
</row>
<row>
<entry>700052</entry>
<entry>July 6, 2007</entry>
<entry>7.0-CURRENT after moving I4B headers to
include/i4b.</entry>
</row>
<row>
<entry>700053</entry>
<entry>September 30, 2007</entry>
<entry>7.0-CURRENT after the addition of support for
PCI domains</entry>
</row>
<row>
<entry>700054</entry>
<entry>October 25, 2007</entry>
<entry>7.0-CURRENT after MFC of wide and single byte
ctype separation.</entry>
</row>
<row>
<entry>700055</entry>
<entry>October 28, 2007</entry>
<entry>7.0-RELEASE, and 7.0-CURRENT after ABI backwards
compatibility to the FreeBSD 4/5/6 versions of the
PCIOCGETCONF, PCIOCREAD and PCIOCWRITE IOCTLs was
MFCed, which required the ABI of the PCIOCGETCONF
IOCTL to be broken again</entry>
</row>
<row>
<entry>700100</entry>
<entry>December 22, 2007</entry>
<entry>7.0-STABLE after 7.0-RELEASE</entry>
</row>
<row>
<entry>700101</entry>
<entry>February 8, 2008</entry>
<entry>7.0-STABLE after the MFC of m_collapse().</entry>
</row>
<row>
<entry>700102</entry>
<entry>March 30, 2008</entry>
<entry>7.0-STABLE after the MFC of
kdb_enter_why().</entry>
</row>
<row>
<entry>700103</entry>
<entry>April 10, 2008</entry>
<entry>7.0-STABLE after adding l_sysid to struct
flock.</entry>
</row>
<row>
<entry>700104</entry>
<entry>April 11, 2008</entry>
<entry>7.0-STABLE after the MFC of procstat(1).</entry>
</row>
<row>
<entry>700105</entry>
<entry>April 11, 2008</entry>
<entry>7.0-STABLE after the MFC of umtx
features.</entry>
</row>
<row>
<entry>700106</entry>
<entry>April 15, 2008</entry>
<entry>7.0-STABLE after the MFC of &man.write.2; support
to &man.psm.4;.</entry>
</row>
<row>
<entry>700107</entry>
<entry>April 20, 2008</entry>
<entry>7.0-STABLE after the MFC of F_DUP2FD command
to &man.fcntl.2;.</entry>
</row>
<row>
<entry>700108</entry>
<entry>May 5, 2008</entry>
<entry>7.0-STABLE after some &man.lockmgr.9; changes,
which makes it necessary to include
<filename>sys/lock.h</filename> in order to use
&man.lockmgr.9;.</entry>
</row>
<row>
<entry>700109</entry>
<entry>May 27, 2008</entry>
<entry>7.0-STABLE after MFC of the
<function>memrchr</function> function.</entry>
</row>
<row>
<entry>700110</entry>
<entry>August 5, 2008</entry>
<entry>7.0-STABLE after MFC of kernel NFS lockd
client.</entry>
</row>
<row>
<entry>700111</entry>
<entry>August 20, 2008</entry>
<entry>7.0-STABLE after addition of physically
contiguous jumbo frame support.</entry>
</row>
<row>
<entry>700112</entry>
<entry>August 27, 2008</entry>
<entry>7.0-STABLE after MFC of kernel DTrace
support.</entry>
</row>
<row>
<entry>701000</entry>
<entry>November 25, 2008</entry>
<entry>7.1-RELEASE</entry>
</row>
<row>
<entry>701100</entry>
<entry>November 25, 2008</entry>
<entry>7.1-STABLE after 7.1-RELEASE.</entry>
</row>
<row>
<entry>701101</entry>
<entry>January 10, 2009</entry>
<entry>7.1-STABLE after <function>strndup</function>
merge.</entry>
</row>
<row>
<entry>701102</entry>
<entry>January 17, 2009</entry>
<entry>7.1-STABLE after cpuctl(4) support
added.</entry>
</row>
<row>
<entry>701103</entry>
<entry>February 7, 2009</entry>
<entry>7.1-STABLE after the merge of
multi-/no-IPv4/v6 jails.</entry>
</row>
<row>
<entry>701104</entry>
<entry>February 14, 2009</entry>
<entry>7.1-STABLE after the store of the suspension
owner in the struct mount, and introduction of
vfs_susp_clean method into the struct vfsops.</entry>
</row>
<row>
<entry>701105</entry>
<entry>March 12, 2009</entry>
<entry>7.1-STABLE after the incompatible change
to the kern.ipc.shmsegs sysctl to allow to allocate
larger SysV shared memory segments on 64bit
architectures.</entry>
</row>
<row>
<entry>701106</entry>
<entry>March 14, 2009</entry>
<entry>7.1-STABLE after the merge of a fix for
POSIX semaphore wait operations.</entry>
</row>
<row>
<entry>702000</entry>
<entry>April 15, 2009</entry>
<entry>7.2-RELEASE</entry>
</row>
<row>
<entry>702100</entry>
<entry>April 15, 2009</entry>
<entry>7.2-STABLE after 7.2-RELEASE.</entry>
</row>
<row>
<entry>702101</entry>
<entry>May 15, 2009</entry>
<entry>7.2-STABLE after ichsmb(4) was changed to
use left-adjusted slave addressing to match other
SMBus controller drivers.</entry>
</row>
<row>
<entry>702102</entry>
<entry>May 28, 2009</entry>
<entry>7.2-STABLE after MFC of the
<function>fdopendir</function> function.</entry>
</row>
<row>
<entry>702103</entry>
<entry>June 06, 2009</entry>
<entry>7.2-STABLE after MFC of PmcTools.</entry>
</row>
<row>
<entry>702104</entry>
<entry>July 14, 2009</entry>
<entry>7.2-STABLE after MFC of the
<function>closefrom</function> system call.</entry>
</row>
<row>
<entry>702105</entry>
<entry>July 31, 2009</entry>
<entry>7.2-STABLE after MFC of the SYSVIPC ABI
change.</entry>
</row>
<row>
<entry>702106</entry>
<entry>September 14, 2009</entry>
<entry>7.2-STABLE after MFC of the x86 PAT
enhancements and addition of d_mmap_single() and
the scatter/gather list VM object type.</entry>
</row>
<row>
<entry>703000</entry>
<entry>February 9, 2010</entry>
<entry>7.3-RELEASE</entry>
</row>
<row>
<entry>703100</entry>
<entry>February 9, 2010</entry>
<entry>7.3-STABLE after 7.3-RELEASE.</entry>
</row>
<row>
<entry>704000</entry>
<entry>December 22, 2010</entry>
<entry>7.4-RELEASE</entry>
</row>
<row>
<entry>704100</entry>
<entry>December 22, 2010</entry>
<entry>7.4-STABLE after 7.4-RELEASE.</entry>
</row>
<row>
<entry>800000</entry>
<entry>October 11, 2007</entry>
<entry>8.0-CURRENT. Separating wide and single byte
ctype.</entry>
</row>
<row>
<entry>800001</entry>
<entry>October 16, 2007</entry>
<entry>8.0-CURRENT after libpcap 0.9.8 and tcpdump 3.9.8
import.</entry>
</row>
<row>
<entry>800002</entry>
<entry>October 21, 2007</entry>
<entry>8.0-CURRENT after renaming kthread_create()
and friends to kproc_create() etc.</entry>
</row>
<row>
<entry>800003</entry>
<entry>October 24, 2007</entry>
<entry>8.0-CURRENT after ABI backwards compatibility
to the FreeBSD 4/5/6 versions of the PCIOCGETCONF,
PCIOCREAD and PCIOCWRITE IOCTLs was added, which
required the ABI of the PCIOCGETCONF IOCTL to be
broken again</entry>
</row>
<row>
<entry>800004</entry>
<entry>November 12, 2007</entry>
<entry>8.0-CURRENT after agp(4) driver moved from
src/sys/pci to src/sys/dev/agp</entry>
</row>
<row>
<entry>800005</entry>
<entry>December 4, 2007</entry>
<entry>8.0-CURRENT after
<ulink
url="http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/kern_mbuf.c#rev1.35">changes
to the jumbo frame allocator</ulink>.</entry>
</row>
<row>
<entry>800006</entry>
<entry>December 7, 2007</entry>
<entry>8.0-CURRENT after the addition of callgraph
capture functionality to &man.hwpmc.4;.</entry>
</row>
<row>
<entry>800007</entry>
<entry>December 25, 2007</entry>
<entry>8.0-CURRENT after kdb_enter() gains a "why"
argument.</entry>
</row>
<row>
<entry>800008</entry>
<entry>December 28, 2007</entry>
<entry>8.0-CURRENT after LK_EXCLUPGRADE option
removal.</entry>
</row>
<row>
<entry>800009</entry>
<entry>January 9, 2008</entry>
<entry>8.0-CURRENT after introduction of
&man.lockmgr.disown.9;</entry>
</row>
<row>
<entry>800010</entry>
<entry>January 10, 2008</entry>
<entry>8.0-CURRENT after the &man.vn.lock.9; prototype
change.</entry>
</row>
<row>
<entry>800011</entry>
<entry>January 13, 2008</entry>
<entry>8.0-CURRENT after the &man.VOP.LOCK.9; and
&man.VOP.UNLOCK.9; prototype changes.</entry>
</row>
<row>
<entry>800012</entry>
<entry>January 19, 2008</entry>
<entry>8.0-CURRENT after introduction of
&man.lockmgr.recursed.9;, &man.BUF.RECURSED.9; and
&man.BUF.ISLOCKED.9; and the removal of
<function>BUF_REFCNT()</function>.</entry>
</row>
<row>
<entry>800013</entry>
<entry>January 23, 2008</entry>
<entry>8.0-CURRENT after introduction of the
<quote>ASCII</quote> encoding.</entry>
</row>
<row>
<entry>800014</entry>
<entry>January 24, 2008</entry>
<entry>8.0-CURRENT after changing the prototype of
&man.lockmgr.9; and removal of
<function>lockcount()</function> and
<function>LOCKMGR_ASSERT()</function>.</entry>
</row>
<row>
<entry>800015</entry>
<entry>January 26, 2008</entry>
<entry>8.0-CURRENT after extending the types
of the &man.fts.3; structures.</entry>
</row>
<row>
<entry>800016</entry>
<entry>February 1, 2008</entry>
<entry>8.0-CURRENT after adding an argument to
MEXTADD(9)</entry>
</row>
<row>
<entry>800017</entry>
<entry>February 6, 2008</entry>
<entry>8.0-CURRENT after the introduction of
LK_NODUP and LK_NOWITNESS options in the
&man.lockmgr.9; space.</entry>
</row>
<row>
<entry>800018</entry>
<entry>February 8, 2008</entry>
<entry>8.0-CURRENT after the addition of
m_collapse.</entry>
</row>
<row>
<entry>800019</entry>
<entry>February 9, 2008</entry>
<entry>8.0-CURRENT after the addition of current
working directory, root directory, and jail
directory support to the kern.proc.filedesc
sysctl.</entry>
</row>
<row>
<entry>800020</entry>
<entry>February 13, 2008</entry>
<entry>8.0-CURRENT after introduction of
&man.lockmgr.assert.9; and
<function>BUF_ASSERT</function> functions.</entry>
</row>
<row>
<entry>800021</entry>
<entry>February 15, 2008</entry>
<entry>8.0-CURRENT after introduction of
&man.lockmgr.args.9; and LK_INTERNAL flag
removal.</entry>
</row>
<row>
<entry>800022</entry>
<entry>(backed out)</entry>
<entry>8.0-CURRENT after changing the default system ar
to BSD &man.ar.1;.</entry>
</row>
<row>
<entry>800023</entry>
<entry>February 25, 2008</entry>
<entry>8.0-CURRENT after changing the prototypes of
&man.lockstatus.9; and &man.VOP.ISLOCKED.9;, more
specifically retiring the
<literal>struct thread</literal> argument.</entry>
</row>
<row>
<entry>800024</entry>
<entry>March 1, 2008</entry>
<entry>8.0-CURRENT after axing out the
<function>lockwaiters</function> and
<function>BUF_LOCKWAITERS</function> functions,
changing the return value of
<function>brelvp</function> from void to int and
introducing new flags for &man.lockinit.9;.</entry>
</row>
<row>
<entry>800025</entry>
<entry>March 8, 2008</entry>
<entry>8.0-CURRENT after adding F_DUP2FD command
to &man.fcntl.2;.</entry>
</row>
<row>
<entry>800026</entry>
<entry>March 12, 2008</entry>
<entry>8.0-CURRENT after changing the priority parameter
to cv_broadcastpri such that 0 means no
priority.</entry>
</row>
<row>
<entry>800027</entry>
<entry>March 24, 2008</entry>
<entry>8.0-CURRENT after changing the bpf monitoring ABI
when zerocopy bpf buffers were added.</entry>
</row>
<row>
<entry>800028</entry>
<entry>March 26, 2008</entry>
<entry>8.0-CURRENT after adding l_sysid to struct
flock.</entry>
</row>
<row>
<entry>800029</entry>
<entry>March 28, 2008</entry>
<entry>8.0-CURRENT after reintegration of the
<function>BUF_LOCKWAITERS</function> function and the
addition of &man.lockmgr.waiters.9;.</entry>
</row>
<row>
<entry>800030</entry>
<entry>April 1, 2008</entry>
<entry>8.0-CURRENT after the introduction of the
&man.rw.try.rlock.9; and &man.rw.try.wlock.9;
functions.</entry>
</row>
<row>
<entry>800031</entry>
<entry>April 6, 2008</entry>
<entry>8.0-CURRENT after the introduction of the
<function>lockmgr_rw</function> and
<function>lockmgr_args_rw</function>
functions.</entry>
</row>
<row>
<entry>800032</entry>
<entry>April 8, 2008</entry>
<entry>8.0-CURRENT after the implementation of the
openat and related syscalls, introduction of the
O_EXEC flag for the &man.open.2;, and providing the
corresponding linux compatibility syscalls.</entry>
</row>
<row>
<entry>800033</entry>
<entry>April 8, 2008</entry>
<entry>8.0-CURRENT after added &man.write.2; support for
&man.psm.4; in native operation level. Now arbitrary
commands can be written to
<devicename>/dev/psm%d</devicename> and status can be
read back from it.</entry>
</row>
<row>
<entry>800034</entry>
<entry>April 10, 2008</entry>
<entry>8.0-CURRENT after introduction of the
<function>memrchr</function> function.</entry>
</row>
<row>
<entry>800035</entry>
<entry>April 16, 2008</entry>
<entry>8.0-CURRENT after introduction of the
<function>fdopendir</function> function.</entry>
</row>
<row>
<entry>800036</entry>
<entry>April 20, 2008</entry>
<entry>8.0-CURRENT after switchover of 802.11 wireless
to multi-bss support (aka vaps).</entry>
</row>
<row>
<entry>800037</entry>
<entry>May 9, 2008</entry>
<entry>8.0-CURRENT after addition of multi routing
table support (aka setfib(1), setfib(2)).</entry>
</row>
<row>
<entry>800038</entry>
<entry>May 26, 2008</entry>
<entry>8.0-CURRENT after removal of netatm and
ISDN4BSD. Also, the addition of the
Compact C Type (CTF) tools.</entry>
</row>
<row>
<entry>800039</entry>
<entry>June 14, 2008</entry>
<entry>8.0-CURRENT after removal of sgtty.</entry>
</row>
<row>
<entry>800040</entry>
<entry>June 26, 2008</entry>
<entry>8.0-CURRENT with kernel NFS lockd client.</entry>
</row>
<row>
<entry>800041</entry>
<entry>July 22, 2008</entry>
<entry>8.0-CURRENT after addition of arc4random_buf(3)
and arc4random_uniform(3).</entry>
</row>
<row>
<entry>800042</entry>
<entry>August 8, 2008</entry>
<entry>8.0-CURRENT after addition of cpuctl(4).</entry>
</row>
<row>
<entry>800043</entry>
<entry>August 13, 2008</entry>
<entry>8.0-CURRENT after changing bpf(4) to use a
single device node, instead of device cloning.</entry>
</row>
<row>
<entry>800044</entry>
<entry>August 17, 2008</entry>
<entry>8.0-CURRENT after the commit of the first step of
the vimage project renaming global variables to be
virtualized with a V_ prefix with macros to map them
back to their global names.</entry>
</row>
<row>
<entry>800045</entry>
<entry>August 20, 2008</entry>
<entry>8.0-CURRENT after the integration of the
MPSAFE TTY layer, including changes to various
drivers and utilities that interact with it.</entry>
</row>
<row>
<entry>800046</entry>
<entry>September 8, 2008</entry>
<entry>8.0-CURRENT after the separation of the GDT
per CPU on amd64 architecture.</entry>
</row>
<row>
<entry>800047</entry>
<entry>September 10, 2008</entry>
<entry>8.0-CURRENT after removal of VSVTX, VSGID
and VSUID.</entry>
</row>
<row>
<entry>800048</entry>
<entry>September 16, 2008</entry>
<entry>8.0-CURRENT after converting the kernel NFS mount
code to accept individual mount options in the
nmount() iovec, not just one big
struct nfs_args.</entry>
</row>
<row>
<entry>800049</entry>
<entry>September 17, 2008</entry>
<entry>8.0-CURRENT after the removal of &man.suser.9;
and &man.suser.cred.9;.</entry>
</row>
<row>
<entry>800050</entry>
<entry>October 20, 2008</entry>
<entry>8.0-CURRENT after buffer cache API
change.</entry>
</row>
<row>
<entry>800051</entry>
<entry>October 23, 2008</entry>
<entry>8.0-CURRENT after the removal of the
&man.MALLOC.9; and &man.FREE.9; macros.</entry>
</row>
<row>
<entry>800052</entry>
<entry>October 28, 2008</entry>
<entry>8.0-CURRENT after the introduction of accmode_t
and renaming of VOP_ACCESS 'a_mode' argument
to 'a_accmode'.</entry>
</row>
<row>
<entry>800053</entry>
<entry>November 2, 2008</entry>
<entry>8.0-CURRENT after the prototype change of
&man.vfs.busy.9; and the introduction of its
MBF_NOWAIT and MBF_MNTLSTLOCK flags.</entry>
</row>
<row>
<entry>800054</entry>
<entry>November 22, 2008</entry>
<entry>8.0-CURRENT after the addition of buf_ring,
memory barriers and ifnet functions to facilitate
multiple hardware transmit queues for cards that
support them, and a lockless ring-buffer
implementation to enable drivers to more efficiently
manage queuing of packets.</entry>
</row>
<row>
<entry>800055</entry>
<entry>November 27, 2008</entry>
<entry>8.0-CURRENT after the addition of Intel™
Core, Core2, and Atom support to
&man.hwpmc.4;.</entry>
</row>
<row>
<entry>800056</entry>
<entry>November 29, 2008</entry>
<entry>8.0-CURRENT after the introduction of
multi-/no-IPv4/v6 jails.</entry>
</row>
<row>
<entry>800057</entry>
<entry>December 1, 2008</entry>
<entry>8.0-CURRENT after the switch to the
ath hal source code.</entry>
</row>
<row>
<entry>800058</entry>
<entry>December 12, 2008</entry>
<entry>8.0-CURRENT after the introduction of
the VOP_VPTOCNP operation.</entry>
</row>
<row>
<entry>800059</entry>
<entry>December 15, 2008</entry>
<entry>8.0-CURRENT incorporates the
new arp-v2 rewrite.</entry>
</row>
<row>
<entry>800060</entry>
<entry>December 19, 2008</entry>
<entry>8.0-CURRENT after the addition of makefs.</entry>
</row>
<row>
<entry>800061</entry>
<entry>January 15, 2009</entry>
<entry>8.0-CURRENT after TCP Appropriate Byte
Counting.</entry>
</row>
<row>
<entry>800062</entry>
<entry>January 28, 2009</entry>
<entry>8.0-CURRENT after removal of minor(),
minor2unit(), unit2minor(), etc.</entry>
</row>
<row>
<entry>800063</entry>
<entry>February 18, 2009</entry>
<entry>8.0-CURRENT after GENERIC config change to use
the USB2 stack, but also the addition of
fdevname(3).</entry>
</row>
<row>
<entry>800064</entry>
<entry>February 23, 2009</entry>
<entry>8.0-CURRENT after the USB2 stack is moved to and
replaces dev/usb.</entry>
</row>
<row>
<entry>800065</entry>
<entry>February 26, 2009</entry>
<entry>8.0-CURRENT after the renaming of all functions
in libmp(3).</entry>
</row>
<row>
<entry>800066</entry>
<entry>February 27, 2009</entry>
<entry>8.0-CURRENT after changing USB devfs handling and
layout.</entry>
</row>
<row>
<entry>800067</entry>
<entry>February 28, 2009</entry>
<entry>8.0-CURRENT after adding getdelim(), getline(),
stpncpy(), strnlen(), wcsnlen(), wcscasecmp(), and
wcsncasecmp().</entry>
</row>
<row>
<entry>800068</entry>
<entry>March 2, 2009</entry>
<entry>8.0-CURRENT after renaming the ushub devclass to
uhub.</entry>
</row>
<row>
<entry>800069</entry>
<entry>March 9, 2009</entry>
<entry>8.0-CURRENT after libusb20.so.1 was renamed to
libusb.so.1.</entry>
</row>
<row>
<entry>800070</entry>
<entry>March 9, 2009</entry>
<entry>8.0-CURRENT after merging IGMPv3 and
Source-Specific Multicast (SSM) to the IPv4
stack.</entry>
</row>
<row>
<entry>800071</entry>
<entry>March 14, 2009</entry>
<entry>8.0-CURRENT after gcc was patched to use C99
inline semantics in c99 and gnu99 mode.</entry>
</row>
<row>
<entry>800072</entry>
<entry>March 15, 2009</entry>
<entry>8.0-CURRENT after the IFF_NEEDSGIANT flag has
been removed; non-MPSAFE network device drivers are no
longer supported.</entry>
</row>
<row>
<entry>800073</entry>
<entry>March 18, 2009</entry>
<entry>8.0-CURRENT after the dynamic string token
substitution has been implemented for rpath and needed
paths.</entry>
</row>
<row>
<entry>800074</entry>
<entry>March 24, 2009</entry>
<entry>8.0-CURRENT after tcpdump 4.0.0 and
libpcap 1.0.0 import.</entry>
</row>
<row>
<entry>800075</entry>
<entry>April 6, 2009</entry>
<entry>8.0-CURRENT after layout of structs vnet_net,
vnet_inet and vnet_ipfw has been changed.</entry>
</row>
<row>
<entry>800076</entry>
<entry>April 9, 2009</entry>
<entry>8.0-CURRENT after adding delay profiles in
dummynet.</entry>
</row>
<row>
<entry>800077</entry>
<entry>April 14, 2009</entry>
<entry>8.0-CURRENT after removing VOP_LEASE() and
vop_vector.vop_lease.</entry>
</row>
<row>
<entry>800078</entry>
<entry>April 15, 2009</entry>
<entry>8.0-CURRENT after struct rt_weight fields have
been added to struct rt_metrics and struct
rt_metrics_lite, changing the layout of struct
rt_metrics_lite. A bump to RTM_VERSION was made, but
backed out.</entry>
</row>
<row>
<entry>800079</entry>
<entry>April 15, 2009</entry>
<entry>8.0-CURRENT after struct llentry pointers are
added to struct route and struct route_in6.</entry>
</row>
<row>
<entry>800080</entry>
<entry>April 15, 2009</entry>
<entry>8.0-CURRENT after layout of struct inpcb has been
changed.</entry>
</row>
<row>
<entry>800081</entry>
<entry>April 19, 2009</entry>
<entry>8.0-CURRENT after the layout of struct
malloc_type has been changed.</entry>
</row>
<row>
<entry>800082</entry>
<entry>April 21, 2009</entry>
<entry>8.0-CURRENT after the layout of struct ifnet has
changed, and with if_ref() and if_rele() ifnet
refcounting.</entry>
</row>
<row>
<entry>800083</entry>
<entry>April 22, 2009</entry>
<entry>8.0-CURRENT after the implementation of a
low-level Bluetooth HCI API.</entry>
</row>
<row>
<entry>800084</entry>
<entry>April 29, 2009</entry>
<entry>8.0-CURRENT after IPv6 SSM and MLDv2
changes.</entry>
</row>
<row>
<entry>800085</entry>
<entry>April 30, 2009</entry>
<entry>8.0-CURRENT after enabling support for
VIMAGE kernel builds with one active image.</entry>
</row>
<row>
<entry>800086</entry>
<entry>May 8, 2009</entry>
<entry>8.0-CURRENT after adding support for input lines
of arbitrarily length in patch(1).</entry>
</row>
<row>
<entry>800087</entry>
<entry>May 11, 2009</entry>
<entry>8.0-CURRENT after some VFS KPI changes. The
thread argument has been removed from the FSD parts of
the VFS. <function>VFS_*</function> functions do not
need the context any more because it always refers to
<varname>curthread</varname>. In some special cases,
the old behavior is retained.</entry>
</row>
<row>
<entry>800088</entry>
<entry>May 20, 2009</entry>
<entry>8.0-CURRENT after net80211 monitor mode
changes.</entry>
</row>
<row>
<entry>800089</entry>
<entry>May 23, 2009</entry>
<entry>8.0-CURRENT after adding UDP control block
support.</entry>
</row>
<row>
<entry>800090</entry>
<entry>May 23, 2009</entry>
<entry>8.0-CURRENT after virtualizing interface
cloning.</entry>
</row>
<row>
<entry>800091</entry>
<entry>May 27, 2009</entry>
<entry>8.0-CURRENT after adding hierarchical jails
and removing global securelevel.</entry>
</row>
<row>
<entry>800092</entry>
<entry>May 29, 2009</entry>
<entry>8.0-CURRENT after changing
<function>sx_init_flags()</function> KPI. The
<constant>SX_ADAPTIVESPIN</constant> is retired and a
new <constant>SX_NOADAPTIVE</constant> flag is
introduced in order to handle the reversed
logic.</entry>
</row>
<row>
<entry>800093</entry>
<entry>May 29, 2009</entry>
<entry>8.0-CURRENT after adding mnt_xflag to
struct mount.</entry>
</row>
<row>
<entry>800094</entry>
<entry>May 30, 2009</entry>
<entry>8.0-CURRENT after adding
&man.VOP.ACCESSX.9;.</entry>
</row>
<row>
<entry>800095</entry>
<entry>May 30, 2009</entry>
<entry>8.0-CURRENT after changing the polling KPI.
The polling handlers now return the number of packets
processed. A new
<constant>IFCAP_POLLING_NOCOUNT</constant> is also
introduced to specify that the return value is
not significant and the counting should be
skipped.</entry>
</row>
<row>
<entry>800096</entry>
<entry>June 1, 2009</entry>
<entry>8.0-CURRENT after updating to the new netisr
implementation and after changing the way we
store and access FIBs.</entry>
<!--
Had been 96 and 97 but were folded because we are
running out of numbers.
-->
</row>
<row>
<entry>800097</entry>
<entry>June 8, 2009</entry>
<entry>8.0-CURRENT after the introduction of vnet
destructor hooks and infrastructure.</entry>
</row>
<row>
<entry>800097</entry>
<entry>June 11, 2009</entry>
<entry>8.0-CURRENT after the introduction of netgraph
outbound to inbound path call detection and queuing,
which also changed the layout of struct
thread.</entry>
</row>
<row>
<entry>800098</entry>
<entry>June 14, 2009</entry>
<entry>8.0-CURRENT after OpenSSL 0.9.8k import.</entry>
</row>
<row>
<entry>800099</entry>
<entry>June 22, 2009</entry>
<entry>8.0-CURRENT after NGROUPS update and moving
route virtualization into its own VImage
module.</entry>
</row>
<row>
<entry>800100</entry>
<entry>June 24, 2009</entry>
<entry>8.0-CURRENT after SYSVIPC ABI change.</entry>
</row>
<row>
<entry>800101</entry>
<entry>June 29, 2009</entry>
<entry>8.0-CURRENT after the removal of the
/dev/net/* per-interface character
devices.</entry>
</row>
<row>
<entry>800102</entry>
<entry>July 12, 2009</entry>
<entry>8.0-CURRENT after padding was added to
struct sackhint, struct tcpcb, and struct
tcpstat.</entry>
</row>
<row>
<entry>800103</entry>
<entry>July 13, 2009</entry>
<entry>8.0-CURRENT after replacing struct tcpopt
with struct toeopt in the TOE driver interface
to the TCP syncache.</entry>
</row>
<row>
<entry>800104</entry>
<entry>July 14, 2009</entry>
<entry>8.0-CURRENT after the addition of the
linker-set based per-vnet allocator.</entry>
</row>
<row>
<entry>800105</entry>
<entry>July 19, 2009</entry>
<entry>8.0-CURRENT after version bump for all
shared libraries that do not have symbol versioning
turned on.</entry>
</row>
<row>
<entry>800106</entry>
<entry>July 24, 2009</entry>
<entry>8.0-CURRENT after introduction of OBJT_SG
VM object type.</entry>
</row>
<row>
<entry>800107</entry>
<entry>August 2, 2009</entry>
<entry>8.0-CURRENT after making the newbus subsystem
Giant free by adding the newbus sxlock and
8.0-RELEASE.</entry>
</row>
<row>
<entry>800108</entry>
<entry>November 21, 2009</entry>
<entry>8.0-STABLE after implementing EVFILT_USER kevent
filter.</entry>
</row>
<row>
<entry>800500</entry>
<entry>January 7, 2010</entry>
<entry>8.0-STABLE after
<literal>__FreeBSD_version</literal> bump to make
<command>pkg_add -r</command> use
packages-8-stable.</entry>
</row>
<row>
<entry>800501</entry>
<entry>January 24, 2010</entry>
<entry>8.0-STABLE after change of the
<function>scandir(3)</function> and
<function>alphasort(3)</function> prototypes to
conform to SUSv4.</entry>
</row>
<row>
<entry>800502</entry>
<entry>January 31, 2010</entry>
<entry>8.0-STABLE after addition of
<function>sigpause(3)</function>.</entry>
</row>
<row>
<entry>800503</entry>
<entry>February 25, 2010</entry>
<entry>8.0-STABLE after addition of SIOCGIFDESCR
and SIOCSIFDESCR ioctls to network interfaces. These
ioctl can be used to manipulate interface description,
as inspired by OpenBSD.</entry>
</row>
<row>
<entry>800504</entry>
<entry>March 1, 2010</entry>
<entry>8.0-STABLE after MFC of importing x86emu, a
software emulator for real mode x86 CPU from
OpenBSD.</entry>
</row>
<row>
<entry>800505</entry>
<entry>May 18, 2010</entry>
<entry>8.0-STABLE after MFC of adding liblzma, xz,
xzdec, and lzmainfo.</entry>
</row>
<row>
<entry>801000</entry>
<entry>June 14, 2010</entry>
<entry>8.1-RELEASE</entry>
</row>
<row>
<entry>801500</entry>
<entry>June 14, 2010</entry>
<entry>8.1-STABLE after 8.1-RELEASE.</entry>
</row>
<row>
<entry>801501</entry>
<entry>November 3, 2010</entry>
<entry>8.1-STABLE after KBI change in struct sysentvec,
and implementation of PL_FLAG_SCE/SCX/EXEC/SI and
pl_siginfo for ptrace(PT_LWPINFO) .</entry>
</row>
<row>
<entry>802000</entry>
<entry>December 22, 2010</entry>
<entry>8.2-RELEASE</entry>
</row>
<row>
<entry>802500</entry>
<entry>December 22, 2010</entry>
<entry>8.2-STABLE after 8.2-RELEASE.</entry>
</row>
<row>
<entry>802501</entry>
<entry>February 28, 2011</entry>
<entry>8.2-STABLE after merging DTrace changes,
including support for userland tracing.</entry>
</row>
<row>
<entry>802502</entry>
<entry>March 6, 2011</entry>
<entry>8.2-STABLE after merging log2 and log2f
into libm.</entry>
</row>
<row>
<entry>802503</entry>
<entry>May 1, 2011</entry>
<entry>8.2-STABLE after upgrade of the gcc to the last
GPLv2 version from the FSF gcc-4_2-branch.</entry>
</row>
<row>
<entry>802504</entry>
<entry>May 28, 2011</entry>
<entry>8.2-STABLE after introduction of the KPI and
supporting infrastructure for modular congestion
control.</entry>
</row>
<row>
<entry>802505</entry>
<entry>May 28, 2011</entry>
<entry>8.2-STABLE after introduction of Hhook and Khelp
KPIs.</entry>
</row>
<row>
<entry>802506</entry>
<entry>May 28, 2011</entry>
<entry>8.2-STABLE after addition of OSD to struct
tcpcb.</entry>
</row>
<row>
<entry>802507</entry>
<entry>June 6, 2011</entry>
<entry>8.2-STABLE after ZFS v28 import.</entry>
</row>
<row>
<entry>802508</entry>
<entry>June 8, 2011</entry>
<entry>8.2-STABLE after removal of the schedtail event
handler and addition of the sv_schedtail method to
struct sysvec.</entry>
</row>
<row>
<entry>802509</entry>
<entry>July 14, 2011</entry>
<entry>8.2-STABLE after merging the SSSE3 support
into binutils.</entry>
</row>
<row>
<entry>802510</entry>
<entry>July 19, 2011</entry>
<entry>8.2-STABLE after addition of
RFTSIGZMB flag for
<function>rfork(2)</function>.</entry>
</row>
<row>
<entry>802511</entry>
<entry>September 9, 2011</entry>
<entry>8.2-STABLE after addition of automatic detection
of USB mass storage devices which do not support the
no synchronize cache SCSI command.</entry>
</row>
<row>
<entry>802512</entry>
<entry>September 10, 2011</entry>
<entry>8.2-STABLE after merging of
re-factoring of auto-quirk.</entry>
</row>
<row>
<entry>802513</entry>
<entry>October 25, 2011</entry>
<entry>8.2-STABLE after merging of the MAP_PREFAULT_READ
flag to <function>mmap(2)</function>.</entry>
</row>
<row>
<entry>802514</entry>
<entry>November 16, 2011</entry>
<entry>8.2-STABLE after merging of
addition of posix_fallocate(2) syscall.</entry>
</row>
<row>
<entry>802515</entry>
<entry>January 6, 2012</entry>
<entry>8.2-STABLE after merging of addition of the
posix_fadvise(2) system call.</entry>
</row>
<row>
<entry>802516</entry>
<entry>January 16, 2012</entry>
<entry>8.2-STABLE after merging gperf 3.0.3</entry>
</row>
<row>
<entry>802517</entry>
<entry>February 15, 2012</entry>
<entry>8.2-STABLE after introduction of the new
extensible sysctl(3) interface NET_RT_IFLISTL
to query address lists (rev
<svnref>231769</svnref>.</entry>
</row>
<row>
<entry>803000</entry>
<entry>March 3, 2012</entry>
<entry>8.3-RELEASE.</entry>
</row>
<row>
<entry>803500</entry>
<entry>March 3, 2012</entry>
<entry>8.3-STABLE after branching releng/8.3
(RELENG_8_3).</entry>
</row>
<row>
<entry>900000</entry>
<entry>August 22, 2009</entry>
<entry>9.0-CURRENT.</entry>
</row>
<row>
<entry>900001</entry>
<entry>September 8, 2009</entry>
<entry>9.0-CURRENT after importing x86emu, a software
emulator for real mode x86 CPU from OpenBSD.</entry>
</row>
<row>
<entry>900002</entry>
<entry>September 23, 2009</entry>
<entry>9.0-CURRENT after implementing the EVFILT_USER
kevent filter functionality.</entry>
</row>
<row>
<entry>900003</entry>
<entry>December 2, 2009</entry>
<entry>9.0-CURRENT after addition of
<function>sigpause(3)</function> and PIE
support in csu.</entry>
</row>
<row>
<entry>900004</entry>
<entry>December 6, 2009</entry>
<entry>9.0-CURRENT after addition of libulog and its
libutempter compatibility interface.</entry>
</row>
<row>
<entry>900005</entry>
<entry>December 12, 2009</entry>
<entry>9.0-CURRENT after addition of
<function>sleepq_sleepcnt()</function>, which can be
used to query the number of waiters on a specific
waiting queue.</entry>
</row>
<row>
<entry>900006</entry>
<entry>January 4, 2010</entry>
<entry>9.0-CURRENT after change of the
<function>scandir(3)</function> and
<function>alphasort(3)</function> prototypes to
conform to SUSv4.</entry>
</row>
<row>
<entry>900007</entry>
<entry>January 13, 2010</entry>
<entry>9.0-CURRENT after the removal of utmp(5) and
the addition of utmpx (see
<function>getutxent(3)</function>) for improved
logging of user logins and system events.</entry>
</row>
<row>
<entry>900008</entry>
<entry>January 20, 2010</entry>
<entry>9.0-CURRENT after the import of BSDL bc/dc and
the deprecation of GNU bc/dc.</entry>
</row>
<row>
<entry>900009</entry>
<entry>January 26, 2010</entry>
<entry>9.0-CURRENT after the addition of SIOCGIFDESCR
and SIOCSIFDESCR ioctls to network interfaces. These
ioctl can be used to manipulate interface description,
as inspired by OpenBSD.</entry>
</row>
<row>
<entry>900010</entry>
<entry>March 22, 2010</entry>
<entry>9.0-CURRENT after the import of zlib
1.2.4.</entry>
</row>
<row>
<entry>900011</entry>
<entry>April 24, 2010</entry>
<entry>9.0-CURRENT after adding soft-updates
journalling.</entry>
</row>
<row>
<entry>900012</entry>
<entry>May 10, 2010</entry>
<entry>9.0-CURRENT after adding liblzma, xz, xzdec,
and lzmainfo.</entry>
</row>
<row>
<entry>900013</entry>
<entry>May 24, 2010</entry>
<entry>9.0-CURRENT after bringing in USB fixes for
linux(4).</entry>
</row>
<row>
<entry>900014</entry>
<entry>June 10, 2010</entry>
<entry>9.0-CURRENT after adding Clang.</entry>
</row>
<row>
<entry>900015</entry>
<entry>July 22, 2010</entry>
<entry>9.0-CURRENT after the import of BSD grep.</entry>
</row>
<row>
<entry>900016</entry>
<entry>July 28, 2010</entry>
<entry>9.0-CURRENT after adding mti_zone to
struct malloc_type_internal.</entry>
</row>
<row>
<entry>900017</entry>
<entry>August 23, 2010</entry>
<entry>9.0-CURRENT after changing back default grep to
GNU grep and adding WITH_BSD_GREP knob.</entry>
</row>
<row>
<entry>900018</entry>
<entry>August 24, 2010</entry>
<entry>9.0-CURRENT after the
<function>pthread_kill(3)</function> -generated signal
is identified as SI_LWP in si_code. Previously,
si_code was SI_USER.</entry>
</row>
<row>
<entry>900019</entry>
<entry>August 28, 2010</entry>
<entry>9.0-CURRENT after addition of the
MAP_PREFAULT_READ flag to
<function>mmap(2)</function>.</entry>
</row>
<row>
<entry>900020</entry>
<entry>September 9, 2010</entry>
<entry>9.0-CURRENT after adding drain functionality
to sbufs, which also changed the layout of
struct sbuf.</entry>
</row>
<row>
<entry>900021</entry>
<entry>September 13, 2010</entry>
<entry>9.0-CURRENT after DTrace has grown support
for userland tracing.</entry>
</row>
<row>
<entry>900022</entry>
<entry>October 2, 2010</entry>
<entry>9.0-CURRENT after addition of the BSDL man
utilities and retirement of GNU/GPL man
utilities.</entry>
</row>
<row>
<entry>900023</entry>
<entry>October 11, 2010</entry>
<entry>9.0-CURRENT after updating xz to git 20101010
snapshot.</entry>
</row>
<row>
<entry>900024</entry>
<entry>November 11, 2010</entry>
<entry>9.0-CURRENT after libgcc.a was replaced
by libcompiler_rt.a.</entry>
</row>
<row>
<entry>900025</entry>
<entry>November 12, 2010</entry>
<entry>9.0-CURRENT after the introduction of the
modularised congestion control.</entry>
</row>
<row>
<entry>900026</entry>
<entry>November 30, 2010</entry>
<entry>9.0-CURRENT after the introduction of Serial
Management Protocol (SMP) passthrough and the
XPT_SMP_IO and XPT_GDEV_ADVINFO CAM CCBs.</entry>
</row>
<row>
<entry>900027</entry>
<entry>December 5, 2010</entry>
<entry>9.0-CURRENT after the addition of log2 to
libm.</entry>
</row>
<row>
<entry>900028</entry>
<entry>December 21, 2010</entry>
<entry>9.0-CURRENT after the addition of the Hhook
(Helper Hook), Khelp (Kernel Helpers) and Object
Specific Data (OSD) KPIs.</entry>
</row>
<row>
<entry>900029</entry>
<entry>December 28, 2010</entry>
<entry>9.0-CURRENT after the modification of the TCP
stack to allow Khelp modules to interact with it via
helper hook points and store per-connection data in
the TCP control block.</entry>
</row>
<row>
<entry>900030</entry>
<entry>January 12, 2011</entry>
<entry>9.0-CURRENT after the update of libdialog to
version 20100428.</entry>
</row>
<row>
<entry>900031</entry>
<entry>February 7, 2011</entry>
<entry>9.0-CURRENT after the addition of
<function>pthread_getthreadid_np(3)</function>.</entry>
</row>
<row>
<entry>900032</entry>
<entry>February 8, 2011</entry>
<entry>9.0-CURRENT after the removal of the uio_yield
prototype and symbol.</entry>
</row>
<row>
<entry>900033</entry>
<entry>February 18, 2011</entry>
<entry>9.0-CURRENT after the update of binutils to
version 2.17.50.</entry>
</row>
<row>
<entry>900034</entry>
<entry>March 8, 2011</entry>
<entry>9.0-CURRENT after the struct sysvec
(sv_schedtail) changes.</entry>
</row>
<row>
<entry>900035</entry>
<entry>March 29, 2011</entry>
<entry>9.0-CURRENT after the update of base gcc and
libstdc++ to the last GPLv2 licensed revision.</entry>
</row>
<row>
<entry>900036</entry>
<entry>April 18, 2011</entry>
<entry>9.0-CURRENT after the removal of libobjc and
Objective-C support from the base system.</entry>
</row>
<row>
<entry>900037</entry>
<entry>May 13, 2011</entry>
<entry>9.0-CURRENT after importing the libprocstat(3)
library and fuser(1) utility to the base
system.</entry>
</row>
<row>
<entry>900038</entry>
<entry>May 22, 2011</entry>
<entry>9.0-CURRENT after adding a lock flag argument to
VFS_FHTOVP(9).</entry>
</row>
<row>
<entry>900039</entry>
<entry>June 28, 2011</entry>
<entry>9.0-CURRENT after importing pf from OpenBSD
4.5.</entry>
</row>
<row>
<entry>900040</entry>
<entry>July 19, 2011</entry>
<entry>Increase default MAXCPU for FreeBSD to 64 on
amd64 and ia64 and to 128 for XLP (mips).</entry>
</row>
<row>
<entry>900041</entry>
<entry>August 13, 2011</entry>
<entry>9.0-CURRENT after the implementation of Capsicum
capabilities; fget(9) gains a rights argument.</entry>
</row>
<row>
<entry>900042</entry>
<entry>August 28, 2011</entry>
<entry>Bump shared libraries' version numbers for
libraries whose ABI has changed in preparation for
9.0.</entry>
</row>
<row>
<entry>900043</entry>
<entry>September 2, 2011</entry>
<entry>Add automatic detection of USB mass storage
devices which do not support the no synchronize cache
SCSI command.</entry>
</row>
<row>
<entry>900044</entry>
<entry>September 10, 2011</entry>
<entry>Re-factor auto-quirk. 9.0-RELEASE.</entry>
</row>
<!-- Note: at one point 900045 was documented as follows, even though
it was never committed:
<row>
<entry>900045</entry>
<entry>Oct 13, 2011</entry>
<entry>All non-compatibility system call entry points
have been prefixed with sys_.</entry>
</row>
-->
<row>
<entry>900045</entry> <entry>January 2, 2012</entry>
<entry>9-CURRENT after MFC of true/false from
1000002.</entry>
</row>
<row>
<entry>900500</entry>
<entry>January 2, 2012</entry>
<entry>9.0-STABLE.</entry>
</row>
<row>
<entry>900501</entry>
<entry>January 6, 2012</entry>
<entry>9.0-STABLE after merging of addition of the
posix_fadvise(2) system call.</entry>
</row>
<row>
<entry>900502</entry>
<entry>January 16, 2012</entry>
<entry>9.0-STABLE after merging gperf 3.0.3</entry>
</row>
<row>
<entry>900503</entry>
<entry>February 15, 2012</entry>
<entry>9.0-STABLE after introduction of the new
extensible sysctl(3) interface NET_RT_IFLISTL
to query address lists (rev
<svnref>231768</svnref>).</entry>
</row>
<row>
<entry>900504</entry>
<entry>March 3, 2012</entry>
<entry>9.0-STABLE after changes related to mounting
of filesystem inside a jail (rev
<svnref>232728</svnref>).</entry>
</row>
<row>
<entry>900505</entry>
<entry>March 13, 2012</entry>
<entry>9.0-STABLE after introduction of new tcp(4)
socket options: TCP_KEEPINIT, TCP_KEEPIDLE,
TCP_KEEPINTVL, and TCP_KEEPCNT (rev
<svnref>232945</svnref>).</entry>
</row>
<row>
<entry>1000000</entry>
<entry>September 26, 2011</entry>
<entry>10.0-CURRENT.</entry>
</row>
<row>
<entry>1000001</entry>
<entry>November 4, 2011</entry>
<entry>10-CURRENT after addition of the posix_fadvise(2)
system call.</entry>
</row>
<row>
<entry>1000002</entry>
<entry>December 12, 2011</entry>
<entry>10-CURRENT after defining boolean true/false in
sys/types.h, sizeof(bool) may have changed (rev
<svnref>228444</svnref>). 10-CURRENT after xlocale.h
was introduced (rev
<svnref>227753</svnref>).</entry>
</row>
<row>
<entry>1000003</entry>
<entry>December 16, 2011</entry>
<entry>10-CURRENT after major changes to carp(4),
changing size of struct in_aliasreq,
struct in6_aliasreq (rev <svnref>228571</svnref>)
and straitening arguments check of SIOCAIFADDR (rev
<svnref>228574</svnref>).</entry>
</row>
<row>
<entry>1000004</entry>
<entry>January 1, 2012</entry>
<entry>10-CURRENT after the removal of skpc(9) and the
addition of memcchr(9) (rev
<svnref>229200</svnref>).</entry>
</row>
<row>
<entry>1000005</entry>
<entry>January 16, 2012</entry>
<entry>10-CURRENT after the removal of support for
SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR,
SIOCSIFDSTADDR ioctls (rev
<svnref>230207</svnref>).</entry>
</row>
<row>
<entry>1000006</entry>
<entry>January 26, 2012</entry>
<entry>10-CURRENT after introduction of read capacity
data asynchronous notification in the cam(4) layer
(rev <svnref>230590</svnref>).</entry>
</row>
<row>
<entry>1000007</entry>
<entry>February 5, 2012</entry>
<entry>10-CURRENT after introduction of new tcp(4)
socket options: TCP_KEEPINIT, TCP_KEEPIDLE,
TCP_KEEPINTVL, and TCP_KEEPCNT (rev
<svnref>231025</svnref>).</entry>
</row>
<row>
<entry>1000008</entry>
<entry>February 11, 2012</entry>
<entry>10-CURRENT after introduction of the new
extensible sysctl(3) interface NET_RT_IFLISTL
to query address lists (rev
<svnref>231505</svnref>).</entry>
</row>
<row>
<entry>1000009</entry>
<entry>February 25, 2012</entry>
<entry>10-CURRENT after import of libarchive 3.0.3
(rev <svnref>232153</svnref>).</entry>
</row>
<row>
<entry>1000010</entry>
<entry>March 31, 2012</entry>
<entry>10-CURRENT after xlocale cleanup (rev
<svnref>233757</svnref>).</entry>
</row>
<row>
<entry>1000011</entry>
<entry>April 16, 2012</entry>
<entry>10-CURRENT import of LLVM/Clang 3.1 trunk r154661
(rev <svnref>234353</svnref>).</entry>
</row>
<row>
<entry>1000012</entry>
<entry>May 2, 2012</entry>
<entry>10-CURRENT jemalloc import
(rev <svnref>234924</svnref>).</entry>
</row>
<row>
<entry>1000013</entry>
<entry>May 22, 2012</entry>
<entry>10-CURRENT after byacc import
(rev <svnref>235788</svnref>).</entry>
</row>
<row>
<entry>1000014</entry>
<entry>June 27, 2012</entry>
<entry>10-CURRENT after BSD sort becoming the default
sort (rev <svnref>237629</svnref>).</entry>
</row>
<row>
<entry>1000015</entry>
<entry>July 12, 2012</entry>
<entry>10-CURRENT after import of OpenSSL 1.0.1c
(rev <svnref>238405</svnref>).</entry>
</row>
<row>
<entry>(not changed)</entry>
<entry>July 13, 2012</entry>
<entry>10-CURRENT after the fix for LLVM/Clang 3.1
regression (rev <svnref>238429</svnref>).</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>Note that 2.2-STABLE sometimes identifies itself as
<quote>2.2.5-STABLE</quote> after the 2.2.5-RELEASE. The
pattern used to be year followed by the month, but we
decided to change it to a more straightforward major/minor
system starting from 2.2. This is because the parallel
development on several branches made it infeasible to
classify the releases simply by their real release dates.
If you are making a port now, you do not have to worry about
old -CURRENTs; they are listed here just for your
reference.</para>
</note>
</sect1>
<sect1 id="dads-after-port-mk">
<title>Writing Something After
<filename>bsd.port.mk</filename></title>
<para>Do not write anything after the <literal>.include
<bsd.port.mk></literal> line. It usually can be
avoided by including <filename>bsd.port.pre.mk</filename>
somewhere in the middle of your <filename>Makefile</filename>
and <filename>bsd.port.post.mk</filename> at the end.</para>
<note>
<para>Include either the
<filename>bsd.port.pre.mk</filename>/<filename>bsd.port.post.mk</filename>
pair or <filename>bsd.port.mk</filename> only; do not mix
these two usages.</para>
</note>
<para><filename>bsd.port.pre.mk</filename> only defines a few
variables, which can be used in tests in the
<filename>Makefile</filename>,
<filename>bsd.port.post.mk</filename> defines the rest.</para>
<para>Here are some important variables defined in
<filename>bsd.port.pre.mk</filename> (this is not the complete
list, please read <filename>bsd.port.mk</filename> for the
complete list).</para>
<informaltable frame="none" pgwide="0">
<tgroup cols="2">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><makevar>ARCH</makevar></entry>
<entry>The architecture as returned by <command>uname
-m</command> (e.g., <literal>i386</literal>)</entry>
</row>
<row>
<entry><makevar>OPSYS</makevar></entry>
<entry>The operating system type, as returned by
<command>uname -s</command> (e.g.,
<literal>FreeBSD</literal>)</entry>
</row>
<row>
<entry><makevar>OSREL</makevar></entry>
<entry>The release version of the operating system
(e.g., <literal>2.1.5</literal> or
<literal>2.2.7</literal>)</entry>
</row>
<row>
<entry><makevar>OSVERSION</makevar></entry>
<entry>The numeric version of the operating system; the
same as <link
linkend="freebsd-versions"><literal>__FreeBSD_version</literal></link>.</entry>
</row>
<row>
<entry><makevar>LOCALBASE</makevar></entry>
<entry>The base of the <quote>local</quote> tree (e.g.,
<literal>/usr/local/</literal>)</entry>
</row>
<row>
<entry><makevar>PREFIX</makevar></entry>
<entry>Where the port installs itself (see <link
linkend="porting-prefix">more on
<makevar>PREFIX</makevar></link>).</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<note>
<para>If you have to define the variables
<makevar>USE_IMAKE</makevar> or
<makevar>MASTERDIR</makevar>, do so before including
<filename>bsd.port.pre.mk</filename>.</para>
</note>
<para>Here are some examples of things you can write after
<filename>bsd.port.pre.mk</filename>:</para>
<programlisting># no need to compile lang/perl5 if perl5 is already in system
.if ${OSVERSION} > 300003
BROKEN= perl is in system
.endif
# only one shlib version number for ELF
.if ${PORTOBJFORMAT} == "elf"
TCL_LIB_FILE= ${TCL_LIB}.${SHLIB_MAJOR}
.else
TCL_LIB_FILE= ${TCL_LIB}.${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
# software already makes link for ELF, but not for a.out
post-install:
.if ${PORTOBJFORMAT} == "aout"
${LN} -sf liblinpack.so.1.0 ${PREFIX}/lib/liblinpack.so
.endif</programlisting>
<para>You did remember to use tab instead of spaces after
<literal>BROKEN=</literal> and
<literal>TCL_LIB_FILE=</literal>, did you not?
<!-- smiley -->:-).</para>
</sect1>
<sect1 id="dads-sh-exec">
<title>Use the <function>exec</function> Statement in Wrapper
Scripts</title>
<para>If the port installs a shell script whose purpose is to
launch another program, and if launching that program is the
last action performed by the script, make sure to launch the
program using the <function>exec</function> statement, for
instance:</para>
<programlisting>#!/bin/sh
exec %%LOCALBASE%%/bin/java -jar %%DATADIR%%/foo.jar "$@"</programlisting>
<para>The <function>exec</function> statement replaces the shell
process with the specified program. If
<function>exec</function> is omitted, the shell process
remains in memory while the program is executing, and
needlessly consumes system resources.</para>
</sect1>
<sect1 id="dads-rational">
<title>Do Things Rationally</title>
<para>The <filename>Makefile</filename> should do things simply
and reasonably. If you can make it a couple of lines shorter
or more readable, then do so. Examples include using a make
<literal>.if</literal> construct instead of a shell
<literal>if</literal> construct, not redefining
<maketarget>do-extract</maketarget> if you can redefine
<makevar>EXTRACT*</makevar> instead, and using
<makevar>GNU_CONFIGURE</makevar> instead of
<literal>CONFIGURE_ARGS
+= --prefix=${PREFIX}</literal>.</para>
<para>If you find yourself having to write a lot of new code to
try to do something, please go back and review
<filename>bsd.port.mk</filename> to see if it contains an
existing implementation of what you are trying to do. While
hard to read, there are a great many seemingly-hard problems
for which <filename>bsd.port.mk</filename> already provides a
shorthand solution.</para>
</sect1>
<sect1 id="dads-cc">
<title>Respect Both <makevar>CC</makevar> and
<makevar>CXX</makevar></title>
<para>The port must respect both <makevar>CC</makevar> and
<makevar>CXX</makevar> variables. What we mean by this is
that the port must not set the values of these variables
absolutely, overriding existing values; instead, it may
append whatever values it needs to the existing values. This
is so that build options that affect all ports can be set
globally.</para>
<para>If the port does not respect these variables,
please add <literal>NO_PACKAGE=ignores either cc or
cxx</literal> to the <filename>Makefile</filename>.</para>
<para>An example of a <filename>Makefile</filename> respecting
both <makevar>CC</makevar> and <makevar>CXX</makevar>
variables follows. Note the <makevar>?=</makevar>:</para>
<programlisting>CC?= gcc</programlisting>
<programlisting>CXX?= g++</programlisting>
<para>Here is an example which respects neither
<makevar>CC</makevar> nor <makevar>CXX</makevar>
variables:</para>
<programlisting>CC= gcc</programlisting>
<programlisting>CXX= g++</programlisting>
<para>Both <makevar>CC</makevar> and <makevar>CXX</makevar>
variables can be defined on FreeBSD systems in
<filename>/etc/make.conf</filename>. The first example
defines a value if it was not previously set in
<filename>/etc/make.conf</filename>, preserving any
system-wide definitions. The second example clobbers
anything previously defined.</para>
</sect1>
<sect1 id="dads-cflags">
<title>Respect <makevar>CFLAGS</makevar></title>
<para>The port must respect the <makevar>CFLAGS</makevar>
variable. What we mean by this is that the port must not
set the value of this variable absolutely, overriding the
existing value; instead, it may append whatever values it
needs to the existing value. This is so that build options
that affect all ports can be set globally.</para>
<para>If it does not, please add <literal>NO_PACKAGE=ignores
cflags</literal> to the
<filename>Makefile</filename>.</para>
<para>An example of a <filename>Makefile</filename> respecting
the <makevar>CFLAGS</makevar> variable follows. Note the
<makevar>+=</makevar>:</para>
<programlisting>CFLAGS+= -Wall -Werror</programlisting>
<para>Here is an example which does not respect the
<makevar>CFLAGS</makevar> variable:</para>
<programlisting>CFLAGS= -Wall -Werror</programlisting>
<para>The <makevar>CFLAGS</makevar> variable is defined on
FreeBSD systems in <filename>/etc/make.conf</filename>. The
first example appends additional flags to the
<makevar>CFLAGS</makevar> variable, preserving any system-wide
definitions. The second example clobbers anything previously
defined.</para>
<para>You should remove optimization flags from the third party
<filename>Makefile</filename>s. System
<makevar>CFLAGS</makevar> contains system-wide optimization
flags. An example from an unmodified
<filename>Makefile</filename>:</para>
<programlisting>CFLAGS= -O3 -funroll-loops -DHAVE_SOUND</programlisting>
<para>Using system optimization flags, the
<filename>Makefile</filename> would look similar to the
following example:</para>
<programlisting>CFLAGS+= -DHAVE_SOUND</programlisting>
</sect1>
<sect1 id="dads-pthread">
<title>Threading Libraries</title>
<para>The threading library must be linked to the binaries using
a special linker flag <literal>-pthread</literal> on &os;. If
a port insists on linking <literal>-lpthread</literal> or
<literal>-lc_r</literal> directly, patch it to use
<makevar>PTHREAD_LIBS</makevar> variable provided by the ports
framework. This variable usually has the value of
<literal>-pthread</literal>, but on certain architectures and
&os; versions it can have different values, so do not just
hardcode <literal>-pthread</literal> into patches and always
use <makevar>PTHREAD_LIBS</makevar>.</para>
<note>
<para>If building the port errors out with
<literal>unrecognized option '-pthread'</literal> when
setting <makevar>PTHREAD_LIBS</makevar>, it may be desirable
to use <command>gcc</command> as linker by setting
<makevar>CONFIGURE_ENV</makevar> to
<literal>LD=${CC}</literal>. The
<literal>-pthread</literal> option is not supported by
<command>ld</command> directly.</para>
</note>
</sect1>
<sect1 id="dads-freedback">
<title>Feedback</title>
<para>Do send applicable changes/patches to the original
author/maintainer for inclusion in next release of the code.
This will only make your job that much easier for the next
release.</para>
</sect1>
<sect1 id="dads-readme">
<title><filename>README.html</filename></title>
<para>Do not include the <filename>README.html</filename> file.
This file is not part of the SVN collection but is generated
using the <command>make readme</command> command.</para>
<note>
<para>If <command>make readme</command> fails, make sure that
the default value of <makevar>ECHO_MSG</makevar> has not
been modified by the port.</para>
</note>
</sect1>
<sect1 id="dads-noinstall">
<title>Marking a Port Not Installable with
<makevar>BROKEN</makevar>, <makevar>FORBIDDEN</makevar>, or
<makevar>IGNORE</makevar></title>
<para>In certain cases users should be prevented from installing
a port. To tell a user that a port should not be installed,
there are several <command>make</command> variables that can
be used in a port's <filename>Makefile</filename>. The value
of the following <command>make</command> variables will be the
reason that is given back to users for why the port refuses to
install itself. Please use the correct
<command>make</command> variable as each make variable conveys
radically different meanings to both users, and to automated
systems that depend on the <filename>Makefile</filename>s,
such as <link linkend="build-cluster">the ports build
cluster</link>, <link linkend="freshports">FreshPorts</link>,
and <link linkend="portsmon">portsmon</link>.</para>
<sect2 id="dads-noinstall-variables">
<title>Variables</title>
<itemizedlist>
<listitem>
<para><makevar>BROKEN</makevar> is reserved for ports that
currently do not compile, install, or deinstall
correctly. It should be used for ports where the
problem is believed to be temporary.</para>
<para>If instructed, the build cluster will still attempt
to try to build them to see if the underlying problem
has been resolved. (However, in general, the cluster is
run without this.)</para>
<para>For instance, use <makevar>BROKEN</makevar> when a
port:</para>
<itemizedlist>
<listitem>
<para>does not compile</para>
</listitem>
<listitem>
<para>fails its configuration or installation
process</para>
</listitem>
<listitem>
<para>installs files outside of
<filename>${LOCALBASE}</filename></para>
</listitem>
<listitem>
<para>does not remove all its files cleanly upon
deinstall (however, it may be acceptable, and
desirable, for the port to leave user-modified files
behind)</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para><makevar>FORBIDDEN</makevar> is used for ports that
contain a security vulnerability or induce grave concern
regarding the security of a FreeBSD system with a given
port installed (e.g., a reputably insecure program or a
program that provides easily exploitable services).
Ports should be marked as <makevar>FORBIDDEN</makevar>
as soon as a particular piece of software has a
vulnerability and there is no released upgrade. Ideally
ports should be upgraded as soon as possible when a
security vulnerability is discovered so as to reduce the
number of vulnerable FreeBSD hosts (we like being known
for being secure), however sometimes there is a
noticeable time gap between disclosure of a
vulnerability and an updated release of the vulnerable
software. Do not mark a port
<makevar>FORBIDDEN</makevar> for any reason other than
security.</para>
</listitem>
<listitem>
<para><makevar>IGNORE</makevar> is reserved for ports that
should not be built for some other reason. It should be
used for ports where the problem is believed to be
structural. The build cluster will not, under any
circumstances, build ports marked as
<makevar>IGNORE</makevar>. For instance, use
<makevar>IGNORE</makevar> when a port:</para>
<itemizedlist>
<listitem>
<para>compiles but does not run properly</para>
</listitem>
<listitem>
<para>does not work on the installed version of
&os;</para>
</listitem>
<listitem>
<para>requires &os; kernel sources to build, but the
user does not have them installed</para>
</listitem>
<listitem>
<para>has a distfile which may not be automatically
fetched due to licensing restrictions</para>
</listitem>
<listitem>
<para>does not work with some other currently
installed port (for instance, the port depends on
<filename role="package">www/apache20</filename> but
<filename role="package">www/apache22</filename> is
installed)</para>
</listitem>
</itemizedlist>
<note>
<para>If a port would conflict with a currently
installed port (for example, if they install a file in
the same place that performs a different function),
<link linkend="conflicts">use
<makevar>CONFLICTS</makevar> instead</link>.
<makevar>CONFLICTS</makevar> will set
<makevar>IGNORE</makevar> by itself.</para>
</note>
</listitem>
<listitem>
<para>If a port should be marked <makevar>IGNORE</makevar>
only on certain architectures, there are two other
convenience variables that will automatically set
<makevar>IGNORE</makevar> for you:
<makevar>ONLY_FOR_ARCHS</makevar> and
<makevar>NOT_FOR_ARCHS</makevar>. Examples:</para>
<programlisting>ONLY_FOR_ARCHS= i386 amd64</programlisting>
<programlisting>NOT_FOR_ARCHS= ia64 sparc64</programlisting>
<para>A custom <makevar>IGNORE</makevar> message can be
set using <makevar>ONLY_FOR_ARCHS_REASON</makevar> and
<makevar>NOT_FOR_ARCHS_REASON</makevar>. Per
architecture entries are possible with
<makevar>ONLY_FOR_ARCHS_REASON_<replaceable>ARCH</replaceable></makevar>
and
<makevar>NOT_FOR_ARCHS_REASON_<replaceable>ARCH</replaceable></makevar>.</para>
</listitem>
<listitem>
<para>If a port fetches i386 binaries and installs them,
<makevar>IA32_BINARY_PORT</makevar> should be set. If
this variable is set, it will be checked whether the
<filename>/usr/lib32</filename> directory is available
for IA32 versions of libraries and whether the kernel
has IA32 compatibility compiled in. If one of these two
dependencies is not satisfied, <makevar>IGNORE</makevar>
will be set automatically.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2 id="dads-noinstall-notes">
<title>Implementation Notes</title>
<para>The strings should not be quoted.
Also, the wording of the string should be somewhat
different due to the way the information is shown to the
user. Examples:</para>
<programlisting>BROKEN= this port is unsupported on FreeBSD 5.x</programlisting>
<programlisting>IGNORE= is unsupported on FreeBSD 5.x</programlisting>
<para>resulting in the following output from
<command>make describe</command>:</para>
<programlisting>===> foobar-0.1 is marked as broken: this port is unsupported on FreeBSD 5.x.</programlisting>
<programlisting>===> foobar-0.1 is unsupported on FreeBSD 5.x.</programlisting>
</sect2>
</sect1>
<sect1 id="dads-deprecated">
<title>Marking a Port for Removal with
<makevar>DEPRECATED</makevar> or
<makevar>EXPIRATION_DATE</makevar></title>
<para>Do remember that <makevar>BROKEN</makevar> and
<makevar>FORBIDDEN</makevar> are to be used as a temporary
resort if a port is not working. Permanently broken ports
should be removed from the tree entirely.</para>
<para>When it makes sense to do so, users can be warned about
a pending port removal with <makevar>DEPRECATED</makevar>
and <makevar>EXPIRATION_DATE</makevar>. The former is
simply a string stating why the port is scheduled for removal;
the latter is a string in ISO 8601 format (YYYY-MM-DD). Both
will be shown to the user.</para>
<para>It is possible to set <makevar>DEPRECATED</makevar>
without an <makevar>EXPIRATION_DATE</makevar> (for instance,
recommending a newer version of the port), but the converse
does not make any sense.</para>
<para>There is no set policy on how much notice to give.
Current practice seems to be one month for security-related
issues and two months for build issues. This also gives any
interested committers a little time to fix the
problems.</para>
</sect1>
<sect1 id="dads-dot-error">
<title>Avoid Use of the <literal>.error</literal>
Construct</title>
<para>The correct way for a <filename>Makefile</filename> to
signal that the port can not be installed due to some external
factor (for instance, the user has specified an illegal
combination of build options) is to set a non-blank value to
<makevar>IGNORE</makevar>. This value will be formatted and
shown to the user by <command>make install</command>.</para>
<para>It is a common mistake to use <literal>.error</literal>
for this purpose. The problem with this is that many
automated tools that work with the ports tree will fail in
this situation. The most common occurrence of this is seen
when trying to build <filename>/usr/ports/INDEX</filename>
(see <xref linkend="make-describe"/>). However, even more
trivial commands such as <command>make maintainer</command>
also fail in this scenario. This is not acceptable.</para>
<example id="dot-error-breaks-index">
<title>How to Avoid Using <literal>.error</literal></title>
<para>Assume that someone has the line</para>
<programlisting>USE_POINTYHAT=yes</programlisting>
<para>in <filename>make.conf</filename>. The first of the
next two <filename>Makefile</filename> snippets will cause
<command>make index</command> to fail, while the second one
will not:</para>
<programlisting>.if USE_POINTYHAT
.error "POINTYHAT is not supported"
.endif</programlisting>
<programlisting>.if USE_POINTYHAT
IGNORE= POINTYHAT is not supported
.endif</programlisting>
</example>
</sect1>
<sect1 id="dads-sysctl">
<title>Usage of <filename>sysctl</filename></title>
<para>The usage of <filename>sysctl</filename> is discouraged
except in targets. This is because the evaluation of any
<literal>makevar</literal>s, such as used during
<command>make index</command>, then has to run the command,
further slowing down that process.</para>
<para>Usage of &man.sysctl.8; should always be done with the
<makevar>SYSCTL</makevar> variable, as it contains the fully
qualified path and can be overridden, if one has such a
special need.</para>
</sect1>
<sect1 id="dads-rerolling-distfiles">
<title>Rerolling Distfiles</title>
<para>Sometimes the authors of software change the content of
released distfiles without changing the file's name. You have
to verify that the changes are official and have been
performed by the author. It has happened in the past that the
distfile was silently altered on the download servers with the
intent to cause harm or compromise end user security.</para>
<para>Put the old distfile aside, download the new one, unpack
them and compare the content with &man.diff.1;. If you see
nothing suspicious, you can update
<filename>distinfo</filename>. Be sure to summarize the
differences in your PR or commit log, so that other people
know that you have taken care to ensure that nothing bad has
happened.</para>
<para>You might also want to contact the authors of the software
and confirm the changes with them.</para>
</sect1>
<sect1 id="dads-avoiding-linuxisms">
<title>Avoiding Linuxisms</title>
<para>Do not use <filename>/proc</filename> if there are any
other ways of getting the information, e.g.,
<function>setprogname(argv[0])</function> in
<function>main()</function> and then &man.getprogname.3; if
you want to <quote>know your name</quote>.</para>
<para>Do not rely on behaviour that is undocumented by
<acronym>POSIX</acronym>.</para>
<para>Do not record timestamps in the critical path of the
application if it also works without. Getting timestamps may
be slow, depending on the accuracy of timestamps in the
<acronym>OS</acronym>. If timestamps are really needed,
determine how precise they have to be and use an
<acronym>API</acronym> which is documented to just deliver the
needed precision.</para>
<para>A number of simple syscalls (for example
&man.gettimeofday.2;, &man.getpid.2;) are much faster on
&linux; than on any other operating system due to caching and
the vsyscall performance optimizations. Do not rely on them
being cheap in performance-critical applications. In general,
try hard to avoid syscalls if possible.</para>
<para>Do not rely on &linux;-specific socket behaviour. In
particular, default socket buffer sizes are different (call
&man.setsockopt.2; with <literal>SO_SNDBUF</literal> and
<literal>SO_RCVBUF</literal>, and while &linux;'s &man.send.2;
blocks when the socket buffer is full, &os;'s will fail and
set <literal>ENOBUFS</literal> in errno.</para>
<para>If relying on non-standard behaviour is required,
encapsulate it properly into a generic <acronym>API</acronym>,
do a check for the behaviour in the configure stage, and stop
if it is missing.</para>
<para>Check the <ulink
url="http://www.freebsd.org/cgi/man.cgi">man pages</ulink>
to see if the function used is a <acronym>POSIX</acronym>
interface (in the <quote>STANDARDS</quote> section of the man
page).</para>
<para>Do not assume that <filename>/bin/sh</filename> is
<application>bash</application>. Ensure that a command line
passed to &man.system.3; will work with a
<acronym>POSIX</acronym> compliant shell.</para>
<para>A list of common <application>bash</application>isms is
available <ulink
url="https://wiki.ubuntu.com/DashAsBinSh">here</ulink>.</para>
<para>Do not <literal>#include
<filename><stdint.h></filename></literal> if
<filename>inttypes.h</filename> is sufficient. This will
ensure that the software builds on older versions of
&os;.</para>
<para>Check that headers are included in the
<acronym>POSIX</acronym> or man page recommended way, e.g.,
<filename>sys/types.h</filename> is often forgotten, which is
not as much of a problem for &linux; as it is for &os;.</para>
<para>Compile threaded applications with
<quote>-pthread</quote>, not <quote>-lpthread</quote> or
variations thereof.</para>
</sect1>
<sect1 id="dads-misc">
<title>Miscellanea</title>
<para>The files <filename>pkg-descr</filename> and
<filename>pkg-plist</filename> should each be double-checked.
If you are reviewing a port and feel they can be worded
better, do so.</para>
<para>Do not copy more copies of the GNU General Public License
into our system, please.</para>
<para>Please be careful to note any legal issues! Do not let us
illegally distribute software!</para>
</sect1>
</chapter>
<chapter id="porting-samplem">
<title>A Sample <filename>Makefile</filename></title>
<para>Here is a sample <filename>Makefile</filename> that you can
use to create a new port. Make sure you remove all the extra
comments (ones between brackets)!</para>
<para>It is recommended that you follow this format (ordering of
variables, empty lines between sections, etc.). This format is
designed so that the most important information is easy to
locate. We recommend that you use <link
linkend="porting-portlint">portlint</link> to check the
<filename>Makefile</filename>.</para>
<programlisting>[the header...just to make it easier for us to identify the ports.]
# $FreeBSD$
[ ^^^^^^^^^ This will be automatically replaced with RCS ID string by SVN
when it is committed to our repository. If upgrading a port, do not alter
this line back to "$FreeBSD$". SVN deals with it automatically.]
# Created by: Satoshi Asami <asami@FreeBSD.org>
[The optional <emphasis>Created by:</emphasis> line names the person who originally
created the port. If this line is present, future maintainers should
not change or remove it except at the original author's request.]
[section to describe the port itself and the master site - PORTNAME
and PORTVERSION are always first, followed by CATEGORIES,
and then MASTER_SITES, which can be followed by MASTER_SITE_SUBDIR.
PKGNAMEPREFIX and PKGNAMESUFFIX, if needed, will be after that.
Then comes DISTNAME, EXTRACT_SUFX and/or DISTFILES, and then
EXTRACT_ONLY, as necessary.]
PORTNAME= xdvi
PORTVERSION= 18.2
CATEGORIES= print
[do not forget the trailing slash ("/")!
if you are not using MASTER_SITE_* macros]
MASTER_SITES= ${MASTER_SITE_XCONTRIB}
MASTER_SITE_SUBDIR= applications
PKGNAMEPREFIX= ja-
DISTNAME= xdvi-pl18
[set this if the source is not in the standard ".tar.gz" form]
EXTRACT_SUFX= .tar.Z
[section for distributed patches -- can be empty]
PATCH_SITES= ftp://ftp.sra.co.jp/pub/X11/japanese/
PATCHFILES= xdvi-18.patch1.gz xdvi-18.patch2.gz
[maintainer; *mandatory*! This is the person who is volunteering to
handle port updates, build breakages, and to whom a users can direct
questions and bug reports. To keep the quality of the Ports Collection
as high as possible, we no longer accept new ports that are assigned to
"ports@FreeBSD.org".]
MAINTAINER= asami@FreeBSD.org
COMMENT= A DVI Previewer for the X Window System
[dependencies -- can be empty]
RUN_DEPENDS= gs:${PORTSDIR}/print/ghostscript
LIB_DEPENDS= Xpm:${PORTSDIR}/graphics/xpm
[this section is for other standard bsd.port.mk variables that do not
belong to any of the above]
[If it asks questions during configure, build, install...]
IS_INTERACTIVE= yes
[If it extracts to a directory other than ${DISTNAME}...]
WRKSRC= ${WRKDIR}/xdvi-new
[If the distributed patches were not made relative to ${WRKSRC}, you
may need to tweak this]
PATCH_DIST_STRIP= -p1
[If it requires a "configure" script generated by GNU autoconf to be run]
GNU_CONFIGURE= yes
[If it requires GNU make, not /usr/bin/make, to build...]
USE_GMAKE= yes
[If it is an X application and requires "xmkmf -a" to be run...]
USE_IMAKE= yes
[et cetera.]
[non-standard variables to be used in the rules below]
MY_FAVORITE_RESPONSE= "yeah, right"
[then the special rules, in the order they are called]
pre-fetch:
i go fetch something, yeah
post-patch:
i need to do something after patch, great
pre-install:
and then some more stuff before installing, wow
[and then the epilogue]
.include <bsd.port.mk></programlisting>
</chapter>
<chapter id="keeping-up">
<title>Keeping Up</title>
<para>The &os; Ports Collection is constantly changing. Here is
some information on how to keep up.</para>
<sect1 id="freshports">
<title>FreshPorts</title>
<para>One of the easiest ways to learn about updates that have
already been committed is by subscribing to <ulink
url="http://www.FreshPorts.org/">FreshPorts</ulink>. You
can select multiple ports to monitor. Maintainers are
strongly encouraged to subscribe, because they will receive
notification of not only their own changes, but also any
changes that any other &os; committer has made. (These are
often necessary to keep up with changes in the underlying
ports framework—although it would be most polite to
receive an advance heads-up from those committing such
changes, sometimes this is overlooked or just simply
impractical. Also, in some cases, the changes are very minor
in nature. We expect everyone to use their best judgement in
these cases.)</para>
<para>If you wish to use FreshPorts, all you need is an account.
If your registered email address is
<literal>@FreeBSD.org</literal>, you will see the opt-in link
on the right hand side of the webpages. For those of you who
already have a FreshPorts account, but are not using your
<literal>@FreeBSD.org</literal> email address, just change
your email to <literal>@FreeBSD.org</literal>, subscribe, then
change it back again.</para>
<para>FreshPorts also has a sanity test feature which
automatically tests each commit to the FreeBSD ports tree. If
subscribed to this service, you will be notified of any errors
which FreshPorts detects during sanity testing of your
commits.</para>
</sect1>
<sect1 id="svnweb">
<title>The Web Interface to the Source Repository</title>
<para>It is possible to browse the files in the source
repository by using a web interface. Changes that affect the
entire port system are now documented in the <ulink
url="http://svnweb.FreeBSD.org/ports/head/CHANGES">CHANGES</ulink>
file. Changes that affect individual ports
are now documented in the <ulink
url="http://svnweb.FreeBSD.org/ports/head/UPDATING">UPDATING</ulink>
file. However, the definitive answer to
any question is undoubtedly to read the source code of <ulink
url="http://svnweb.FreeBSD.org/ports/head/Mk/bsd.port.mk">bsd.port.mk</ulink>,
and associated files.</para>
</sect1>
<sect1 id="ports-mailling-list">
<title>The &os; Ports Mailing List</title>
<para>If you maintain ports, you should consider following the
&a.ports;. Important changes to the way ports work will be
announced there, and then committed to
<filename>CHANGES</filename>.</para>
</sect1>
<sect1 id="build-cluster">
<title>The &os; Port Building Cluster on
<hostid role="hostname">pointyhat.FreeBSD.org</hostid></title>
<para>One of the least-publicized strengths of &os; is that
an entire cluster of machines is dedicated to continually
building the Ports Collection, for each of the major OS
releases and for each Tier-1 architecture. You can find
the results of these builds at <ulink
url="http://pointyhat.FreeBSD.org/">package building logs
and errors</ulink>.</para>
<para>Individual ports are built unless they are specifically
marked with <makevar>IGNORE</makevar>. Ports that are
marked with <makevar>BROKEN</makevar> will still be attempted,
to see if the underlying problem has been resolved. (This
is done by passing <makevar>TRYBROKEN</makevar> to the
port's <filename>Makefile</filename>.)</para>
</sect1>
<sect1 id="distfile-survey">
<title>Portscout: the &os; Ports Distfile Scanner</title>
<para>The build cluster is dedicated to building the latest
release of each port with distfiles that have already been
fetched. However, as the Internet continually changes,
distfiles can quickly go missing. <ulink
url="http://portscout.org">Portscout</ulink>, the &os;
Ports distfile scanner, attempts to query every download site
for every port to find out if each distfile is still
available. <application>Portscout</application> can generate
<acronym>HTML</acronym> reports and send emails about newly
available ports to those who request them. Unless not
otherwise subscribed, maintainers are asked to check
periodically for changes, either by hand or using the
<acronym>RSS</acronym> feed.</para>
<para><application>Portscout</application>'s first page gives
the email address of the port maintainer, the number of ports
the maintainer is responsible for, the number of those ports
with new distfiles, and the percentage of those ports that are
out-of-date. The search function allows for searching by
email address for a specific maintainer, and for selecting
whether or not only out-of-date ports should be shown.</para>
<para>Upon clicking on a maintainer's email address,
a list of all of their ports is displayed, along with port
category, current version number, whether or not there is a
new version, when the port was last updated, and finally when
it was last checked. A search function on this page allows
the user to search for a specific port.</para>
<para>Clicking on a port name in the list displays the
<ulink url="http://freshports.org">FreshPorts</ulink> port
information.</para>
</sect1>
<sect1 id="portsmon">
<title>The &os; Ports Monitoring System</title>
<para>Another handy resource is the <ulink
url="http://portsmon.FreeBSD.org"> FreeBSD Ports Monitoring
System</ulink> (also known as <literal>portsmon</literal>).
This system comprises a database that processes information
from several sources and allows it to be browsed via a web
interface. Currently, the ports Problem Reports (PRs), the
error logs from the build cluster, and individual files from
the ports collection are used. In the future, this will be
expanded to include the distfile survey, as well as other
sources.</para>
<para>To get started, you can view all information about a
particular port by using the <ulink
url="http://portsmon.FreeBSD.org/portoverview.py">
Overview of One Port</ulink>.</para>
<para>As of this writing, this is the only resource available
that maps GNATS PR entries to portnames. (PR submitters do
not always include the portname in their Synopsis, although we
would prefer that they did.) So, <literal>portsmon</literal>
is a good place to start if you want to find out whether an
existing port has any PRs filed against it and/or any build
errors; or, to find out if a new port that you may be thinking
about creating has already been submitted.</para>
</sect1>
</chapter>
</book>
|