summaryrefslogtreecommitdiff
path: root/Master/tlpkg/libexec/ctan2tds
blob: 3b08ef40f84bcab97be81aceb8e7249f804d1576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
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
#!/usr/bin/env perl
# $Id$
# Public domain.
# Originally written by Sebastian Rahtz.  Comments to tex-live@tug.org.
# 
# A script to TL-install a package from CTAN.
# For a higher-level invocation, see ctan2tl.
# 
# Its default actions, given a "raw" directory copied from CTAN (the
# current directory on invocation), are
#  1. copy everything to texmf-dist/doc/<format>/<package>
#  2. run any .ins files
#  3. run any .mf files through mktextfm
#  4. move .sty/.cls etc files to texmf-dist/tex/<format>/<package>
#  5. move other files to appropriate places in the hierarchy.
#  
# All the patterns for what to move or run can be overridden per-package.

BEGIN {
  ($mydir = $0) =~ s,/[^/]*$,,;
  unshift (@INC, "$mydir/../libexec");
}

use Getopt::Long;
use File::Basename;
use Cwd;
use vars qw($opt_ctan_dir);

# programs used; must all be on the path
$MV = "mv -v";
$CP = "cp -pv";
$RM = "rm -vf";  # just to get feedback from GNU rm on removals
$MAKEINFO = "makeinfo";
$INSTALL = "install -D -m 664";

$| = 1;
select ((select (STDERR), $| = 1)[0]);

$RAW_DIR = getcwd();     # where we start from (raw dir)
chdir "../tmp.cooked" || die "chdir(../tmp.cooked) failed: $!";
$COOKED_TOP = getcwd();  # output (cooked) directory paren
chdir $RAW_DIR || die "chdir($RAW_DIR) failed: $!";  # back to raw

# the real Master and Build tree.
chomp ($Master = `cd $mydir/../.. && pwd`);
chomp ($Build = `cd $Master/../Build/source && pwd`);


# 
# packages to treat entirely on their own, or not at all.
# the code here is evaluated by Perl, so special packages
# can have their own subroutine.
#
%special = (
 'AkkTeX',      "die 'skipping, use akktex'",
 'ANUfinalexam',"die 'skipping, use anufinalexam'",
 'Catalogue',   "die 'skipping, goes stale too soon'",
 'CJK',         "die 'skipping, use cjk'",
 'Einfuehrung', "die 'skipping, use einfuehrung (lowercase)'",
 'FiXme',       "die 'skipping, use fixme'",
 'GuIT',        "die 'skipping, use guitlogo'",
 'HA-prosper',  '&MAKEhaprosper',
 'IEEEtran',    "&MAKEIEEEtran",
 'LingTrees',   "die 'skipping, requires python'",
 'SIstyle',     '&MAKEflatten',
 'SQLTeX',      "die 'skipping, see sqltex'",
 'TeXemplar',   "die 'skipping, use texemplar'",
 'TeXmacs',     "die 'skipping, binary'",
 'TOPtesi',     "die 'skipping, use toptesi'",
 'a4',          "die 'skipping, just a pointer to ntgclass'",
 'aastex',      "&MAKEflatten",
 'accenti',     "die 'skipping, use bosisio instead'",
 'acmtrans',    "die 'skipping, nonfree (nosell) license'",
 'acromake',    "die 'skipping, nonfree (nomodify) license'",
 'acroflex',    "die 'skipping, per author (dps) request'",
 'acrotex',     "die 'skipping, per author (dps) request'",
 'adforn',      "&MAKEcopy",
 'adfsymbols',  "&MAKEcopy",
 'adobe-euro',  "die 'skipping, support for nonfree fonts'",
 'adobecaslon', "die 'skipping, support for nonfree fonts'",
 'adrlist',     "die 'skipping, noinfo license'",
 'ae',          "&MAKEae",
 'aeb_mlink',   "die 'skipping, per author (dps) request'",
 'aeb_mobile',  "die 'skipping, per author (dps) request'",
 'aeb_pro',     "die 'skipping, per author (dps) request'",
 'aeb_tilebg',  "die 'skipping, per author (dps) request'",
 'aecc',        "&MAKEflatten",
 'akktex',      "&MAKEflatten",
 'alatex',      "die 'skipping, 1995 LaTeX generalization'",
 'algorithm2e', "&MAKEflatten",
 'algorithmicx',"&MAKEnosymlinks",
 'alkalami',    "&MAKEflatten",
 'allrunes',    "&MAKEflatten",
 'almfixed',	"&MAKEflatten",
 'alterqcm',    "&MAKEaqcm",
 'alphabib',    "die 'skipping, shell script, and no doc source?'",
 'ams',         "die 'skipping, use amscls for ams*.bst'",
 'ams-cd',      "die 'skipping, latex 2.09 and never in tl'",
 'amslatex',    "die 'skipping, use ams subpackages (see tlpkginfo)'",
 'amsldoc-vn',  "&MAKEflatten",
# 'amsmath',    "die 'skipping until ams fixes missing amstex.sty, per bb'",
 'amstex',      "&MAKEflatten",
 'analogclock', "die 'skipping, requires system font installation",
 'annot_pro',   "die 'skipping, per author (dps) request'",
 'anonymouspro',"&MAKEflatten",
 'ans',         "die 'skipping, LaTeX 2.09'",
 'ant-worker-tasks',    "die 'skipping, Java'",
 'antomega',    "die 'skipping, not ready'", #"&MAKEflatten",
 'antp',        "die 'skipping, use poltawski'",
 'antt',        "&MAKEcopy",
 'apacite',     "&MAKEflatten",
 'apalike',     "die 'skipping, merged into bibtex'",
 'apl',         "die 'skipping, noinfo license'",
 'ar',          "die 'skipping, use aspectratio'",
 'arabi',       "&MAKEarabi",
 'arabtex',     "&MAKEarabtex",
 'aramaic',     "die 'skipping, use archaic'",
 'aramaic-serto',       "&MAKEflatten",
 'arbeit',      "die 'skipping, latex 2.09 and never in tl'",
 'archaic',     "&MAKEwilson",
 'arev',        "&MAKEcopy",
 'arial',       "die 'skipping, nonfree Aladdin license'",
 'armenian',    "&MAKEcopy",
 'armtex',      "die 'skipping, use armenian'",
 'arphic',      "&MAKEarphic",
 'arrayjob',    "die 'skipping, use arrayjobx'",
 'artthreads',	"die 'skipping, per author (dps) request'",
 'asana-math',  "die 'skipping, use Asana-Math'",
 'ascii',       "die 'skipping, use ascii-font'",
 'ascii-font',  "&MAKEflatten",
 'astron',      "die 'skipping, nonfree license'",
 'atqolive',    "die 'skipping, nonfree font'",
 'auctex',      "die 'skipping, as it is Emacs'",
 'augie',       "&MAKEaugie",
 'aurical',     "&MAKEaurical",
 'aurora',      "die 'skipping, nocommercial license'",
 'auto-pst-pdf-lua', "&MAKEflatten",
 'auto1',       "die 'skipping, nonfree font support'",
 'autolatex',   "die 'skipping, not self-locating'",
 'autotab',     "die 'skipping, noinfo license, latex 2.09'",
 'babel-frenchb',  "die 'skipping, use babel-french'",
 'babel-serbianc', "&MAKEflatten",
 'babel-slovene',  "die 'skipping, use babel-slovenian'",
 'babeltools',  "die 'skipping, use bezos'",
 'babyloniannum', "die 'skipping, requires nonfree fonts'",
 'backgammon',  "die 'skipping, nonfree license'",
 'bangtex',     "&MAKEflatten",
 'bardi',       "die 'skipping, nonfree license'",
 'bardiag',     "&MAKEbardiag",
 'base',        "die 'skipping, what package did you really mean?'",
 'baskervald',  "&MAKEcopy",
 'basque',      "die 'skipping, use babel-basque'",
 'bbm-macros',  "&MAKEnosymlinks",
 'bclogo',      "&MAKEflatten",
 'beamer2thesis',       "&MAKEflatten",
 'beamer-contrib',      "die 'skipping, use subdirs'",
 'beamertheme-metropolis',	"&MAKEflatten",
 'beamertheme-upenn-bc',	"&MAKEflatten",
 'beebe',               "die 'skipping, MAKEbeebe needs work, sorry'",
 'belleek',             "die 'skipping, need to fix my*.fdd, sorry'",
 'bengali',             "&MAKEflatten",
 'bengali-omega',       "die 'skipping, duplicates odev.sty et al.'",
 'bera',        "&MAKEunzipandflatten",
 'berenisadf',  "&MAKEflatten",
 'beuron',	"&MAKEflatten",
 'bg',          "die 'skipping, nonfree license'",
 'bgreek',      "&MAKEcopy",
 'bgteubner',   "&MAKEflatten",
 'bib2ml',      "die 'skipping, no self-locate?, etc.'",
 'bib2xhtml',   "die 'skipping, requires PDF::API2'",
 'biber',       "&MAKEflatten",
 'bibextract',  "die 'skipping, hardwires nawk cmd name'",
 'bibfilex',	"die 'skipping, compiled'",
 'biblatex-abnt',       "&MAKEflatten",
 'biblatex-chicago',    "&MAKEflatten",
 'biblatex-contrib',    "die 'skipping, use subdir'",
 'biblatex-fiwi',       "&MAKEflatten",
 'biblatex-gost',       "&MAKEflatten",
 'biblatex-musuos',     "&MAKEflatten",
 'biblio',      "die 'skipping, too big, use beebe'",
 'bibtool',     "die 'skipping, requires compilation'",
 'bibtools',    "die 'skipping, ca.2000, await request",
 'bibtopicprefix', "&MAKEflatten",
 'bickham',     "die 'skipping, support for nonfree font'",
 'bigints',     "&MAKEflatten",
 'bin-cjkutils',"&MAKEbin_cjkutils",
 'biolinum-type1',      "die 'skipping, replaced by libertine'",
 'bitfield',    "die 'skipping, obsolete on CTAN'",
 'blanks',      "die 'skipping, unknown license (and c.1992)'",
 'blockdraw_mp',"&MAKEflatten",
 'blu',         "die 'skipping, too old'",
 'bnf-plain',   "die 'skipping, unknown license (and c.1992)'",
 'bookhands',   "&MAKEwilson",
 'booktabs-fr', "&MAKEnosymlinks",
 'boondox',     "&MAKEcopy",
 'borceux',     "&MAKEborceux",
 'bridge',      "die 'skipping, latex 2.09'",
 'bsheaders',   "die 'skipping, license unstated, ca.2005, await request'",
 'burmese',     "&MAKEflatten",
 'business-research',   "die 'skipping, w32 fonts required'",
 'byzantinemusic',	"die 'skipping, includes non-relocating jar'",
 'c90',         "&MAKEc90",
 'cachepic',    "&MAKEcopy",
 'calxxxx',     "die 'skipping, nomodify license'",
 'calendar',    "die 'skipping, nosell license'",
 'calendar_barr',       "die 'skipping, ca.2001, noinfo license'",
 'cantarell',   "&MAKEcopy",
 'cascover',    "die 'skipping, license unclear, ancient'",
 'camel',       "die 'skipping, nosell license'",
 'cassette',    "die 'skipping, nonfree license'",
 'cassette-shipunov',   "die 'skipping, use shipunov'",
 'cassette209', "die 'skipping, latex 2.09'",
 'casslbl',     "die 'skipping, license unclear, ancient'",
 'catalogue',   "die 'skipping, goes stale too soon'",
 'catdvi',      "die 'skipping, compilation'",
 'catchfile',   "die 'skipping, part of oberdiek'",
 'catoptions',  "&MAKEflatten",
 'cbfonts',     "&MAKEflatten",
 'cc-pl',       "&MAKEflatten",
 'cchess',      "die 'skipping, noinfo license, old'",
 'cdcover',     "die 'skipping, use cd-cover'",
 'cellular',    "die 'skipping, noinfo license, author deceased'",
 'cellwise',    "die 'skipping, noinfo license'",
 'changebar',   "&MAKEchangebar",
 'chapterbib',  "die 'skipping, update cite instead'",
 'check-parens',"die 'skipping, C++'",
 'chemarrow',   "&MAKEflatten", # check about Arrow.vfb
 'chemstruct',  "die 'skipping, old latex 2.09, never in tl'",
 'chemsym',     "die 'skipping, nonfree'",
 'cheq',        "die 'skipping, nosell license'",
 'chess',       "&MAKEflatten",
 'chet',        "&MAKEflatten",
 'china2e',     "die 'skipping, nosell license and/or too complicated'",
 'chitex',      "die 'skipping, nonfree'",
 'chivo',	"&MAKEflatten",
 'chklref',     "die 'skipping, needs configure, etc.'",
 'chktex',      "die 'skipping, merge into Build'",
 'chngpage',    "die 'skipping, use changepage'",
 'circle',      "die 'skipping, noinfo license, author unfindable'",
 'circuit_macros', "die 'skipping, needs m4'",
 'circuit-macros', "die 'skipping, needs m4'",
 'circuitikz',  "&MAKEcopy",
 'cirth',       "die 'skipping, nosell license'",
 'citeref',     "die 'skipping, noinfo license, lots of authors'",
 'cjk',         "&MAKEcjk",
 'cjw',                 "die 'skipping, nosell license'",
 'clarendo',            "die 'skipping, nonfree font'",
 'classico',            "die 'skipping, nonfree font'",
 'clock',               "&MAKEflatten",
 'cm-lgc',              "&MAKEcmlgc",
 'cm-super',            "&MAKEflatten",
 'cm-unicode',          "&MAKEflatten",
 'cmastro',             "die 'skipping, noinfo license, author unknown'",
 'cmbright',            "&MAKEcopy",
 'cmcyr',               "&MAKEflatten",
 'cmcyralt',            "die 'skipping, noinfo license",
 'cmexb',		"&MAKEflatten",
 'cmsrb',               "&MAKEflatten",
 'cnbwp',               "&MAKEflatten",
 'cntdwn',              "die 'skipping, author (dps) request",
 'comicsans',           "die 'skipping, Comic Sans is nonfree'",
 'comfortaa',           "&MAKEcopy",
 'comment_io',		"die 'skipping, await request i guess'",
 'committee-font',	"die 'skipping, noinfo license, old Knuthian font'",
 'compact',             "die 'skipping, nonfree license'",
 'computer-typesetting-using-latex',    "die 'skipping, nosource'",
 'concmath-fonts',      "&MAKEflatten",
 'concmath',            "&MAKEnosymlinks",
 'concrete',            "&MAKEflatten",
 'conferences',         "die 'skipping, container directory'",
 'context-algorithmic', "&MAKEcopy",
 'context-account',     "&MAKEcopy",
 'context-animation',   "&MAKEcopy",
 'context-annotation',  "&MAKEcopy",
 'context-bnf',         "&MAKEcopy",
 'context-chromato',    "&MAKEcopy",
 'context-cmscbf',	"&MAKEcopy",
 'context-cmttbf',	"&MAKEcopy",
 'context-cyrillicnumbers',  "&MAKEcopy",
 'context-construction-plan',"&MAKEcopy",
 'context-degrade',     "&MAKEcopy",
 'context-fancybreak',	"&MAKEcopy",
 'context-filter',      "&MAKEcopy",
 'context-fixme',       "die 'skipping, obsolete per author'",
 'context-french',      "&MAKEcopy",
 'context-fullpage',    "&MAKEcopy",
 'context-games',       "die 'skipping, obsolete per author'",
 'context-gantt',       "&MAKEcopy",
 'context-gnuplot',     "&MAKEcopy",
 'context-handlecsv',	"&MAKEcopy",
 'context-inifile',     "&MAKEcopy",
 'context-layout',	"&MAKEcopy", 
 'context-letter',      "&MAKEcopy",
 'context-lettrine',    "&MAKEcopy",
 'context-lilypond',    "die 'skipping, obsolete per author'",
 'context-mathsets',    "&MAKEcopy",
 'context-rst',         "&MAKEcopy",
 'context-ruby',        "&MAKEcopy",
 'context-sgf',         "die 'skipping, obsolete per author'",
 'context-simplefonts', "&MAKEcopy",
 'context-simpleslides',"&MAKEcopy",
 'context-taspresent',  "&MAKEcopy",
 'context-title',	"&MAKEcopy",
 'context-top-ten',     "die 'skipping, overhaul needed per author'",
 'context-transliterator',      "&MAKEcopy",
 'context-urwgaramond', "die 'skipping, nonfree font'",
 'context-urwgothic',   "die 'skipping, nonfree font'",
 'context-typearea',    "&MAKEcopy",
 'context-typescripts', "&MAKEcopy",
 'context-vim',         "&MAKEcopy",
 'context-visualcounter',	"&MAKEcopy",
 'cookybooky',  "die 'skipping, requires nonfree emerald fonts'",
 'copac-clean', "die 'skipping, snobol? await request'",
 'coptic',      "die 'skipping, replaced by cbcoptic'",
 'copypaste',   "die 'skipping, replaced by clipboard'",
 'coronet',     "die 'skipping, nonfree font'",
 'correctmathalign', "&MAKEflatten",
 'corridx',     "die 'skipping, Pascal source'",
 'count1to',    "die 'skipping, use ms'",
 'courier',	"die 'skipping, nonfree IBM Courier font'",
 'cpssp',       "die 'skipping, requires python'",
 'create-struktex',     "die 'sorry, investigate self-locating?'",
 'croatian',    "die 'skipping, nonfree (nomodify) license'",
 'crosstex',    "die 'sorry, investigate self-locating?'",
 'csfonts',     "die 'skipping, use cs'",
 'csfonts-t1',  "die 'skipping, use cs'",
 'cspsfonts',   "die 'skipping, use cs'",
 'csv2latex',   "die 'skipping, mac only?, ruby + applescript'",
 'csvtools',    "die 'skipping, replaced by datatools'",
 'csvtolatex',  "die 'skipping, w32 only, visual basic'",
 'ctable',      "&MAKEflatten",
 'ctantools',   "die 'skipping, not sure we should usurp the cmd name ctan'",
 'ctib',        "&MAKEflatten",
 'cursor',      "die 'skipping, no known license, very old and small'",
 'cvsty',       "die 'skipping, ca.2004, noinfo license'",
 'cweb',        "die 'skipping, programs'",
 'cwpuzzle',    "die 'skipping, in crossword package'",
 'cyklop',      "&MAKEcopy",
 'dantelogo',   "&MAKEflatten",
 'dataref',     "&MAKEflatten",
 'datatooltk',  "die 'skipping, Java installation'",
 'datepicker-pro',	"die 'skipping, per author (dpstory) request'",
 'datetime2-contrib',	"die 'skipping, use its subdirectories'",
 'dco',		"die 'skipping, obsolete DC fonts with oldstyle numerals'",
 'dejavu',      "&MAKEflatten",
 'dejavu-math', "&MAKEflatten",
 'dejavu-otf',  "&MAKEflatten",
 'deleq',       "die 'skipping, nosell license'",
 'denisbdoc',   "&MAKEflatten",
 'deproc',      "die 'skipping, for latex 2.09'",
 'designcon',   "die 'skipping, requires nonfree fonts'",
 'detlev-cm',	"die 'skipping, use beamertheme-detlev-cm'",
 'devanagr',    "&MAKEdevanagr",
 'devanagari',  "die 'skipping, use velthuis'",
 'devanagari-omega', "die 'skipping, author unknown, license unknown'",
 'devnag',	"die 'skipping, use velthuis'",
 'dfgproposal', "die 'skipping, replaced by proposal'",
 'diagmac',     "die 'skipping, for latex 2.09 and we have diagmac2'",
 'diagnose',    "&MAKEflatten",
 'diagrams',    "die 'skipping, use specific package name'",
 'diagxy',      "die 'skipping, use barr'",
 'dictsym',     "&MAKEunzipandflatten",
 'disser',      "&MAKEdisser",
 'divine',      "die 'skipping, requires nonfree font'",
 'dktools',     "die 'skipping, needs compilation, etc.'",
 'dmfonts',     "die 'skipping, needs work'",
 'dnp',         "&MAKEdnp",
 'dogma',       "die 'skipping, requires nonfree font'",
 'dot2tex',     "die 'skipping, only useful with supporting python setup'",
 'dozenal',	"&MAKEflatten",
 'dps',         "die 'skipping, requires acrotex'",
 'draftmark',   "die 'skipping, nosell license'",
 'drm',		"&MAKEflatten",
 'droid',       "&MAKEcopy",
 'dropping',    "die 'skipping, nosell license'",
 'dtxtut',      "&setup",  # straight copy
 'duplicat',    "die 'skipping, use piff'",
 'dutchcal',    "&MAKEcopy",
 'dvipdfmx-def',"die 'skipping, replaced by graphics-def'",
 'dvisvgm-def', "die 'skipping, replaced by graphics-def'",
 'easy',        "&MAKEeasy",
 'easylatex',   "die 'skipping, complicated perl modules, sorry'",
 'ean13isbn',   "&MAKEcopy",
 'ebib',        "die 'skipping, as it is Emacs'",
 'ebong',       "&MAKEflatten",
 'ecards',      "die 'skipping, per author request'",
 'eCards',      "die 'skipping, per author request'",
 'ecc',         "&MAKEflatten",
 'ecgdraw',	"die 'skipping, need new CTAN update to sync (2017)'",
 'eclbip',      "die 'skipping, use ecltree'",
 'eco',         "&MAKEeco",
 'economic',    "&MAKEnosymlinks",
 'edmac',       "die 'skipping, needs work (unzip xx)'",
 'ednotes',     "&MAKEnosymlinks",
 'eforms',      "die 'skipping, per author (dps) request'",
 'efrench',     "die 'skipping, new bases and more, sorry'",
 'eiad',        "&MAKEflatten",
 'eitl',        "die 'skipping, distro-specific scripts, etc.'",
 'electrum',    "&MAKEcopy",
 'eledpar',     "die 'skipping, use eledmac'",
 'elhyphen',    "die 'skipping, incorporated in hyph-utf8'",
 'elsarticle',  "&MAKEflatten",
 'em',          "die 'skipping, european modern fonts too old, not packaged'",
 'emerald',     "die 'skipping, nonfree fonts'",
 'empheq',      "die 'skipping, use mh'",
 'enpassant',   "die 'skipping, license unknown'",
 'epic',        "die 'skipping, license unknown and replaced by eepic'",
 'epigrafica',  "&MAKEflatten",
 'epiolmec',    "&MAKEflatten",
 'epix',        "die 'skipping, needs C++'",
 'epspdf',      "die 'skipping, siep does it by hand'", #"&MAKEflatten",
 'epspdf-setup',"die 'skipping, siep does it by hand'",
 'epyt',	"die 'renamed to beamertheme-epyt'",
 'eq-save',	"die 'skipping, requires acrotex'",
 'eq2db',	"die 'skipping, author request (and nonfree requirements)'",
 'eqexam',      "die 'skipping, per author (dps) request'",
 'eqmark',      "die 'skipping, latex 2.09, was never in TL'",
 'esindex',     "die 'skipping, use bezos'",
 'eskdx',       "&MAKEeskdx",
 'esstix',      "&MAKEcopy",
 'esvect',      "&MAKEflatten",
 'ethiop',      "&MAKEflatten",
 'euclide',     "&MAKEpst",
 'eukleides',   "die 'skipping, requires compilation'",
 'eulervm',     "&MAKEcopy",
 'euproposal',  "die 'skipping, replaced by proposal'",
 'eurofont',    "die 'skipping, support for nonfree fonts or obsolete'",
 'europs',      "die 'skipping, support for nonfree fonts",
 'eurosans',    "die 'skipping, support for nonfree fonts",
 'eurosym',     "&MAKEflatten",
 'everysel',    "die 'skipping, use ms",
 'excel2latex', "die 'skipping, only supports excel?'",
 'expl3',       "die 'skipping, now l3kernel, etc.'",
 'expressgx',   "&MAKEexpressg",
 'extractpdfmark', "die 'skipping, compiled program'",
 'fac',         "die 'skipping, noinfo license'",
 'fancyvrb',    "&MAKEfancyvrb",
 'faq',         "die 'skipping, use FAQ-en'",
 'faq-en',      "die 'skipping, use FAQ-en'",
 'faq-fr',      "die 'skipping, nonfree'",
 'famt',        "die 'skipping, noinfo license'",
 'fax',         "die 'skipping, nosell license'",
 'fc',          "&MAKEflatten",
 'fc_arith',    "die 'skipping, per author request'",
 'fc-arith',    "die 'skipping, per author request'",
 'fetamont',    "&MAKEflatten",
 'fetchbibpes',	"die 'skipping, per author (dps) request'",
 'feynmf',      "&MAKEfeynmf",
 'findhyph',    "&MAKEflatten",
 'firststeps',  "die 'skipping, noinfo license, 1999 book examples'",
 'fitr',        "die 'skipping, per author (dpstory) request'",
 'fixocgx',     "die 'skipping, replaced by ocgx2'",
 'fldigigal',   "die 'skipping, per author request'",
 'fltpage',     "die 'skipping, unclear license'",
 'fnlineno',    "die 'skipping, use lineno'",
 'foiltex',     "die 'skipping, nosell license'",
 'font-change', "&MAKEflatten",
 'fontawesome', "&MAKEflatten",
 'fontawesome5', "&MAKEflatten",
 'fontinst',    "&MAKEfontinst",
 'fontinstallationguide', "die 'skipping, use Type1fonts'",
 'fontname',    "die 'skipping, done through tl-update-auto'",
 'fontools',    "&MAKEflatten",
 'fonts-arundina',	"die 'skipping, depends on uninstalled thailatex'",
 'fonts-churchslavonic',"&MAKEflatten",
 'footnpag',    "&MAKEfootnpag",
 'formula',     "die 'skipping, requires scripts, very old'",
 'fourier',     "&MAKEflatten",
 'fp',          "&MAKEfp",
 'fpl',         "&MAKEflatten",
 'fraktur',     "die 'skipping, replaced by yfonts'",
 'free-math-font-survey', "die 'skipping, noinfo license'",
 'french',      "die 'skipping, use babel-french'",
 'frenchb',     "die 'skipping, use babel-french'",
 'frenchle',    "die 'skipping, replaced by e-french'",
 'frenchpro',   "die 'skipping, complicated format, filename conflicts'",
 'fribrief',    "die 'skipping, nonfree license'",
 'fribidixetex',"die 'skipping, compiled, await request, 2016'",
 'fullpict',    "die 'skipping, noinfo license'",
 'fundus',      "die 'skipping, use fundus-* names'",
 'fundus-cmoutlines',   "die 'skipping, noinfo license of fonts'",
 'fundus-la',           "die 'skipping, noinfo license of fonts'",
 'fundus-pvscript',     "die 'skipping, noinfo license of fonts'",
 'fundus-startrek',     "die 'skipping, noinfo license of fonts'",
 'fundus-twcal',        "die 'skipping, nocommercial? license of fonts'",
 'fundus-va',           "die 'skipping, noinfo license of fonts'",
 'futhark',     "die 'skipping, nonfree license'",
 'futurans',    "die 'skipping, requires nonfree font'",
 'galley',      "die 'skipping, will be included in xpackages later'",
 'gandhi',      "die 'skipping, nonfree font'",
 'gapfill',     "die 'skipping, separate macosx scripts are too painful'",
 'garamond',    "die 'skipping, nonfree font'",
 'garamondx',   "die 'skipping, nonfree font'",
 'garuda-c90',  "&MAKEgaruda_c90",
 'georgian',	"die 'skipping, bitstream font licensing missing, complicated'",
 'gene',        "die 'skipping, complicated, some have sources, sorry'",
 'genmisc',     "die 'skipping, too complicated, sorry'",
 'gentium',     "die 'skipping, use gentium-tug'",
 'gentl-gr',    "die 'skipping, nonfree license'",
 'geomsty',     "die 'skipping, nonfree license'",
 'georgian',    "die 'skipping, babel and other naming problems'",
 'germbib',     "&MAKEgermbib",
 'getargs',	"die 'skipping, obsolete on CTAN'",
 'getnonfreefonts', "die 'skipping, requires nonfree fonts'",
 'gfsartemisia',"&MAKEflatten",
 'gfsbaskerville',"&MAKEflatten",
 'gfsbodoni',   "&MAKEflatten",
 'gfsdidot',    "&MAKEflatten",
 'gfscomplutum',"&MAKEflatten",
 'gfsneohellenic', "&MAKEflatten",
 'gfsporson',   "&MAKEflatten",
 'gfssolomos',  "&MAKEflatten",
 'ghostgum',    "die 'skipping, nonfree'",
 'gladtex',	"die 'skipping, requires python setup.py?'",
 'glhyph',      "die 'skipping, merged into hyph-utf8'",
 'glossary',    "die 'skipping, replaced by glossaries'",
 'glosstex',    "die 'skipping, requires compilation'",
 'gmeometric',  "die 'skipping, obsolete'",
 'gnu-freefont',"&MAKEgnu_freefont",
 'go',          "&MAKEflatten",
 'gothic',      "&MAKEflatten",
 'gradback',    "die 'skipping, ca.2002, await request'",
 'graphicp',    "die 'skipping, experimental ca.2003'",
 'graphicxsp',  "die 'skipping, requires adobe distiller'",
 'greekinfo3',	"die 'skipping, no license info, no source for samples pdf'",
 'grnumalt',    "die 'skipping, nonfree'",
 'grtimes',     "die 'skipping, requires nonfree monotype times'",
 'grverb',      "die 'skipping, nonfree restriction on Crete U. Press'",
 'gs1',         "die 'skipping, use GS1'",
 'gurps',	"die 'skipping, Steve Jackson Games restrictions -> nonfree'",
 'guitbeamer',  "die 'skipping, nonfree'",
 'ha-prosper',  "die 'skipping, use HA-prosper'",
 'hacm',        "&MAKEflatten",
 'harvardkyoto',"die 'skipping, use xetex-devanagari'",
 'he-le-na',    "die 'skipping, nonfree (shareware) license'",
 'hexdump',     "die 'skipping, nonfree (probably) license'",
 'hfbright',    "&MAKEflatten",
 'hge',         "die 'skipping, looks nonfree'",
 'hieroglf',	"die 'skipping, use archaic'",
 'highlight',   "die 'skipping, complicated compilation'",
 'hilowres',    "die 'skipping, nonfree'",
 'historische-zeitschrift', "&MAKEflatten",
 'hm-ftx',      "die 'skipping, use persian-hm-ftx'",
 'hm-xbs',      "die 'skipping, use persian-hm-xbs'",
 'html2latex',  "die 'skipping, no self-locating of Perl modules'",
 'hvfloat',     "&MAKEflatten",
 'hvindex',     "&MAKEflatten",
 'hyph-utf8',   "&MAKEcopy",
 'hyphen-german',"die 'skipping, part of hyph-utf8'",
 'ibygrk',      "&MAKEflatten",
 'ieeeconf',    "die 'skipping, use IEEEconf'",
 'ieeetran',    "die 'skipping, use IEEEtran'",
 'ifacmtg',     "die 'skipping, nonfree license'",
 'ifluatex',    "die 'skipping, use oberdiek'",
 'ifmslide',    "&MAKEflatten",
 'ifpdf',       "die 'skipping, use oberdiek'",
 'imprintmtshadow', "die 'skipping, nonfree font support'",
 'indxcite',    "die 'skipping, too old, license suboptimal'",
 'induni-om',   "die 'skipping, for omega, use of pua?'",
 'interactiveanimation',"die 'skipping, acrobat only'",
 'interactiveplot',	"die 'skipping, acrobat only'",
 'intex',       "die 'skipping, wants autoconfery'",
 'invoice',     "&MAKEflatten",
 'ipa',         "die 'skipping, part of wsuipa'",
 'ipaex-type1', "&MAKEflatten",
 'isopt',	"&MAKEflatten",
 'isostds',     "die 'skipping, use iso or iso10303'",
 'itrans',      "die 'skipping, no longer maintained (maybe you want xetex-itrans?), too complex'",
 'itrans-processor',    "die 'skipping, no longer maintained, too complex'",
 'iwona',       "&MAKEcopy",
 'jadetex',     "&MAKEjadetex",
 'japanese',    "die 'skipping, now babel-japanese'",
 'japanese-otf',"&MAKEjapaneseotf",
 'japanese-otf-uptex',"&MAKEjapaneseotf",
 'jasthesis',   "die 'skipping, noinfo license'",
 'javadoc',     "die 'skipping, requires java and no source'",
 'javatex',     "die 'skipping, ca.1998, not integrated'",
 'jeopardy',    "die 'skipping, requires dpstory packages'",
 'jflap2tikz',  "die 'skipping, requires java'",
 'jfontmaps',   "die 'skipping, use ptex-fontmaps'",
 'jhep',        "die 'skipping, probably nonfree license'",
 'jj_game',     "die 'skipping, requires acrotex'",
 'jkthesis',    "die 'skipping, probably nonfree license, ca.2002'",
 'jknappen',    "die 'skipping, use jknapltx'",
 'jmakepdfx',   "die 'skipping, non-self-locating java?'",
 'jpgfdraw',    "die 'skipping, requires java'",
 'junicode',    "&MAKEflatten",
 'kalendar',    "die 'skipping, noinfo license'",
 'kbordermatrix',"die 'skipping, noinfo license'",
 'kd',          "die 'skipping, too old, too complicated, sorry'",
 'kdgcoursetext',       "die 'skipping, replaced by kdgdocs'",
 'kdgreek',     "die 'skipping, nonfree license'",
 'kdgcoursetext',       "die 'skipping, confused/nonfree license'",
 'kelly',       "die 'skipping, obsoleted by cbgreek?'",
 'kerkis',      "&MAKEflatten",
 'keyreader',   "&MAKEmv_doctex",
 'keys3',       "die 'skipping, merged into expl3'",
 'knitting',    "&MAKEflatten",
 'knuth',	"die 'skipping, new top-level web/ dir? copies from sources?'",
 'koi8',        "die 'skipping, ca.1996, noinfo license'",
 'koma-script-examples-3', "die 'skipping, just have koma-script-examples'",
 'koma-script-examples-4', "die 'skipping, just have koma-script-examples'",
 'koma-script-SFS',     "die 'skipping, use koma-script-sfs'",
 'ktv-texdata',         "&MAKEflatten",
 'kurier',              "&MAKEcopy",
 'kuvio',               "die 'skipping, nonfree license'",
 'l2a',                 "die 'skipping, another old detex, needs compilation'",
 'l2tabu-it',           "die 'skipping, use l2tabu-italian'",
 'labelcas',		"die 'skipping, obsolete as of 17apr16'",
 'lamstex',             "die 'skipping, old'",
 'lamstex-index',       "die 'skipping, old'",
 'labtable',            "die 'skipping, nonfree w32 application'",
 'lastbib',             "die 'skipping, nonfree'",
 'latex_maker',         "die 'skipping, ruby'",
 'latex-essential',     "die 'skipping, nonfree'",
 'latex-fonts',         "&MAKEflatten",
 'latex-base',  	"die 'skipping, use latex'",
 'latex-doc',	  	"die 'skipping, use latex'",
 'latex-graphics',	"die 'skipping, use graphics'",
 'latex-help-texinfo',  "die 'skipping, use latex2e-help-texinfo'",
 'latex-pro-pragmatiky',    "die 'skipping, no source'",
 'latex-sciences-humaines', "die 'skipping, no source'",
 'latex-tipps-und-tricks',  "die 'skipping, noinfo license'",
 'latex_maker', "die 'skipping, we must not usurp two-character cmd name'",
 'latex2html',  "die 'skipping, not self-locating, needs apache changes'",
 'latex2pdf',   "die 'skipping, too bare-bones'",
 'latex2rtf',   "die 'skipping, no configure or requests, etc.'",
 'latex3',      "die 'skipping, use xpackages'",
 'latexdb',     "die 'skipping, needs sql, etc.'",
 'latexmp',     "&MAKEflatten",
 'layaureo',    "&MAKEflatten",
 'lato',        "&MAKEcopy",
 'lcircuit',    "die 'skipping, license unknown, too old to investigate'",
 'leawood',     "&MAKEflatten",
 'lecturer',    "&MAKEflatten",
 'ledmpar',     "die 'skipping, use ledmac'",
 'ledpar',      "die 'skipping, use ledmac'",
 'letter1',     "die 'skipping, ca.1989, never in TL, await request'",
 'lettrgth',    "die 'skipping, nonfree font'",
 'lettrine',    "&MAKEflatten",
 'levy-font',   "die 'skipping, use levy'",
 'levy-latex',  "die 'skipping, nosell per old latex'",
 'lexitex',     "die 'skipping, use camel'",
 'lfb',         "&MAKElfb",
 'lgraph',      "die 'skipping, obsolete'",
 'lgrx',        "die 'skipping, obsolete per author'",
 'lh',          "&MAKElh",
 'lhfonts',     "die 'skipping, use lh'",
 'libertine-legacy',    "die 'skipping, replaced by libertine'",
 'libertine-type1',     "die 'skipping, replaced by libertine'",
 'libertineotf',        "die 'skipping, replaced by libertine'",
 'librarian',   "&MAKEflatten",
 'libris',      "&MAKEcopy",
 'lifia-th',    "die 'skipping, ?'",
 'linearA',     "&MAKEflatten",
 'list',      "die 'skipping, part of knuth-local'",
 'lintex',      "die 'skipping, compiled program'",
 'listofanswers',       "die 'skipping, noinfo license'",
 'literat',     "&MAKEliterat",
 'lithuanian',  "&MAKEflatten",
 'lkort',       "die 'skipping, obsolete'",
 'lm',          "&MAKEcopy",
 'lm-math',     "&MAKEflatten",
 'lmacs',       "die 'skipping, author request'",
 'lms',         "die 'skipping, nonfree license'",
 'logfilter',   "die 'skipping, nosource (and java)'",
 'loggates',    "die 'skipping, LaTeX 2.09 and never in TL'",
 'logic',       "die 'skipping, noinfo license, ancient'",
 'loops',       "&MAKEflatten",
 'lsabon',      "die 'skipping, nonfree font support'",
 'lshort',      "die 'skipping, use lshort-english (or whatever language)'",
 'lshort-bulgarian',    '&MAKElshort',
 'lshort-chinese',      '&MAKElshort',
 'lshort-english',      '&MAKElshort',
 'lshort-finnish',      '&MAKElshort',
 'lshort-korean',       '&MAKElshort',
 'lshort-mongol',       '&MAKElshort',
 'lshort-mongolian',    "die 'skipping, replaced by lshort-mongol'",
 'lshort-persian',      '&MAKElshort',
 'lshort-portuguese',   '&MAKElshort',
 'lshort-slovenian',    '&MAKElshort',
 'lshort-turkish',      '&MAKElshort',
 'lshort-vietnamese',   '&MAKElshort',
 'lshort-zh-cn',        "die 'skipping, use lshort-chinese'",
 'ltnews',              "die 'skipping, nonfree doc'",
 'ltt',                 "&MAKEltt",
 'ltxkeys',             "&MAKEflatten",
 'ltxmisc',             "die 'skipping, too complicated, sorry'",
 'ltxtable',            "die 'skipping, use carlisle'",
 'lua-visual-debug',    "&MAKEflatten",
 'luamesh',		"&MAKEflatten",
 'luatex-def',		"die 'skipping, replaced by graphics-def'",
 'lucida',              "die 'skipping, nonfree font'",
 'lucida-otf',          "die 'skipping, nonfree font'",
 'lucidabr',            "die 'skipping, nonfree font'",
 'lucold',              "die 'skipping, nonfree font'",
 'lxfonts',     "&MAKEflatten",
 'ly1',         "&MAKEcopy",
 'lyx',         "die 'skipping, container directory'",
 'mab2bib',     "die 'skipping, python'",
 'magyar',      "die 'skipping, use babel-hungarian'",
 'make-env',    "die 'skipping, no license, too old to bother with'",
 'makebarcode', "&MAKEcopy",
 'makecell',    "&MAKEnosymlinks",
 'makedtx',     "&MAKEflatten",
 'makedlossariesgui',   "skipping, impossible java'",
 'maketexwork',         "die 'skipping, too old'",
 'makor',               "&MAKEbase",
 'malayalam-latex',     "die 'skipping, until asked for'",#language/malayalam
 'malayalam-omega',     "die 'skipping, until asked for'",
 'manfnt-font',		"&MAKEflatten",
 'manjutex',    "die 'skipping, obsolete on CTAN'", #"&MAKEflatten",
 'manpage',     "die 'skipping, nonfree license'",
 'manual',	"die 'skipping, in knuth-lib knuth-local cmextra'",
 'mapcodes',    "die 'skipping, nosell (old latex) license'",
 'maple',       "die 'skipping, noinfo license'",
 'marigold',    "die 'skipping, nonfree font'",
 'marvosym',    "&MAKEcopy",
 'match_parens',"&MAKEflatten",
 'mathabx',     "&MAKEflatten",
 'mathabx-type1',       "&MAKEflatten",
 'mathalfa',	"&MAKEflatten",
 'mathesatz-examples',  "die 'skipping, big'",
 'mathgifg',    "die 'skipping, nonfree font support'",
 'mathexam',    "&MAKEflatten",
 'mathpazo',    "&MAKEmathpazo",
 'mathpunctspace', "&MAKEflatten",
 'mathspic',    "&MAKEflatten",
 'mathstone',   "die 'skipping, requires nonfree Stone fonts'",
 'matlab',      "die 'skipping, requires nonfree matlab'",
 'mathtex',     "die 'skipping, compiled, cgi, etc.'",
 'mattex',      "die 'skipping, requires nonfree matlab'",
 'mdwfonts',    "die 'skipping, too many tfm duplicates'",
 'mem',         "die 'skipping, experimental ca.2006'",
 'memo2',       "die 'skipping, latex 2.09'",
 'memoirchapterstyles', "die 'skipping, use MemoirChapStyles'",
 'meper',       "die 'skipping, requires Java, confused license'",
 'messagebubbles', "die 'skipping, no license stated'",
 'metalogo',    "&MAKEflatten",
 'metaobj',     "&MAKEflatten",
 'metapost',    "die 'skipping, core binary'",
 'metauml',     "&MAKEmetauml",
 'metropolis',	"die 'skipping, use beamertheme-metropolis'",
 'mff',         "die 'skipping, noinfo license'",
 'mflogo-font', "&MAKEflatten",
 'mftoeps',     "die 'skipping, bat-only (mirror.ctan.org/graphics/MF-PS)'",
 'mfpic',       "&MAKEcopy",
 'mh',		"die 'skipping, replaced by breqn and mathtools'",
 'mhs',         "die 'skipping, nomodify license'",
 'mil',         "die 'skipping, have newer'",
 'mil3',        "die 'skipping, have newer'",
 'milstd',      "die 'skipping, have milstd.sty from logic'",
 'mimetex',     "die 'skipping, CGI'",
 'miniltx',     "die 'skipping, use graphics-pln'",
 'minionpro',   "die 'skipping, requires nonfree minion'",
 'minion2newtx',"die 'skipping, requires nonfree minion'",
 'missaali',    "&MAKEflatten",
 'misc',        "&MAKEmisc",
 'mk',          "die 'skipping, not self-locating, must not usurp two-character cmd name'",
 'mkbangtex',   "die 'skipping, no copyright (and python)'",
 'mkbib',       "die 'skipping, compilcation'",
 'mkstmpdad',   "die 'skipping, requires dpstory packages'",
 'mlbib',       "die 'skipping, bib file names are too generic'",
 'mnhyphn',     "&MAKEmnhyphn",
 'mnsymbol',    "&MAKEflatten",
 'modular',     "&MAKEflatten",
 'mol2chemfig', "die 'skipping, python dependencies'",
 'montex',      "&MAKEflatten",
 'morehelp',    "die 'skipping, nonfree license'",
 'morisawa',	"&MAKEflatten",
 'morse',       "die 'skipping, nosell license'",
 'mp3d',        "&MAKEflatten",
 'mpcolornames',"&MAKEcopy",
 'mpdinbrief',  "die 'skipping, nosell license'",
 'mptopdf',     "&MAKEcopy",
 'msuthesis',   "die 'skipping, use msu-thesis'",
 'mtp2lite',    "die 'skipping, nonfree'",
 'mtx',         "die 'skipping, pascal musixtex binaries'",
 'multibox',    "die 'skipping, noinfo license, author deceased'",
 'multido',     "&MAKEpst",
 'multirow',    "&MAKEflatten",
 'musictex',    "die 'skipping, superseded by musixtex",
 'musixtnt',	"&MAKEflatten",
 'mwrite',      "die 'skipping, nonfree license",
 'mx'   ,       "die 'skipping, author does not recommend system install'",
 'mxd',         "die 'skipping, noinfo license, old mongolian'",
 'mxedruli',    "&MAKEflatten",
 'nanumtype1',  "&MAKEflatten",
 'nassflow',    "die 'skipping, nosell license'",
 'nbaskerv',    "die 'skipping, requires nonfree font'",
 'ncctools',    "&MAKEflatten",
 'newalg',      "die 'skipping, noinfo license, 1995'",
 'newproof',    "die 'skipping, use piff'",
 'newsletr',    "&MAKEnewsletr",
 'newthm',      "die 'skipping, obsolete, no longer on ctan'",
 'newtxsf',     "&MAKEflatten",
 'niceframe-type1',	"&MAKEflatten",
 'nlatexdb',    "die 'skipping, C#/.NET'",
 'nohyph',      "die 'skipping, nohyph must be done by hand'",
 'norasi-c90',  "&MAKEnorasi_c90",
 'notes',       "&MAKEnotes",
 'notestex',    "&MAKEflatten",
 'ntabbing',    "die 'skipping, noinfo license, author email bad'",
 'ntg',         "die 'skipping, ntg is stale user group information'",
 'numending',   "die 'skipping, noinfo license'",
 'numline',     "die 'skipping, obsolete'",
 'numparse',    "die 'skipping, experimental, not recommended by author'",
 'oca',         "die 'skipping, nosell license'",
 'occam',       "die 'skipping, too old and strange'",
 'ocgtools',    "die 'skipping, requires acrotex'",
 'ocherokee',   "&MAKEflatten",
 'ocr-a',       "die 'skipping, nosell license'",
 'ocr-b-outline',"&MAKEflatten",
 'oesch',       "die 'skipping, nosell license'",
 'ofs',         "&MAKEflatten",
 'ogonek',      "die 'skipping, nonfree license'",
 'oinuit',      "&MAKEflatten",
 'old-arrows',	"&MAKEflatten",
 'oldstandardt1',"die 'skipping, use oldstandard'",
 'omegajapanese',"&MAKEflatten",
 'onepagem',    "die 'skipping, use piff'",
 'optima',      "die 'skipping, nonfree font'",
 'osa',         "die 'skipping, relies on endfloat.cfg and non-unique filenames'",
 'osmanian',    "die 'skipping, no good license info'",
 'ot2cyr',      "die 'skipping, nonfree font support",
 'otfinst',     "die 'skipping, python script, perhaps stale",
 'opensans',    "&MAKEcopy",
 'otibet',      "&MAKEflatten",
 'oxford',      "die 'skipping, nosell license'",
 'padauk',	"&MAKEflatten",
 'pageframe',   "die 'skipping, noinfo license'",
 'pageno',      "die 'skipping, nosell license'",
 'pagesLTS',    "die 'skipping, use pageslts'",
 'pandora',     "die 'skipping, nosell license'",
 'pandora-latex',       "die 'skipping, pandora is nosell'",
 'pandora-type1',       "die 'skipping, pandora is nosell'",
 'paradigm',            "die 'skipping, too old, for BLUe'",
 'parse-split',         "die 'skipping, requires compilation'",
 'pas-cours',           "&MAKEflatten",
 'pas-crosswords',      "&MAKEflatten",
 'pas-tableur',         "&MAKEflatten",
 'pb-diagram',  "&MAKEpbdiagram",
 'pcarl',       "die 'skipping, free support for nonfree font'",
 'pclnfss',     "die 'skipping, nonfree hardware fonts'",
 'pdbf-toolkit',"die 'skipping, non-self-locating java+sql'",
 'pdcmac',      "die 'skipping, needs work'",
 'pdf-forms-tutorial',  "die 'skipping, use pdf-forms-tutorial-de or -en'",
 'pdf-forms-tutorial-de', "die 'skipping, requires acrobat'", #"&MAKEpdf_forms_tutorial",
 'pdf-forms-tutorial-en', "die 'skipping, requires acrobat'", #"&MAKEpdf_forms_tutorial",
 'pdfbook',     "die 'skipping, requires compilation'",
 'pdfjam',      "&MAKEflatten",
 'pdfmarginpar',"&MAKEflatten",
 'pdfrack',     "die 'skipping, until someone asks for it'",
 'pdftex-def',	"die 'skipping, replaced by graphics-def'",
 'pdfx',	"&MAKEflatten",
 'pedigree',    "die 'skipping, use pedigree-perl'",
 'persian-bib', "&MAKEflatten",
 'persian-hm-ftx',"die 'skipping, legality?'", #"&MAKEflatten",
 'persian-hm-xbs',"die 'skipping, legality?'", #"&MAKEflatten",
 'persian-modern',"die 'skipping, legality?'", #"&MAKEflatten",
 'pgothic',     "die 'skipping, use bookhands'",
 'phaistos',    "&MAKEflatten",
 'philosophers-imprint', "die 'skipping, use philosophersimprint'",
 'phonetic',    "&MAKEphonetic",
 'phonenumbers',"&MAKEflatten",
 'physe',       "die 'skipping, noinfo license, c.1992 plain format for physics'",
 'physymb',	"die 'skipping, obsolete per author requests",
 'phyzzx',      "die 'skipping, noinfo license, c.1988 plain format for physics'",
 'pictex',      "&MAKEflatten",
 'pictex-autoarea',"die 'skipping, use autoarea",
 'pigpen',      "&MAKEflatten",
 'pinlabel',    "&MAKEnosymlinks",
 'pitthesis',   "die 'skipping, noinfo license",
 'pl',		"&MAKEflatten",
 'plain',	"die 'skipping, just plain.tex, rest in knuth-lib",
 'pl-qx',       "&MAKEplqx",
 'pointRuler',  "die 'skipping, requires compilation'",
 'poltawski',   "&MAKEcopy",
 'polyglossia-kannada', "die 'skipping, now in polyglossia proper'",
 'popupmenu',   "die 'skipping, per author (dps) request'",
 'poster',      "die 'skipping, requires compilation'",
 'powerdot',    "&MAKEflatten",
 'ppower4',     "die 'skipping, sourceless java ca.2002'",
 'prepr',       "die 'skipping, ca.1989, never in TL, await request'",
 'preview-latex',"die 'skipping, use preview'",
 'progkeys',    "die 'skipping, noinfo license, author unfindable'",
 'proofs',      "die 'skipping, nosell license'",
 'ps2eps',      "die 'skipping, must go into sources'",
 'ps4pdf',      "die 'skipping, obsolete'",
 'psfig',       "die 'skipping, nosell license'",
 'psfragx',     "&MAKEflatten",
 'pslatex',     "&MAKEpslatex",
 'psizzl',      "die 'skipping, needs to be its own format-level directory'",
# 'psnfss',     tds.zip now "&MAKEpsnfss",
 'psnfss-addons',       "die 'skipping, do not understand, sorry'",
 'psnfssx',             "die 'skipping, situation too confused, sorry'",
 'pst-2dplot',  "&MAKEpst",
 'pst-3d',      "&MAKEpst",
 'pst-3dplot',  "&MAKEpst",
 'pst-abspos',  "&MAKEpst",
 'pst-antiprism',"&MAKEpst",
 'pst-arrow',   "&MAKEpst",
 'pst-am',      "&MAKEpst",
 'pst-asr',     "&MAKEpst",
 'pst-bar',     "&MAKEpst",
 'pst-barcode', "&MAKEpst",
 'pst-bezier',  "&MAKEpst",
 'pst-blur',    "&MAKEpst",
 'pst-bspline', "&MAKEpst",
 'pst-calculate',     "&MAKEpst",
 'pst-cie',     "&MAKEpst",
 'pst-circ',    "&MAKEpst",
 'pst-coil',    "&MAKEpst",
 'pst-cox',     "&MAKEflatten",
 'pst-dbicons', "&MAKEpst",
 'pst-dart',    "&MAKEpst",
 'pst-diffraction',     "&MAKEpst",
 'pst-electricfield',   "&MAKEpst",
 'pst-eps',     "&MAKEpst",
 'pst-eucl',    "&MAKEpst",
 'pst-exa',     "&MAKEflatten",
 'pst-fill',    "&MAKEpst",
 'pst-fit',     "&MAKEpst",
 'pst-fr3d',    "&MAKEpst",
 'pst-fractal', "&MAKEpst",
 'pst-fun',     "&MAKEpst",
 'pst-func',    "&MAKEpst",
 'pst-gantt',   "&MAKEpst",
 'pst-geo',     "&MAKEpst",
 'pst-geo-compress',    "die 'skipping, in pst-geo, check with hvoss'",
 'pst-geometrictools',	"&MAKEpst",
 'pst-graphicx',"&MAKEpst",
 'pst-gr3d',    "&MAKEpst",
 'pst-grad',    "&MAKEpst",
 'pst-infixplot',"&MAKEpst",
 'pst-jftree',  "&MAKEpst",
 'pst-jtree',   "&MAKEpst",
 'pst-knot',    "&MAKEpst",
 'pst-labo',    "&MAKEpst",
 'pst-layout',  "&MAKEcopy",
 'pst-lens',    "&MAKEpst",
 'pst-light3d', "&MAKEpst",
 'pst-magneticfield',   "&MAKEpst",
 'pst-math',    "&MAKEpst",
 'pst-mirror',  "&MAKEpst",
 'pst-node',    "&MAKEpst",
 'pst-ob3d',    "&MAKEpst",
 'pst-optic',   "&MAKEpst",
 'pst-osci',    "&MAKEpst",
 'pst-ovl',     "&MAKEpst",
 'pst-pad',     "&MAKEpst",
 'pst-pdgr',    "&MAKEpst",
 'pst-perspective',     "&MAKEpst",
 'pst-platon',  "&MAKEpst",
 'pst-plot',    "&MAKEpst",
 'pst-poker',   "&MAKEflatten",
 'pst-poly',    "&MAKEpst",
 'pst-pulley',  "&MAKEpst",
 'pst-qtree',   "&MAKEpst",
 'pst-rputover',"&MAKEpst",
 'pst-rubans',  "&MAKEpst",
 'pst-shell',   "&MAKEpst",
 'pst-sigsys',  "&MAKEpst",
 'pst-slpe',    "&MAKEpst",
 'pst-solarsystem',     "&MAKEpst",
 'pst-solides3d',       "&MAKEpst",
 'pst-soroban', "&MAKEpst",
 'pst-spectra', "&MAKEpst",
 'pst-spinner',	"&MAKEpst",
 'pst-spirograph',	"&MAKEpst",
 'pst-stru',    "&MAKEpst",
 'pst-support', "&MAKEpst",
 'pst-text',    "&MAKEpst",
 'pst-thick',   "&MAKEpst",
 'pst-tools',   "&MAKEpst",
 'pst-tree',    "&MAKEpst",
 'pst-tvz',     "&MAKEpst",
 'pst-uml',     "&MAKEpst",
 'pst-vehicle', "&MAKEpst",
 'pst-vue3d',   "&MAKEpst",
 'pst2pdf',     "&MAKEflatten",
 'pstdoc',      "die 'skipping, requires python'",
 'pstrees',     "die 'skipping, obsolete (for latex 2.09)'",
 'pstricks',    "&MAKEpstricks",
 'pstricks-add',"&MAKEpst",
 'pstricks-calcnotes',  "die 'skipping, use pstricks_calcnotes'",
 'pstricks-examples-7', "die 'skipping, CTAN suffices for this big package'",
 'pstricks-examples',   "die 'skipping, ditto'",
 'pstricks-examples-en',"die 'skipping, ditto'",
 'ptmsc',       "die 'skipping, nonfree font'",
 'ptsans',      "die 'skipping, use paratype'",
 'ptserif',     "die 'skipping, use paratype'",
 'punk',        "&MAKEflatten",
 'pxchfon',     "&MAKEflatten",
 'pxfonts',     "&MAKEflatten",
 'pxtxalfa',    "&MAKEcopy",
 'pxufont',	"&MAKEflatten",
 'pzccal',      "die 'skipping, obsoleted by urwchancal'",
 'quran',	"&MAKEflatten",
 'r2bib',       "die 'skipping, requires compilation'",
 'ragged2e',    "die 'skipping, part of ms'",
 'rake4latex',  "die 'skipping, requires rake'",
 'rangen',      "die 'skipping, per author request'",
 'ratexdb',     "die 'skipping, needs sql, etc.'",
 'realcalc',    "die 'skipping, nosell license'",
 'references',  "die 'skipping, requires binary'",
 'renditions',  "die 'skipping, per author request'",
 'resume',      "die 'skipping, nosell license'",
 'revnum',      "die 'skipping, obsolete'",
 'revtex',      "&MAKEcopy",
 'revtex4-1',   "die 'skipping, use revtex'",
 'richtext',    "die 'skipping, per author (dps) request'",
 'rmannot',     "die 'skipping, per author (dps) request'",
 'rmligs',      "die 'skipping, no requests'",
 'romande',     "&MAKEcopy",
 'rosario',     "&MAKEflatten",
 'rotating',	"die 'skipping, now part of (core latex) graphics'",
 'rpg-module',	"die 'skipping, basic-stats name'",
 'rsfs',        "&MAKEflatten",
 'rsfso',       "&MAKEcopy",
 'rst',         "die 'skipping, nonfree license'",
 'rtsched',     "die 'skipping, Elisp package'",
 'rubikcube',	 "die 'skipping, use rubik'",
 'rubikrotation',"die 'skipping, use rubik'",
 'rubiktwocube', "die 'skipping, use rubik'",
 'russian',     "die 'skipping, babel non-update, must install as doc only'",
 'sa-tikz',     "&MAKEflatten",
 'sae',         "die 'skipping, nosell license'",
 'saferef',     "die 'skipping, nonfree license'",
 'sagetex',     "die 'skipping, omitted at author request (25 Jan 2010 19:50:16)'",
 'sansmathaccent',      "&MAKEflatten",
 'sansmathfonts',       "&MAKEflatten",
 'schedule',            "die 'skipping, noinfo license, too old to matter'",
 'schulschriften',      "&MAKEflatten",
 'scientifixpaper',     "die 'skipping, noinfo license'",
 'sciwordconv', "die 'skipping, for old versions of scientific word'",
 'script',      "die 'skipping, noinfo license, too old to matter'",
 'scripttex',   "die 'skipping, nosell license'",
 'selnolig',    "&MAKEflatten",
 'seminar',     "&MAKEflatten",
 'serbianc',    "die 'skipping, use babel-serbianc'",
 'serbianpart', "die 'skipping, await request'",
 'serial',      "die 'skipping, koma, 1999'",
 'setouterbox', "die 'skipping, use oberdiek'",
 'sfarticle',   "die 'skipping, LaTeX 2.09'",
 'sfheaders',   "die 'skipping, noinfo license, no reply from author'",
 'shadbox',     "die 'skipping, nonfree license'",
 'shipunov',    "&MAKEcopy",
 'shobhika',	"&MAKEflatten",
 'shortlst',    "die 'skipping, nosell license'",
 'showexpl',    "&MAKEflatten",
 'siam',        "die 'skipping, nonfree license'",
 'siggraph',    "die 'skipping, nonfree license'",
 'sikumuna',    "die 'skipping, lyx template'",
 'simurgh',     "&MAKEflatten",
 'simpsons',    "die 'skipping, noinfo license'",
 'skak',        "&MAKEflatten",
 'skeyval',     "&MAKEmv_doctex",
 'slashbox',    "die 'skipping, noinfo license, c.1993'",
 'slidenotes',  "die 'skipping, nonfree'",
 'smallcap',    "die 'skipping, questionable license, 1996'",
 'smflatex',    "die 'skipping, nosource'",
 'softmaker-freefonts', "die 'skipping, requires nonfree fonts'",
 'soulpos',     "die 'skipping, use bezos'",
 'soyombo',     "die 'skipping, noinfo license, Mongolian ca.1996'",
 'spanish',     "die 'skipping, complicated collection'",
 'spark-otf',	"&MAKEflatten",
 'splint',      "die 'skipping, binary'",
 'springer',    "die 'skipping, licenses not checked'",
 'sprite',      "die 'skipping, noinfo license'",
 'sqltex',	"die 'skipping, not self-locating'",
 'ssqquote',    "die 'skipping, nonfree license'",
# 'startex',     "die 'skipping, own format, sorry'",
 'statrep',     "die 'skipping, only for nonfree sas'",
 'staves',      "&MAKEflatten",
 'stmaryrd',    "&MAKEflatten",
 'stellenbosch',"&MAKEcopy",
 'streetex',    "die 'skipping, nonfree'",
 'studies-lm',  "die 'skipping, nonfree'",
 'style_showcase',      "die 'skipping, until JimH advises it is a good idea'",
 'svg',		"&MAKEflatten",
 'svjour',      "die 'skipping, license and packaging unclear'",
 'symbolindex', "die 'skipping, requires binary'",
 't2',          "&MAKEt2",
 'tabbing',     "die 'skipping, use Tabbing'",
 'tabto',       "die 'skipping, use tabto-generic or tabto-ltx'",
 'tamethebeast',"&MAKEtamethebeast",
 'tamil-omega', "die 'skipping, supports nonfree ISM fonts'", #"&MAKEflatten",
 'taupin',      "die 'skipping, noinfo license'",
 'taylor',      "die 'skipping, nonfree'",
 'tclldoc',     "die 'skipping, use tcldoc'",
 'tds',         "die 'skipping, do by hand from http://tug.org/tds'",
 'technica',    "die 'skipping, generic .sty names'",
 'template',    "die 'skipping, use xpackages'",
 'tengwarscript',       "&MAKEflatten",
 'tex-extensions',	"die 'skipping, compiled extensions ca.2003, unknown license'",
 'tex-gpc',		"die 'skipping, alternate implementation'",
 'tex-gyre',            "&MAKEcopy",
 'tex-gyre-math',       "&MAKEflatten",
# 'tex-refs',   "die 'skipping, not ready, sorry'",
 'texdraw',     "&MAKEflatten",
 'texemplar',   "die 'skipping, await request, 199x'",
 'texlipse',    "die 'skipping, plugin for Eclipse'",
 'texlog-extract',      "die 'skipping, Ruby, not self-locating'",
 'texlog_extract',      "die 'skipping, Ruby, not self-locating'",
 'texmacs',             "die 'skipping, binary'",
 'texpower',    "&MAKEnosymlinks",
 'texsis',      "die 'skipping, needs its own format-level directory, sorry'", #"&MAKEtexsis",
 'texsort',     "die 'skipping, use sttools'",
 'tfrupee',     "&MAKEflatten",
 'tgothic',     "die 'skipping, use bookhands'",
 'thaifonts-arundina',   "die 'skipping, fontforge format only'",
 'thaifonts-scalable',   "die 'skipping, fontforge format only'",
 'thailatex',   "die 'skipping, use babel-thai'",
 'thesis',      "die 'skipping, contradictory licenses'", # texdev.net/2016/12/18/tex-on-windows-tex-live-versus-miktex-revisited/
 'thesis-titlepage-fhAC',"die 'skipping, use ...fhac'",
 'thsmc',       "die 'skipping, requires nonfree font'",
 'ticket',      "&MAKEflatten",
 'ticollege',   "&MAKEflatten",
 'tikz-kalender',"&MAKEflatten",
 'tikz-karnaugh',"&MAKEflatten",
 'tikz-ladder',	"&MAKEflatten",
 'tikz-sfc',	"&MAKEflatten",
 'time',        "die 'skipping, use piff'",
 'timeline',    "die 'skipping, LaTeX 2.09, never in TL'",
 'timescyr',    "die 'skipping, monotype font is nonfree'",
 'timesnew',    "die 'skipping, monotype/ibm font is nonfree'",
 'timing',      "die 'skipping, noinfo license, 1994 mf'",
 'tipa',        "&MAKEflatten",
 'tipfr',       "&MAKEflatten",
 'titlepage-uni-dortmund', "die 'skipping, needs graphics (too short names) in .'",
 'titleps',     "die 'skipping, use titlesec'",
 'tkhyph',      "die 'skipping, part of hyph-utf8'",
 'tksbrief',    "die 'skipping, LaTeX 2.09'",
 'tkz',         "die 'skipping, container directory'",
 'tkz-base',    "&MAKEtkz",
 'tkz-berge',   "&MAKEtkz",
 'tkz-euclide', "&MAKEtkz",
 'tkz-fct',     "&MAKEtkz",
 'tkz-graph',   "&MAKEtkz",
 'tkz-kiviat',  "&MAKEtkz",
 'tkz-linknodes',"&MAKEtkz",
 'tkz-tab',     "&MAKEtkz",
 'tlaunch',	"die 'skipping, siep installs by hand'",
 'tlg2latex',   "die 'skipping, not self-locating for default.py?'",
 'tolkienfonts',"die 'skipping, cannot easily separate free from nonfree fonts'",
 'tpcmfont',    "die 'skipping, ?'",
 'tpic2pdftex', "die 'skipping, in Build/source, not ready'",
 'tr2latex',    "die 'skipping, needs compilation, at least'",
 'tracking',    "die 'skipping, nonfree license'",
 'translation-europecv-de',     "&MAKEnosymlinks",
 'translation-footmisc-de',     "die 'skipping, nocommercial'",
 'translation-pst-jtree-de',    "die 'skipping, nocommercial'",
 'translations',"&MAKEflatten",
# 'tree-dvips', "die 'skipping, noinfo license, latex 2.09'",
 'treesvr',     "die 'skipping, await request, 1995'",
 'trig',	"die 'skipping, core LaTeX'",
 'tugboat-toc', "die 'skipping, nonfree, CTAN enough'",
 'turkish',     "die 'skipping, await request, 1989'",
 'turkishintro',"die 'skipping, nosource'",
 'turnstile',   "&MAKEflatten",
 'turnthepage', "&MAKEflatten",
 'tpx',         "die 'skipping, nosource, Windows'",
 'txfonts',     "&MAKEflatten",
 'txfontsb',    "&MAKEflatten",
 'txuprcal',     "&MAKEflatten",
 'ty',          "die 'skipping, name too generic'",
 'typedref',    "die 'skipping, nonfree license'",
 'typespec',    "die 'skipping, nonfree font specimens'",
 'uafthesis',   "&MAKEnosymlinks",
 'urwchancal',  "&MAKEcopy",
 'ucs',         "&MAKEucs",
 'uebungsblatt',"&MAKEflatten",
 'uk-faq',      "die 'skipping, use FAQ-en'",
 'uk-tex-faq',  "die 'skipping, use FAQ-en'",
 'ukrhyph',     "&MAKEukrhyph",
 'ulsy',        "die 'skipping, noinfo license, old'",
 'umrand',      "die 'skipping, nonfree'",
 'undertilde',  "die 'skipping, noinfo license, author not responsive'",
 'unitsdef',    "&MAKEflatten",
 'univers',     "die 'skipping, nonfree font'",
 'upgreek',     "die 'skipping, use was'",
 'upmethodology',"&MAKEflatten",
 'uppunctlm',	"&MAKEflatten",
 'urcls',	"&MAKEflatten",
 'uspatent',    "&MAKEflatten",
 'util-half',   "die 'skipping, noinfo license, old Knuthian font'",
 'utorontothesis',      "die 'skipping, noinfo license, 1997'",
 'utthesis',    "die 'skipping, await request, 1995'",
 'variablelm',  "&MAKEflatten",
 'varioref',    "die 'skipping, use latex[-tds]'",
 'vector',      "die 'skipping, noinfo license, 1994'",
 'vdm',         "die 'skipping, noinfo license, 1994'",
 'velthuis',    "&MAKEflatten",
 'venturisadf', "&MAKEcopy",
 'verdana',     "die 'skipping, support for nonfree font'",
 'vertex',      "die 'skipping, noinfo license, aer.sty clash, ancient'",
 'vhistory',    "&MAKEflatten",
 'vicentino',   "die 'skipping, nonfree license'",
 'view_print_ps_pdf', "die 'skipping, three-char cmd name for ruby script?'",
 'viiptar',     "die 'skipping, 1998, await request'",
 'visualFAQ',	"die 'skipping, use visualfaq'",
 'vita',        "die 'skipping, nonfree license'",
 'voss-mathmode',"die 'skipping, obsolete'",
 'vpp',         "die 'skipping, not self-locating, three-char name for ruby script?'",
 'vrb',         "die 'skipping, noinfo license, author does not recall'",
 'vrsion',      "die 'skipping, nonfree license'",
 'vxu',         "die 'skipping, obsolete'",
 'w32tex',      "die 'skipping, um, no.'",
 'wadalab',     "&MAKEwadalab",
 'wasy2',       "die 'skipping, use wasy'",
 'wasy2-ps',	"&MAKEflatten",
 'winedt',      "die 'skipping, nonfree license'",
 'winfonts',    "die 'skipping, support for nonfree fonts'",
 'withesis',    "die 'skipping, thesis package ca.2002, wait for request'",
 'wntamil',     "die 'skipping, nonfree license'",
 'wp-conv',     "die 'skipping, nonfree license'",
 'wp2latex',    "die 'skipping, compilation'",
 'wtref',	"&MAKEflatten",
 'xbase',       "die 'skipping, use xpackages'",
 'xcoffins',    "die 'skipping, use xpackages'",
 'xeCJK',       "die 'skipping, use xecjk'",
 'xecolour',    "die 'skipping, replaced by xecolor'",
 'xecyr',       "&MAKEcopy",
 'xelibertine', "die 'skipping, replaced by libertine'",
 'xetex-def',	"die 'skipping, replaced by graphics-def'",
 'xetex-pstricks',"&MAKEcopy",
 'xfrac',       "die 'skipping, use mh (I think)'",
 'xinitials',   "die 'skipping, will be in xpackages when ready (Morten says)'",
 'xindy-persian',"die 'skipping, do by hand in /texmf-dist/xindy/modules/lang/persian: too painful to preserve rest of xindy'",
 'xits',        "&MAKEflatten",
 'xkeyval',     "&MAKExkeyval",
 'xlop',        "&MAKEflatten",
 'xltabular',   "&MAKEflatten",
 'xmltex',      "&MAKExmltex",
 'xor',         "die 'skipping, will be in xpackages when ready (Morten says)'",
 'xpackages',   "die 'skipping, now l3packages, etc.'",
 'xparse',      "die 'skipping, use xpackages'",
 'xtcapts',     "die 'skipping, noinfo license'",
 'xtheorem',    "die 'skipping, will be in xpackages when ready (Morten says)'",
 'xurl',	"&MAKEflatten",
 'xwatermark',  "&MAKEflatten",
 'xypic',       "&MAKExypic",
 'yi4latex',    "die 'skipping, nosell license'",
 'yinit-as',    "die 'skipping, wait request, old never-included variant of yinit'",
 'yplan',       "&MAKEnosymlinks",
 'yt4pdf',      "die 'skipping, per author (dps) request'",
 'ytex',        "die 'skipping, noinfo license'",
 'zefonts',     "die 'skipping, noinfo license'", #&MAKEflatten",
 'zhmakeindex',	"die 'skipping, go seems too much to ask'",
 'zhmetrics',   "&MAKEcopy",
 'zhmetrics-uptex',	"&MAKEflatten",
 'zhmcjk',      "die 'skipping, sorry, 8000 tfm files, (7feb12)'",
 'zwgetfdate',  "&MAKEcopy",
 'zwpagelayout',"&MAKEcopy",
);


%prehook = (
 'a2ping'		=> '&PREHOOK_a2ping',
 'apa6'                 => '&PREHOOK_apa6',
 'cals'                 => '&PREHOOK_cals',
 'chess'                => '&PREHOOK_chess',
 'cm'			=> '&PREHOOK_cm',
 'cm-super'             => '&PREHOOK_cm_super',
 'cmextra'              => '&PREHOOK_cmextra',
 'concrete'             => '&PREHOOK_concrete',
 'ctan-o-mat'		=> '&PREHOOK_ctan_o_mat',
 'download'             => '&PREHOOK_savepdf',
 'dynblocks'            => '&PREHOOK_flatten1',
 'enctex'		=> '&PREHOOK_flatten1',
 'fixme'                => '&PREHOOK_fixme',
 'font-change-xetex'    => '&PREHOOK_flatten1',
 'fontools'             => '&PREHOOK_fontools',
 'gost'                 => '&PREHOOK_flatten1',
 'gothic'		=> '&PREHOOK_gothic',
 'grotesq'		=> '&PREHOOK_unzip',
 'hagenberg-thesis'	=> '&PREHOOK_hagenberg_thesis',
 'ibygrk'               => '&PREHOOK_ibygrk',
 'knuth-local'          => '&PREHOOK_knuth_local',
 'ktv-texdata'          => '&PREHOOK_ktv_texdata',
 'latex-git-log'        => '&PREHOOK_latex_git_log',
 'latexdiff'            => '&PREHOOK_latexdiff',
 'latexindent'          => '&PREHOOK_latexindent',
 'lilyglyphs'           => '&PREHOOK_lilyglyphs',
 'lollipop'             => '&PREHOOK_flatten1',
 'mathspic'             => '&PREHOOK_mathspic',
 'movie15'              => '&PREHOOK_flatten1',
 'musixtex-fonts'       => '&PREHOOK_unzip',
 'mp3d'                 => '&PREHOOK_mp3d',
 'numericplots'		=> '&PREHOOK_flatten1',
 'nwejm'		=> '&PREHOOK_flatten1',
 'pgfornament'		=> '&PREHOOK_flatten1',
 'pictex'               => '&PREHOOK_pictex',
 'pkuthss'              => '&PREHOOK_flatten1',
 'plex-otf'             => '&PREHOOK_flatten1',
 'prosper'              => '&PREHOOK_prosper',
 'skb'                  => '&PREHOOK_flatten1',
 'suftesi'              => '&PREHOOK_suftesi',
 'texdraw'              => '&PREHOOK_texdraw',
 'texfot'               => '&PREHOOK_texfot',
 'tudscr'		=> '&PREHOOK_tudscr',
 'tui'                  => '&PREHOOK_tui',
 'univie-ling'		=> '&PREHOOK_flatten1',
 'utf8mex'              => '&PREHOOK_flatten1',
 'vhistory'             => '&PREHOOK_vhistory',
 'wasy'                 => '&PREHOOK_wasy',
 'wsuipa'               => '&PREHOOK_wsuipa',
 'yathesis'		=> '&PREHOOK_flatten1',
 'xepersian'            => '&PREHOOK_flatten1',
 'xsim'                 => '&PREHOOK_xsim',
);


%posthook = (
 'amscls-doc'           => '&POST_rmsymlink',
 'amsrefs'              => '&POSTamsrefs',
 'amstex'               => '&POSTamstex',
 'apalike'              => '&POSTapalike',
 'asapsym'		=> '&POSTasapsym',
 'autosp'		=> '&POSTautosp',
 'bib2gls'		=> '&POSTbib2gls',
 'biber'                => '&POSTbiber',
 'biblatex'             => '&POSTbiblatex',
 'bibtex'               => '&POSTbibtex',
 'bibtexperllibs'       => '&POSTbibtexperllibs',
 'cfr-lm'               => '&POSTcfr_lm',
 'cjk-gs-integrate'	=> '&POSTcjk_gs_integrate',
 'cmcyr'		=> '&POSTcmcyr',
 'context'              => '&POSTcontext',
 'context-games'        => '&POSTcontext_games',
 'coordsys'             => '&POSTcoordsys',
 'ctanify'              => '&POST_do_man',
 'cs'                   => '&POSTcs',
 'cslatex'              => '&POST_cstexpkgs',
 'csplain'              => '&POST_cstexpkgs',
 'cstex'                => '&POSTcstex',
 'dehyph-exptl'         => '&POSTdehyph_exptl',
 'doipubmed'            => '&POSTlatex2html',
 'download'             => '&POST_savepdf',
 'e-french'             => '&POSTe_french',
 'encxvlna'             => '&POSTencxvlna',
 'enigma'               => '&POSTenigma',
 'eplain'               => '&POSTeplain',
 'epspdf'               => '&POSTepspdf',
 'fixme'                => '&POSTfixme',
 'font-change-xetex'	=> '&POSTfont_change_xetex',
 'formation-latex-ul'	=> '&POSTformation_latex_ul',
 'fpl'                  => '&POSTfpl',
 'frenchle'             => '&POST_rmsymlink',
 'ghsystem'             => '&POSTghsystem',
 'glossaries'           => '&POST_do_man',
 'grotesq'              => '&POSTgrotesq',
 'grverb'               => '&POSTgrverb',
 'hustthesis'		=> '&POSThustthesis',
 'ibygrk'               => '&POSTibygrk',
 'isodoc'		=> '&POSTisodoc',
 'impatient'            => '&POSTimpatient',
 'interactiveworkbook'  => '&POSTinteractiveworkbook',
 'knitting'             => '&POSTknitting',
 'knuth'                => '&POSTknuth',
 'knuth-lib'            => '&POSTknuth_lib',
 'koma-script'          => '&POSTkoma_script', #'&POST_rmsymlink',
 'kotex-oblivoir'       => '&POSTkotex_oblivoir',
 'kotex-utf'            => '&POSTkotex_utf',
 'l3build'		=> '&POST_do_man',
 'latex2e-help-texinfo' => '&POSTlatex2e_help_texinfo',
 'lhcyr'                => '&POSTlhcyr',
 'lilyglyphs'           => '&POSTlilyglyphs',
 'listbib'              => '&POSTlistbib',
 'lithuanian'           => '&POSTlithuanian',
 'lni'                  => '&POST_rmsymlink',
 'lollipop'             => '&POST_otherformat',
 'lua-check-hyphen'     => '&POST_rmsymlink',
 'luaotfload'           => '&POST_do_man',
 'luatexja'             => '&POSTluatexja',
 'm-tx'                 => '&POSTmtx',
 'mathdesign'           => '&POSTmathdesign',
 'mflogo'               => '&POST_rmsymlink',
 'montex'               => '&POSTmontex',
 'mptopdf'              => '&POSTmptopdf',
 'musixtex'             => '&POSTmusixtex',
 'musixtnt'             => '&POSTmusixtnt',
 'niceframe'            => '&POST_rmsymlink',
 'numericplots'         => '&POSTnumericplots',
 'nwejm'		=> '&POSTnwejm',
 'pas-cv'               => '&POSTpas_vc',
 'pbibtex-base'		=> '&POSTpbibtex_base',
 'pedigree-perl'        => '&POSTpedigreeperl',
 'pgfornament'		=> '&POSTpgfornament',
 'pgfplots'             => '&POSTpgfplots',
 'pict2e'               => '&POSTpict2e',
 'pmx'                  => '&POSTpmx',
 'pmxchords'            => '&POST_do_man',
 'prerex'               => '&POSTprerex',
 'pst-cox'              => '&POSTpstcox',
 'pst-geo'              => '&POSTpstgeo',
 'ptex-fontmaps'        => '&POSTptex_fontmaps',
 'pxbase'               => '&POSTpxbase',
 'pxchfon'              => '&POSTpxchfon',
 'recipebook'		=> '&POST_rmsymlink',
 'simple-resume-cv'	=> '&POST_simple_rmFonts',
 'simple-thesis-dissertation' => '&POST_simple_rmFonts',
 'splitindex'           => '&POST_do_man',
 'startex'              => '&POST_otherformat', 
 'tap'                  => '&POSTtap',
 'texdraw'              => '&POSTtexdraw',
 'tex-ps'               => '&POSTtex_ps',
 'tikz-cd'              => '&POSTtikz_cd',
 'tipa-de'              => '&POST_rmsymlink',
 'tudscr'		=> '&POSTtudscr',
 'velthuis'		=> '&POSTvelthuis',
 'xecyr'                => '&POSTxecyr',
 'xetex-pstricks'       => '&POSTxetexpstricks',
 'xsim'                 => '&POSTxsim',
 'xymtex'               => '&POSTxymtex',
 'zhmetrics'            => '&POSTzhmetrics',
);


%specialdest = (
);
$standarddest = "texmf-dist";


%specialfmt = (
 'abbr',        'generic',
 'abstyles',    'generic',
 'amstex',      'amstex',
 'antomega',    'omega',
 'arabxetex',   'xelatex',
 'arrayjob',    'generic',
 'babel',       'generic',
 'barr',        'generic',
 'bghyphen',    'generic',
 'bibtex',      'generic',
 'chronosys',   'generic',
 'circ',        'latex',
 'cirth',       'generic',
 'cyrplain',    'plain',
 'dad',		'lualatex',
 'dehyph-exptl','generic',
 'dratex',      'generic',
 'e-french',	'generic',
 'edmac',       'generic',
 'eijkhout',    'generic',
 'enctex',      'generic',
 'epigram',     'generic',
 'eplain',      'eplain',
 'epsf',        'generic',
 'esint-type1', 'plain',
 'expex',       'generic',
 'fenixpar',    'generic',
 'fltpoint',    'generic',
 'fontch',      'plain',
 'genmisc',     'generic',
 'german',      'generic',
 'hyphenex',    'generic',
 'hyplain',     'plain',
 'ibygrk',      'generic',
 'iftex',       'generic',
 'ifxetex',     'generic',
 'jadetex',     'jadetex',
 'japanese',    'platex',
 'knuth-lib',	'plain',
 'knuth-local', 'plain',
 'kotex-plain', 'plain',
 'levy',        'generic',  # one .sty, one .tex
 'lollipop',	'lollipop',
 'luatexja',    'luatex',
 'luaxml',      'luatex',
 'mathabx',     'generic',
 'mathdots',    'generic',
 'metatex',     'plain',
 'mfpic',       'generic',
 'midnight',    'generic',
 'mkpattern',   'plain',
 'musixtnt',	'generic',
 'oberdiek',    'generic',
 'ocherokee',   'lambda',
 'ofs',         'generic',
 'oinuit',      'lambda',
 'passivetex',  'xmltex',
 'pdcmac',      'plain',
 'pdf-trans',   'generic',
 'philokalia',  'xelatex',
 'pictex',      'generic',
 'placeins-plain',      'plain',
 'plnfss',              'plain',
 'pmx',                 'generic',
 'pstricks',            'generic',
 'pst-cox',             'generic',
 'ptex-base',		'ptex',
 'pxbase',              'platex',
 'pxchfon',             'platex',
 'pxjahyper',           'platex',
 'pxrubrica',           'platex',
 'rsfs',                'plain',
 'ruhyphen',            'generic',
 'shapepar',            'generic',
 'spelling',            'luatex',
 'startex',             'startex',
 'systeme',             'generic',
 'tabto-generic',       'generic',
 'tap',                 'generic',
 'texdraw',             'generic',
 'texsis',              'texsis',
 'textmerg',            'generic',
 'tugboat-plain',       'plain',
 'ulem',                'generic',
 'uptex-base',		'uptex',
 'utf8mex',             'mex',
 'variations',          'generic',
 'vaucanson-g',         'generic',
 'vertex',              'plain',
 'wasy',                'plain',
 'xepersian',           'xelatex',
 'xesearch',            'xetex',
 'xetex-def',           'xelatex',
 'xetexfontinfo',       'xetex',
 'xetexko',             'xetex',
 'xevlna',              'xelatex',
 'xint',                'generic',
 'xltxtra',             'xelatex',
 'xstring',             'generic',
 'xunicode',            'xelatex',
 'zhspacing',           'xetex',
);
$standardfmt='latex';


# packages which need special .tex/.sty files installed
$standardtex
   = '(\.(.bx|4ht|cls|clo|cmap|code\.tex|def|fd|fontspec|ldf|sty|trsl)'
    . '|.*[^c]\.cfg)$'; # not ltxdoc.cfg
%specialtex = (
 '2up',         '2up\.tex|' . $standardtex,
 'FAQ-en',      'NULL',
 'uowthesis',   '\.(eps|png)|' . $standardtex,
 'abbr',        '\.tex',
 'abstyles',    'apreambl.tex', # not a4c.sty
 'aobs-tikz',   'tikz.*tex',
 'ae',          '\.fd$|\.sty', 
 'alertmessage','img|' . $standardtex,
 'amscls-doc',	'NULL',
 'amstex',      '\.st[iy]|ams(ppt1|tex).tex|amstex.bug',
 'apa',         '\.apa|\.cls',  # not endfloat.cfg
 'apa6',        'config|' . $standardtex,
 'apacite',     '\.apc|' . $standardtex,
 'apnum',	'apnum.tex',
 'arabtex',     '\.tex|' . $standardtex,
 'autoaligne',  '\.tex|' . $standardtex,
 'babel',       'bl?plain\.tex|' . $standardtex,
 'babel-french',        '\.lua|' . $standardtex,
 'babel-georgian',      'georgiancaps\.tex|' . $standardtex,
 'babelbib',    '\.bdf|\.sty',
 'bagpipe',	'bagpipex?\.(tex|ini)',
 'bangtex',     'bangfont\.tex|' . $standardtex,
 'bangorcsthesis',	'Bangor-Logo\.tex|' . $standardtex,
 'bardiag',     '\.bar|\.sty|\.cfg',
 'barr',        'diagxy.tex',
 'base',        'idx.tex|lablst.tex|latexbug.tex|lablst.tex|docstrip.tex|nfssfont.tex|sample2e.tex|small2e.tex|testpage.tex|ltxcheck.tex|\.cfg|\.fd$|\.cls|\.clo|\.ltx|\.sty|\.def|^\.',
 'bbold',       'bbold.sty|\.fd',       # no fonttabl.sty
 'bclogo',      'bc[^l].*\.(tex|pdf|eps|mps)|bclogo\.sty',
 'beamer2thesis','\.jpg|' . $standardtex,
 'bghyphen',    '\.tex',
# 'bgteubner',   '\.sty|\.cls|[^c]\.cfg',        # not ltxdoc.cfg
 'biblatex-gost', '\.(.bx|def|)$',      # not .cfg
 'bibtex',      'apalike\..*|' . $standardtex,
 'bidi',        '^bidi\.tex|' . $standardtex,
 'blockdraw_mp','NULL',                 # skip .sty's
 'booktabs-de', 'NULL',                 # doc package
 'booktabs-fr', 'NULL',                 # doc package
 'breqn',       '\.sty|\.sym',
 'c-pascal',    '^[^d].*\.tex|' . $standardtex, # not demo*.tex
 'calxxxx',     'cal.*\.tex',
 'calxxxx-yyyy','cal.*\.tex',
 'captcont',    '\.sty|[^c]\.cfg',      # omit ltxdoc.cfg, would be system-wide
 'captdef',     '^..[^s].*\.sty',       # not miscdoc.sty
 'carlisle',    '\.sty|\.ltx',
 'chemfig',     '(t-)?chemfig.tex|' . $standardtex,
 'chemstyle',   '\.jdf|' . $standardtex,
 'chickenize',  'chickenize\.tex|\.lua|' . $standardtex,
 'chronosys',   '^(x-)?chronosys',
 'cirth',       'num\.tex',
 'cjw',         '\.tex|' . $standardtex,
 'clock',       '\.sty|clock\.tex',
 'cmap',        '\.cmap|' . $standardtex,
 'codepage',    '\.sty|\.tex',
 'colortab',    'colortab\.tex|' . $standardtex,
 'components-of-TeX',   'NULL',
 'concepts',    'concepts\.sty',
 'contracard',  "$package\.(cls|sty)",
 'contour',     '\.cfg|\.sty|\.cnt',
 'csplain',     '\.tex',
 'ctib',        '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$|ctib\.tex',
 'custbib',     '\.mbs|\.tex',
 'custom-bib',  '\.mbs|\.tex',
 'cweb-latex',  'cwebbase.tex|' . $standardtex,
 'cyrillic',    '\.tex|\.sty|\.fd$|\.def',
 'cyrplain',    '.',
 'dccpaper',    'dccpaper-base.tex|dccpaper-by.(eps|pdf)|' . $standardtex,
 'dehyph-exptl','de.*-x-.*\.tex|\.pat',
 'dialogl',     '[^c]\.sty|listout\.tex', # not dialogl-doc.sty
 'din1505',     'NULL', # no tex files, only natbib.cfg, would be system-wide
 'dirtree',     '\.tex|' . $standardtex,
 'disser',      '\.rtx|' . $standardtex,
 'dlfltxb',     '\.sty', # no sample.cfg
 'docbytex',	'docby\.tex',
 'doclicense',  'images|license-texts|' . $standardtex,
 'duckuments',	'example-image.*pdf|' . $standardtex,
 'ean',         'ean[0-9]*\.tex',
 'easy',        'easy.*\.sty',          # no mydoc.sty
 'ecv',         '\.sty|\.cls|\.ldf',    # no docstrip.cfg, else system-wide
 'edmac',       'edmac.tex|edstanza.tex|\.sty',
 'enctex',	'(1250-|852-|csfmacro|enc-u|encmacro|il2-|kam-'
                  . '|mixcodes|noprefnt|plain-|polyset|t1macro|utf8).*\.tex',
 'epsf-dvipdfmx', 'epsf-dvipdfmx\.tex',
 'esami',       '\.sty|\.lng',          # no example .cfg
 'expex',       '\.tex|' . $standardtex,
 'exsheets',    'dicts|' . $standardtex,
 'eijkhout',    '\.tex',
 'einfuehrung', 'NULL',                 # doc package 
 'einfuehrung2','NULL',                 # doc package 
 'eltex',       'eltex.*tex',
 'elsarticle',  'elsarticle.cls',       # no rvdtx, pdfwidgets
 'enigma',      'NULL',
 'epigram',     'epigram.tex',
 'epsf',        'epsf.(tex|sty)',
 'epslatex-fr', 'NULL',
 'esint-type1', 'esint.tex',
 'etdipa',	'NULL',			# doc says "copy all files"
 'europasscv',  '(icon|logo).*\.pdf|' . $standardtex,
 'europecv',    'EuropeFlag|europasslogo|\.cls|\.def',
 'exam-n',	'\.cls',		# not .clo example file
 'fancytooltips',       'fancytipmark\..*|' . $standardtex,
 'figflow',     '\.tex',
 'fjodor',      'fjodor\.sty',          # not srbook-mem.sty
 'flashmovie',  '\.swf|' . $standardtex,
 'fltpoint',    '\.sty|\.tex',
 'fntproof',    'fntproof.tex',
 'font-change', 'default-amssymbols.tex|font_.*\.tex',
 'fontawesome',	'fontawesomesymbols-.*\.tex|' . $standardtex,
 'fontawesome5','\.lua|' . $standardtex,
 'fontch',      '\.tex',
 'fontloader-luaotfload',    '\.lua$',
 'footnpag',    'footnpag\.sty',
 'fragments',   '\.tex|' . $standardtex,
 'frame',       'frame\.tex|' . $standardtex,
 'francais-bst','francaisbst.tex',
 'frankenstein','\.(sto|stq)|' . $standardtex,
 'gates',       '\.lua|gates.tex|' . $standardtex, # both t-gates and gates
 'genealogytree','code\.tex|' . $standardtex,
 'genmisc',     '\.sty|\.tex',
 'geometry',    '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$', # not cfg
 'geometry-de', 'NULL',                 # all doc
 'german',      '\.sty',
 'getoptk',     '\.tex',
 'gfnotation',	'notation\.tex',
 'ginpenc',     '\.gie|\.sty',
 'gobble',	'gobble\.tex|' . $standardtex,
 'graphics-pln','^[^e].*\.tex|.*\.sty',  # not exmpl*
 'greek-inputenc', '\.def|\.dfu$',
 'hanoi',       'hanoi\.tex',           
 'harvmac',     'mac\.tex',
 'hc',          '\.hld|' . $standardtex,
 'hlist',	'hlist\.tex|' . $standardtex,
 'hobby',       'code\.tex|' . $standardtex,
 'hrefhide',    '\.sty|[^c]\.cfg',      # omit ltxdoc.cfg, would be system-wide
 'hyper',       '^[^d].*\.sty|\.hyp',   # not defpattern.sty
 'hyphenex',    'ushyphex\.tex',
 'hyplain',     '(hyrules|hy.*plain|hylang)\..*',
 'ibygrk',      'iby4extr.tex|ibycus4.tex|ibycusps.tex|pssetiby.tex|setiby4.tex|tlgsqq.tex|version4.tex|' . $standardtex,
 'ifmslide',    '[^n]\.(eps|pdf|jpg)|' . $standardtex,  # not ifmman.pdf
 'ijsra',	'ijsra_logo.*|' . $standardtex,
 'insbox',      'insbox.tex',
 'interactiveworkbook', 'NULL', # done in POSTinteractiveworkbook
 'interpreter', 'interpreter.(tex|lua)|' . $standardtex,
 'ipaex-type1', '\.fdx|' . $standardtex,
 'iso10303',    'a.*tex|b.*tex|e.*tex|stp.*tex|\.sty|\.4ht',
 'isodate',     '\.idf|\.sty',
 'isodoc',      '\.cls|iso.*\.ldf',       # not *.sty
 'jadetex',     '\.ltx|\.def|\.tex|\.ini|\.sty|\.fd',
 'js-misc',     '(cassette|idverb|js-misc|schild|sperr|xfig)\.tex',
 'jslectureplanner', '\.lps|' . $standardtex,
 'karnaugh',    'kvmacros.tex',
 'kastrup',     'binhex.tex|' . $standardtex,
 'keystroke',   'keystroke_.*|\.sty',
 'knuth-lib',	'\.tex',
 'knuth-local', '\.tex',
 'koma-script-sfs', '\.lco',
 'kotex-plain', '\.tex',
 'kotex-utf',   'hfontspec.default|\.dfu|' . $standardtex,
 'kpfonts',     '\.sty|\.fd',
 'kuvio',       '\.tex|\.sty',
 'labyrinth',   '\.sty',        # not .cfg
 'langsci',	'(langsci(b|_|-[^d])|tbls|.*sp-).*', # not langsci-doc
 'lastpage',    '\.sty',        # not .cfg
 'latex-bib-ex',	'NULL',	# keep doc together
 'latex-bib2-ex',	'NULL', # keep doc together
 'latex-brochure',	'NULL', # keep doc together
 'latex-course',	'NULL', # keep doc together
 'latex-doc-ptr',	'NULL', # keep doc together
 'latex-referenz',	'NULL', # keep doc together
 'latex-veryshortguide','NULL', # keep doc together
 'latex4wp',    	'NULL', # keep doc together
 'latex4wp-it', 	'NULL', # keep doc together
 'leadsheets',	'\.library\.|' . $standardtex,
 'lecturer',    '(t-)?lecturer.(tex|sty)|ltr-',
 'leipzig',     'leipzig\.tex|' . $standardtex,
 'lettre',      'default\.ins|\.cls',
 'lettrine',    '\.cfl|' . $standardtex,
 'levy',        'greekmacros.tex|' . $standardtex,
 'lgrx',        '\.dfu$|' . $standardtex,
 'lhcyr',       'lhcyr.*',
 'librarian',   '(t-)?librarian.(tex|sty)',
 'lion-msc',	'-logo.pdf|' . $standardtex,
 'listbib',     'listbib.tex|' . $standardtex,
 'listings',     '\.prf|' . $standardtex,
 'listings-ext','\.sty',        # not .cfg
 'listofitems',	'listofitems.tex|' . $standardtex,
 'logic',       'milstd\.tex|' . $standardtex,
 'lollipop',	'\.ini|lollipop\.tex|lollipop-.*tex|lollipop.tex',
 'ltxkeys',     '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$',  # not cfg
 'lua-check-hyphen', '\.lua|' . $standardtex,
 'lua-visual-debug', '\.lua|' . $standardtex,
 'lua2dox',     'NULL',         # .def is lua code
 'luaintro',    'NULL',         # doc pkg
 'lualatex-math', '\.sty',      # not phst-doc.cls
 'luamesh',	'\.sty',        # not lltxdoc.cls
 'luapackageloader', '\.lua|' . $standardtex,
 'luatexko',    '\.lua|' . $standardtex,
 'luatodonotes','\.lua|' . $standardtex, 
 'luaxml',      '\.lua|' . $standardtex,
 'lyluatex',	'\.sty',	# not *.cls
 'magyar',      'NULL',  # do not install in runtime, conflicts with babel
 'manjutex',    '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$|manju.tex',
 'math-e',      'NULL',
 'math-into-latex-4', 'NULL',
 'mathdots',    'mathdots\.tex|' . $standardtex,
 'mdframed',    '\.mdf|' . $standardtex,
 'metatex',     'metatex.tex',
 'mff',         '\.sty|mf[^f].*\.tex',
 'mfpic',       'mfpic.tex|mfpic.sty|mfppatch.tex',
 'mfpic4ode',   'mfpic4ode.tex|' . $standardtex,
 'midnight',    '\.tex',
 'mil3',        'NULL',
 'mathabx',     'mathabx\.(dcl|tex)|' . $standardtex,
 'minitoc',     '\.ml[do]|' . $standardtex,
 'misc',        '\.sty|\.ltx|\.cls',
 'mkpattern',   'mkpatter.tex',
 'montex',      '(mlsgalig|mlstrans|mnhyphex)\.tex|' . $standardtex,
 'mpman-ru',    'NULL',         # doc package
 'msg',         '-msg\.tex|' . $standardtex,
 'msu-thesis',  'gb4e-compat\.tex|' . $standardtex,
 'multirow',    '^..[^s].*\.sty', # not miscdoc.sty
 'musixtex',    'NULL',           # not musixdoc.sty
 'musixtnt',    'musixtnt.tex',
 'mycv',        'mycv.*\.tex|' . $standardtex,
 'mylatexformat',       '.*\.ltx',
 'nag',         '\.nag|' . $standardtex,
 'navigator',   '(t-)?navigator.tex|' . $standardtex,
 'nddiss',      '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$',
 'nodetree',	'nodetree.(tex|lua)|' . $standardtex,
 'noindentafter',       "noindentafter\.sty",
 'notes',       '[^s]\.(eps|pdf|png)|' . $standardtex,  # not notes.pdf
 'ntheorem',    '\.sty|\.std',
 'nucleardata',	'\.(csv|hd|pytxcode)|' . $standardtex,
 'nwejm',	'[^c]\.cfg$|\.(.bx|sty|cls)$',	# not ltxdoc.cfg
 'ocgx',        'tikz.*\.code\.tex|' . $standardtex,
 'odsfile',     '\.lua|' . $standardtex,
 'ofs',         '^ofs\.tex|ofsdef\.tex|ofs-.*\.tex|\.sty|a.*\.tex|.*fn\.tex',
 'olsak-misc',	'(qrcode|scanbase|scancsv|xmlparser)\.tex',
 'pageslts',    '\.sty|[^c]\.cfg',      # not ltxdoc.cfg
 'papermas',    '\.sty|[^c]\.cfg',      # not ltxdoc.cfg, would be system-wide
 'passivetex',  '\.xmt|' . $standardtex,
 'patch',       '\.tex',
 'pdf-trans',   'pdf-trans.tex',
 'pdfcprot',    '\.cpa|\.sty',
 'pdfscreen',   'overlay.*pdf|but.*pdf|left.*pdf|right\.pdf|pdfscreen.sty',
 'pdfslide',    '\.jpg|\.sty|\.clo|\.cfg|meta.*\.pdf',
 'pdfx',        '\.(def|dfu|icc|xmp)$|(glyph|Profiles).*tex|pdfx\.sty|ICC_LIC',
 'petri-nets',  'pnets\.tex|pntext\.tex|\.sty|pndraw\.tex|pnversion\.tex|\.sty|pndraw\.tex',
 'pgf-blur',    'tikzlibraryshadows.blur.code.tex',
 'pgf-spectra', 'spectra.data.tex|' . $standardtex,
 'pgfmolbio',   'pgfmolbio\..*\.|' . $standardtex, # .lua+.tex submodules
 'pgfornament-han', 'han$|' . $standardtex,
 'phonenumbers','[A-Z][A-Z]_.*|Landes.*tex|' . $standardtex,
 'pictex',      '\.sty|\.tex',
 'pictexsum',   'NULL',         # doc pkg
 'pigpen',      'pigpen\.tex|' . $standardtex,
 'pitex',       'pitex\.tex|\.ptx|' . $standardtex,
 'pkgloader',   '^[^t].*\.sty', # not .cls, not test*.sty
 'placeins-plain',      'placeins.tex',
 'plain',	'\.tex',
 'plantuml',,	'\.lua|' . $standardtex,
 'plgraph',     '\.tex',
 'plipsum',     'plipsum.tex',
 'plnfss',      '\.tex|\.pfd',
 'plstmary',    '^stmary.tex',
 'pmx',         'pmx\.tex|' . $standardtex,
 'poster-mac',  'poster\.tex|' . $standardtex,
 'poetrytex',   'poetrytex\.sty$', # not -style
 'powerdot',    '\.ps|images|' . $standardtex,
 'ppchtex',     'm.*tex|m.*sty',
 'present',     'present.tex',
 'presentations-en',    'NULL', # doc pkg
 'prosper',     '\.ps|\.eps|\.sty|\.cls',
 'pstricks',    'pst-*\.tex',
 'pstricks-examples',   'NULL',
 'pstricks-examples-en','NULL',
 'pst-bspline', 'pst-bspline\.(tex|sty)',
 'pst-cox',     'pst-cox(coor|eterp)\.tex',
 'pst-eucl-translation-bg', 'NULL',
 'pst-geo',     'pst-map.*\.tex|pst-map.*\.sty',
 'pst-infixplot', 'infix-RPN\.tex|pst-infixplot\.tex',
 'pst-poker',   '\.eps|' . $standardtex,
 'pst-text',    'pst-(char|text)\.(tex|sty)',
 'ptex-base',	'\.(ini|lib|src)$|(ascii-jplain|kinsoku|ptex).tex$',
 'punk',        'NULL', # have separate punk-latex
 'qobitree',    'qobitree.tex',
 'r_und_s',     '\.tex|\.sty',
 'randomlist',	'randomlist\.tex|' . $standardtex,
 'realcalc',    'realcalc.tex',
 'resumemac',   'resumemac.tex',
 'revtex',      '\.sty|\.cls|\.rtx',
 'rlepsf',      'rlepsf.tex',
 'rsfs',        'scrload\.tex|' . $standardtex,
 'ruhyphen',    '\.tex',
 'sa-tikz',     'tikzlib.*tex|' . $standardtex,
 'sansmath',    '^..[^s].*\.sty', # not miscdoc.sty
 'scrlttr2copy','\.lco',
 'sduthesis',	'figures|' . $standardtex,
 'selnolig',    '\.lua|' . $standardtex,
 'seminar',     '\.bug|\.bg2|\.cls|\.sty|2up.tex',
 'shade',       'shade\.tex',  # not description.tex
 'shadethm',    '\.sth|' . $standardtex,
 'simplekv',	'simplekv\.tex|' . $standardtex,
 'simurgh',     '\.lua|' . $standardtex,
 'spanish',     'NULL',  # babel conflict
 'showexpl',    '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$',  # not cfg
 'skeycommand', '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$',  # not cfg
 'smartdiagram','code\.tex|' . $standardtex,
 'splitindex',  'splitindex\.tex|' . $standardtex,
 'spotcolor',   'spotcolor.*\.tex|' . $standardtex,
 'startex',     '\.(tex|stx|lan)$',
 'subfig',      '\.sty|[^c]\.cfg',      # not ltxdoc.cfg, would be system-wide
 'subfigure',   '\.sty|[^c]\.cfg',      # not ltxdoc.cfg, would be system-wide
 'syntax',      'syntax\.tex',
 'systeme',     '^systeme\.tex$|' . $standardtex,
 'tabls',       '^[^m].*\.sty',         # not miscdoc.sty
 'tabto-generic','tabto.tex',
 'tap',         ,'tap.tex',
 'taylor',      'diagrams.tex',
 'termmenu',    '\.tex',
 'tex-ewd',     'dotnot.tex',
 'tex-ini-files','\.(dat|ini|tex)$',
 'tex-ps',      '\.tex',
 'texapi',      'texapi\.tex',
 'texdraw',     'tex$|' . $standardtex,
 'texosquery',  '\.tex$|' . $standardtex,
 'texproposal', 'NULL',
 'texsis',      '\.txs|TXS.*tex|texsis.tex',
 'thesis-ekf',  'images|\.cls',			# not magyar.ldf
 'thesis-titlepage-fhac','LOGO.*|' . $standardtex,
 'threeparttable',      '^..[^s].*\.sty',	# not miscdoc.sty
 'ticket',      '\.tdf|' . $standardtex,
 'tikz-cd',     'tikz-cd.sty|tikzlibrarycd.code.tex',   # not pgfmanual.sty
 'tikz-karnaugh',	'\.code\.tex$',
 'tikz-qtree',  '(pgf|tikz-)(subpic|q?tree(-compat)?)\.(tex|sty)',
 'tikz-sfc',	'\.code\.tex$',
 'tikzposter',  'tikzposter[^-].*\.tex|' . $standardtex,
 # tipa: we want to install all .sty except tipaman|boxchar|codelist.
 # i can't explain why ^(?!...), the "zero-width negative look-ahead
 # assertion", is what works, but it does. found in (and modified from)
 # the perl cookbook,
 # http://docstore.mik.ua/orelly/perl/cookbook/ch06_18.htm,
 # Expressing AND, OR, and NOT in a Single Pattern.  Fun, huh?
 'tipa',        '\.fd$|\.def$|^(?!tipaman|boxchar|codelist).*\.sty$',
 'tipa-de',     'NULL',                 # doc package
 'titleref',    '^..[^s].*\.sty',       # not miscdoc.sty
 'tikz-feynman','\.lua|' . $standardtex,
 'tkz-orm',     'tkz.*\.sty',           # no pgfmanual.sty
 'tlc2',        'NULL',                 # doc package
 'tools',       '\.cfg|\.sty|\.clo|\.cls|\.def|\.fd$|.?\.tex|^\.tex$',
 'toptesi',	'toptesi\.cfg|\.sty|\.cls',
 'translator',  '\.dict|translator-language-mappings.tex|' . $standardtex,
 'translation-array-fr',        'NULL', # doc
 'translation-europecv-de',     'NULL', # doc
 'translation-tabbing-fr',      'NULL', # doc
 'treetex',     '(treetex|l_pic|classes)\.tex',
 'trigonometry','\.tex',
 'truncate',    '^..[^s].*\.sty',       # not miscdoc.sty
 'tudscr',	'DDC.*|TUD.*|' . $standardtex,
 'tugboat-plain','\.cmn|' . $standardtex,
 'uestcthesis', '\.png|' . $standardtex,
 'udesoftec',   'udesoftec-cover|\.cls|\.def',
 'ulthese',     'ulthese.cls|ul_p\.(eps|pdf)', # logo for the university
 'underoverlap','underoverlap\.sty',
 'underscore',  '^..[^s].*\.sty',       # not miscdoc.sty
 'undolabl',    '\.sty|[^c]\.cfg',      # omit ltxdoc.cfg, would be system-wide
 'unitn-bimrep','\.jpg|' . $standardtex,
 'univie-ling',	'univie.*logo.*.pdf|' . $standardtex,
 'universa',    '\.fd|uni\.sty',        # not unidoc.sty
 'upca',        '^upca\.tex',
 'uptex-base',	'\.(ini|src|tex)$',
 'url',         '^[^m].*\.sty',         # not miscdoc.sty
 'utf8mex',     '^utf8.*\.(ini|tex)',
 'variations',  '^variations\.tex|' . $standardtex,  # not docvariations.tex
 'varisize',    '\.tex',
 'varwidth',    '^..[^s].*\.sty',       # not miscdoc.sty
 'vaucanson-g', '\.(def|tex)|' . $standardtex,
 'vertex',      'vertex\.tex|' . $standardtex,
 'vhistory',    '\.sty',                # not hyperref.cfg
 'voss-mathmode','NULL',                # doc
 'vrb',         'vrb\.tex',
 'vruler',      '^..[^s].*\.sty', # not miscdoc.sty
 'wallcalendar','i18n|\.lua$|' . $standardtex,
 'wasy',        'wasyfont\.tex',
 'wordcount',   '\.tex',
 'xcomment',    'xcomment\.tex|' . $standardtex,
 'xduthesis',	'\.eps|' . $standardtex,
 'xepersian',   'xepersian-mathsdigitspec\.tex|' . $standardtex,
 'xesearch',    't-.*|' . $standardtex,
 'xetexfontinfo','\.tex',
 'xetexko',     '\.tab$|' . $standardtex,
 'xwatermark',  '\.sty',                # no .cfg
 'xlop',        'xlop\.(tex|sty)',      # no manual.sty
 'xstring',     'xstring\.tex|' . $standardtex,
 'yathesis',    '\.(sty|cls)$',         # no .cfg
 'yax',         '(t-)?yax\.(sty|tex)|' . $standardtex,
 'zefonts',     '\.sty|\.fd',
);


%specialdocfmt = (
 'Asana-Math',          'fonts',
 'FAQ-en',              'generic',
 'Type1fonts',          'fonts',
 'a2ping',		'support',
 'abbr',                'generic',
 'abstyles',            'bibtex',
 'apalike',             'bibtex',
 'accfonts',            'fonts',
 'allrunes',            'fonts',
 'amstex',              'amstex',
 'antomega',            'omega',
 'arabxetex',           'xelatex',
 'archaic',             'fonts',
 'arev',                        'fonts',
 'around-the-bend',             'generic',
 'arrayjob',                    'generic',
 'ascii-chart',                 'support',
 'astro',                       'fonts',
 'asymptote-faq-zh-cn',         'support',
 'asymptote-by-example-zh-cn',  'support',
 'asymptote-manual-zh-cn',      'support',
 'aurical',                     'fonts',
 'automata',                    'metapost',
 'autosp',			'generic',
 'ascii',                       'fonts',
 'barr',                        'generic',
 'bartel-chess-fonts',          'fonts',
 'bbm',                         'fonts',
 'bengali',                     'fonts',
 'bera',                        'fonts',
 'bghyphen',                    'generic',
 'bib-fr',                      'bibtex',
 'bibhtml',                     'bibtex',
 'blacklettert1',               'fonts',
 'boisik',                      'fonts',
 'bundledoc',                   'support',
 'burmese',                     'fonts',
 'cbfonts',             'fonts',
 'cc-pl',               'fonts',
 'cfr-lm',              'fonts',
 'chicago-annote',      'bibtex',
 'chemarrow',           'fonts',
 'chronosys',           'generic',
 'circ',                'latex',
 'cirth',               'fonts',
 'cjhebrew',            'fonts',
 'cjk-gs-integrate',    'fonts',
 'cm-super',            'fonts',
 'cmarrows',            'metapost',
 'cmexb',		'fonts',
 'components-of-TeX',   'generic',
 'concmath',            'fonts',
 'concmath-fonts',      'fonts',
 'context-notes-zh-cn', 'context/third',
 'context-top-ten',     'context/third',
 'dad',			'fonts',
 'de-macro',            'support',
 'dehyph-exptl',        'generic',
 'devanagr',            'fonts',
 'dictsym',             'fonts',
 'dingbat',             'fonts',
 'dinat',               'bibtex',
 'doublestroke',        'fonts',
 'doc-pictex',          'generic',
 'dozenal',             'fonts',
 'dratex',              'generic',
 'e-french',		'generic',
 'eco',                 'fonts',
 'economic',            'bibtex',
 'edmac',               'generic',
 'eiad',                'fonts',
 'elhyphen',            'generic',
 'elsevier-bib',        'bibtex',
 'elvish',              'fonts',
 'enctex',              'generic',
 'encxvlna',            'generic',
 'epigrafica',          'fonts',
 'eplain',              'eplain',
 'epsf',                'generic',
 'epspdf',              'support',
 'eurofont',            'fonts',
 'eurosym',             'fonts',
 'expex',               'generic',
 'expressg',            'metapost',
 'exteps',              'metapost',
 'fc',                  'fonts',
 'fenixpar',            'generic',
 'feyn',                 'fonts',
 'fge',                 'fonts',
 'fig4latex',           'support',
 'findhyph',            'support',
 'fltpoint',            'generic',
 'font-change-xetex',	'xetex',
 'fontch',              'plain',
 'fontools',            'support',
 'fourier',             'fonts',
 'fouriernc',           'fonts',
 'fpl',                 'fonts',
 'fragmaster',          'support',
 'frcursive',           'fonts',
 'genmisc',             'generic',
 'german',              'generic',
 'gfsartemisia',        'fonts',
 'gfsbaskerville',      'fonts',
 'gfsbodoni',           'fonts',
 'gfscomplutum',        'fonts',
 'gfsdidot',            'fonts',
 'gfsneohellenic',      'fonts',
 'germbib',             'bibtex',
 'gnu-freefont',        'fonts',
 'gost',                'bibtex',
 'greenpoint',          'fonts',
 'hieroglf',            'fonts',
 'hyplain',             'plain',
 'ibygrk',              'fonts',
 'iftex',               'generic',
 'ifxetex',             'generic',
 'ijqc',                'bibtex',
 'impatient',           'plain',
 'impatient-cn',        'plain',
 'impatient-fr',        'plain',
 'inconsolata',         'fonts',
 'iopart-num',          'bibtex',
 'jablantile',          'fonts',
 'jadetex',             'jadetex',
 'japanese',            'platex',
 'japanese-otf',        'fonts',
 'japanese-otf-uptex',  'fonts',
 'junicode',            'fonts',
 'kixfont',             'fonts',
 'knitting',            'fonts',
 'kotex-plain',         'plain',
 'kpfonts',             'fonts',
 'latexmk',             'support',
 'latexmp',             'metapost',
 'leawood',             'fonts',
 'lfb',                 'fonts',
 'lh',                  'fonts',
 'latex-notes-zh-cn',   'generic',
 'lollipop',            'otherformats',
 'lua-alt-getopt',      'support',
 'lua2dox',             'support',
 'luaintro',            'luatex',
 'luatexja',            'luatex',
 'luaxml',              'luatex',
 'marvosym',            'fonts',
 'mathabx',             'fonts',
 'mathdots',            'generic',
 'mcf2graph',		'metapost',
 'memdesign',           'fonts',
 'metafont-beginners',  'fonts',
 'metatex',             'plain',
 'metauml',             'metapost',
 'mfpic',               'generic',
 'midnight',            'generic',
 'mkgrkindex',          'support',
 'mkpattern',           'plain',
 'mkjobtexmf',          'generic',
 'musixtex',            'generic',
 'musixtnt',            'generic',
 'mxedruli',            'fonts',
 'nkarta',              'fonts',
 'npp-for-context',	'context/third',
 'oberdiek',            'generic',
 'ocherokee',           'omega',
 'ofs',                 'generic',
 'oinuit',              'fonts',
 'oldlatin',            'fonts', 
 'orkhun',              'fonts',
 'ot2cyr',              'fonts',
 'pacioli',             'fonts',
 'patgen2-tutorial',    'support',
 'pdcmac',              'plain',
 'pdf-trans',           'generic',
 'pdfcrop',             'support',
 'pedigree-perl',       'support',
 'persian-bib',         'xelatex',
 'phaistos',            'fonts',
 'philokalia',          'xelatex',
 'phonetic',            'fonts',
 'pictex',              'generic',
 'pkfix',               'support',
 'pkfix-helper',        'support',
 'pl',           	'fonts',
 'plain-doc',           'plain',
 'plnfss',              'plain',
 'pmx',                 'generic',
 'pst-cox',             'generic',
 'ptex-base',		'ptex',
 'ptex-fontmaps',       'fonts',
 'purifyeps',           'support',
 'pxfonts',             'fonts',
 'pxbase',              'platex',
 'pxchfon',             'platex',
 'pxjahyper',           'platex',
 'pxrubrica',           'platex',
 'recycle',             'fonts',
 'rsfs',                'fonts',
 'shapepar',            'generic',
 'skak',                'latex',
 'skaknew',             'fonts',
 'spelling',            'luatex',
 'splines',             'metapost',
 'startex',             'otherformats',
 'staves',              'fonts',
 'systeme',             'generic',
 'tamil-omega',         'omega',
 'tap',                 'generic',
 'tex-refs',            'generic',
 'tex-virtual-academy-pl',	'generic',
 'texbytopic',          'plain',
 'texcount',            'support',
 'texdiff',             'support',
 'texdirflatten',       'support',
 'texdraw',             'support',
 'texloganalyser',      'support',
 'texsis',              'otherformats',
 'textmerg',            'generic',
 'textpath',            'metapost',
 'timing',              'fonts',
 'trajan',              'fonts',
 'tugboat-plain',       'plain',
 'txfonts',             'fonts',
 'txfontsb',            'fonts',
 'ulem',                'generic',
 'universa',            'fonts',
 'uptex-base',		'uptex',
 'utf8mex',             'mex',
 'vancouver',           'bibtex',
 'variablelm',          'fonts',
 'variations',          'generic',
 'vaucanson-g',         'generic',
 'velthuis',            'generic',
 'vertex',              'plain',
 'wasy2',               'fonts',
 'xepersian',           'xelatex',
 'xesearch',            'xetex',
 'xetex-devanagari',    'xetex',
 'xetex-itrans',        'xelatex',
 'xetex-pstricks',      'xetex',
 'xetex-tibetan',       'xetex',
 'xetexfontinfo',       'xetex',
 'xetexko',             'xetex',
 'xetexref',            'xetex',
 'xevlna',              'xelatex',
 'xint',                'generic',
 'xltxtra',             'xelatex',
 'xq',                  'fonts',
 'xstring',             'generic',
 'xunicode',            'xelatex',
 'zhspacing',           'xetex',
);
$standarddocfmt='latex';


# needs special TeX program to run the doc.
%specialTEX = (
 'arabtex',     'tex',
 'barr',        'latex',
 'bytefield',   'pdflatex',
 'esint-type1', 'pdftex',
 'euro-ce',     'tex',
 'floatrow',    'latex',
 'genealogy',   'tex',
 'insbox',      'tex',
 'iso10303',    'pdflatex',
 'mfpic',       'tex',
 'ofs',         'csplain',
 'pdfscreen',   'pdflatex',
 'pdfslide',    'pdflatex',
 'pl-qx',       'platex',
 'sesamanuel',	'tex',
 'subfig',      'pdflatex',
 'texsis',      'tex',
 'typespec',    'tex',
 'wasy2',       'tex',
 'webeq',       'pdflatex',
);

# 
%specialsourcefmt = (
 'allrunes',    'fonts',
 'antomega',    'omega',
 'apl',         'fonts',
 'arabxetex',   'xelatex',
 'archaic',     'fonts',
 'arev',        'fonts',
 'arrayjob',    'generic',
 'blacklettert1','fonts',
 'blockdraw_mp','metapost',
 'burmese',     'fonts',
 'cb',          'fonts',
 'chemarrow',   'fonts',
 'circ',        'latex',
 'cirth',       'generic',
 'cjhebrew',    'fonts',
 'cmpica',      'fonts',
 'cryst',       'fonts',
 'dozenal',     'fonts',
 'eplain',      'eplain',
 'epsf',        'generic',
 'eurofonts',   'fonts',
 'eurosym',     'fonts',
 'expressg',    'metapost',
 'fc',          'fonts',
 'feyn',        'fonts',
 'fge',         'fonts',
 'figflow',     'plain',
 'fltpoint',    'generic',
 'fourier',     'fonts',
 'fouriernc',   'fonts',
 'fpl',         'fonts',
 'frcursive',   'fonts',
 'genmisc',     'generic',
 'german',      'generic',
 'germbib',     'bibtex',
 'gost',        'bibtex',
 'greenpoint',  'fonts',
 'hyphenex',    'generic',
 'jadetex',     'jadetex',
 'japanese',    'platex',
 'kixfont',     'fonts',
 'kpfonts',     'fonts',
 'latexmp',     'metapost',
 'leawood',     'fonts',
 'lfb',         'fonts',
 'latexmp',     'metapost',
 'mathdots',    'generic',
 'metatype1',	'metapost',
 'mkjobtexmf',  'generic',
 'mnhyphn',     'generic',
 'mfpic',       'generic',
 'multido',     'generic',
 'oberdiek',    'generic',
 'ofs',         'generic',
 'oinuit',      'lambda',
 'ot2cyr',      'fonts',
 'patch',       'generic',
 'pdcmac',      'plain',
 'philokalia',  'xelatex',
 'pictex',      'generic',
 'pstricks',    'generic',
 'pxbase',      'platex',
 'pxchfon',     'platex',
 'pxjahyper',   'platex',
 'pxrubrica',   'platex',
 'ruhyphen',    'generic',
 'splines',     'metapost',
 'startex',     'startex',
 't2',          'generic',
 'textmerg',    'generic',
 'trajan',      'fonts',
 'universa',    'fonts',
 'variations',  'generic',
 'velthuis',    'fonts',
 'wasy2',       'fonts',
 'xint',        'generic',
 'xltxtra',     'xelatex',
);
$standardsourcefmt='latex';


$standardsource = '(\.(bat|c|drv|dtx|fea|fdd|ins|sfd)'
                  . '|configure.*|install-sh|Makefile\..*|ltxdoc\.cfg)$';
%specialsource= (
 'FAQ-en',              'NULL',
 'ae',                  '\.mtx|\.etx|\.tex|clean|go|install|makepl',
 'amsldoc-vn',          'NULL',
 'apl',                 ".",                    # everything, simplest
 'arabxetex',           'NULL',                 # dtx with others, why not
 'axodraw2',		$standardsource . '|test', # in source/ too, but small
 'babelbib',            'NULL',                 # dtx with others, why not
 'bbold',               $standardsource . '|fonttabl.sty',
 'bib2gls',		'src/',
 'biber',               '.',                    # everything, lots done in post
 'bibtexperllibs',	'.',			# everything
 'bigints',             'NULL',
 'blacklettert1',       '\.dtx|\.ins|\.pl|Makefile',
 'booktabs-de',         'NULL',                 # doc package
 'booktabs-fr',         'NULL',                 # doc package
 'burmese',             '\.pl',
 'carlisle',            '\.dtx|\.ins|ltxtable\.tex',
 'chemarrow',           '\.mp|\.vfb',
 'cmextra',             'NULL',
 'concmath-fonts',      'NULL',
 'crossword',           $standardsource . '|AcrossLite',
 'ctan-o-mat',          'NULL',                 # process .bat
 'cyrplain',            'NULL',                 # all in tex
 'dccpaper',            $standardsource . '|Makefile',
 'docbytex',		'NULL',
 'epsf',                'NULL',
 'epslatex-fr',         'NULL',
 'epspdf',              'NULL',                 # leave .install
 'eskdx',               'NULL',                 # leave makefiles
 'eurosym',             'NULL',                 # leave makefiles, etc.
 'export',              '\.l$|' . $standardsource,
 'feynmf',              'feynmf\.pl|' . $standardsource,
 'findhyph',            'NULL',                 # leave makefile
 'fmtcount',            'fmtcount.perl|' . $standardsource,
 'fpl',                 'Add|\.pe|\.ps' . $standardsource,
 'fullblck',            '\.asc|' . $standardsource,
 'grverb',              '\.vpl|' . $standardsource,
 'geometry-de',         'NULL',                 # keep together
 'grverb',              '\.vpl|' . $standardsource,
 'hyper',               '\.pl|' . $standardsource,
 'hyphenex',            '.',			# everything
 'impatient',           'NULL',                 # doc package
 'intro-scientific',    'NULL',                 # doc package
 'js-misc',             'NULL',                 # no gain in splitting up
 'kpfonts',             '\.zip',
 'latex-doc-ptr',       'NULL',                 # doc package
 'latex-veryshortguide','NULL', 		# doc package
 'latex2e-help-texinfo','NULL',                 # doc package
 'latex2man',           'NULL',                 # leave Makefile
 'latexdiff',           'NULL',                 # leave Makefile
 'lettre',              'NULL',
 'lhcyr',               'README',               # historical
 'lua-alt-getopt',      'NULL',
 'lua2dox',             'NULL',                 # process lua2dox_filter.bat
 'mdframed',            'Makefile|' . $standardsource,
 'metatype1',		'.',			# everything
 'mff',                 '\.mfj|\.bat|\.diz',
 'microtype-de',        'NULL',                 # doc package
 'mkjobtexmf',          'Makefile.in|' . $standardsource,
 'mpman-ru',            'NULL', # doc package
 'needspace',           '\.tex|' . $standardsource,
 'ot2cyr',              '\.afm|\.etx|' . $standardsource,
 'patch',               '\.doc',
 'pdfx',                'rvdtx\.sty|' . $standardsource,
 'poetrytex',           'Makefile|' . $standardsource,
 'pst-pdf',		'\.(dtx|ins|e?ps|png)$|CHANGES.tex',
 'pygmentex',		'NULL',	# keep together
 'rcs',                 'rcs.el|src|' . $standardsource,
 'ruhyphen',            '^[^.]*$|README.ru|hyphen.rules',
 'selnolig',            'NULL',                 # not .fea
 'texosquery',		'java|\.batch$|' . $standardsource,
 'thailatex',           'NULL',                 # no gain in splitting up
 'translation-array-fr',        'NULL',         # doc
 'translation-chemsym-de',      'NULL',         # doc
 'translation-dcolumn-fr',      'NULL',         # doc
 'translation-filecontents-de', 'NULL',         # doc
 'translation-natbib-fr',       'NULL',         # doc
 'translation-tabbing-fr',      'NULL',         # doc
 'tkz-orm',             'NULL',                 # no gain ...
 'velthuis',		'NULL',
 'xlop',                'manual.sty|' . $standardsource,
);


# special cases of which .ins files to run; used to remove
# normal choices, and get the most general.
%specialins = (
 'aastex',      'NULL',                 # everything is pregenerated
 'autopdf',     'NULL',                 # everything is pregenerated
 'base',        'NULL',
 'booktabs-de', 'NULL',                 # doc, no need to build
 'blacklettert1','NULL',                # don't try to do fontinst
 'carlisle',    '\.ins|ltxtable.tex',
 'cbfonts-fd',  '\.fdd',
 'cmbright',    'NULL',
 'geometry-de', 'NULL',                 # doc, no need to build
 'lettre',      'NULL',
 'paper',       'install',
 'seuthesis',   'NULL',                 # don't want to run iconv, etc.
 'thesis',      'install.01|install.ndx',
 'translation-filecontents-de', 'NULL', # doc
 'turnstile',   'turnstile-en.ins',     # skip pt since it changes the sty
 'xymtex',      'NULL',                 # already built, too complicated 
 'yathesis',	'yathesis.dtx',		# not templates
);
$standardins = '\.ins$';

# if no .ins is present, but a .dtx is present, return a pattern for
# that extension; else return the empty string.  This is only called if
# there was no $specialins for the package.  We do this because more and
# more packages omit the .ins and just put everything in the .dtx, so
# it's nice to recognize that case automatically.
#
sub specialins {
  my ($package) = $_;
  
  if (exists $specialins{$package}) {
    # sanity check
    warn "\t SPECIALINS called for $package, "
         . "but have specialins=$specialins{$package}\n";
    return "";
  }

  my $raw_dir = "$RAW_DIR/$packagedir";
  return if (-e "$RAW_DIR/$packagedir/TDS_READY");
  
  my @ins = `find $raw_dir -regex ".*$standardins" -type f -print`;
  if (@ins) {
    print "\t SPECIALINS found normal ins: @ins";
    return "";
  }
  
  my @dtx = `find $raw_dir -regex '.*\\.dtx\$' -type f -print`;
  if (@dtx) {
    print "\t SPECIALINS no .ins, but found .dtx: @dtx";
    return '\.dtx$';
  }
  
  # No .dtx's, either.  Presumably this package has no .ins-like file.
  return "";
}

# ltxtable.tex in carlisle uses the {filecontents} environment to write
# ltxtable.sty.  Unfortunately if the file exists anywhere in the input
# tree, it won't be written, and of course TL already has it installed.
# So set TEXINPUTS to only the directories actually needed for the run,
# so that latex will not find our installed ltxtable.sty.
my $core_latex = "$Master/texmf-dist/tex/latex";

%specialinsrunner = (
 'actuarialsymbol' => 'pdflatex-preserve-pdf',# requires interaction
 'aligned-overset' => 'tex',
 'antomega'     => 'latex',  # requires interaction
 'apa6e'        => 'latex',  # requires interaction
 'asciilist'	=> 'latex',  # requires interaction
 'babel'	=> 'etex',
 'babel-greek'  => 'latex',  # requires interaction
 'babel-serbianc' => 'latex',# requires interaction
 'beamersubframe' => 'latex',# requires interaction
 'basque-book'  => 'latex',  # requires interaction
 'basque-date'  => 'latex',  # requires interaction
 'bbold'	=> 'pdflatex',
 'beamerswitch' => 'tex -8bit',    # no doc remake
 'biblatex-oxref' => 'luatex', # no doc remake
 'bguq'         => 'latex',  # requires interaction
 'bhcexam'      => 'latex',  # requires interaction
 'bosisio'      => 'latex -translate-file=empty.tcx',   # ^^, no 8-bit
 'bullcntr'     => 'latex',  # requires interaction
 'canoniclayout'=> 'tex',
 'carlisle'     => "env TEXINPUTS=$core_latex/base:$core_latex/tools:. latex",
 'cdpbundl'     => 'latex',  # requires interaction
 'chickenize'   => 'luatex',
 'classpack'    => 'latex',  # requires interaction
 'clefval'      => 'latex -translate-file=empty.tcx',   # no 8-bit
 'cleveref'     => 'latex',  # requires interaction
 'ctable'       => 'latex',  # requires interaction
 'curve2e'      => 'tex',
 'dateiliste'   => 'latex',  # requires interaction
 'dccpaper'	=> 'etex',   # 8bit
 'denisbdoc' 	=> 'tex',
 'dotseqn'      => 'latex',  # requires interaction
 'delimtxt'     => 'latex -translate-file=empty.tcx',   # no 8-bit
 'download'     => 'pdflatex', # fancy fonts, doc and subfiles combined
 'dramatist'	=> 'latex',  # requires interaction
 'drm'          => 'latex',  # requires interaction
 'duckuments'	=> 'tex',
 'ejpecp'       => 'latex',  # requires interaction
 'ekaia'        => 'latex',  # requires interaction
 'elteikthesis' => 'latex',  # requires interaction
 'emisa'	=> 'pdflatex-preserve-pdf',
 'engpron'      => 'latex -translate-file=empty.tcx',   # no 8-bit
 'ecclesiastic' => 'latex',  # requires interaction
 'etextools'    => 'etex -translate-file=empty.tcx',    # no 8-bit
 'extpfeil'     => 'latex -translate-file=empty.tcx',   # no 8-bit
 'factura'	=> 'pdftex',
 'facture'	=> 'latex', # requires interaction
 'fancytooltips'=> 'latex', # requires interaction
 'fancyvrb'     => 'latex -translate-file=empty.tcx',   # no 8-bit
 'fbithesis'    => 'latex',  # requires interaction
 'fcolumn'	=> 'tex',
 'fei'		=> 'tex',
 'fge'          => 'latex',  # requires interaction
 'g-brief'      => 'latex',  # requires interaction
 'geometry'     => 'tex',
 'german'       => 'tex',
 'gost'         => 'latex',  # requires interaction
 'graphics-pln' => "env TEXINPUTS=$Master/texmf-dist/source/latex/base: latex",
 'halloweenmath' => 'latex',  # requires interaction
 'hf-tikz'      => 'tex',
 'hrlatex'      => 'latex',  # requires interaction
 'intopdf',	=> 'tex',
 'isodoc'       => 'luatex',
 'japanese'     => 'platex',
 'kdgdocs'      => 'latex',  # requires interaction
 'komacv'	=> 'latex',  # requires interaction
 'labelcas'     => 'latex',  # requires interaction
 'lastpage'     => 'tex',
 'latex-veryshortguide' => 'latex',  # requires interaction
 'lcd'          => 'latex -translate-file=empty.tcx',   # no 8-bit
 'listings'     => 'latex',  # requires interaction
 'lmake'        => 'latex',  # requires interaction
 'luaindex'     => 'lualatex --shell-escape',
 'luatexja'     => 'lualatex',
 'mandi'	=> 'pdflatex-preserve-pdf',
 'mcmthesis'	=> 'tex',    # requires interaction
 'mversion'     => 'latex',  # requires interaction
 'minitoc'      => 'latex',  # requires interaction and 1000q instead of 10q
 'mylatexformat'=> 'tex',
 'nameauth'	=> 'pdflatex-preserve-pdf',
 'notespages'   => 'latex',  # requires interaction
 'nwejm'	=> 'tex',
 'nomentbl'     => 'latex -translate-file=empty.tcx',   # no 8-bit
 'pbsheet'      => 'latex',  # requires interaction
 'thumb'        => 'latex -translate-file=empty.tcx',   # no 8-bit
 'pageslts'     => 'tex -translate-file=empty.tcx',     # no 8-bit
 'papermas'     => 'tex',
 'pauldoc'      => 'latex',  # requires interaction
 'placeat'      => 'luatex',
 'poemscol'     => 'latex',  # requires interaction
 'polski'       => 'latex',  # requires interaction
 'psfragx'      => 'latex',  # requires interaction
 'pxrubrica'    => 'platex',
 'schedule'     => 'latex',  # requires interaction
 'silence'      => 'latex -translate-file=empty.tcx',   # no 8-bit
 'skdoc'        => 'tex',
 'skrapport'    => 'pdflatex', # as with download
 'svg'		=> 'etex -interaction=nonstopmode',
 'svn-multi'    => 'latex',  # interaction for .pl
 'teubner'      => 'latex',  # interaction
 'termlist'     => 'tex',    # interaction for .pl
 'thumb'        => 'latex -translate-file=empty.tcx',   # no 8-bit
 'tikz-page'	=> 'tex -8bit',    # no doc remake, 8-bit name
 'todonotes'    => 'latex',  # requires interaction
 'toptesi'      => 'latex',  # requires interaction
 'tudscr'       => 'tex',
 'uadocs'       => 'latex',  # requires interaction
 'undolabl'     => 'tex',
 'velthuis'     => 'latex',  # requires interaction
 'xduthesis'	=> 'tex',
 'xecjk'        => 'xecjk-xelatex',
 'xskak'        => 'latex',  # requires interaction
 'yathesis'	=> 'pdftex',
);
$standardinsrunner="latex -interaction=nonstopmode";


%specialmakeindex= (
 'apprends-latex'       => 'NULL',      # doc
 'bigints'              => 'NULL',      # doc
 'bibleref'		=> 'NULL',      # doc
 'einfuehrung'          => 'NULL',      # doc
 'einfuehrung2'         => 'NULL',      # doc
 'istgame'              => 'NULL',      # doc
 'labyrinth'            => 'NULL',      # doc
 'luaintro'             => 'NULL',      # doc
 'minitoc'		=> 'NULL',      # doc
 'mpman-ru'             => 'NULL',      # doc
 'musuos'               => 'NULL',      # gind.ist conflict
 'pst-eucl-translation-bg' => 'NULL',   # doc
 'seuthesis'            => 'NULL',      # doc
 'tipfr'                => 'NULL',      # doc
 'tkz-tab'              => 'NULL',      # doc
 'ticollege'            => 'NULL',      # doc
 'turnthepage'          => 'NULL',      # doc
 'voss-mathmode'        => 'NULL',      # doc
);
$standardmakeindex='\.ist';


# packages which need special MetaPost files
$standardmp = '\.mp$';
%specialmp = (
 'automata',    'automata.mp',  # skip example.mp
 'beuron',	'NULL',		# doc file
 'bpolynomial', 'bpolynomial.mp', # skip examples.mp
 'chemarrow',   'NULL',         # don't install arrow.mp
 'dviincl',     'fix.*mp',      # skip test-bop.mp
 'einfuehrung', 'NULL',         # doc package
 'einfuehrung2','NULL',         # doc package
 'epsincl',     'eps.*mp',      # skip testincl.mp
 'feynmp',      'feynmp.mp',
 'hatching',    '[^e].mp',      # no htchuse.mp
 'latexmp',     'latexmp.mp',
 'latex-graphics-companion', 'NULL',    # doc package
 'luamesh',	'NULL',		# not doc file fond.mp
 'mcf2graph',	'mcf2graph.mf',	# not the examples
 'metapost-examples', 'NULL',           # doc package
 'mpattern',    'mpattern.mp',  # don't install test.mp
 'mp3d',        '^(3d|ani)',    # not examples
 'mpman-ru',    'NULL',         # doc package
 'pdfslide',    'NULL',         # no meta.mp
 'polski',      'NULL',         # no sample-*.mp
 'semioneside', 'NULL',         # don't install figure*.mp
 'textpath',    'textpath.mp',  # don't install textpathfigs.mp
);


%specialdvi = ();
$standarddvi = 'NULL';  # rely on authors/CTAN making pdf's.

$standardcsf='\.csf';
%specialcsf = (
 'disser'       => 'cp1251lc.csf',  # cp1251.csf dup with gost
);

$standardbst='\.bst$';
%specialbst = (
 'einfuehrung'  	=> 'NULL',
 'einfuehrung2' 	=> 'NULL',
 'feupphdteses' 	=> 'NULL',
 'latex-bib-ex' 	=> 'NULL',
 'latex-bib2-ex'	=> 'NULL',
 'latex-referenz'       => 'NULL',
 'mil3'         	=> 'NULL',
 'msu-thesis'   	=> 'NULL',
 'przechlewski-book-examples'   => 'NULL',
 'texproposal'		=> 'NULL',
 'umthesis'     	=> 'NULL',
);

# packages which need special BibTeX data files (not) installed.
$standardbib = 'NULL';  # almost all bib files are for the doc
#$standardbib='\.bib$'; # $ so we don't find README.bibtex in IEEEtran
%specialbib= (
 'IEEEtran'                     => '\.bib$',
 'amsrefs'                      => 'ams.*bib', # not jr.bib
 'archaeologie'                 => '\.bib$',
 'bibtex'                       => 'xampl\.bib$',
 'cnltx'                        => '\.bib$',
);

# packages which have Metafont sources to run.
$standardmf='[0-9]\.mf';
%specialmf= (
 'asaetr',      'NULL', # cmcscsl10.mf conflict
 'astro',       'astrosym.mf',
 'backgammon',  'bg\.mf',
 'cherokee',    'cherokee.mf',
 'circ',        'csybimos\.mf|csycirc\.mf|csydiod\.mf|csyrest\.mf|csywidko\.mf|csysym\.mf|optic\.mf',
 'cirth',       'cir.*\.mf',
 'clock',       'clock.mf',
 'cm',		'NULL', # don't rebuild 'cminch|' . $standardmf,
 'cmcyr',       'NULL', # already made
 'cmextra',     'cm(man|tim)|' . $standardmf,
 'cookingsymbols', 'cookingsymbols\.mf',
 'cmpica',      'cmpic.*\.mf',
 'dancers',     'dancers\.mf',
 'dice',        'dice3d',
 'dingbat',     '\.mf',
 'drm',		'NULL', # pregen
 'eiad-ltx',    'NULL', # Fr10.mf and Fbf10.mf don't compile (need cmbase)
 'engwar',      'engwar\.mf',
 'euro-ce',     'eu.*\.mf|ce.*\.mf',
 'fetamont',    'NULL', # pregen
 'feynmf',      'feynmf\.mf',
 'gothic',	'(cmfrak|schwell|suet14|yinit(dd)?)\.mf',
 'greenpoint',  'greenpoint\.mf',
 'hands',       'hands\.mf',
 'ibygrk',      'NULL',
 'ifsym',       '\.mf|\.gen',
   # no point in making tfm without pk for (black|gray|slant), is there?
 'knuth-lib',   'manfnt\.mf|' . $standardmf,
 'knuth-local', '(domino|mfman|random|snfont)\.mf',
 'logic',       'milstd\.mf',
 'mfpic',       'grafbase\.mf',
 'morse',       'morse10.mf|morse.def',
 'niceframe',   'karta15\.mf|umrand[ab]\.mf', # not bbding or dingbat
 'ogham',       'ogham\.mf',
 'pl',		'NULL',
 'skak',        'skak.*[0-9].*\.mf',
 'tengwar',     'tengwar\.mf',
 'umrand',      'umrand[ab]\.mf',
 'xq',          'xq(normal|large)\.mf',
);


%specialfoundry = (
 'asapsym'	=> 'omnibus-type',
 'berenisadf'	=> 'arkandis',
 'charter'      => 'bitstrea',
 'fc'           => 'jknappen',
 'grotesq'	=> 'urw',
 'manfnt-font'	=> 'hoekwater',
 'mflogo-font'	=> 'hoekwater',
 'mfpic'	=> 'metafont',
 'sourcesanspro'=> 'adobe',
);
$standardfoundry='public';

# additional mf files to be installed but not run.
$standardmfinstall = '\.mf$';
%specialmfinstall = (
 'asaetr'       => 'NULL',                              # cmcscsl10.mf conflict
 'astro'        => 'astrosym.(cal|cmn|mac|uni|xtr)',
 'ibygrk'       => 'ibycus4\.map',                      # tex|mf source
 'ifsym'        => $standardmfinstall . '|\.gen',
 'mcf2graph'	=> 'NULL',
 'niceframe'    => '(karta|umrand).*\.mf',              # not bbding or dingbat
 'pl'		=> '\.mf',				# include .mft
 'tipa'         => $standardmfinstall . '|[^c]\.def$',
 'wnri'         => $standardmfinstall . '|wnindic\.map',# mf source
);

# packages which have dvips header files
$standardpro='\.pro$';
%specialpro= (
 'brushscr'     => 'config.pbsi',
 'cm-super'     => 'config.cm-super|cm-super.GS',
 'countriesofeurope' => 'config.*',
 'dvipsconfig'  => '.*',   # addpsctrl should be in bin, but ...
 'epspdf'       => 'NULL', # makegray.pro goes in scripts
 'esint-type1'  => 'config.esint',
 'initials'     => 'config.*',
 'pl'		=> 'config.*',
 'pspicture'    => 'pspicture.ps',
 'tex-ps'       => 'mirr.hd',
 'yfonts-t1'    => 'config.*',
 'zefonts'      => 'slantcm.cfg',
);

$standardmap='\.(map|tec)$';
%specialmap = (
 'adobemapping' => '.',         # take them all
 'fundus'       => 'NULL',      # skip startrek fonts we don't have
 'ibygrk'       => 'iby\.map',  # not ibycus4.map, which is tex|mf
 'kerntest'     => 'NULL',      # skip test map file
 'skak'         => 'NULL',      # skip ill-named special.map
 'xetex-devanagari' => 'README|' . $standardmap, # no point in breaking up
);
#
$standardmapdest = "fonts/map/dvips";
%specialmapdest = (
 'adobemapping'         => "fonts/cmap",
 'arabxetex'            => "fonts/misc/xetex/fontmapping",
 'ipaex'                => "fonts/map/dvipdfmx",
 'morisawa'             => "fonts/map/dvipdfmx",
 'xepersian'            => "fonts/misc/xetex/fontmapping",
 'xetex-devanagari'     => "fonts/misc/xetex/fontmapping",
 'xetex-itrans'         => "fonts/misc/xetex/fontmapping",
 'xetex-tibetan'        => "fonts/misc/xetex/fontmapping",
);

$standardafm='\.afm';
%specialafm = ();

$standardvmap='\.ali$';
%specialvmap = ();

$standardenc='\.enc';
%specialenc = ();

$standardocp='\.ocp';
%specialocp = ();

$standardofm='\.ofm';
%specialofm = ();

$standardotf='\.otf';
%specialotf = (
 'cm-unicode'   => '^[^.]*\.otf',       # not Fontmap.CMU.otf
);

$standardotp='\.otp';
%specialotp = ();

$standardovf='\.ovf';
%specialovf = ();

$standardovp='\.ovp';
%specialovp = ( 'psfragx', 'NULL',);

$standardpfb = '\.pfb|\.inf$';
%specialpfb = (
 'brushscr'     => '.*\.pfa',
 'cm-unicode'   => '^[^.]*\.pfb',       # not Fontmap.CMU.pfb
 'dviincl'      => 'NULL',              # skip *.inf, is a README
 'metatype1'    => 'NULL',              # skip *.inf, is a README
 'pigpen'       => 'pigpen.pfa',
);

$standardpfm='\.pfm';
%specialpfm = ();

$standardsfd=NULL;  # subfont definition, not fontforge!
%specialsfd = ();   # only dnp, ttf2pk

$standardttf = '\.ttf|\.TTC';
%specialttf = (
);


# scripts to install under texmf*/.../scripts, but not bindir.
%specialscripts_nobin = (
 'bib2gls'		=> '\.jar$',
 'changes'		=> '\.bash$',
 'cloze'		=> '\.lua$',
 'ctan-o-mat'		=> 'ctan-o-mat(|\.pl)$',
 'epspdf'               => '(epspdf(|\.help|boot|tk)|\.rb|makegray\.pro)$',
 'latex2nemeth'         => '\.jar$',
 'latex-make'           => '\.py$',
 'latexindent'          => 'LatexIndent|\.yaml$',
 'lilyglyphs'           => 'lilyglyphs_common.py',
 'lua-alt-getopt'       => '\.lua$',
 'lua2dox'              => '\.(lua|def)$',
 'luaindex'             => '\.lua$',
 'lualatex-math'        => '\.lua$',
 'luamesh'		=> '\.lua$',
 'luasseq'              => '\.lua$',
 'lyluatex'		=> '\.lua$',
 'make4ht'		=> 'filters|\.lua$',
 'mycv'                 => 'mycv_split_contents\.pl',
 'pgfmolbio'		=> '\.lua$',
 'placeat'              => '\.lua$',
 'pst-pdf'		=> '\.bat(.w95)?$',
 'pythontex'            => '([23]|_.*)\.py$',
 'songs'		=> '\.lua$',
 'spelling'             => '\.lua$',
 'tex4ebook'		=> '\.lua$',
 'texosquery'		=> '\.jar$',
);


# scripts that should end up in $bindir too.
%specialscripts_bin = (
 'a2ping'               => '\.pl$',
 'accfonts'             => 'mkt1font|vpl2',
 'adhocfilelist'        => 'adhocfilelist\.sh$',
 'arara'                => 'arara\.sh$',
 'authorindex'          => 'authorindex$',
 'bib2gls'		=> '\.sh$',
 'bibexport'            => 'bibexport\.sh$',
 'bundledoc'            => '(arlatex|bundledoc)$',
 'checkcites'           => '\.lua$',
 'checklistings'        => '\.sh$',
 'cjk-gs-integrate'     => '\.pl$',
 'convbkmk'             => '\.rb$',
 'crossrefware'		=> '\.pl$',
 'ctan-o-mat'		=> 'ctan-o-mat$',
 'ctanify'              => '^ctanify$',
 'ctanupload'           => '\.pl$',
 'de-macro'             => 'de-macro',
 'diadia'		=> '\.lua$',
 'dosepsbin'            => 'dosepsbin\.pl$',
 'dtxgen'               => 'dtxgen$',
 'dviasm'               => '\.py$',
 'dviinfox'		=> '\.pl$',
 'ebong'                => '\.py$',
 'epstopdf'             => 'epstopdf\.pl',      # doscripts() does r*
 'exceltex'             => 'exceltex$',
 'fig4latex'            => 'fig4latex',
 'findhyph'             => 'findhyph$',
 'fragmaster'           => 'fragmaster\.pl$',
 'fontools'             => '(afm2afm|autoinst|ot2kpx)$',
 'getmap' 		=> 'getmapdl.lua',
 'glossaries'		=> 'makeglossaries$|makeglossaries-lite\.lua',
 'installfont'          => 'installfont-tl',
 'jfmutil'		=> '\.pl',
 'kotex-utils'          => '\.pl$',
 'l3build'		=> 'l3build\.lua$',
 'latex-git-log'        => 'latex-git-log$',
 'latex-papersize'	=> '\.py$',
 'latex2man'            => 'latex2man$',
 'latex2nemeth'         => 'latex2nemeth$',
 'latexdiff'            => 'latex(diff|diff-vc|revise)\.pl$',
 'latexindent'          => 'latexindent\.pl$',
 'latexmk'              => '\.pl$',
 'latexfileversion'     => 'latexfileversion$',
 'latexpand'            => 'latexpand$',
 'lilyglyphs'           => 'lily-.*\.py$',
 'listbib'              => 'listbib$',
 'listings-ext'         => '\.sh$',
 'ltxfileinfo'          => 'ltxfileinfo$',
 'ltximg'               => 'ltximg\.pl$',
 'lua2dox'              => 'lua2dox_filter?$',
 'luaotfload'           => 'luaotfload-tool',
 'lwarp'		=> 'lwarpmk.lua',
 'm-tx'			=> 'm-tx.lua',
 'make4ht'		=> 'make4ht$',
 'makedtx'		=> '^makedtx\.pl$',
 'match_parens'         => '^match_parens$',
 'mathspic'             => '^mathspic\.pl$',
 'multibibliography'    => '\.pl$',
 'mf2pt1'               => '\.pl$',
 'mkgrkindex'           => 'mkgrkindex$',
 'mkjobtexmf'           => 'mkjobtexmf\.pl$',
 'mkpic'	        => '^mkpic$',
 'musixtex'             => '\.lua$',
 'pdfbook2'             => 'pdfbook2$',
 'pdfcrop'              => '\.pl$',             # doscripts() does r*
 'pdfjam'               => 'pdf[^.]*$',
 'pdflatexpicscale'	=> '\.pl$',	
 'pdfxup'               => 'pdfxup$',
 'pedigree-perl'        => '\.pl$',
 'perltex'              => '\.pl$',
 'pfarrei'              => '\.tlu$',
 'pkfix'                => '\.pl$',
 'pkfix-helper'         => 'pkfix-helper$',
 'pmxchords'            => 'pmxchords\.lua$',
 'petri-nets'		=> 'pn2pdf',
 'pst-pdf'              => 'ps4pdf$',
 'pst2pdf'              => 'pst2pdf\.pl$',
 'ptex2pdf'             => 'ptex2pdf\.lua$',
 'purifyeps'            => 'purifyeps$',
 'pygmentex',		=> 'pygmentex\.py$',
 'pythontex'            => '(de)?pythontex\.py$',
 'rubik'                => '\.pl$',
 'srcredact'		=> '\.pl$',
 'splitindex'           => 'splitindex\.pl$',
 'sty2dtx'              => '\.pl$',
 'svn-multi'            => 'svn-multi\.pl$',
 'tex4ebook'		=> 'tex4ebook$',
 'texcount'             => '\.pl$',
 'texdef'               => '\.pl$',
 'texdiff'              => 'texdiff$',
 'texdirflatten'        => 'texdirflatten$',
 'texfot'               => 'texfot\.pl$',
 'texliveonfly'         => '\.py$',
 'texloganalyser'       => 'texloganalyser',
 'texosquery'		=> 'texosquery(|-jre[5-9])\.sh$',
 'typeoutfileinfo'      => '\.sh$',
 'thumbpdf'             => '\.pl$',
 'ulqda'                => '\.pl$',
 'urlbst'               => 'urlbst$',
 'vpe'                  => '\.pl$',
 'wordcount'		=> '\.sh$',
 'wheretotrim'          => '\.pl$',
 'yplan'                => 'yplan$',
);


# packages which have info files to install.
%specialinfos = (
 'latex2e-help-texinfo'         => '\.info',
 'latex2e-help-texinfo-fr'	=> '\.info',
 'latex2e-help-texinfo-spanish' => '\.info',
 'latex2man'                    => '\.info',
);

# packages which have info files to build and then install.
%specialtexinfos = (
 'mf2pt1'                       => '.*\.texi',
 'texdraw'                      => '.*\.texi',
);

# packages which have man pages to install.
%specialmans = (
 'a2ping'               => '\.1$',
 'bundledoc'            => '\.1$',
 'crossrefware'		=> '\.1$',
 'ctan-o-mat'           => '\.1$',
 'ctanify'              => '\.1$',
 'dosepsbin'            => 'dosepsbin.man',
 'epstopdf'             => 'r?epstopdf.1|epstopdf.man1.pdf', # don't keep pdf
 'findhyph'             => 'findhyph.1',
 'fontools'             => '\.1$',
 'glossaries'		=> '\.1$',
 'l3build'		=> '\.1$',
 'latex-git-log'        => '\.1$',
 'latex2man'            => '\.1$',
 'latexdiff'            => '\.1$',
 'latexmk'              => 'latexmk.1',
 'mathspic'             => 'mathspic.1',
 'mkjobtexmf'           => 'mkjobtexmf.man',
 'musixtnt'		=> '\.1$',
 'pedigree-perl'        => '\.1$',
 'perltex'              => 'perltex.1',
 'pdfbook2'             => '\.1$',
 'pdfjam'               => '\.1$',
 'pdfxup'               => '\.1$',
 'pkfix-helper'         => 'pkfix-helper.1',
 'pmx'                  => '\.1$',
 'purifyeps'            => 'purifyeps.1',
 'rubik'		=> '\.1$',
 'splitindex'           => '\.1$',
 'srcredact'            => '\.1$',
 'sty2dtx'              => '\.1$',
 'texdiff'              => 'texdiff.1',
 'texfot'               => '\.1$',
 'texdirflatten'        => 'texdirflatten.1',
 'wheretotrim'          => '\.1$',
);

# which suffixes to remove after building.  Checked after runins and at
# the end, in the doc directory.
$standardclean = '\.head|\.tmp|\.dvi|\.log|\.out|\.aux|\.toc|\.lof|\.lot'
                . '|\.bbl|\.blg|\.idx|\.ind|\.ilg|\.glo|\.gls|\.loa'
                . '|\.bcf|\.ido|\.run\.xml';
%specialclean  = (
 'a2ping'       => 'README',            # not worth whole separate doc subdir
 'accfonts'     => $standardclean . '|dvips.enc',       # dup enc
 'acmconf'      => $standardclean . '|flushend.sty',    # dup with sttools
 'apalike'      => "apalike2.bst",                      # does not belong
 'bardiag'      => "example/.*(aux|log)",               # junk on CTAN
 'bibleref'	=> $standardclean . '|sample.tex|sample-.*', # derived uploaded
 'bbm-macros'   => $standardclean . '|^bbm$',           # symlink
 'bundledoc'    => $standardclean . '|\.pdf$',          # regen for a4
 'catoptions'   => $standardclean . '|Thumbs.db',       # bogus file
 'cmbright'     => 'cmbright.pdf',
 'cprotect'     => $standardclean . '|\.cpt',           # temp files for doc
 'dateiliste'   => $standardclean . '|dateiliste.README*', # already in dist
 'elvish'       => '\.pk3',                             # no pk files
 'enctex'	=> '\.ch|\.patch',			# binary-related
 'findhyph'     => 'findhyph.pdf',                      # we generate
 'fundus'       => $standardclean . '|outline.sty',     # in own package
 'gentle'       => 'gentle.ps.gz',                      # pdf is enough
 'hyph-utf8'    => 'README',
 'ibycus-babel' => $standardclean . '|ibyhyph.tex',    # in hyphen-ancientgreek
 'jadetex'      => $standardclean           # these sty files are in passivetex
                   . '|(dummyels|mlnames|ucharacters|unicode)\.sty',
 'lshort-russian'=>'lshortbk.zip',                      # sources are enough
 'lshort-spanish'=>'lshort-letter.pdf',                 # a4 is enough
 'mandi'	=> $standardclean . '|\.(lol|tcbtemp|tdo)$',# remakes doc
 'mathexam'     => 'sample.tex~',
 'musixtnt'	=> 'msxlint(.exe)?$',    		# extra binaries
 'pkfix-helper' => 'pkfix-helper.pdf',
 'placeat'      => $standardclean . '|README\.$',
 'purifyeps'    => 'purifyeps.pdf',
 'revtex'       => '00readme.tex|DOWNLOAD|README',      # already in doc
 'sanskrit'     => 'ps-type1|sktdoc.ps',          # symlink, pdf in sanskrit-t1
 'suftesi'      => 'example/MaterialeInizialeFinale/.DS_Store',
 'tlc2'         => 'NULL',                              # doc package
 'tufte-latex'  => $standardclean . '|.tds.zip$',
 'velthuis'	=> $standardclean . '|devnag.c',	# already in source
 'wsuipa'       => $standardclean . '|.*pk$',           # premade pk files
);

# if a hash entry is matched here, README.TEXLIVE is created mentioning
# that the files were removed.  These are checked after runins.
%moreclean = (
 'akktex'        => 'still to do',
 'alkalami'	 => 'Alkalami-.*pdf',			# InDesign source
 'ametsoc'	 => '.*\.pdf',                          # no source
 'ascii-font'    => '.*\.pdf',                          # no source
 'axodraw2'	 => 'axohelp.exe',			# wait tl18
 'bbcard'        => 'bbcard.tpm',                       # old TL infra
 'chessboard'    => 'chessboard.pdf',                   # no source
 'chessfss'      => 'chessfonts_gallery.pdf|chessfss.pdf', # no source
 'clrscode3e'	 => 'clrscode3e.pdf',			# no source
 'comprehensive' => '-letter.pdf',			# have a4, save space
 'dfgproposal'   => '1_02.*\.pdf',                      # nonfree specs
 'din1505'       => '(leitbild3|normpatsoft).pdf',      # no source
 'ducksay'	 => '.*\.pdf',				# no source
 'easy'          => '.*\.pdf|doc.html.tgz',             # no source
 'ednotes'       => 'perpage.sty',                      # copy from bigfoot
 'emisa'	 => 'emisa-instructions.pdf',		# symlink
 'epslatex-fr'   => 'R?Danger.eps',                     # unneeded, name clash
 'exceltex'      => 'manpage.pdf',                      # no source
 'facture'	 => 'issue7.pdf',                       # no source
 'flacards'      => 'flacards.pdf',                     # no source
 'gfsartemisia'  => 'A*Specimen.pdf',                   # no source
 'gfsbaskerville'=> 'B*Specimen.pdf',                   # no source
 'gfsbodoni'     => 'B*Specimen.pdf',                   # no source
 'gfscomplutum'  => 'C*Specimen.pdf',                   # no source
 'gfsdidot'      => '.pdf',                             # no source
 'gfsneohellenic'=> '.pdf',                             # no source
 'jknapltx'      => 'ubbold.fd', # clash bbold's Ubbold.fd; sauter bbold fails
 'latexmk'	 => '(sweave_|tex4ht-)latexmkrc',	# case-folding clash
 'maker'	 => 'maker_manual.pdf',			# no source
 'math-into-latex-4' => 'video.*zip|S.*\.pdf',          # nonfree
 'numericplots'  => '.*\.m',                            # matlab
 'oinuit'        => 'cmssbxo10.tfm',                    # should not be here
 'padauk'	 => '\.pdf$',				# no source
 'pas-cours'     => '\.pdf$',                           # no source
 'pas-tableur'   => '\.pdf$',                           # no source
 'piechartmp'    => 'piechartmp.pdf',                   # no source
 'ptptex'        => '(overcite|cite|wrapfig).sty',      # duplicated
 'rutitlepage'	 => 'logo.*',				# nonfree
 'sapthesis'     => '.*-ML.*\.pdf',                     # univ logos
 'scientific-thesis-cover' => 'demo.pdf',		# no source
 'sectionbox'    => 'example/lenna.*.jpg',              # nonfree
 'startex'	 => 'epsf.tex',				# stale copy
 'stubs'         => 'stubs.pdf',                        # no source
 'susy'          => 'susy.pdf',                         # no source
 'swimgraf'      => 'swimgraf.pdf',                     # no source
 'sympytexpackage' => '.*\.pdf$',		        # cc-nc
 'table-fct'	 => '.*\.pdf$',			        # no source
 'tikz-layers'	 => '.*\.pdf$',			        # no source
 'toptesi'       => 'logo.*',                           # legalities unknown
 'tree-dvips'    => 'avm.*',                            # author no response
 'ucs'		 => 'languages.ps.gz',			# no source
 'xskak'         => 'xskak.pdf',                        # no source
 'xymtex'        => 'doc/.*\.pdf$',                     # no source
 'yannisgr'      => '^(digits|gen_acc)\.mf'             # levy dup
);

#  (main program)
# Read from config file to make local adjustments to above.
readconfig();

# command line options
$opt_debug = 1;  # verbosity is good
exit 2 unless Getopt::Long::GetOptions (
  "ctan-dir=s",
  "debug!",
  "help",
  "test|n!",
  "contrib",
  "version",
);

for (@ARGV) { 
  $packagedir = $_;
  if (! -d $packagedir) {
    warn "$0: $packagedir not a directory, skipping.\n";
    next;
  }

  &set_dir_defaults ($opt_ctan_dir);

  @x = split(/\//,$packagedir);
  $package = pop (@x);
  my $COOKED_PKG = "$COOKED_TOP/$package";  # output directory

  if ($specialscripts_bin{$package}
      # special POSTcases:
      || $package =~ /^(biber|context|mptopdf|musixtnt)$/) {
    $BUILDDEST = "$COOKED_PKG/Build/source";
    $TOPDEST = "$COOKED_PKG/Master";
  } else {
    $BUILDDEST = "oops-no-builddest-should-be-needed?!";
    $TOPDEST = $COOKED_PKG;         # that is, Master
  }

  $DEST_TREE = $specialdest{$package} || $standarddest; # usually texmf-dist
  $DEST = "$TOPDEST/$DEST_TREE";  # goes to Master/texmf-dist or whatever

  $whichformat = $specialfmt{$package} || $standardfmt;
  $whichdocformat = $specialdocfmt{$package} || $standarddocfmt;
  print "pkg=$package (fmt=$whichformat docfmt=$whichdocformat) -> $DEST\n";

  $inspatt = $specialins{$package} || &specialins($package) || $standardins;
  $insrunner = $specialinsrunner{$package} || $standardinsrunner;
  $Foundry = $specialfoundry{$package} || $standardfoundry;

  if (exists $special{$package}) {
    if ($special{$package} =~ s/^die //) {
      # avoid repeating the die message.
      die "*** $package failed: $special{$package}\n";
    } else {
      print "special: $special{$package}...\n";
      eval $special{$package};
      die "*** $package failed in $special{$package}:\n $@" if $@;
    }
  } else {
    &donormal;
  }
  &sanitize_file_names ($COOKED_PKG);
  
  &xchdir ($RAW_DIR);  # pop back to top-level raw dir for next package.
}


# We do not want to deal with anything but "normal" characters, a subset
# of 7-bit ASCII.  The file names appear in too many contexts for
# anything else to reliably work.
# 
# Nothing in tlpdb itself restricts the characters used (except for
# spaces and newlines), but we want to be cautious here. That
# discrepancy seems ok?
# 
sub sanitize_file_names {
  my ($dir) = @_;
  # -0 in case of spaces or other chars in filenames, which would be
  # parsed into words by the shell otherwise.
  &SYSTEM ("find $dir -print0 "
            . "| xargs -0 /l/bin/rename 's![^-_A-Za-z0-9.,/+]!!g'");
}



# Override our default guess of "latex" if we can intuit from the CTAN
# path, which ctan2tl kindly passes us.
# 
sub set_dir_defaults {
  my ($ctan_dir) = @_;
  my $guess = "";
  
  if ($ctan_dir =~ m!/tex-archive/biblio/bib!) {
    $standarddocfmt = $standardsourcefmt = "bibtex";
    $guess = "$standarddocfmt for docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/fonts/!) {
    $standarddocfmt = $standardsourcefmt = "fonts";
    $guess = "$standarddocfmt for docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/(graphics|info)/metapost/!) {
    $standarddocfmt = $standardsourcefmt = "metapost";
    $guess = "$standarddocfmt for docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/macros/generic/!) {
    $standarddocfmt = $standardsourcefmt = $standardfmt = "generic";
    $guess = "$standarddocfmt for fmt/docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/macros/luatex/generic/!) {
    $standarddocfmt = $standardsourcefmt = $standardfmt = "luatex";
    $guess = "$standarddocfmt for fmt/docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/macros/luatex/latex/!) {
    $standarddocfmt = $standardsourcefmt = $standardfmt = "lualatex";
    $guess = "$standarddocfmt for fmt/docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/macros/plain/!) {
    $standarddocfmt = $standardsourcefmt = $standardfmt = "plain";
    $guess = "$standarddocfmt for fmt/docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/macros/xetex/latex/!) {
    $standarddocfmt = $standardsourcefmt = $standardfmt = "xelatex";
    $guess = "$standarddocfmt for fmt/docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/tex-archive/support/!) {
    $standarddocfmt = $standardsourcefmt = "support";
    $guess = "$standarddocfmt for docfmt/srcfmt";

  } elsif ($ctan_dir =~ m!/contrib/babel-contrib/!) {
    # this can be removed when Catalogue is complete.
    $standarddocfmt = $standardsourcefmt = $standardfmt = "generic";
    $guess = "$standarddocfmt for fmt/docfmt/srcfmt (babel)";
  }

  print "\t guessed $guess (based on $ctan_dir)\n" if $guess;
}



sub xchdir {
  my ($dir) = @_;
  chdir ($dir) || die "chdir($dir) failed: $!";
  my $pwd = getcwd ();
  print "\t CHDIR $dir (now $pwd)\n";
}

sub xmkdir {
  my (@dirs) = @_;
  &SYSTEM ("mkdir -p @dirs");
}

# mv multiple things into one final (possibly new) destination directory.
sub mv_with_mkdir {
  my @args = @_;
  my $destdir = pop (@args);
  &xmkdir ($destdir);
  &SYSTEM ("$MV @args $destdir");
}

# mv a single thing to another name, ensuring the parent of the
# destination exists.  But if the destination itself exists, that's an error.
sub rename_with_mkdir {
  my ($from,$to) = @_;
  die "rename_with_mkdir needs exactly two args (got @_)" if @_ != 2;
  die "rename_with_mkdir destination exists: $to" if -e $to;
  (my $parent = $to) =~ s,/[^/]*$,,;
  &xmkdir ($parent);
  &SYSTEM ("$MV $from $to");
}

# run a shell command.
# 
sub SYSTEM {
 my ($job) = @_;
 if ($opt_test) {
   print "\t SYSTEM $job\n";
 } else {
   print "\t SYSTEM $job\n" if $opt_debug;
   system ($job);
 }
}

# Return .exe or empty string, as required by PLATFORM.
# 
sub exeext {
  my ($platform) = @_;
  my $ext = $platform =~ /^(win[0-9]+|.*-cygwin)$/ ? ".exe" : "";
  return $ext;
}

# copy man pages from runtime to new stage directory,
# so they won't appear to be deleted.
# 
sub preserve_man_pages {
  my ($pkg) = @_;
  
  my $mandest = "$TOPDEST/texmf-dist/doc/man/man1";
  &xmkdir ($mandest);
  &SYSTEM ("$CP $Master/texmf-dist/doc/man/man1/$pkg.* $mandest/");
}



# some packages need to intervene at the beginning.
sub run_prehook {
  my $prehook = $prehook{$package};
  if ($prehook) {
    print "\t PREHOOK: running $prehook\n";
    eval $prehook;
    die "$package failed in $prehook: $@" if $@;
  }
}



# some packages (e.g., vntex) are tl-ready (or near enough).
# 
sub MAKEcopy {
  my $dest = $_[0] || $DEST;
  my $pdir = $packagedir;

  chomp (my $abspackagedir = `cd $pdir && pwd`);
  print "\t COPY from $abspackagedir to $dest\n";

  &xchdir ($pdir);
  &SYSTEM ("mkdir -p $dest");

  # do the copy.
  &SYSTEM ("$CP -r * $dest");

  my $docdir = "$dest/doc/$whichdocformat/$package/";
  &xmkdir ($docdir);

  # for arev et al., remove symlinks.
  &SYSTEM ("find $dest -type l | xargs --no-run-if-empty rm");

  # ditto assorted other for lm (files are in doc subtree already).  
  -r "$dest/MANIFEST.txt"
  && &SYSTEM ("cd $dest && $RM GUST*.txt MANIFEST.txt README.eng");

  # move README for encxvlna and others
  -r "$dest/README" 
  && &SYSTEM ("$MV $dest/README $docdir/");

  # move manifest.txt for droid
  -r "$dest/manifest.txt" 
  && &SYSTEM ("$MV $dest/manifest.txt $docdir/");

  # move CHANGELOG for stellenbosch.
  -r "$dest/CHANGELOG" 
  && &SYSTEM ("$MV $dest/CHANGELOG $docdir/");

  # move README.eulervm for eulervm.
  -r "$dest/README.eulervm" 
  && &SYSTEM ("$MV $dest/README.eulervm $docdir/");

  # for tex-gyre, rename context subdir.  (shouldn't be needed next time.)
  if (-d "$dest/fonts/map/pdftex/context") {
    print "$package: rename context map dir.\n";
    &SYSTEM ("$MV $dest/fonts/map/pdftex/context $dest/fonts/map/pdftex/tex-gyre");
  }

  # for velthuis, remove bin dir (with warning).
  if ($package eq "velthuis" && -d "$dest/bin") {
    warn "WARNING: removing bin/ dir in $dest\n";
    warn " -- YOU must deal with it!\n";
    &SYSTEM ("rm -rf $dest/bin");
  }

  # preserve the lm sources.
  if ($package eq "lm") {
    my $srcdir = "$dest/source/fonts/$package/";
    &SYSTEM ("mkdir -p $srcdir");
    &SYSTEM ("$MV $dest/lm*mt1.zip $srcdir/");
  }

  &xchdir ($DEST);
  &killfiles ($specialclean{$package} || $standardclean);
  &killfiles ($moreclean{$package}, "more") if $moreclean{$package};
  
  # horrible special case to avoid listing every context-* package again.
  if ($package =~ /^context-/ && ! $posthook{$package}) {
    $posthook{$package} = "POST_context_contrib";
  }
 
  &do_posthook ();
}

sub do_posthook {
  my $posthook = $posthook{$package};
  if ($posthook) {
    print "\t POSTHOOK: running $posthook\n";
    eval ($posthook);
    die "$package failed in $posthook: $@" if $@;
  }
}


# 
# For most packages, this is the first thing called.  It copies
# everything from $packagedir to the doc directory of the package.
# 
sub setup {
  my ($ctl) = @_;

  print "doing setup($ctl)...\n";
  # precreate the directories we might need.
  $DOCDIR = "$DEST/doc/$whichdocformat/$package";
  &SYSTEM ("mkdir -p $DOCDIR");
  &SYSTEM ("mkdir -p $DEST/tex/$whichformat/$package");
  &SYSTEM ("mkdir -p $DEST/source/$whichdocformat/$package");
  
  # remove README symlinks.
  &SYSTEM ("test -h $packagedir/README && $RM $packagedir/README");

  return if $ctl eq "nocopytodoc";
  # copy everything to the doc directory
  # and work in there.
  &SYSTEM ("$CP -r $packagedir/* $DEST/doc/$whichdocformat/$package");
}

sub donormal {
   my ($ctrl) = @_;

   print "doing donormal($ctrl) with DEST=$DEST\n";

   # Check for tds-ready packages
   if (-e "$RAW_DIR/$packagedir/TDS_READY") {
     print "using TDS_READY tree\n";
     &SYSTEM ("$RM $RAW_DIR/$packagedir/TDS_READY");
     &SYSTEM ("mkdir -p $DEST");
     &xchdir ($DEST);
     &SYSTEM ("$CP -r $RAW_DIR/$packagedir/* .");
     
     my $scriptdir = "$DEST/scripts/$package";
     if (-d $scriptdir) {
       &xchdir ($scriptdir);
       &doscripts;
       &xchdir ($DEST);
     }

     my @docdirs = glob ("doc/*/*/");
     if ($moreclean{$package} && @docdirs) {
       &xchdir ($docdirs[0]);
       &killfiles ($moreclean{$package}, "more");
     }

   } else {
     # Use the normal procedure, not TDS.

     &setup unless $ctrl eq "nosetup";
     &xchdir ("$DEST/doc/$whichdocformat/$package");
     &run_prehook ($package) unless $ctrl eq "nosetup";

     &buildfilelist;

     # run the .ins files (if any) supplied
     &runins($inspatt);

     &killfiles ($moreclean{$package}, "more") if $moreclean{$package};

     # rebuild the list of files in the directory
     &buildfilelist;

     if ($Foundry eq "metafont") {
       &dosimplemf;
     } else {
       &domf;
     }

     &dodvi;
     # rebuild again, as we have .dvi files now
     &buildfilelist;
     &dobst;
     &domp;
     &dobib;
     &dotex;
     &runfonts;
     &domakeindex;
     &doomega;
     &dosource;
     &dotype1;
     &doscripts;
     &dotexinfos;
     &doinfos;
     &domans;

     # remove empty directories that we never used.
     &SYSTEM ("rmdir $DEST/*/$whichformat/$package 2>/dev/null");

     &killfiles ($specialclean{$package} || $standardclean);
   }

   # do the postaction in any case (we need to adapt some tds zips).
   &do_posthook ();
}

sub runins {
  my ($thispatt) = @_;
  print "\t RUNINS $thispatt\n";
  for (grep (/$thispatt/, @filenames)) { 
    my $env_mktex = "env MKTEXTFM=0 MKTEXMF=0 MKTEXPK=0";
    # do not infinite loop on docstrip "output directory", e.g., fltpoint.
    &runjob ("yes | sed 1000q | $env_mktex $insrunner $_");
    
    # bbold.dtx generates bbold.ins, and then does "low level hacks" to
    # run the .ins itself.  We don't want to do anything.
    next if $package eq "bbold";

    # in the case of fullblck (et al.?), the .dtx creates the .ins (so the
    # .ins is not in @filenames), and the .ins creates the .sty.
    # So we have to run the .ins.
    if (! grep (/$package\.ins$/, @filenames) && -r "$package.ins") {
      &runjob ("yes | sed 10q | $env_mktex $insrunner $package.ins");
    }
  }

  &killfiles ($specialclean{$package} || $standardclean);
}

sub install {
  my ($destdir,$thispatt) = @_;
  return unless $thispatt;

  my @files = grep (/$thispatt/, @filenames);  # ugh, @filenames global
  return unless @files;  # avoid lots of useless output

  print "\t INSTALL $thispatt to $destdir\n";
  &xmkdir ($destdir) unless -d $destdir;

  for my $file (@files) {
    next if $file eq "dtx-style.sty";  # this should never be in runtime
    &SYSTEM ("$MV $file $destdir");
  }
}



# build the documentation files (we don't any more).
# 
sub dodvi {
  # packages which are doc themselves rarely rebuild cleanly,
  # and aren't worth it.
  $dvipatt = $specialdvi{$package} || $standarddvi;
  unless ( "$dvipatt" eq "$standarddvi" ) {
    warn "$0: Building doc: shouldn't need to do that. Please check.";
    &rundvi ($dvipatt);
  }
}

# move the runtime files
sub dotex {
  my $texpatt = $specialtex{$package} || $standardtex;
  &install("$DEST/tex/$whichformat/$package", $texpatt);
}

# move the makeindex runtime files
sub domakeindex {
   $makeindexpatt = $specialmakeindex{$package};
   if ($makeindexpatt eq "") { $makeindexpatt=$standardmakeindex; }
   &install("$DEST/makeindex/$package",$makeindexpatt);
}

# BibTeX style files:
sub dobst {
   $csfpatt = $specialcsf{$package};
   if ($csfpatt eq "") { $csfpatt=$standardcsf; }
   &install("$DEST/bibtex/csf/$package",$csfpatt);
   $bstpatt = $specialbst{$package};
   if ($bstpatt eq "") { $bstpatt=$standardbst; }
   &install("$DEST/bibtex/bst/$package",$bstpatt);
}

# simple MF files, e.g., if specialfoundry eq "metafont".
sub dosimplemf {
   my $mfpatt = $specialmf{$package} || $standardmf;
   &install ("$DEST/metafont/$package", $mfpatt);
}

# MetaPost files:
sub domp {
   $mppatt = $specialmp{$package} || $standardmp;
   &install("$DEST/metapost/$package", $mppatt);
}

# BibTeX bibliography files:
sub dobib {
  $bibpatt = $specialbib{$package} || $standardbib;
  &install("$DEST/bibtex/bib/$package", $bibpatt);
}

# source files:
sub dosource {
  $sourceformat = $specialsourcefmt{$package} || $standardsourcefmt;
  # default to using specialdocfmt, as we do in setup?
  $sourcepatt = $specialsource{$package} || $standardsource;
  &install("$DEST/source/$sourceformat/$package", $sourcepatt);
}

# omega files:
sub doomega
{
   $ovfpatt = $specialovf{$package};
   if ($ovfpatt eq "") { $ovfpatt=$standardovf; }
   &install("$DEST/fonts/ovf/public/$package",$ovfpatt);
   $ofmpatt = $specialofm{$package};
   if ($ofmpatt eq "") { $ofmpatt=$standardofm; }
   &install("$DEST/fonts/ofm/public/$package",$ofmpatt);
   $ovppatt = $specialovp{$package};
   if ($ovppatt eq "") { $ovppatt=$standardovp; }
   &install("$DEST/fonts/ovp/public/$package",$ovppatt);
   $otppatt = $specialotp{$package};
   if ($otppatt eq "") { $otppatt=$standardotp; }
   &install("$DEST/omega/otp/$package",$otppatt);
   $ocppatt = $specialocp{$package};
   if ($ocppatt eq "") { $ocppatt=$standardocp; }
   &install("$DEST/omega/ocp/$package",$ocppatt);
}

# the dvips and font mapping files:
sub dotype1{
   my $encpatt = $specialenc{$package} || $standardenc;
   &install("$DEST/fonts/enc/dvips/$package", $encpatt);

   my $mappatt = $specialmap{$package} || $standardmap;
   my $mapdest = $specialmapdest{$package} || $standardmapdest;
   &install ("$DEST/$mapdest/$package", $mappatt);

   my $vmappatt = $specialvmap{$package} || $standardvmap;
   &install("$DEST/fonts/map/vtex/$package", $vmappatt);

   my $propatt = $specialpro{$package} || $standardpro;
   &install("$DEST/dvips/$package", $propatt);

   my $foundry = $specialfoundry{$package} || $standardfoundry;
   
   my $pfbpatt = $specialpfb{$package} || $standardpfb;
   &install("$DEST/fonts/type1/$foundry/$package", $pfbpatt);

   my $afmpatt = $specialafm{$package} || $standardafm;
   &install("$DEST/fonts/afm/$foundry/$package", $afmpatt);

   my $pfmpatt = $specialpfm{$package} || $standardpfm;
   &install("$DEST/fonts/type1/$foundry/$package", $pfmpatt);

   my $otfpatt = $specialotf{$package} || $standardotf;
   &install("$DEST/fonts/opentype/$foundry/$package", $otfpatt);

   my $ttfpatt = $specialttf{$package} || $standardttf;
   &install("$DEST/fonts/truetype/$foundry/$package", $ttfpatt);

   my $sfdpatt = $specialsfd{$package} || $standardsfd;
   &install("$DEST/fonts/sfd/$package", $sfdpatt);
}



# scripts.  Make them executable even if it isn't always necessary.
# Build/source/tex/texlive/linked_scripts/Makefile.am installs symlinks
# in the bin directories where needed.  That Makefile is independently
# maintained, and needs to be updated by hand when new user-visible scripts
# are added.  We add/update the script itself under linked_scripts.
# We also make the symlinks/w32-wrapper-copy in Master/bin.
# 
sub doscripts {
  my $pwd = getcwd();
  my $scriptsdir = "$DEST/scripts/$package";

  # in the .tds.zip case, we will already be in the scripts dir
  # and they will already be installed, ipso facto.
  my $tds_zip = $pwd eq $scriptsdir;

  my @scripts = ();
  # first do the user-visible bindir entries.
  $scriptpatt = $specialscripts_bin{$package};
  if ($scriptpatt) {
    if (! $tds_zip) {
      &install ($scriptsdir, $scriptpatt);
      &SYSTEM ("chmod a+x $scriptsdir/*");
    }
    # determine list of scripts from scriptpatt, since a .tds.zip (e.g.,
    # adhocfilelist) might have unpacked others into the scripts/ dir.
    chomp (@scripts = grep (/$scriptpatt/, `ls $scriptsdir`));
    #
    # update the copy in Build (the reason we do the bindir ones first).
    for my $s (@scripts) {
      &build_scripts_copy ("$scriptsdir/$s");
    }
  }
  
  # then do the ones that go only under scripts/ and not in the bindirs.
  # (and hence also not in Build.)
  my $nobin_scriptpatt = $specialscripts_nobin{$package};
  if ($nobin_scriptpatt) {
    if (! $tds_zip) {
      &install ($scriptsdir, $nobin_scriptpatt);
      &SYSTEM ("chmod a+x $scriptsdir/*");
    }
  }

  # List of scripts we just copied in for installing in the bindirs.
  return unless @scripts;

  # If not already present, create the platform-specific bindir entries.
  # 
  my $build_tldir = "texk/texlive";
  chomp (my @platforms = `cd $Master/bin && ls`);
  #
  for my $s (@scripts) {
    (my $linkname = $s) =~ s/\..*$//;
    for my $p (@platforms) {
      my $platdir = "$TOPDEST/bin/$p";
      &xmkdir ($platdir);
      #
      if ($p ne "win32") {
        my $linktarget = "../../$DEST_TREE/scripts/$package/$s";
        &SYSTEM ("ln -s $linktarget $platdir/$linkname");
        #
        # Scripts with special cases.
        # xx should merge with bin_links in
        # Build/source/texk/texlive/linked_scripts/Makefile.am, sigh.
        &SYSTEM ("ln -s $linkname $platdir/r$linkname")
          if $linkname =~ /^(pdfcrop|epstopdf)$/; # rpdfcrop ->pdfcrop, ...

        &SYSTEM ("ln -s $linkname $platdir/latexdef")
          if $linkname eq "texdef"; # latexdef->texdef

      } else {
        # Windows.  If a shell script, usually skip, except for Java
        # programs.  Else copy the wrapper.
        if ($s !~ /arara|bib2gls|convertgls2bib|texosquery/) {
          next if $s =~ /\.sh$/ && $s !~ /-sys\.sh$/;
        }
        #
        # Other shell scripts whose names don't end in .sh.  We need to
        # change this to match texmf_dist_shell_scripts in
        # linked_scripts/Makefile.am, or rather read that list.  xx
        next if $s =~ /dtx(file)?gen/;
        next if $s =~ /latexfileversion|ltxfileinfo$/;
        next if $s =~ /pdf(book2|xup)/;
        next if $package eq "pdfjam";
        #
        if ($s eq "ps4pdf") {  # package pst-pdf
          # handwritten special .bat
          &SYSTEM ("$CP $s.bat.noMiKTeX $platdir/$s.bat");
          # keep copy in scripts/ too, for clarity?
          &SYSTEM ("$MV $s.bat.noMiKTeX $scriptsdir");
          # best to have wrapper also, maybe?

        } elsif ($s eq "lua2dox_filter"   # package lua2dox
                 || $s eq "ctan-o-mat") { # package ctan-o-mat
          # handwritten .bat
          &SYSTEM ("$MV $s.bat $platdir/");
          next; # no wrapper

        } elsif ($s eq "latexindent.pl") {
          # provided .exe (made with par::packer)
          &SYSTEM ("$MV latexindent.exe $platdir/");
          next; # no wrapper
        }

        # xx here too should merge with bin_links in
        # Build/source/texk/texlive/linked_scripts/Makefile.am, sigh.
        my $w32_wrapper = "$Build/$build_tldir/w32_wrapper/runscript.exe";
        &SYSTEM ("$CP $w32_wrapper $platdir/$linkname.exe");
        &SYSTEM ("$CP $w32_wrapper $platdir/r$linkname.exe")
          if $linkname =~ /^(pdfcrop|epstopdf)/; # r{pdfcrop,epstopdf}.exe
        &SYSTEM ("$CP $w32_wrapper $platdir/latexdef.exe")
          if $linkname eq "texdef"; # latexdef->texdef
      }
    }
  }
}


# info files.  We put these in texmf-dist/doc/info, which is where we keep
# the info files for the programs, too.  Having an info dir in
# texmf-dist also would imply lots of changes in the installer, and
# there seems to be no gain.
# 
sub doinfos {
   my $infopatt = $specialinfos{$package};
   return unless $infopatt;
   &install ("$TOPDEST/texmf-dist/doc/info/", $infopatt);
}


# generate info files from .texi.
# 
sub dotexinfos {
  my $texipatt = $specialtexinfos{$package};
  return unless $texipatt;
  
  local *DOT;
  opendir (DOT, ".") || die "opendir(.) failed: $! in " . `pwd`;
  my @files = readdir (DOT);
  my @texi_files = grep (/$texipatt/, @files);
  die ("dotexinfos: no texi files match $texipatt (@files) in " . `pwd`)
    if ! @texi_files;

  closedir (DOT) || die "closedir(.) failed: $! in " . `pwd`;

  print "tl_texi_to_info for: @texi_files\n";  
  &SYSTEM ("$MAKEINFO --force --no-split @texi_files");
  
  # install() needs the @filenames global set (ugh).
  local @filenames = <*.info>;
  &install ("$TOPDEST/texmf-dist/doc/info/", '.info');
}


# man pages.  We put these in texmf-dist/doc/man/man1, a la info (see above).
# 
sub domans {
  my $manpatt = $specialmans{$package};
  return unless $manpatt;
  &install ("$TOPDEST/texmf-dist/doc/man/man1/", $manpatt);
  &tl_man_to_pdf ();  # make pdfs for them
}

# When a package has man pages, we want to update the pdf versions of
# them that we distribute using our Makefile setup, so that they are
# all consistent.  So we copy over our Makefiles, run make, and then
# remove them.
# 
sub tl_man_to_pdf {
  my ($secnum) = @_;
  $secnum = 1 unless $secnum;
  my $manN = "man$secnum";
  
  my $Master_man = "$Master/texmf-dist/doc/man";
  my $pkg_man = "$TOPDEST/texmf-dist/doc/man";
  print "tl_man_to_pdf for: " . join (" ", <$pkg_man/$manN/*>) . "\n";

  my $man_makefiles = "Makefile $manN/Makefile";
  &SYSTEM ("cd $Master_man && $CP --parents $man_makefiles $pkg_man/");
  
  # Extra complication: we don't want to rebuild everything, only those
  # that have changed.  Therefore, also copy in the pdfs for the package
  # being updated from the Master man dir.
  for my $man (<$pkg_man/$manN/*>) {
    if ($man =~ /\.man$/) {  # rename from .man to .1
      (my $this_man = $man) =~ s/\.man$/\.$secnum/;
      &SYSTEM ("$MV $man $this_man");
      $man = $this_man;
    }
    (my $pdf_man = $man) =~ s,^.*/,,;  # just foo.1, no directories
    $pdf_man =~ s/$secnum$/$manN.pdf/; # foo.1 -> foo.man1.pdf
    #
    my $Master_pdf_man = "$Master_man/$manN/$pdf_man";
    if (-r $Master_pdf_man) {
      &SYSTEM ("$CP $Master_pdf_man $pkg_man/$manN/");  # copy existing
    }
  }
  
  &SYSTEM ("cd $pkg_man && make DIR=$manN");               # build new pdfs
  &SYSTEM ("cd $pkg_man && $RM Makefile $manN/Makefile");  # rm Makefiles
}


# build the font files
sub domf {
  $mfpatt = $specialmf{$package} || $standardmf;
  &runmf ($mfpatt);

  my $mfdir = "$DEST/fonts/source/$Foundry/$package";
  #
  # don't use $mfpatt since that's only the tfm-able mf files; just
  # install all the .mf files.
  my $mf_inst_patt = $specialmfinstall{$package} || $standardmfinstall;
  &install ($mfdir, $mf_inst_patt);
}

sub runmf {
  my ($mfpatt) = @_;
  print "\t doing runmf for $package ($mfpatt)\n";
  print "  from filenames: @filenames\n";
  for my $file (grep (/$mfpatt/, @filenames)) { 
    ($FileBase,$Filepath,$Filesuffix) = fileparse ($file, "\.[A-z]*");
    if (! -e "$FileBase.tfm") {
      print "\t\t Make TFM from $file\n";
      &runjob ("mktextfm --destdir=`pwd` $FileBase.tfm");
      &SYSTEM ("$RM *pk");  # not worth the space
    }
  }
}

sub rundvi {
   local($thispatt) = @_;
   $TEX = $specialTEX{$package};
   if ($TEX eq "") { 
       if ($whichformat eq 'latex') { $TEX="pdflatex"; }
       else { $TEX=$whichformat; }
   }
   if ($TEX eq "generic") { $TEX="pdflatex"; }
   print "\t MAKEDVI $thispatt using $TEX (@filenames)\n";
   for (grep(/$thispatt/,@filenames)) { 
     ($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z]*");
     print "found $FileBase\n";
      if (-r "$FileBase.drv" && $Filesuffix eq ".dtx" ) 
          { $Filesuffix=".drv" ; }
      print "\t DOC: run $TEX on $FileBase$Filesuffix\n";
      open(TMP,">$FileBase.aux");
      close(TMP);
      &runjob("TEXMFLOCAL=. $TEX '\\nonstopmode\\input $FileBase$Filesuffix'");
      &runjob("bibtex $FileBase");
      &runjob("TEXMFLOCAL=. $TEX '\\nonstopmode\\input $FileBase$Filesuffix'");
      if ($Filesuffix eq ".drv" || $Filesuffix eq ".dtx" ) {
        &runjob("$CP $RAW_DIR/gind.ist .");
        &runjob("makeindex -s gind.ist $FileBase");
        unlink "gind.ist";
      } else {
        &runjob("makeindex $FileBase");
      }
      &runjob("$TEX '\\nonstopmode\\input $FileBase$Filesuffix'");
   }
   print "\t MAKEDVI done\n";
}

# run a &SYSTEM job, and append stderr output to log file
#
sub runjob {
  my ($job) = @_;
  my $status = 0;
  
  if ($opt_test) {
    print "WOULDRUNJOB $job\n";
  } else {
    my $Jobid = "_$$";
    chomp (my $PWD = `pwd`);
    &SYSTEM ("$job >$PWD/$Jobid.log 2>&1");
    $status = $?;
    local *TMP;
    open (TMP, "$Jobid.log") || die "open($Jobid.log) failed: $!";
    my @output = (<TMP>);
    if ($job =~ /^mktextfm/) {
      my $lastline = $output[$#output-1];
      print "runjob mktextfm last output line: $lastline\n";
      # it's too verbose to print the full mf run of every font.
      # but if mktextfm failed, show that.
      print `cat $Jobid.log` if $status != 0;
      $status = 0; # do not worry if the bitmap failed, e.g., grtt10.mf.
    } else {
      print `cat $Jobid.log`;
    }
    close (TMP);
    system ("$RM -f /tmp/$Jobid.log; mv $Jobid.log /tmp"); # save last log
    
    die "goodbye, exit status $status for $job\n"
      if $status != 0;
  }
  return $status;
}

# Remove all files matching something in $KILLPATT.
# Also remove .ps files for which we have a .pdf.
# 
# if MORE is true, remove additional files matching something in
# $moreclean and create a README.TEXLIVE which lists the removed files.
# As a kludge created for rangen (now used for marvosym), if KILLPATT
# starts with a directory path (e.g., doc/), we cd to that directory
# before globbing (and cd back at the end).
# 
# (Switching all the kill patterns to globs, so we could just use the
# glob function, seemed too ugly.  And removing the file in a posthook
# would have meant a separate fn for README.TEXLIVE, also ugly.)
# 
sub killfiles {
   my ($killpatt,$more) = @_;

   print "killfiles($killpatt,$more)\n";
   return unless $killpatt;

   # cd to a leading directory name in KILLPATT.
   my $origdir = "";
   if ($killpatt =~ m,^(.*/),,) {
     $origdir = getcwd ();
     &xchdir ($1);
     $killpatt =~ s,^$1,,;
   }
   
   local *DOT;
   opendir (DOT, ".") || die "opendir(.) failed: $! in " . `pwd`;

   my @delfiles = ();
   for (grep (/$killpatt/, readdir (DOT))) { 
     if (unlink ($_)) {
       print "\t Removing $_\n";
       push (@delfiles, $_);
     } else {
       warn "unlink($_) failed: $!";
     }
   }
   for (grep (/\.ps$/, @filenames)) { 
     (my $pdf = $_) =~ s/ps$/pdf/;
     next unless grep (/$pdf/, @filenames);
     print "\t Removing ps $_ (since have $pdf)\n";
     unlink ($_) && push (@delfiles, $_);
   }  

   if ($more && @delfiles) {
     # get package url on CTAN
     my $ctan_url = '.';
     chomp (my $ctan_root = `tlpkginfo --ctan-root`);
     chomp (my $ctan_dir = `tlpkginfo --ctan-dir $packagedir`);
     if (not $?) {
       $ctan_dir =~ s!$ctan_root/!!;
       $ctan_url = " at\n\thttp://mirror.ctan.org/$ctan_dir";
     }
     # create/update README.TEXLIVE.
     open (RTL, ">README.TEXLIVE") || warn "open(>README.TEXLIVE) failed: $!";
     print RTL <<"EOF";
The following files have been removed in the TeX Live installation of
the current package, typically due to duplication, lack of space, or
missing source code.  You can find these files on CTAN$ctan_url
If questions or concerns, email tex-live\@tug.org.

EOF
     foreach my $f (@delfiles) {
       print RTL "\t$f\n";
     }
     close RTL;
   }
   
   # if we cd'd, cd back.
   &xchdir ($origdir) if $origdir;

   &buildfilelist();
}

# rebuild list of input files, e.g., after flattening
sub buildfilelist {
  print "doing buildfilelist()...\n";
  opendir (DIR ,'.') || die "opendir(.) failed: $!";
  @filenames = grep (!/^\.\.?$/, readdir (DIR));
  closedir (DIR);
}

sub runfonts {
   $Foundry = $specialfoundry{$package} || $standardfoundry;
   for (grep(/\.vf$/, @filenames)) { 
      $needdir=1;
      print "\t\t install VF $_\n";
($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z]*");
      if ($needdir) { 
         &SYSTEM("mkdir -p $DEST/fonts/vf/$Foundry/$package");
         $needdir=0;
         }
         &SYSTEM("$MV $FileBase.vf $DEST/fonts/vf/$Foundry/$package  ");
    }
   for (grep(/\.tfm$/,@filenames)) { 
      $needdir=1;
      print "\t\t INSTALL tfm $_\n";
($FileBase,$Filepath,$Filesuffix) = fileparse($_,"\.[A-z]*");
      if ($needdir) { 
         &SYSTEM("mkdir -p $DEST/fonts/tfm/$Foundry/$package");
         $needdir=0;
         }
         &SYSTEM("$MV $FileBase.tfm $DEST/fonts/tfm/$Foundry/$package");
    }
}



sub MAKEflatten {
  # don't do this in a tds-ready tree...
  -e "$RAW_DIR/$packagedir/TDS_READY" 
   && die "$0: using MAKEflatten with TDS_READY tree $RAW_DIR/$packagedir.\n";

  &setup;
  &xchdir ("$DEST/doc/$whichdocformat/$package");

  &flatten_dirtree ($package);
  
  # do the usual.
  &buildfilelist;
  &donormal ("nosetup");
}

# Flatten the directory tree (for PACKAGE) under the cwd.
# 
sub flatten_dirtree {
  my ($package) = @_;

  print "\t SPECIAL flatten $package\n";

  # cm-super et al. need to intervene at this point.
  &run_prehook ($package);

  # I don't think flattened packages ever want symlinks.
  &SYSTEM ("find . -type l | xargs --no-run-if-empty $RM");

  # mv foo/README to README.foo.  README.txt is for psfragx.
  # LISEZ-MOI is for bclogo.  Makefile and 00README are for tipa.
  # Obviously should be generalized to non-README files.
  my $findcmd = "find . -mindepth 2 '(' "
                . "-name README -o -name README.txt -o -name LISEZ-MOI "
                . "-o -name Makefile -o -name 00README "
                . "')'";
  &SYSTEM ("for r in `$findcmd`; do"
           . ' mv $r $r.`basename \`dirname $r\``; done');

  # move all non-directories to top level, but don't accidentally
  # overwrite one with another.
  &SYSTEM ("yes n | find . -mindepth 2 -not -type d -exec mv -i '\{\}' . \\;");

  # remove newly empty directories.
  &SYSTEM ("find -depth -type d -print | xargs rmdir 2>/dev/null");
}

sub MAKEunzipandflatten {
  &setup;
  chdir("$DEST/doc/$whichdocformat/$package");
  my $archive = -r "$package.zip" ? "$package.zip" : "$package.tar.gz";
  my $unarchiver = &unarchiver ($archive);
  &SYSTEM ("$unarchiver $archive; $RM $archive");

  &flatten_dirtree ($package);

  &buildfilelist;
  &donormal ("nosetup");
}

sub MAKEnosymlinks {
  &setup;
  &xchdir ("$DEST/doc/$whichdocformat/$package");

  print "\t SPECIAL nosymlinks $package\n";
  &SYSTEM ("find . -type l | xargs --no-run-if-empty rm");

  &buildfilelist;
  &donormal ("nosetup");
}

sub MAKEaqcm {
  print "\t SPECIAL $package";

  # sort of flatten, but not completely (keep the 'examples' subdir)
  &xchdir($packagedir);
  &SYSTEM('mv latex/* . && rmdir latex');
  &SYSTEM('mv doc/README README.doc');
  &SYSTEM('mv doc/* . && rmdir doc');

  # now do the normal thing
  &xchdir($RAW_DIR);
  &donormal();
}

sub MAKEarabi {
  &xchdir ("$packagedir/arabi/texmf");  # author will remove these next time
  #
  print "\t SPECIAL $package - removing microsoft and nonfree\n";
  &SYSTEM('find -name microsoft -o -name nonfree | xargs rm -rf');
  #
  print "\t SPECIAL $package - rearranging for tds\n";
  &SYSTEM ("mkdir -p tex; mv latex tex");
  &SYSTEM ("$RM tex/latex/arabi/updmap.cfg");
  &SYSTEM ("$MV tex/latex/arabi/poetry.sty tex/latex/arabi/arabipoetry.sty");
  &SYSTEM ("$MV tex/latex/arabi/bblopts.cfg doc/latex/arabi");
  &SYSTEM ("rm -rf dvips");
  #
  print "\t SPECIAL $package - copying to $DEST\n";
  &SYSTEM ("mkdir -p $DEST");
  &SYSTEM ("$CP -r * $DEST/");
}

sub MAKEarabtex {
  &xchdir ($packagedir);
  #
  print "\t SPECIAL $package: removing top-level links\n";
  &SYSTEM('for f in apatch.sty arabtex.tex hebtex.tex hepatch.sty; do test -h $f && rm -v $f; done');
  #
  print "\t SPECIAL $package: removing top-level tgz's\n";
  &SYSTEM('for f in *.tgz; do rm -v $f; done');
  #
  print "\t SPECIAL $package: removing bitmap fonts\n";
  &SYSTEM("rm -rf laser.pk");
  #
  print "\t SPECIAL $package: renaming arabtex.htm\n";
  &SYSTEM('mv doc/html/arabtex.htm arabtex1.htm');
  &SYSTEM('mv doc/txt/arabtex.htm arabtex2.htm');
  #
  print "\t SPECIAL $package: flatten\n";
  &xchdir ("..");
  &MAKEflatten ();
  #
  print "\t SPECIAL $package: removing redundant files\n";
  &SYSTEM("rm -rf doc texinput");
}

sub MAKEarphic {
  # tds-ready tarballs with a top-level dir name.  copy all into new/.
  &SYSTEM ("mkdir -p new");
  for my $tar (<*.tar.*>) {
    (my $tarbase = $tar) =~ s/\.tar.*//;
    &SYSTEM ("tar xf $tar "
             . "&& (cd $tarbase && cp -arf * ../new)"
             . "&& rm -rf $tar $tarbase");
  }
  # move everything from new to the top level.
  &SYSTEM ("mv new/* . && rmdir new");
  #
  # move docs to subdir.
  &SYSTEM ("mv arphic-sampler* doc/fonts/arphic");
  #
  # copy to dest.
  &xchdir ("..");
  &MAKEcopy ();
}

sub MAKEaurical {
  &xchdir ($packagedir);
  #
  # basically have a tds hier to unzip, with some cleanups.
  &SYSTEM ("unzip -q aurical_texmf.zip");
  &SYSTEM ("mkdir -p fonts/source/public/aurical/");
  &SYSTEM ("$MV $DEST/README doc/latex/aurical/");
  &SYSTEM ("$MV aurical_source.zip fonts/source/public/aurical/");
  &SYSTEM ("$RM aurical.pdf aurical_texmf.zip");
  #
  &xchdir ("..");
  &MAKEcopy ();
}

sub MAKEborceux {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package/user-guides");
 &SYSTEM("$MV -f * $DEST/doc/$whichdocformat/$package");
 chdir("$DEST/doc/$whichdocformat/$package/diagram");
 &SYSTEM("$MV -f * $DEST/tex/$whichformat/$package");
}

sub MAKEeskdx {
 &setup;
 &xchdir ("$DEST/doc/$whichdocformat/$package");
 print "\t SPECIAL $package: flatten unpacked/ dir (only)\n";
 &SYSTEM ("$MV unpacked/Makefile Makefile.unpacked");
 &SYSTEM ("$MV unpacked/* .");
 &SYSTEM ("rmdir unpacked");
 &buildfilelist;
 &donormal;
}

sub MAKEfp {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &runjob("mkdir -p $DEST/tex/plain/fp; $CP fp.tex $DEST/tex/plain/fp");
 &donormal;
}

sub MAKElh {
  &setup ();
  &xchdir ($DOCDIR);
  #
  # basically have several tds hiers to unzip, with some cleanups.
  print "\t SPECIAL $package: unzip etc.\n";
  for my $zip (<*.zip>) {
    &SYSTEM ("cd $DEST && unzip -q -o $DOCDIR/$zip; $RM $DOCDIR/$zip");
  }
  # they had wrong texmf level in zip; can't mv since dirs exist
  &SYSTEM ("cd $DEST/texmf && cp -arf . .. && rm -rf $DEST/texmf");
}

sub MAKEmetauml {
 &setup;
 &xchdir ("$DEST/doc/$whichdocformat/$package");
 &SYSTEM ("$MV doc/* examples/* inputs/* .");
 &SYSTEM ("rmdir doc examples inputs");
 &buildfilelist;
 &donormal;
}

sub MAKEgermbib {
  &xchdir ($packagedir);
  #
  print "\t SPECIAL $package remove symlinks\n";
  &SYSTEM ("find . -type l | xargs --no-run-if-empty rm");
  #
  # we can't conflict with standard apalike.sty.
  print "\t SPECIAL $package rename second apalike.sty\n";
  &SYSTEM ("$MV styles/apalike.sty styles/apalike.germbib_sty");
  #
  &xchdir ("..");  
  &MAKEflatten ();
}

sub MAKEgnu_freefont {
  &xchdir ($packagedir);
  #
  # Let's not include the woff files.
  &SYSTEM ("$RM *woff*"); # rm remainder
  #
  # both tars and zips with a common top-level dir name.
  # will overwrite some common files, but hopefully they are identical.
  for my $zip (<*20120503*.zip>) {
    &SYSTEM ("unzip -o -q $zip && $RM $zip");
  }
  for my $tar (<*20120503*.tar.gz>) {
    &SYSTEM ("tar xf $tar && $RM $tar");
  }
  &SYSTEM ("$RM *.sig *.zip *.tar.gz"); # rm remainder
  #
  # move everything out of the subdir to the doc dir,
  # to get ready for setup.
  my $docdir = "$DEST/doc/$whichdocformat/$package";
  &SYSTEM ("mkdir -p $docdir/");
  &SYSTEM ("$MV freefont-*/* $docdir/ && rmdir freefont-*");
  #
  # Move sfd files to source subtree.
  my $sourcetree = "$DEST/source/$whichdocformat";
  &SYSTEM ("mkdir -p $sourcetree/");
  &SYSTEM ("$MV $docdir/sfd $sourcetree/$package");
  #
  &donormal ("nosetup");
}

sub MAKEnewsletr {
  &setup;
  chdir("$DEST/doc/$whichdocformat/$package");
  &SYSTEM ("$MV newsletr.tex $DEST/tex/$whichformat/$package");
  &SYSTEM ("$RM *.dvi");
}

sub MAKEnotes {
  &setup;
  &xchdir ($DOCDIR);
  &SYSTEM ("make eps png pdf");
  &donormal;
}

sub MAKEpbdiagram {
 &setup;
 chdir("$DEST/doc/latex/$package");
 &SYSTEM("rm -rf mf tfm");
 &buildfilelist;
 &donormal;
}

sub MAKExkeyval {
  # needs files in both latex and generic.
  &MAKEflatten ();
  print "\t SPECIAL $package moving .tex\n";
  my $generic = "$DEST/tex/generic/$package/";
  &SYSTEM ("mkdir -p $generic; mv *.tex $generic");
}

sub MAKExypic {
  # Copy source files per INSTALL instructions.
  &xchdir ($packagedir);
  my $Foundry = "public";
  &SYSTEM ("mkdir -p $DEST/doc/generic/xypic");
  &SYSTEM ("$CP [A-Z]* $DEST/doc/generic/xypic/");
  &SYSTEM ("$CP doc/*.* $DEST/doc/generic/xypic");
  &SYSTEM ("$CP -r support/ $DEST/doc/generic/xypic");  # copy dir as dir
  #
  &SYSTEM ("mkdir -p $DEST/tex/generic/xypic");
  &SYSTEM ("$CP texinputs/* $DEST/tex/generic/xypic/");
  #
  &SYSTEM ("mkdir -p $DEST/fonts/tfm/$Foundry/xypic");
  &SYSTEM ("$CP texfonts/* $DEST/fonts/tfm/$Foundry/xypic/");
  #
  &SYSTEM ("mkdir -p $DEST/fonts/afm/$Foundry/xypic");
  &SYSTEM ("$CP afm/* $DEST/fonts/afm/$Foundry/xypic/");
  #
  &SYSTEM ("mkdir -p $DEST/fonts/map/dvips/xypic");
  &SYSTEM ("$CP map/* $DEST/fonts/map/dvips/xypic/");
  #
  &SYSTEM ("mkdir -p $DEST/fonts/enc/dvips/xypic");
  &SYSTEM ("$CP enc/* $DEST/fonts/enc/dvips/xypic/");
  #
  &SYSTEM ("mkdir -p $DEST/fonts/source/$Foundry/xypic");
  &SYSTEM ("$CP mfinputs/* $DEST/fonts/source/$Foundry/xypic/");
  #
  &SYSTEM ("mkdir -p $DEST/fonts/type1/$Foundry/xypic");
  &SYSTEM ("$CP type1/* $DEST/fonts/type1/$Foundry/xypic/");
  &SYSTEM ("$CP pfm/* $DEST/fonts/type1/$Foundry/xypic/");
  #
  &SYSTEM ("mkdir -p $DEST/dvips/xypic");
  &SYSTEM ("$CP ps/* $DEST/dvips/xypic/");
}

sub MAKEplqx {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &SYSTEM("$MV tex/* .");
 &SYSTEM("$MV doc/* .");
 &SYSTEM("rmdir doc tex");
 &buildfilelist;
 &donormal;
}

sub MAKEaugie {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &SYSTEM("$MV dvips/* .");
 &SYSTEM("$MV tfm/* .");
 &SYSTEM("$MV afm/* .");
 &SYSTEM("$MV doc/* .");
 &SYSTEM("$MV vf/* .");
 &SYSTEM("$MV tex/* .");
 &SYSTEM("$MV type1/* .");
 &SYSTEM("rmdir type1 tex vf afm dvips doc tfm");
 &buildfilelist;
 &donormal;
}

sub MAKEae {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &SYSTEM("$MV tfm/* .");
 &SYSTEM("$MV vf/* .");
 &SYSTEM("$MV src/* .");
 &SYSTEM("$MV tex/* .");
 &SYSTEM("rmdir tex vf src tfm");
 &buildfilelist;
 &dosource;
 &dotex;
   &domakeindex;
 &runfonts;
}

sub MAKEdevanagr {
 &xchdir ($packagedir);
 #
 print "\t SPECIAL $package: renaming README files\n";
 &SYSTEM('for f in *; do test -r $f/README && mv $f/README README.$f; done');
 #
 print "\t SPECIAL $package: moving .c and .exe to /tmp\n";
 &SYSTEM('mv bin/devnag.c bin/devnag.exe /tmp');
 #
 print "\t SPECIAL $package: flatten\n";
 &xchdir ("..");
 &MAKEflatten;
 print "YOU-MUST-DO! update /tmp/devnag.c and devnag.exe into Build\n";
}

# We don't want to flatten the templates, only the source.
# 
sub MAKEdisser
{
  &setup;
  &xchdir ("$DEST/doc/$whichdocformat/$package");
  print "\t SPECIAL $package\n";
  &SYSTEM ("$MV -f src/* .");
  &buildfilelist;
  &donormal ("nosetup");
}

sub MAKEeasy {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &SYSTEM("$MV doc/* $DEST/doc/$whichdocformat/$package");
   &buildfilelist;
   &dotex;
   &domakeindex;
   &dosource;
   &killfiles ($moreclean{$package}, "more") if $moreclean{$package};
}

sub MAKEfootnpag {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &SYSTEM("$MV src/* .");
   &buildfilelist;
   &dodvi;
# rebuild again, as we have .dvi files now
   &buildfilelist;
   &dotex;
   &domakeindex;
   &dosource;
}


sub MAKEfeynmf
{
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &SYSTEM("gunzip manual.ps");
 &buildfilelist;
 &runins('feynmf.ins');
 &buildfilelist;
 &dosimplemf;
 &dodvi;
 &buildfilelist;
 &domp;
 &dotex;
 &domakeindex;
 &dosource;
 killfiles($standardclean);
}

sub MAKEchangebar {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &buildfilelist;
 &donormal;
}

sub MAKEsiam
{
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &buildfilelist;
 &dodvi;
 &buildfilelist;
 &dobst;
 &dotex;
   &domakeindex;
 &dosource;
 &SYSTEM("mkdir -p $DEST/doc/plain/siam");
 &SYSTEM("mkdir -p $DEST/doc/amstex/siam");
 &SYSTEM("mkdir -p $DEST/tex/plain/siam");
 &SYSTEM("mkdir -p $DEST/tex/plain/amstex");
 &SYSTEM("$MV plain/*doc* $DEST/doc/plain/siam");
 &SYSTEM("$MV plain/* $DEST/tex/plain/siam");
 &SYSTEM("$MV amstex/*doc* $DEST/doc/amstex/siam");
 &SYSTEM("$MV amstex/* $DEST/tex/amstex/siam");
 killfiles($standardclean);
}

sub MAKEmisc {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &buildfilelist;
 &dotex;
   &domakeindex;
 killfiles($standardclean);
}

sub MAKEmv_doctex {
  # move files in tex to runtime, and doc/* up a level.
  &donormal ();
  #
  my $texdest = "$DEST/tex/$whichformat/$package";
  &xmkdir ($texdest);
  &SYSTEM ("$MV `find tex -type f` $texdest/");
  &SYSTEM ("$RM -r tex");  # rm now-empty dir
  &SYSTEM ("$MV doc/* .");
  #
  # remove newly empty directories.
  &SYSTEM ("find -depth -type d -print | xargs rmdir 2>/dev/null");
}

sub MAKEtamethebeast {
  my $destdir = "$DEST/doc/bibtex/$package";
  &SYSTEM("mkdir -p $destdir");
  &SYSTEM("$CP -r $packagedir/* $destdir");
}

sub MAKEexpressg {
 &setup;
chdir("$DEST/doc/$whichdocformat/$package");
&buildfilelist;
   $inspatt = $specialins{$package};
   &buildfilelist;
   if ($inspatt eq "") { 
        $inspatt=$standardins; 
        }
&runins($inspatt);
 &SYSTEM("mpost expeg.mp");
# rebuild the list of files in the directory
 &buildfilelist;
 &dodvi;
# rebuild again, as we have .dvi files now
 &buildfilelist;
 &runfonts;
&dobst;
 &dobib;
&dotex;
   &domakeindex;
 &dosource;
 &dotype1;
#
# this is a bit weird, but its an easy way to remove
# empty directories that we never used.
#
   &SYSTEM("rmdir $DEST/tex/$whichformat/$package 2> /dev/null");
   &SYSTEM("rmdir $DEST/doc/$whichdocformat/$package 2> /dev/null");
   &SYSTEM("rmdir $DEST/source/$whichformat/$package 2> /dev/null");
   killfiles($standardclean);
}

sub MAKEpslatex
{
  &xchdir ($packagedir);
  $Foundry = $specialfoundry{$package} || $standardfoundry;
  #
  &runjob("mkdir -p $DEST/tex/latex/pslatex");
  &runjob("$CP latex/* $DEST/tex/latex/pslatex");
  #
  &runjob("mkdir -p $DEST/fonts/tfm/$Foundry/pslatex");
  &runjob("$CP tfm/* $DEST/fonts/tfm/$Foundry/pslatex");
  #
  &runjob("mkdir -p $DEST/fonts/vf/$Foundry/pslatex");
  &runjob("$CP vf/* $DEST/fonts/vf/$Foundry/pslatex");
  #
  &runjob("mkdir -p $DEST/fonts/map/dvips/pslatex");
  &runjob("$CP dvips/* $DEST/fonts/map/dvips/pslatex");
  #
  &runjob("mkdir -p $DEST/source/latex/pslatex");
  &runjob("$CP -r fontinst $DEST/source/latex/pslatex");
  &runjob("$CP -r shell $DEST/source/latex/pslatex");
}

sub MAKEeco {
  # this simply copies source files
  chdir($packagedir) || die ("ERROR: cannot open directory");
  &runjob("mkdir -p $DEST/fonts/tfm/$Foundry/eco");
  &runjob("mkdir -p $DEST/fonts/vf/$Foundry/eco");
  &runjob("mkdir -p $DEST/tex/latex/eco");
  &runjob("mkdir -p $DEST/dvips/eco");
  &runjob("mkdir -p $DEST/doc/fonts/eco");
  &runjob("mkdir -p $DEST/source/fonts/eco");
  &runjob("$CP src/*sty $DEST/tex/latex/eco");
  &runjob("$CP fd/* $DEST/tex/latex/eco");
  &runjob("$CP tfm/* $DEST/fonts/tfm/$Foundry/eco");
  &runjob("$CP vf/* $DEST/fonts/vf/$Foundry/eco");
  &runjob("$CP -r [A-Z]* $DEST/doc/fonts/eco");
  &runjob("$CP src/*x src/*.sh $DEST/source/fonts/eco/");
}

sub MAKEelhyphen {
 &setup;
 &buildfilelist;
 &donormal;

 print "\t SPECIAL $package: lowercase names\n";
 &SYSTEM('for f in GR*hyph*.tex; do mv $f `echo $f | tr A-Z a-z`; done');
 
 print "\t SPECIAL $package: install gr*hyph.tex files\n";
 my $generichyphdir = "$TOPDEST/texmf-dist/tex/generic/hyphen";
 &SYSTEM("mkdir -p $generichyphdir");
 &SYSTEM("$MV gr*hyph*.tex $generichyphdir");

 print "YOU-MUST-DO! $package: update texmf/tex/generic/config/language.gr.dat\n";
 print "YOU-MUST-DO! $package: update texmf/tpm/hyphen-greek.tpm\n";
 print "YOU-MUST-DO! $package: add to texmf/tpm/collection-langgreek.tpm\n";
}

# all the lshort translations are pretty similar.
sub MAKElshort {
  print "MAKElshort $package\n";
  (my $lang = $package) =~ s,.*-,,;  # lshort-english -> english
  my $destdir = "$DEST/doc/latex/$package";
  &SYSTEM ("mkdir -p $destdir");
  &SYSTEM ("$CP -r $packagedir/* $destdir");
  # keep only the main pdf to save space.
  &SYSTEM ("cd $destdir && $RM lshort*.ps *lshort*.ps.*z* lshort*.dvi");
  &SYSTEM ("cd $destdir && $RM *lshort*-a5.pdf lshort*-letter.pdf");
  &SYSTEM ("cd $destdir && $RM lshort-*-book.zip");
  # remove symlinks such as README.
  &SYSTEM ("cd $destdir && find -type l | xargs --no-run-if-empty rm");
}

sub MAKEltt {
# this simply copies source files
   chdir($packagedir) || die ("ERROR: cannot open directory");
  &runjob("mkdir -p $DEST/doc/ltt");
  &runjob("$CP * $DEST/doc/ltt");
 }

# pstricks packages usually support both plain and latex.
# 
sub MAKEpst {
  print "\t SPECIAL pst $package starts\n";
  # pst-laboObj.tex, pst-fp.sty, pst-vehicle need special cases:
  $standardtex = qq!^(($package(Obj)?)|pst-fp|ListVehicles)\.(tex|sty)!;
  $whichformat='generic';
  $whichdocformat='generic';
  $specialsourcefmt{$package}='generic';
  $specialsource{$package} = "Makefile|$standardsource";  
  &setup;
  &xchdir("$DEST/doc/$whichdocformat/$package");
  &buildfilelist;

  $inspatt=$standardins if ! $inspatt;
  &runins($inspatt);
  &buildfilelist;
  &dosource;
  &dotex;
  &dotype1;   
  &killfiles ($standardclean);
  &killfiles ($moreclean{$package}, "more") if $moreclean{$package};

  my @cfg = glob ("$DEST/doc/generic/$package/*cfg");
  @cfg = () if $package eq "pst-pad"; # its showexpl.cfg is for the doc
  &mv_with_mkdir (@cfg, "$DEST/tex/latex/$package") if @cfg;

  my @dvips = glob ("dvips/*");
  &mv_with_mkdir (@dvips, "$DEST/dvips/$package") if @dvips;

  my @plain = glob ("tex/*");
  &mv_with_mkdir (@plain, "$DEST/tex/generic/$package") if @plain;

  my @sty = glob ("$DEST/tex/generic/$package/*sty");
  push (@sty, "latex/*") if -d "latex";  # in case the source has a subdir
  &mv_with_mkdir (@sty, "$DEST/tex/latex/$package") if @sty;

  &SYSTEM("$MV doc/* .") if -d "doc";
  
  my $postaction = $posthook{$package};
  eval ($postaction) if $postaction;
}

sub MAKEpstricks {
  # move the directories.
  &xchdir ($packagedir);
  &xmkdir ("$DEST/doc/generic");
  #
  my $docdir = "$DEST/doc/generic/pstricks";
  &SYSTEM ("$MV doc $docdir");
  &SYSTEM ("$MV README $docdir");
  #
  # move multiple Changes files out of runtime.
  &SYSTEM("$MV generic/Changes $docdir/Changes.generic");
  &SYSTEM("$MV latex/Changes $docdir/Changes.latex");
  &SYSTEM("$MV dvips/Changes $docdir/Changes.dvips");
  #
  &xmkdir ("$DEST/dvips");
  &SYSTEM ("$MV dvips $DEST/dvips/pstricks");
  #
  &xmkdir ("$DEST/tex/generic");
  &SYSTEM ("$MV generic $DEST/tex/generic/pstricks");
  &SYSTEM ("$MV config $DEST/tex/generic/pstricks/");
  #
  &xmkdir ("$DEST/tex/latex");
  &SYSTEM ("$MV latex $DEST/tex/latex/pstricks");
  &SYSTEM ("$MV $docdir/pst-doc.cls $DEST/tex/latex/pstricks");
}

sub MAKEwilson {
 &setup;

 my $docdir = "$DEST/doc/$whichdocformat/$package";
 &xchdir ($docdir);

 my $mapdir = "$DEST/fonts/map/dvips/$package";
 -d $mapdir || &SYSTEM ("mkdir -p $mapdir");
 &SYSTEM ("$MV *.map $mapdir");  # archaicprw.map

 opendir (DIR, '.') || die "opendir(.) failed: $!";
 @dirnames = grep (!/^\.\.?$/, readdir (DIR));
 closedir (DIR);

 for my $d (@dirnames) {
   if ($d =~ /\.zip$/) {
     unlink ("$docdir/$d");
     next;
   }
   
   # phaistos and linearA are nothing to do with Wilson's archaic, but
   # are separate packages created by AS.
   if ($d =~ /^(phaistos|linearA)$/) {
     &SYSTEM ("rm -rf $d $docdir/$d");
     next;
   }
   
   my $target = "$docdir/$d";
   next if ! -d $target;  # samples/readme files
   print "\t PROCESS Wilson subdir $d\n";
   &xchdir ($target);

   for my $f (glob ("try*"), glob ("*.pdf"), "README") {
     next unless -f $f;  # trysqrcaps.pdf matches both, can only mv once
     my $dest = "$docdir/";
     $dest .= "$d-" if $f !~ /$d/;
     $dest .= $f;
     &runjob("$MV $f $dest");
   }

   &buildfilelist;
   # run the .ins files (if any) supplied
   $inspatt = $specialins{$package} || $standardins;
   &runins($inspatt);
   unlink ("auncial.sty", "allauncl.sty");  # in auncial-new package
   
   &dodvi;
   &domf;
   &dodvi;
   # rebuild again, as we have .dvi files now
   &buildfilelist;
   &runfonts;
   unlink ("$DEST/fonts/tfm/$Foundry/$package/auncl10.tfm",
           "$DEST/fonts/tfm/$Foundry/$package/aunclb10.tfm");
   &dobst;
   &dobib;
   &dotex;
   &domakeindex;
   &dosource;
   &dotype1;
   killfiles($standardclean);
 }
 killfiles($standardclean);
 &SYSTEM ("find $docdir -name \*.ps | xargs gzip");  # compress big output
}


sub MAKEt2 {
  &xchdir ($packagedir);
  &xmkdir ("$DEST/tex/plain");
  &runjob ("$MV cyrplain $DEST/tex/plain");
  #
  &xmkdir ("$DEST/tex/generic/t2");
  &runjob ("$MV cyrfinst $DEST/tex/generic/t2");
  #
  &xmkdir ("$DEST/fonts/enc/t2");
  &runjob ("$CP enc-maps/encfiles/* $DEST/fonts/enc/t2");
  #
  &xmkdir ("$DEST/doc/generic/t2");
  &runjob ("$MV enc-maps/*.* enc-maps/[MR]* $DEST/doc/generic/t2");
  &runjob ("$MV etc examples $DEST/doc/generic/t2");
  #
  &xchdir ("$DEST/doc/generic/t2/etc");
  &xmkdir ("$DEST/tex/latex/t2");
  &runjob ("latex mathtext.ins");
  &runjob ("rm *log; mv *sty $DEST/tex/latex/t2");
}

sub MAKEtkz {
  # move files in latex to runtime, and doc/* up a level.
  &donormal ();
  #
  my $texdest = "$DEST/tex/$whichformat/$package";
  &xmkdir ($texdest);
  &SYSTEM ("$MV `find latex -type f` $texdest/");
  &SYSTEM ("$RM -r latex");  # rm now-empty dir
  &SYSTEM ("$MV doc/* .");
  #
  # remove newly empty directories.
  &SYSTEM ("find -depth -type d -print | xargs rmdir 2>/dev/null");
}

# wadalab provides nearly TDS-ready .tar.gz with additional stuff
#
sub MAKEwadalab {
  print "MAKEwadalab $package - munge tds-ready tarballs\n";
  &setup;
  &xchdir ("$DEST/doc/$whichdocformat/$package");

  # each XX.tar.gz contains a tds-ready tree under XX/texmf: use it
  opendir (HERE, ".") || die "opendir(.) failed: $!";
  my @tarfiles = grep /\.tar\.gz$/, readdir HERE;
  closedir (HERE);
  #  
  my $destfonts = "$DEST/fonts";
  &SYSTEM ("mkdir -p $destfonts");
  foreach my $tarfile (@tarfiles) {
    &SYSTEM ("tar xzf $tarfile && rm $tarfile");
    $tarfile =~ s/\.tar\.gz$//;
    &SYSTEM ("cp -r $tarfile/texmf-dist/* $DEST");
    &SYSTEM ("rm -r $tarfile/texmf && rmdir $tarfile");
  }
  #
  # except the mincho-1-8-* tarball misses the doc/fonts level.
  &SYSTEM ("$MV $DEST/doc/wadalab/* $DEST/doc/fonts/wadalab/");
  #
  # wadalab has a dir of xdelta from the original fonts.  Remove it.
  -d "xdelta" && &SYSTEM ("rm -rf xdelta");
  #
  # rm unused directories.
  &SYSTEM ("rmdir $DEST/*/$whichformat/$package 2>/dev/null");
}

sub MAKEukrhyph {
  chdir($packagedir) || die ("ERROR: cannot open directory");
  &runjob("mkdir -p $DEST/tex/generic/ukrhyph");
  &runjob("mkdir -p $DEST/doc/generic/ukrhyph");
  &runjob("$CP README $DEST/doc/generic/ukrhyph");
  &runjob("$CP *.* $DEST/tex/generic/ukrhyph");
  &runjob("$MV $DEST/tex/generic/ukrhyph/*.pdf $DEST/doc/generic/ukrhyph");
  &runjob("rm $DEST/tex/generic/ukrhyph/*.ps");
 }

# The jadetex distribution is a mess.  Last updated in 2003, so no point in
# trying to push changes upstream that I can see, though.
sub MAKEjadetex
{
  # Unpack the tarball.
  &SYSTEM ("cd $packagedir && tar xf jadetex*.tar.gz && mv jadetex-*/* .");
  &SYSTEM ("cd $packagedir && (rm -rf jadetex-3* doc/.cvsignore)");
  
  # Get rid of the useless doc/ dir.
  &MAKEflatten ();
  
  # Rename resulting jadetex/jadetex dirs to jadetex/base.
  &xchdir ($DEST);
  for my $dir ("doc", "source", "tex") {
    &SYSTEM ("$MV $dir/jadetex/jadetex $dir/jadetex/base");
  }
  
  # This didn't get flattened since there's a name clash.
  &SYSTEM ("$MV doc/jadetex/base/doc/Makefile doc/jadetex/base");
  
  # Their pdfjadetex.ini predates pdftexconfig.tex.
  my $pdfini = "tex/jadetex/base/pdfjadetex.ini";
  &SYSTEM ("(echo '\\input pdftexconfig.tex'; cat $pdfini) >/tmp/pj$$;
           mv /tmp/pj$$ $pdfini");
}

sub MAKElfb
{
  # remove pregenerated pk files.
  &MAKEflatten ();
  print "\t SPECIAL removing lfb PK files\n";
  &SYSTEM("rm *pk");
}

sub MAKEliterat {
  &xchdir($packagedir);
  &runjob("mkdir -p $DEST/fonts/tfm/paragrap/literat");
  &runjob("mkdir -p $DEST/fonts/vf/paragrap/literat");
  &runjob("mkdir -p $DEST/fonts/type1/paragrap/literat");
  &runjob("mkdir -p $DEST/fonts/afm/paragrap/literat");
  &runjob("mkdir -p $DEST/tex/latex/literat");
  &runjob("mkdir -p $DEST/dvips/literat");
  &runjob("mkdir -p $DEST/doc/fonts/literat");

  &runjob("$CP dvips/* $DEST/dvips/literat");
  &runjob("$CP tex/*tex $DEST/doc/fonts/literat");
  &runjob("$CP psfonts/*pfb $DEST/fonts/type1/paragrap/literat");
  &runjob("$CP psfonts/*inf $DEST/fonts/type1/paragrap/literat");
  &runjob("$CP psfonts/*afm $DEST/fonts/afm/paragrap/literat");
  &runjob("$CP tex/*sty tex/*fd $DEST/tex/latex/literat");
  &runjob("$CP tfm/* $DEST/fonts/tfm/paragrap/literat");
  &runjob("$CP tfm-raw/* $DEST/fonts/tfm/paragrap/literat");
  &runjob("$CP vf/* $DEST/fonts/vf/paragrap/literat");
  &runjob("$CP [A-Z]* insta* license $DEST/doc/fonts/literat");
 }

sub MAKExmltex {
  &xchdir ($packagedir);
  
  my $basedir = "$DEST/tex/xmltex/base";
  &xmkdir ($basedir);
  &runjob("$CP xmltex.tex *xmt xmltex.cfg $DEST/tex/xmltex/base");
  &SYSTEM ("$RM -f $basedir/tei.xmt"); # the one in passivetex is newer

  my $docdir = "$DEST/doc/otherformats/xmltex/base";
  &xmkdir ($docdir);
  &runjob("$CP manual* *xml test* *txt $docdir");
}

sub MAKEfancyvrb {
 &setup;
 chdir("$DEST/doc/latex/$package");
 print "\t SPECIAL $package: move contrib\n";
 &SYSTEM("$MV contrib/README README.contrib");
 &SYSTEM("$MV contrib/* .; rmdir contrib");
 &buildfilelist;
 &donormal("nosetup");
}

sub MAKEucs {
 &setup;
 chdir("$DEST/doc/latex/$package");
 &killfiles ($moreclean{$package}, "more") if $moreclean{$package};
 &SYSTEM("$MV data $DEST/tex/latex/ucs");
 &SYSTEM("$MV *def *sty $DEST/tex/latex/ucs");
 &SYSTEM("$MV utils $DEST/tex/latex/ucs");
}

sub MAKEtexsis {
 die "doesn't work, sorry";
 &setup;
 chdir("$DEST/doc/texsis/$package");
 &SYSTEM("make TXSsite.tex");
 &buildfilelist;
 &donormal;
 &SYSTEM("rm *.ps");
}

sub MAKEjapaneseotf {
 &setup;
 &xchdir("$DEST/doc/fonts/$package");
 for my $i (qw/vf tfm ofm ovp/) {
   if (-d $i) {
     &xmkdir ("$DEST/fonts/$i/public/$package");
     &SYSTEM("$MV $i/* $DEST/fonts/$i/public/$package/; rmdir $i");
   }
 }
 if (-d "sty") {
   &xmkdir ("$DEST/tex/platex/$package");
   # if we are building "japanese-otf" package, remove these two
   # style files, as they are overriden by the files in
   # "japanese-otf-uptex"
   if ($package eq "japanese-otf") {
     &SYSTEM("$RM sty/mlutf.sty sty/otf.sty"); 
   }
   &SYSTEM("$MV sty/* $DEST/tex/platex/$package/; rmdir sty");
 }
 if (-d "TeXLive-maps") {
   &xmkdir ("$DEST/fonts/map/dvipdfmx/$package");
   &SYSTEM("$MV TeXLive-maps/* $DEST/fonts/map/dvipdfmx/$package/; rmdir TeXLive-maps");
 }
 #
 # remove the fontmap dir as it contains files with parenthesis
 &SYSTEM("$RM -rf fontmap");
 my $dstdir = "$DEST/source/fonts/$package";
 &xmkdir ($dstdir);
 &SYSTEM ("$MV basepl $dstdir/") if (-d "basepl");
 &SYSTEM ("$MV script $dstdir/") if (-d "script");
 &SYSTEM ("$MV patch $dstdir/") if (-d "patch");
 &SYSTEM ("$MV *mkjvf $dstdir/");
 &SYSTEM ("$MV *makeotf* $dstdir/");
}

sub MAKEIEEEtran {
 print "\t SPECIAL $package - renaming README files, then flatten\n";
 chdir ($packagedir) || die "chdir($packagedir) failed: $!";
 &SYSTEM('for f in *; do test -r $f/README && mv $f/README README.$f; done');
 chdir ("..");
 &MAKEflatten;
 # let's not worry about the fact that the tex run on testflow fails (it
 # wants a paper size); we still get the distributed pdf, which is good enough.
}

sub MAKEbardiag {
 &setup;
 &xchdir ("$DEST/doc/latex/$package");
 print "\t SPECIAL $package - no symlinks, one-level flattening of doc dir\n";
 &SYSTEM ("find . -type l | xargs --no-run-if-empty rm");
 &SYSTEM ("$MV doc/* .");
 &buildfilelist;
 &donormal;
}

sub MAKEmathpazo {
 &setup;
 chdir("$DEST/doc/latex/$package");
 &SYSTEM("$MV latex/* type1/* afm/* vf/* tfm/* dvips/* .; rmdir latex type1 afm vf tfm dvips");
 &buildfilelist;
 &donormal;
}

sub MAKEhaprosper {
 &setup ("nocopytodoc"); # create dirs but that's all
 chdir("$packagedir");
 &SYSTEM("mkdir -p $DEST");
 print "\t SPECIAL copying HA-prosper\n";
 &SYSTEM("$CP -r README Doc/* $DEST/doc/latex/HA-prosper");
 &SYSTEM("$CP -r Run/* $DEST/tex/latex/HA-prosper");
 &SYSTEM("$CP -r Source/* $DEST/source/latex/HA-prosper");
}

sub MAKEpclnfss {
 chdir("$packagedir");
 &SYSTEM("mkdir -p $DEST/source/fonts/pclnfss");
 &SYSTEM("mkdir -p $DEST/doc/fonts/pclnfss");
 &SYSTEM("$CP -r [A-Z]* $DEST/doc/fonts/pclnfss");
 &SYSTEM("$CP -r fonts $DEST");
 &SYSTEM("$CP -r tex $DEST");
 &SYSTEM("$CP -r src/* tests $DEST/source/fonts/pclnfss");

}

sub MAKEpdf_forms_tutorial
{
  # called for both the en and de versions.  both are the same catalogue
  # entry, which is rather excruciating for us.
  &xchdir ($packagedir);
  
  my $lang;
  my $ll = substr ($package, -2);  # en or de
  if ($ll eq "en") {
    $lang = "english";
  } elsif ($ll eq "de") {
    $lang = "german";
  } else {
   die "unexpected language code for $package: $ll";
  }
  
  my $dest_lang = "$DEST/doc/$lang";
  my $dest_pkg = "$dest_lang/pdf-forms-tutorial-$ll";
  &SYSTEM ("mkdir -p $dest_lang");
  &SYSTEM ("$CP -r $ll $dest_pkg");
  &SYSTEM ("$CP README fdl.txt $dest_pkg");
}

sub MAKEbeamer {
 &xchdir ($packagedir);
 my $destdoc = "$DEST/doc/latex/beamer";
 &SYSTEM ("mkdir -p $destdoc");
 &SYSTEM ("$CP -r * $destdoc");
 &xchdir ($destdoc);
 
 my $desttex = "$DEST/tex/latex/beamer";
 &SYSTEM("mkdir -p $desttex");
 &SYSTEM("$MV base/* $desttex");
}


# this doesn't work.
sub MAKEbeebe {
 &setup;
 print "\t SPECIAL moving beebe .bib and .bst\n";
 chdir ("$DEST/doc/latex/$package") || die;
 &SYSTEM("mkdir -p $DEST/bibtex/bib/beebe $DEST/bibtex/bst/beebe");
 &SYSTEM("$MV tex*.bib tug*.bib $DEST/bibtex/bib/beebe");
#xx ugh, they aren't there &SYSTEM("$MV *.bst $DEST/bibtex/bst/beebe");
 &SYSTEM("rm *");
 
}

sub MAKEfontinst {
  &xchdir ($packagedir);
  &runjob("mkdir -p $DEST/tex/latex/fontinst");
  &runjob("mkdir -p $DEST/tex/fontinst");
  &runjob("mkdir -p $DEST/source/fontinst");
  &runjob("mkdir -p $DEST/doc/fonts/fontinst");
  &runjob("$CP -r examples test $DEST/doc/fonts/fontinst");
  &runjob("$CP -r doc/* README test $DEST/doc/fonts/fontinst");
  &runjob("$CP -r source $DEST/source/fontinst/base");
  &runjob("$CP -r latex/* $DEST/tex/latex/fontinst");
  &runjob("$CP -r inputs/* $DEST/tex/fontinst");
  print "\t YOU-MUST-DO $package copy fontinst.bat to bin/win32\n";  
}

sub MAKEpsnfss {
  # we use the psnfss.zip from the latex-tds project.
  # But we don't want the actual tfm/vf; TL has many more tfm's (in
  # different packages), and we don't want to mess with that.  So just
  # remove the fonts subdir -- except for the map files, which we do want.
  #
  print "\t SPECIAL $package omit fonts from latex-tds version\n";
  
  # Start with the usual straight copy.
  &MAKEcopy ();

  # Then remove the entire fonts tree.
  &xchdir ("$DEST/fonts");
  &SYSTEM ("rm -rf enc tfm vf");
}


# CJK (from Werner Lemberg)

sub I {
  my ($s, $d) = @_;
  &SYSTEM ("$INSTALL $s $DEST/$d");
}

sub MAKEcjk_common {
  print "\t SPECIAL $package wholesale rearranging for cjk\n";
  
  &xchdir ($packagedir);
  # also need cjk doc tarball.  should move in next release.
  my $cjkdoc = "cjk-?.?.?-doc.tar.gz";
  &SYSTEM ("tar -C cjk-?.?.? -xf $cjkdoc --strip-components=1");
  
  # remove the version number top-level directory.  
  &SYSTEM ("$RM *.tar.gz && $MV cjk-?.?.?/* . && rmdir cjk-?.?.?");
}

sub MAKEcjk {
  &MAKEcjk_common ();
  require "cjk.pl";   # in tlpkg/libexec
}

sub MAKEbin_cjkutils {
  &MAKEcjk_common ();
  require "bin-cjkutils.pl";
}

sub MAKEc90 {
  &MAKEcjk_common ();
  require "c90.pl";
}

sub MAKEdnp {
  &MAKEcjk_common ();
  require "dnp.pl";
}

sub MAKEgaruda_c90 {
  &MAKEcjk_common ();
  require "garuda-c90.pl";
}

sub MAKEnorasi_c90 {
  &MAKEcjk_common ();
  require "norasi-c90.pl";
}


sub MAKEcmlgc {
 &setup;
 chdir("$DEST/doc/$whichdocformat/$package");
 &SYSTEM("rm -rf vtex");
 &MAKEflatten;
}

sub MAKEphonetic {
  &setup;
  &xchdir ("$DEST/doc/$whichdocformat/$package");
  
  print "\t SPECIAL MAKE$package\n";
  &SYSTEM ("$MV Doc/2e/* .");

  # do the usual.
  &buildfilelist;
  &donormal ("nosetup");
}



sub PREHOOK_a2ping {
  print "PREHOOK_$package - make .1 with pod2man\n";
  &prehook_pod2man ("Peter Szabo", "$package.pl");
}

sub PREHOOK_apa6 {
  print "PREHOOK_$package - subdirectories needed for dtx\n";
  &SYSTEM ("mkdir config pseudoTeX");
}

sub PREHOOK_cals {
  print "PREHOOK_$package - flatten only cals subdir\n";
  &SYSTEM ("$MV cals/* .");
}

sub PREHOOK_chess {
  print "PREHOOK_$package - no babel inputs or pk fonts\n";
  &SYSTEM ("$MV inputs/chess.sty .");
  &SYSTEM ("$RM -rf inputs pkfonts.zip");
}

sub PREHOOK_cm {
  print "PREHOOK_$package - remove cmex9.mf\n";
  &SYSTEM ("$RM cmex9.mf"); # because it's really an amsfonts file
}

sub PREHOOK_cm_super {
  print "PREHOOK_$package - remove dvipdfm map files\n";
  # We generate our own dvipdfm (not to mention pdftex) map files.
  &SYSTEM ("$RM -rf dvipdfm");
}

sub PREHOOK_cmextra {
  print "PREHOOK_$package - knuth/local/cm is our cmextra\n";
  #
  # remove concrete since we have always had that separately.
  &SYSTEM ("rm cm/cc* cm/odigs.mf");
  &SYSTEM ("rm cm/ebigop.mf");        # ditto old cmex for euler
  &SYSTEM ("rm -rf [^c]*");           # ditto everything non-cm
  &SYSTEM ("$MV cm/* .");             # flatten for normal setup
}

sub PREHOOK_concrete {
  print "PREHOOK_$package - instantiate symlinks from symlink\n";
  # would be better done in tlpkginfo --prepare.
  &xchdir ("mf");
  chomp (my $ctan_root = `tlpkginfo --ctan-root`);
  for my $mf (glob ("*.mf")) {
    &SYSTEM ("$CP $ctan_root/systems/knuth/local/cm/$mf ..");
  }
  &xchdir ("..");  
  # symlinks will get removed afterward by MAKEflatten.
}

sub PREHOOK_ctan_o_mat {
  print "PREHOOK_$package - make .1 with pod2man\n";
  &prehook_pod2man ("Gerd Neugebauer", "$package.pl");
  &SYSTEM ("$RM $package.pdf");
}

sub PREHOOK_enctex {
  print "PREHOOK_$package - up a level\n";
  &SYSTEM ("$MV enctex/* .");
}

sub PREHOOK_fixme {
  print "PREHOOK_$package - create dtx subdirs\n";
  &xmkdir ("themes", "layouts", "layouts/env", "layouts/target");
}

sub PREHOOK_flatten1 {
  print "PREHOOK_$package - move files up one level\n";
  &SYSTEM ("$MV */* .");
}

sub PREHOOK_fontools {
  print "PREHOOK_$package - make .1 with pod2man\n";
  &xchdir ("bin");
  &prehook_pod2man ("Marc Penninga", qw(afm2afm autoinst ot2kpx));
  &xchdir ("..");
  &SYSTEM ("$RM -rf doc"); # remove distributed pdf's
}

sub PREHOOK_gothic {
  print "PREHOOK_$package - rm blacklettert1 oldlatin etc.\n";
  &SYSTEM ("$RM -rf blacklettert1 oldlatin ps yinit-as"); # own packages
  &SYSTEM ("$RM corkpaper.tex *.zip"); # symlink
}

sub PREHOOK_hagenberg_thesis {
  print "PREHOOK_$package - flatten doc and latex, not others\n";
  # doc (but not examples/) files at top, move latex/ files to be installed
  &SYSTEM ("$MV doc/* latex/* .");
}

sub PREHOOK_ibygrk {
  print "PREHOOK_$package - handle ibycus4.map\n";
  # ibygrk has two instances of the same file ibycus4.map; it is
  # both tex source and mf source.  the usual method cannot deal, of course.
  &SYSTEM ("$MV fonts/source/public/ibycus4/ibycus4.map .");
  &SYSTEM ("$RM tex/generic/ibycus4/ibycus4.map");
}

sub PREHOOK_knuth_local {
  print "PREHOOK_$package - extract some local/lib/*.mf, xepsf.tex\n";
  &SYSTEM ("$RM -rf [^l]*");   # remove everything but lib

  &SYSTEM ("$MV lib/xepsf.tex ."); # exactboundingbox support

  &SYSTEM ("$MV lib/*.mf .");  # keep lib/*.mf files
  my $mft_dir = "$DEST/mft/knuth-local";
  &mv_with_mkdir ("lib/e.mft", $mft_dir);  # install e.mft

  &SYSTEM ("$RM -rf lib");     # remove rest of lib
  &SYSTEM ("$RM -f lcirc* line*");  # dek does not maintain latex fonts
  &SYSTEM ("$RM -f amsmodes.mf");   # or ams files
}

sub PREHOOK_ktv_texdata {
  print "PREHOOK_$package - eliminate redundant latex dir\n";
  &SYSTEM ("$RM -rf latex");
}

sub PREHOOK_latexdiff {
  print "PREHOOK_$package - rename $package-so to $package.pl, etc.\n";
  # Consistently use *.pl to avoid special case in w32 wrapper
  &SYSTEM ("$MV latexdiff-so latexdiff.pl");  
  &SYSTEM ("$MV latexrevise  latexrevise.pl");  
  &SYSTEM ("$MV latexdiff-vc latexdiff-vc.pl");    
}

sub PREHOOK_latexindent {
  print "PREHOOK_$package - mv documentation/* doc\n";
  &SYSTEM ("$MV documentation/* .");
}

sub PREHOOK_lilyglyphs {
  print "PREHOOK_$package - mv */*.py scripts for specialscripts, rm ~\n";
  &SYSTEM ("$MV scripts/* .");
  &SYSTEM ("find -name \*~ | xargs $RM");
}

sub PREHOOK_mathspic {
  print "PREHOOK_$package - eliminate version from mathspicNNN.pl\n";
  # the w32 wrapper can only find foo.pl from foo, not fooNNN.pl.
  &SYSTEM ("$MV mathspic*.pl mathspic.pl");
}

sub PREHOOK_mp3d {
  print "PREHOOK_$package - rm 1.0\n";
  &SYSTEM ("$RM -rf v1.0");
}

sub PREHOOK_pictex {
  print "PREHOOK_$package - rm autoarea\n";
  &SYSTEM ("$RM -rf addon/autoarea*");
}

sub PREHOOK_prosper {
  print "PREHOOK_$package - handle image conflicts\n";
  # some files different between img/ and contrib/img; prefer
  # those in img.  Also flatten doc/doc-examples.
  &SYSTEM ("$MV contrib/img/* .");
  &SYSTEM ("$MV img/* doc/*/* doc/* designer/* contrib/*.* .");
}

sub PREHOOK_suftesi {
  print "PREHOOK_$package - move doc/latex subdirs\n";
  # not example/, then get logo.png clash
  &SYSTEM ("$MV doc/* latex/* .");
}

sub PREHOOK_texdraw {
  print "PREHOOK_$package - remove compactified, tar texindex source\n";
  &SYSTEM ("$RM -rf compact");
  &SYSTEM ("cd manual && tar czf txi-src.tgz *.c *.h texi2dvi texinfo.tex");
  &SYSTEM ("cd manual && $RM                 *.c *.h texi2dvi texinfo.tex");
}

sub PREHOOK_texfot {
  print "PREHOOK_$package - make .1 with pod2man\n";
  &prehook_pod2man ("Karl Berry", "$package.pl");
  &SYSTEM ("$RM $package.pdf");
}

sub PREHOOK_tudscr {
  print "PREHOOK_$package - cd\n";
  &xchdir ("source");
}

sub PREHOOK_tui {
  print "PREHOOK_$package - flatten only some subdirs\n";
  &SYSTEM ("$MV doc/* tex/* .");
}

sub PREHOOK_unzip {
  print "PREHOOK_unzip - $package\n";
  &SYSTEM ("unzip -q -o -d $DEST *.zip && $RM *.zip");
}

sub PREHOOK_vhistory {
  print "PREHOOK_$package - rm dup file\n";
  &SYSTEM ("$RM doc/sets.sty");
}

sub PREHOOK_wasy {
  print "PREHOOK_$package - rm ps-type1 subdir, in own package wasy2-ps\n";
  &SYSTEM ("$RM -rf ps-type1");
}

sub PREHOOK_wsuipa {
  print "PREHOOK_$package - rearrange directories, except for doc\n";
  # we can't use flatten because we want to preserve the subdirs inside doc.
  # annoyingly, the same filenames are repeated.
  &SYSTEM ("$MV changes/* doc/* macros/* mf/* pk/* tfm/* .");
}

sub PREHOOK_xsim {
  print "PREHOOK_$package - flatten doc, but not others\n";
  # we want doc files at top, but keep examples/ and code/ subdirs
  &SYSTEM ("$MV doc/* .");
}


sub prehook_pod2man {
  my ($author,@scripts) = @_;
  for my $script (@scripts) {
    my $pod2man = qq(pod2man --center="$author" --release="$package") 
                  . ' --section=1';
    (my $base = $script) =~ s,\.pl$,,;
    &SYSTEM ("$pod2man $script - >$base.1");
  }
}


sub POSTamsrefs {
  print "POST$package - mv amsrefs.faq\n";
  &SYSTEM ("cd $DEST "
           . " && $MV source/latex/amsrefs/amsrefs.faq doc/latex/amsrefs/");
}

sub POSTamstex {
  print "POST$package - cleanup, base subdir\n";
  die "not done -- doc format, man page, goodbye"; # but pretty close
  #
  &SYSTEM ("$RM amssym.tex amssym.def"); # in amsfonts
  #
  my $configdir = "$DEST/tex/amstex/config/";
  &xmkdir ($configdir);
  &SYSTEM ("$MV amstex.ini $configdir/");
  #
  &xchdir ($DEST);
  for my $dir ("doc", "tex") {
    &SYSTEM ("$MV $dir/$package/$package $dir/$package/base");
  }
}

sub POSTapalike {
  print "POST$package - move apalike.tex to runtime\n";
  # can't use specialtex because we also need apalike.sty in latex.
  my $src = "$DEST/doc/$whichdocformat/$package/apalike.tex";
  my $dstdir = "$DEST/tex/plain/$package";
  &xmkdir ($dstdir);
  &SYSTEM ("$MV $src $dstdir/");
}

sub POSTasapsym {
  print "POST$package - move TeX files to specific subdirs\n";
  #
  my $plainfile = "$DEST/tex/latex/$package/$package.code.tex";
  my $plaindir = "$DEST/tex/plain/$package";
  &mv_with_mkdir ($plainfile, $plaindir);
  #
  my $genericfile = "$DEST/doc/$whichdocformat/$package/$package-generic.tex";
  my $genericdir = "$DEST/tex/generic/$package";
  &mv_with_mkdir ($genericfile, $genericdir);
}

sub POSTautosp {
  print "POST$package - preserve man pages, remove binaries, up a level\n";
  &preserve_man_pages ($package);
  &SYSTEM ("$RM -r source MacOSX Windows*");
  &SYSTEM ("$MV doc/* .; rmdir doc");
}

sub POSTbib2gls {
  print "POST$package - resources xml, src dir\n";
  my $resources_dir = "$DEST/scripts/$package/resources";
  &mv_with_mkdir ("$package-en.xml", $resources_dir);
  #
  my $source_dir = "$DEST/source/support/$package";
  &SYSTEM ("$MV src $source_dir");
}

sub POSTbiber {
  print "POST$package - unpack and install binaries\n";
  # we've started with everything under source/.
  &xchdir ("$DEST/source/bibtex/biber");
  
  # move doc pdf.
  &mv_with_mkdir ("biber.pdf", $DOCDIR);

  # we don't do 64-bit Windows.
  &SYSTEM ("$RM biber-MSWIN64*");

  # biber uses different platform names.
  my %tl_platform = (
    "MSWIN32"            => "win32",
    "amd64-freebsd"      => "amd64-freebsd",
    "cygwin32"           => "i386-cygwin",
    "cygwin64"           => "x86_64-cygwin",
    "darwin_x86_64"      => "x86_64-darwin",
    "darwin_x86_i386"    => "i386-darwin",
    "i386-freebsd"       => "i386-freebsd",
    "i386-pc-solaris2"   => "i386-solaris",
    "linux_armel"        => "armel-linux",
    "linux_x86_32"       => "i386-linux",
    "linux_x86_64"       => "x86_64-linux",
    "x86_64-pc-solaris2" => "x86_64-solaris",
  );

  # handle the prebuilt binaries, which are zipped or tarred.
  for my $archive (sort (<biber-*>)) {
    next if $archive =~ /freebsd[^7]\./;  # we only want freebsd7

    my $unarchiver = &unarchiver ($archive);
    &SYSTEM ("$unarchiver $archive");

    # each .tar.gz unpacks into a single file named biber,
    # .zip unpacks into biber.exe.
    my $biber_binary = "biber";
    $biber_binary .= ".exe" if $archive =~ /MSWIN|cygwin/i;

    # Put the executable in the Master bin directory.
    (my $biber_platform = $archive) =~ s/biber-(.*?)\..*/$1/;
    my $tl_platform = $tl_platform{$biber_platform};
    die "unknown biber platform $biber_platform, goodbye" if ! $tl_platform;

    # really need to do svn cp for this (in place, can't do it here).
    my $bindir = "$TOPDEST/bin/$tl_platform";
    &SYSTEM ("mkdir -p $bindir/");
    &SYSTEM ("$MV $biber_binary $bindir/") == 0 || die;
  }

  # Mac "legacy" doesn't need its own build.
  my $topbin = "$TOPDEST/bin";
  my $legacybin = "$topbin/x86_64-darwinlegacy";
  &xmkdir ($legacybin);
  &SYSTEM ("$CP $topbin/x86_64-darwin/biber $legacybin/biber");

  # don't keep binary archives around in Master tree.
  &SYSTEM ("$RM biber[-.]*");

  # not meaningful info in TL.
  &SYSTEM ("$RM README.FreeBSD");
}

# biber binaries are distributed in a variety of ways.  The idea here is
# to specify the commands that will get from the distribution on CTAN to
# a binary named "biber".
# 
sub unarchiver {
  my ($archive) = @_;
  my $unarch;
  
  if ($archive =~ /\.tar\./) {
    $unarch = "tar xf";
  } elsif ($archive =~ /\.zip$/) {
    $unarch = "unzip -q";
  } else {
    die "do not know unarchiver for $archive";
  }
  return $unarch;
}

sub POSTbiblatex {
  print "POST$package - move whole directories around\n";
  
  my $dest_bib = "$DEST/bibtex/bib";
  my $dest_bst = "$DEST/bibtex/bst";
  my $dest_csf = "$DEST/bibtex/csf";
  my $dest_latex = "$DEST/tex/latex";
  &xmkdir ($dest_bib, $dest_bst, $dest_csf, $dest_latex);
  
  &SYSTEM ("$MV bibtex/bib $dest_bib/$package");
  &SYSTEM ("$MV bibtex/bst $dest_bst/$package");
  &SYSTEM ("$MV bibtex/csf $dest_csf/$package");
  &SYSTEM ("$MV latex $DEST/tex/latex/$package");
  &SYSTEM ("$MV doc/* .");
}

sub POSTbibtex {
  print "POST$package - switch to base/\n";
  &SYSTEM ("cd $DEST && $MV bibtex/bst/bibtex bibtex/bst/base");
  &SYSTEM ("cd $DEST && $MV bibtex/bib/bibtex bibtex/bib/base");
  &SYSTEM ("cd $DEST && $MV doc/bibtex/bibtex doc/bibtex/base");
  &SYSTEM ("$RM bibtex.web"); # handle separately
  &preserve_man_pages ($package);
}

sub POSTbibtexperllibs {
  print "POST$package - move modules to scripts/, man pages to doc/\n";
  &xchdir ("$DEST/source/support/$package/");
  &mv_with_mkdir ("*/lib/*", "$DEST/scripts/$package/");
  &mv_with_mkdir ("*/man/*/*", "$DEST/doc/support/$package/");
}

sub POSTcfr_lm {
  print "POST$package - move directories around\n";  
  &rename_with_mkdir ("vf", "$DEST/fonts/vf/public/$package");
  &rename_with_mkdir ("tfm", "$DEST/fonts/tfm/public/$package");
  &rename_with_mkdir ("enc", "$DEST/fonts/enc/dvips/$package");
  &rename_with_mkdir ("map", "$DEST/fonts/map/dvips/$package");
  &SYSTEM("$MV source/* $DEST/source/fonts/$package");
  # somehome th source/fonts package is already created???
  #&rename_with_mkdir ("source", "$DEST/source/fonts/$package");
  &rename_with_mkdir ("tex", "$DEST/tex/latex/$package");
  &SYSTEM("$MV doc/* .");
  &SYSTEM("rmdir doc");
}

sub POSTcjk_gs_integrate {
  print "POST$package - move database/ -> fonts/misc/PKGNAME/\n";  
  my $destdir = "$DEST/fonts/misc";
  &xmkdir ($destdir);
  &SYSTEM ("$MV database $destdir/$package"); # rename to pkgname
}

sub POSTcmcyr {
  print "POST$package - exclude cmcsc{8,9,10}.mf from runtime\n";  
  # because they are duplicates of the standard files
  # It is probably possible to achieve this with a
  # negative look-ahead assertion, but this seems more understandable.
  # assuming brace expansion in the shell ...
  &SYSTEM ("$MV $DEST/fonts/source/public/cmcyr/cmcsc{8,9,10}.mf .");
}

sub POSTcontext {
  print "POST$package - rearrange, remove\n";
  &xchdir ($DEST);
  
  # clean up files Hans wants in his distribution but are confusing or
  # problematic in TeX Live.
  &mv_with_mkdir ("colors/icc/context", "tex/context/colors/icc");
  &SYSTEM ("$RM -rf colors");			   # nonfree
  &SYSTEM ("$RM -rf fonts/truetype/hoekwater/lm/");# lmtypewriter10-regular.ttf
  &SYSTEM ("$RM -rf fonts/data/tests/");           # texmfhome.otf
  &SYSTEM ("$RM -rf web2c/");                   # context*cnf*, texlive*cnf.lua
  &SYSTEM ("find -name koeiel\* -o -name jmn | xargs rm -rf");
  
  # remove mptopdf files, since they are in a separate package.
  chomp (my @mptopdf_files = `tlpfiles mptopdf | sed 's,[^/]*/,,'`);
  &SYSTEM ("$RM -f @mptopdf_files ");
  &SYSTEM ("$RM doc/context/scripts/mkii/mptopdf.man"); 
  
  print "still POST$package - user-level executables\n";
  # executables go in both the Master bin dir and the
  # Build linked_scripts dir.  The executables are cherry-picked from
  # ConTeXt's stubs directory.
  my $w32_bindir = "$TOPDEST/bin/win32";
  &xmkdir ($w32_bindir);
  #
  my $pkg_subdir = "stubs/unix"; # where hans keeps them
  &xchdir ("$DEST/scripts/$package/$pkg_subdir");
  my @exec = ();
  for my $exec (qw(context contextjit luatools
                   mtxrun mtxrunjit texexec texmfstart)) {
    &SYSTEM ("chmod a+x $exec");
    &bindirs_symlink ($exec);
    &build_scripts_copy ($exec, $pkg_subdir);
    &SYSTEM ("$CP ../mswin/$exec.exe $w32_bindir/");
    push (@exec, $exec);
  }
  # mtxrun on Windows needs more than just the .exe.
  &xchdir ("../mswin");
  &SYSTEM ("$CP mtxrun.dll mtxrun.lua $w32_bindir/");
   
  print "still POST$package - man pages\n";
  &xchdir ("$DEST/doc/$package/scripts");
  my $mandest = "$TOPDEST/texmf-dist/doc/man/man1";
  &xmkdir ($mandest);
  for my $exec (@exec) {
    # man pages might be under mkii or mkiv, just check both.
    my $mansrc = (-r "mkii/$exec.man" ? "mkii/$exec.man" : "mkiv/$exec.man");
    &SYSTEM ("$CP $mansrc $mandest/$exec.1");
  }
  # In addition, there is mtx-*.man for subcommands in mkiv.
  &xchdir ("mkiv");
  for my $mtxman (<mtx-*.man>) {
    (my $mtxmanbase = $mtxman) =~ s/\.man$//;
    &SYSTEM ("$CP $mtxman $mandest/$mtxmanbase.1");    
  }
  &tl_man_to_pdf ();
}

# Called for the ConTeXt scripts, though conceivably could be used for
# other things.  Make a symlink in each Unix bindir (Windows is not
# handled here) to EXEC, assuming its location is relative to pwd.
# 
sub bindirs_symlink {
  my ($exec) = @_;

  chomp (my $pwd = `pwd`);
  (my $intermediate_dirs = $pwd) =~ s,^.*/$DEST_TREE/,,;
  #
  my $linktarget = "../../$DEST_TREE";
  $linktarget .= "/$intermediate_dirs";
  $linktarget .= "/$exec";
  #
  (my $linkname = $exec) =~ s,.*/,,;  # just the basename
  $linkname =~ s,\.[^./]+$,,;         # rm extension too
  
  chomp (my @platforms = `cd $Master/bin && ls`);  
  for my $p (@platforms) {
    next if $p eq "win32";  # windows handled separately
    my $platdir = "$TOPDEST/bin/$p";
    &xmkdir ($platdir);
    &SYSTEM ("ln -s $linktarget $platdir/$linkname");
  }
}

# Called both for ConTeXt and from doscripts: Update copy of EXEC under
# Build/.../linked_scripts.  If second arg INTERMEDIATE_DIRS is given
# (done by ConTeXt), that path is appended under linked_scripts/.  In
# any case, just the basename of EXEC is used in the destination, and
# the full EXEC, whatever it is, is used for the source of the copy.
# 
sub build_scripts_copy {
  my ($exec,$intermediate_dirs) = @_;

  # prepend / to INTERMEDIATE_DIRS if given.
  $intermediate_dirs = ($intermediate_dirs ? "/$intermediate_dirs" : "");

  my $build_tldir = "texk/texlive";
  my $build_scriptsdir = "$build_tldir/linked_scripts";
  my $build_subdir = "$package$intermediate_dirs";
  my $builddir = "$BUILDDEST/$build_scriptsdir/$build_subdir";
  &xmkdir ($builddir);
  #
  &SYSTEM ("$CP $exec $builddir/");

  # Warn if missing from the Makefile.am in the sources.
  # (but not for mptopdf, since peb unified it.)
  return if $exec =~ /mptopdf/;
  (my $exec_basename = $exec) =~ s,^.*/,,;
  my $pattern = "\\b$build_subdir/$exec_basename\\b";
  #
  my $scripts_Makefile = "$Build/$build_scriptsdir/Makefile.in";
  system ("grep '$pattern' $scripts_Makefile >/dev/null");
  if ($? != 0) {
    print "*** $build_subdir/$exec_basename not in $scripts_Makefile\n";
  }
  # we'd should get rid of scripts.lst since it is nothing but
  # redundancy; coordinate with debian, though.
  my $scripts_lst = "$Build/$build_scriptsdir/scripts.lst";
  system ("grep '$pattern' $scripts_lst >/dev/null");
  if ($? != 0) {
    print "*** $build_subdir/$exec_basename not in $scripts_lst\n";
  }
}

sub POST_context_contrib {
  print "POST_context_contrib for $package - move VERSION file\n";
  (my $context_package = $package) =~ s/^context-//;
  my $destdir = "$DEST/doc/context/third/$context_package";
  &mv_with_mkdir ("VERSION", "$DEST/doc/context/third/$context_package");
}

sub POSTcontext_games {
  print "POST$package - remove duplicated fonts\n";
  &SYSTEM ("$RM -rf fonts");
}

sub POSTcoordsys {
  print "POST$package - rename `putfile.' to `putfile.maple'\n";
  # Apparently dtx (TeX) insists on always adding the period; this can make
  # vfat filesystems choke.
  &SYSTEM ("$MV putfile. putfile.maple");
}

sub POSTcs {
  print "POST$package - untar and combine\n";
  #
  # The cs package is where we have the cstex fonts, in both mf and
  # type1 formats (plus tfm, vf, etc.).  This comes from multiple
  # tarballs in the cstex distribution area.
  # the Catalogue and tar file name is cspsfonts, but the directory
  # name inside is cs; we stay with cs since that has been the name in TL.
  # 
  for my $tarbase ("csfonts-t1", "csfonts", "cspsfonts") {
    my $tarfile = "$tarbase.tar.gz";
    my $untar = "tar -C $DEST --strip-components=1 -x -f $tarfile";
    $untar .= " --exclude texmf/doc/cstex"; # filter out cstex dir
    &SYSTEM ($untar);
  }
  #
  # move map file to right place.
  &SYSTEM ("$MV $DEST/dvips/config/csfonts.map $DEST/fonts/map/dvips/cs/");
  #
  # remove Sauter modifications and other unknown files.
  &SYSTEM ("$RM -rf $DEST/fonts/source/jknappen");
  &SYSTEM ("$RM -rf $DEST/fonts/vf-cnv");
  &SYSTEM ("$RM -rf $DEST/fonts/vf/public/cm2cs");
  &SYSTEM ("$RM *");  # dump rest
}

sub POSTcstex {
  print "POST$package - untar pieces, combine\n";
  #
  # The cstex package itself just contains documentation.  By the
  # author's choice, it is split over several tarballs and other files.
  # Luckily, cstex as defined in the Catalogue maps to
  # CTAN:macros/cstex, which includes everything.  So we can pick and
  # choose what we need.
  #
  for my $tarbase ("csplain", "cslatex", "cspsfonts") {
    my $tarfile = "base/$tarbase.tar.gz";
    my $untar = "tar -C $DEST --strip-components=1 -x -f $tarfile";
    $untar .= " texmf/doc/cstex"; # include only the cstex dir
    &SYSTEM ($untar);
  }
  # no stray symlinks please.
  &POST_rmsymlink ();
  #
  &SYSTEM ("$MV doc/README README-doc");
  &SYSTEM ("$MV doc/cstexman.tex doc/cstexman.pdf .");
  &SYSTEM ("$MV doc/jemny.* doc/prvni.* .");
  &SYSTEM ("$RM -rf README *.zip base/ doc/");
  &SYSTEM ("$MV * $DEST/doc/cstex/"); # move all to same dir
  &SYSTEM ("$RM $DEST/doc/cstex/*.ps $DEST/doc/cstex/*.dvi");
}

sub POST_cstexpkgs { # used for csplain and cslatex
  print "POST_cstexpkgs (for $package) - untar\n";
  my $tarfile = -r "$package.tar.gz" ? "$package.tar.gz" : "somethingwrong";
  my $untar = "tar -C $DEST --strip-components=1 -x -f $tarfile";
  $untar .= " --exclude=texmf/doc/cstex";          # handled in its own package
  $untar .= " --exclude=texmf/tex/generic/enctex"; # must do by hand
  &SYSTEM ($untar);
  &SYSTEM ("$RM $tarfile");
  &SYSTEM ("$RM $DEST/tex/csplain/fonts/texput.log");
}

sub POSTdehyph_exptl {
  print "POST$package - *YOU* must update tlpsrc directives, right now!\n";
}

sub POSTe_french {
  print "POST$package - move directories around\n";
  &SYSTEM ("find [^b]* -type f | xargs chmod -R a-x");
  &mv_with_mkdir ("texmf/makeindex/*.ist", "$DEST/makeindex/$package/");
  &SYSTEM ("$MV texmf/tex $DEST/tex/$whichformat/$package"); # mv dir itself
  &SYSTEM ("$MV texmf/doc/* .");
}

sub POSTencxvlna {
  print "POST$package - .tex name conflict\n";
  &SYSTEM ("$MV doc/* .");
  &mv_with_mkdir ("latex/$package.sty", "$DEST/tex/latex/$package");
  &mv_with_mkdir ("plain/$package.tex", "$DEST/tex/plain/$package");
}

sub POSTenigma {
  print "POST$package - move everything per README\n";
  #
  &mv_with_mkdir ("mtx-t-enigma.lua",
                   "$DEST/scripts/context/lua/third/enigma/mtx-t-enigma.lua/");
  &mv_with_mkdir ("t-enigma.mkvi",
                   "$DEST/tex/context/third/enigma/t-enigma.mkv/");
  &mv_with_mkdir ("enigma.sty", "$DEST/tex/latex/enigma/");
  &mv_with_mkdir ("enigma.tex", "$DEST/tex/plain/enigma/");
  &mv_with_mkdir ("enigma.lua", "$DEST/tex/generic/enigma/");
  #
  &mv_with_mkdir ("enigma-example*", "examples/");
  #
  &xchdir ("..");
  &mv_with_mkdir ("enigma", "$DEST/doc/context/third/enigma/");
}

sub POSTeplain {
  print "POST$package - info, man\n";
  
  my $infodir = "$TOPDEST/texmf-dist/doc/info/";
  &mv_with_mkdir ("doc/$package/$package.info", $infodir);
  
  &POST_do_man ("doc/$package");
  &SYSTEM ("$RM doc/$package/$package.man1.pdf");
}

sub POSTepspdf {
  print "POST$package - construct images subdir\n";
  &xmkdir ("images");
  &SYSTEM ("$MV *.png images/");
  &SYSTEM ("$MV *.bat epspdf.texlua /tmp/");
  print "YOU-MUST-DO! update /tmp/$package* into bin/win32, etc.\n";
}

sub POSTfixme {
  print "POST$package - move subdirectories\n";
  my $dstdir = "$DEST/tex/latex/$package";
  &xmkdir ($dstdir);
  &SYSTEM ("$MV themes layouts $dstdir/");
}

sub POSTfont_change_xetex {
  print "POST$package - move .tex, collision with doc source\n";
  &mv_with_mkdir ("macros/*", "$DEST/tex/xetex/$package/");
}

sub POSTformation_latex_ul {
  print "POST$package - move source subdir, doc/* files\n";  
  &SYSTEM ("$MV source $DEST/source/latex/$package");
  &SYSTEM ("$MV doc/* .");
  &SYSTEM ("rmdir doc");
  &POST_rmsymlink ();
}

sub POSTfpl {
  print "POST$package - rename README.source\n";
  &SYSTEM ("$MV README.source $DEST/source/fonts/fpl/README");
}

sub POSTghsystem {
  print "POST$package - move subdirectories\n";
  my $dstdir = "$DEST/tex/latex/$package";
  &xmkdir ($dstdir);
  &SYSTEM ("$MV language pictures $dstdir/");
}

sub POSTgrotesq {
  print "POST$package - move files\n";
  &xchdir ($DEST);
  &SYSTEM ("$MV doc/fonts/urw/* doc/fonts/$package");
  &mv_with_mkdir ("dvips/config/*", "fonts/map/dvips/$package");
  &SYSTEM ("$MV tex/latex/ugq tex/latex/$package");
  &SYSTEM ("$RM vtex/config/*");
}

sub POSTgrverb {
  print "POST$package - rename psfonts.map\n";
  my $mapdir = "$DEST/fonts/map/dvips/grverb";
  &SYSTEM ("$MV $mapdir/psfonts.map $mapdir/grverb.map");
}

sub POSThustthesis {
  print "POST$package - move ref-example.bib\n";
  &SYSTEM ("$MV $DEST/bibtex/bib/$package/ref-example.bib"
            . " $DEST/doc/latex/$package/");
}

sub POSTibygrk {
  print "POST$package - second copy of ibycus4.map\n";
  # after the ibygrk structure has been set up, copy ibycus4.map to the
  # tex dir.
  &SYSTEM ("cd $DEST && $CP fonts/source/public/ibygrk/ibycus4.map "
           . "tex/generic/ibygrk/ibycus4.map");
}

sub POSTisodoc {
  print "POST$package - remove unneeded (per author) derived files\n";
  &SYSTEM ("$RM Makefile *.sh *.sty *.tex *.uue");
}

sub POSTimpatient {
  print "POST$package - remove artwork and LL subdirectories\n";
  &SYSTEM ("$RM -r artwork cn fr");
}

sub POSTinteractiveworkbook {
  print "POST$package - mv .sty directory\n";
  my $dest = "$DEST/tex/latex/$package";
  &SYSTEM ("mkdir -p $dest");
  &SYSTEM ("$MV interactiveworkbook.sty/* $dest/");
  &SYSTEM ("rmdir interactiveworkbook.sty");
}

sub POSTptex_fontmaps {
  print "POST$package - move directories around\n";
  # dir "src" content -> run files
  # dir "no_runtime" content  -> source files
  # dir "tool" as a whole -> source files
  # dir "doc" content to -> doc files (one dir up!)
  my $mapdest = "$DEST/fonts/map/dvipdfmx/$package";
  my $cmapdest= "$DEST/fonts/cmap/$package";
  my $scriptdest = "$DEST/scripts/$package";
  my $srcdest = "$DEST/source/$package";
  &xmkdir ($mapdest);
  &xmkdir ($cmapdest);
  &xmkdir ($scriptdest);
  &xmkdir ($srcdest);
  &SYSTEM ("$MV cmap/* $cmapdest");
  &SYSTEM ("rmdir cmap");
  &SYSTEM ("$MV script/kanji-* $scriptdest");
  &SYSTEM ("$MV jis04cmap_exp script $srcdest");
  &SYSTEM ("$MV maps/* $mapdest");
  &SYSTEM ("rmdir maps");
  #
  my $fmiscdest= "$DEST/fonts/misc";
  &xmkdir ($fmiscdest);
  &SYSTEM ("$MV database $fmiscdest/$package");
}

sub POSTknitting {
  print "POST$package - move generic .tex file\n";
  my $dest = "$DEST/tex/plain/$package";
  &SYSTEM ("mkdir -p $dest");
  &SYSTEM ("$MV knitting.tex $dest/");
}

sub POSTknuth {
  print "POST$package - removing nonfree/duplicated files\n";
  #
  &xchdir ($DEST);
  &xmkdir ("doc/generic");
  &SYSTEM ("$MV doc/knuth doc/generic/");
  #
  &xmkdir ("source/generic");
  &SYSTEM ("$MV source/knuth source/generic/");
  #
  # remove nonfree.
  &xchdir ("$DEST/doc/generic/knuth");
  &SYSTEM ("$RM tex/texbook.tex mf/mfbook.tex");
  #
  # remove sources that are in build tree.
  &xchdir ("$DEST/source/generic/knuth");
  &SYSTEM ("rm -rf etc mf mfware tex/tex.web tex/trip* texware web/*.web");
}

sub POSTknuth_lib {
  print "POST$package - removing some base files\n";
  &SYSTEM ("rm -rf $DEST/doc/*/knuth-lib/*.mft");
  #
  # somehow it seems like plain.tex, plain.mf, etc. should remain in base/.
  &SYSTEM ("rm -f $DEST/fonts/source/public/knuth-lib/plain.mf");
  #
  &xchdir ("$DEST/tex/plain/knuth-lib");
  &SYSTEM ("rm -f hyphen.tex plain.tex");
  #
  # null.tex, and only null.tex, should be in generic.
  &mv_with_mkdir ("null.tex", "$DEST/tex/generic/$package");
}

sub POSTkoma_script {
  print "POST$package - rm spurious dup top-level trees\n";
  &SYSTEM ("$RM doc/*.* source/* 2>/dev/null");
}

sub POSTkotex_oblivoir {
  print "POST$package - memhangul subdirs in runtime\n";
  &mv_with_mkdir ("memhangul-*", "$DEST/tex/latex/$package");
}

sub POSTkotex_utf {
  print "POST$package - various in runtime\n";
  &mv_with_mkdir ("contrib", "tex4ht", "$DEST/tex/latex/$package");
  &SYSTEM ("$MV doc/* .");
}

sub POSTlatex2html {
  print "POST$package - moving $package.perl to doc\n";
  my $dest = "$DEST/doc/latex/$package";
  &SYSTEM ("mkdir -p $dest");
  &SYSTEM ("$MV $DEST/scripts/latex2html/styles/$package.perl $dest");
}

sub POSTlatex2e_help_texinfo {
  print "POST$package - remove translation subdir\n";
  &SYSTEM ("$RM -rf spanish");
}

sub POSTlhcyr {
  print "POST$package - move to source, avoid dups\n";
  &xchdir ("$DEST/tex/latex/$package");
  # Sebastian moved tex files to the top level, removed from other dirs.
  # We just follow what he did, years ago.
  for my $tex (qw(karabas kniga otchet pismo rusfonts statya)) {
    &SYSTEM ("$MV lhcyralt/$tex.tex .");
    &SYSTEM ("$RM */$tex.tex");
  }
  #
  for my $hyph (glob ("*/{hyphen.cfg,rhyphen.tex}")) {
    my ($hdir) = $hyph =~ m,^(.*)/,;
    (my $hdest = $hyph) =~ s,/(.*)$,/$hdir-$1,;
    &SYSTEM ("$MV $hyph $hdest");
  }
  #
  # mfj's to source dir, ignoring that there are multiple versions.
  for my $dir (glob ("lhcyr{alt,win}")) {
    &SYSTEM ("$MV $dir/*.mfj $DEST/source/latex/$package/");
  }
}

sub POSTlilyglyphs {
  print "POST$package - move directories around\n";  
  &rename_with_mkdir ("fonts", "$DEST/fonts/opentype/public/$package");
  &rename_with_mkdir ("source", "$DEST/source/luatex/$package");
  &rename_with_mkdir ("tex", "$DEST/tex/lualatex/$package");
}

sub POSTlistbib {
  print "POST$package - move .doc to .bst\n";
  my $dest = "$DEST/bibtex/bst/$package";  
  &xmkdir ($dest);
  &SYSTEM ("$MV $package.doc $dest/$package.bst");
}

sub POSTlithuanian {
  print "POST$package - remove old language support, fix .dfu location\n";
  # these files are no longer used in TL.
  &SYSTEM ("$RM language.lt.dat $DEST/tex/latex/lithuanian/language.lt.def");
  &SYSTEM ("$MV $DEST/doc/latex/lithuanian/l7xenc.dfu $DEST/tex/latex/lithuanian/");
}

sub POSTluatexja {
  print "POST$package - runins, move directories\n";
  &xchdir ("src");
  {
    local @filenames = glob ("*");  # dynamic redef for runins call.
    &runins ($specialins{$package} || $standardins);
  }
  &SYSTEM ("luatex ltj-kinsoku_make.tex");
  &SYSTEM ("$RM *.log");
  &xchdir ("..");

  # "src/.{ins,dtx}" -> source files
  # other "src" content -> run files
  # dir "tool" as a whole -> source files
  # dir "doc" content to -> doc files (one level up)
  my $rundest = "$DEST/tex/luatex/$package";
  my $srcdest = "$DEST/source/luatex/$package";
  &xmkdir ($rundest);
  &xmkdir ($srcdest);

  &SYSTEM ("$MV src/*.dtx src/*.ins $srcdest/");
  &SYSTEM ("$MV src/ltj-kinsoku_make.tex $srcdest/");
  &SYSTEM ("$MV src/* $rundest/");

  &SYSTEM ("$MV tool $srcdest/");
  &SYSTEM ("$MV doc/* .; rmdir doc");
}

sub POSTmathdesign {
  print "POST$package - mv files\n";
  &SYSTEM ("$RM non-free/enc/tex*.enc");  # dup of standard enc files
  &SYSTEM ("$RM non-free/enc/7t.enc");
  # one way of merging dirtree A into dirtree B.
  &SYSTEM ("cd non-free && rsync -a --ignore-existing * ..");
  &SYSTEM ("$RM -rf non-free/");
  &SYSTEM ("$RM mathdesign-doc.pdf");
  &SYSTEM ("$RM *-Garamond-Pro-* *-Utopia-Std-*");
  &SYSTEM ("$RM *-itc-Charter-*  *-urw-GaramondNo8-*");
  &SYSTEM ("$MV doc/* .");
  &mv_with_mkdir ("config/*", "$DEST/dvips/$package");
  &mv_with_mkdir ("enc/*", "$DEST/fonts/enc/dvips/$package");
  &mv_with_mkdir ("map/*", "$DEST/fonts/map/dvips/$package");
  &mv_with_mkdir ("latex/*", "$DEST/tex/latex/$package");
  &mv_with_mkdir ("tfm/*", "$DEST/fonts/tfm/public/$package");
  &mv_with_mkdir ("type1/*", "$DEST/fonts/type1/public/$package");
  &mv_with_mkdir ("vf/*", "$DEST/fonts/vf/public/$package");
}

sub POSTmontex {
  print "POST$package - avoid 00readme case clash\n";
  # these files are no longer used in TL.
  &SYSTEM ("$MV 00readme 00readme.mfinput.km");
}

sub POSTmptopdf {
  # mptopdf needs a cut-down version of the context post routine.
  # But there are enough differences that trying to factor out the
  # commonalities doesn't make sense.  Sigh.
  print "POST$package - user-level executables\n";
  my $w32_bindir = "$TOPDEST/bin/win32";
  &xmkdir ($w32_bindir);
  #
  my $pkg_subdir = "perl"; # where hans keeps it
  &xchdir ("$DEST/scripts/context/$pkg_subdir");
  my $exec = "mptopdf.pl";
  &bindirs_symlink ($exec);
  # peb doesn't want a linked_scripts/mptopdf.
  # not sure if the copy under linked_scripts/context/ will get updated
  # (with a context update); doubt it.
  #&build_scripts_copy ($exec, $pkg_subdir);
  #
  # but for windows, use our wrapper rather than ConTeXt's,
  # since the whole point is to have mptopdf available without ConTeXt.

  my $build_tldir = "texk/texlive";
  my $w32_wrapper = "$Build/$build_tldir/w32_wrapper/runscript.exe";
  &SYSTEM ("$CP $w32_wrapper $w32_bindir/mptopdf.exe");
  #
  print "still POST$package - man page\n";
  &xchdir ("$DEST/doc/context/scripts/mkii");
  my $mandest = "$TOPDEST/texmf-dist/doc/man/man1";
  &xmkdir ($mandest);
  &SYSTEM ("$CP mptopdf.man $mandest/mptopdf.1");
  &tl_man_to_pdf ();
}

sub POSTmtx {
  print "POST$package - man pages, preserve prepmx binary\n";
  &POST_do_man ();
  &POST_preserve_bin ("prepmx");
}

sub POSTmusixtex {
  print "POST$package - man pages\n";
  &POST_do_man ("doc/generic/$package/scripts");
}

sub POSTmusixtnt {
  print "POST$package - preserve binaries, use/remove windows exe\n";
  &POST_preserve_bin ("msxlint");
  &SYSTEM ("$RM -rf windows");
}

sub POSTnumericplots {
  print "POST$package - mv latex subdir\n";
  &SYSTEM ("$MV latex $DEST/tex/latex/$package");
}

sub POSTnwejm {
  print "POST$package - mv images subdir\n";
  &SYSTEM ("$MV images $DEST/tex/latex/$package");
}

sub POSTpas_vc {
  print "POST$package - mv latex subdir, doc files\n";
  &SYSTEM ("$MV latex $DEST/tex/latex/$package");
  &SYSTEM ("$MV $DEST/tex/latex/$package/photo.png .");
  &SYSTEM ("$MV doc/* .");
}

sub POSTpbibtex_base {
  print "POST$package - top-level pbibtex/base, etc.\n";
  &mv_with_mkdir ("$DEST/bibtex/bst/pbibtex-base/*.bst", "$DEST/pbibtex/bst/");
  &mv_with_mkdir ("jxampl.bib", "$DEST/pbibtex/bib/");
  &mv_with_mkdir ("*", "$DEST/doc/ptex/pbibtex/");
}

sub POSTpedigreeperl {
  print "POST$package - mv *.pm Pedigree/*.pm\n";
  my $scriptdir = "$DEST/scripts/$package";  
  &xmkdir ("$scriptdir/Pedigree");
  &SYSTEM ("$MV *.pm $scriptdir/");
  &SYSTEM ("$MV Pedigree/*.pm $scriptdir/Pedigree/");
}

sub POSTpgfornament {
  print "POST$package - mv generic/ dirs\n";
  my $genericdir = "$DEST/tex/generic/$package";
  &mv_with_mkdir ("am", "vectorian", $genericdir);
}

sub POSTpgfplots {
  print "POST$package - rm spurious pgfplots.test dir\n";
  # author said he will remove in next version.
  &SYSTEM ("$RM -rf $DEST/tex/generic/pgfplots.test");
}

sub POSTpict2e {
  print "POST$package - mv pict2e{-example,}.cfg \n";
  my $texdir = "$DEST/tex/latex/pict2e";
  &SYSTEM ("$MV $texdir/pict2e-example.cfg $texdir/pict2e.cfg");
}

sub POSTpmx {
  print "POST$package - preserve binaries\n";
  &POST_preserve_bin ("scor2prt", "pmxab");
}

sub POSTprerex {
  print "POST$package - rm dup prerex subdir, install .5 man page\n";
  # move all the stuff from doc dir into ., as it
  # is already in the doc folder
  &SYSTEM ("mv doc/* .");
  &SYSTEM ("rmdir doc");
  &SYSTEM ("$RM -rf prerex");
  #
  my $mandest = "$TOPDEST/texmf-dist/doc/man/man5";
  &mv_with_mkdir ("$package.5", $mandest);
  &tl_man_to_pdf ("5");
  &SYSTEM ("$RM prerex.5.pdf"); # no need to keep original man pdf
}

sub POSTpstcox {
  print "POST$package - mv latex .sty, doc Gallery\n";
  &SYSTEM ("mkdir -p $DEST/tex/latex/$package");
  &SYSTEM ("mv -v $DEST/doc/generic/$package/*sty $DEST/tex/latex/$package");
  &xchdir ("$DEST/doc/generic/$package");
  &SYSTEM ("mkdir pst-coxeterp/");
  # oops, depends on find order
  &SYSTEM ("mv -v Gallery.tex pst-coxeterp?* pst-coxeterp/");
  &SYSTEM ("mv -v doc/pst-coxcoor/ pst-coxcoor");
  &SYSTEM ("mv -v pst-coxcoor?* pst-coxcoor");
}

sub POSTpstgeo {
  print "POST$package - mv data, doc\n";
  &SYSTEM ("$MV data/pst*compress.pl .");
  &SYSTEM ("$RM dataII/pst*compress.pl");
  &SYSTEM ("$MV data dataII $DEST/tex/generic/pst-geo/");
  &SYSTEM ("$MV doc/* .");
  &SYSTEM ("$RM examples/*.pdf");
}

sub POSTpxbase {
  print "POST$package - remove pxcjkcat, separate package\n";
  &SYSTEM ("$RM $DEST/tex/platex/pxbase/pxcjkbase.sty");
}

sub POSTpxchfon {
  print "POST$package - move stuff around\n";
  my $srcdir = "$DEST/source/platex/$package";
  my $sfddir = "$DEST/fonts/sfd/$package";
  &SYSTEM ("$MV *.vpl *.pl $srcdir/");
  &xmkdir ($sfddir);
  &SYSTEM ("$MV $srcdir/*.sfd $sfddir/");
}

sub POSTpxbase {
  print "POST$package - remove pxcjkcat, separate package\n";
  &SYSTEM ("$RM $DEST/tex/platex/pxbase/pxcjkbase.sty");
}

sub POST_simple_rmFonts {
  print "POST$package - rm Fonts dir\n";
  &SYSTEM ("$RM -r Fonts");
}

sub POSTtex_ps {
  print "POST$package - rm zip, mv files from subdirs\n";
  &SYSTEM ("$RM *.zip");
  &mv_with_mkdir ("*/cmyk-hax.tex", "$DEST/tex/generic/$package");
  &mv_with_mkdir ("*/poligraf.sty", "$DEST/tex/generic/$package");
  &mv_with_mkdir ("poligraf/*.pro", "$DEST/dvips/$package");
}

sub POSTtexdraw {
  print "POST$package - rename info file\n";
  &SYSTEM ("$MV texdraw texdraw.info");
  &mv_with_mkdir ("texdraw.info", "$TOPDEST/texmf-dist/doc/info/");
  # not worth the hassle of fixing @setfilename and re-uploading,
  # or forcing the output file name.
}

sub POSTtikz_cd {
  print "POST$package - generic file in generic subdirectory\n";
  &xchdir ("$TOPDEST/texmf-dist/tex");
  &mv_with_mkdir ("latex/tikz-cd/tikzlibrary*tex", "generic/tikz-cd/");
}

sub POSTtudscr {
  print "POST$package - subdirs\n";
  &xchdir (".."); # cd back from the prehook
  &SYSTEM ("$MV source/* $DEST/source/latex/$package");
  &SYSTEM ("$MV logo $DEST/tex/latex/$package/");
  &SYSTEM ("$MV doc/* .");
}

sub POSTvelthuis {
  print "POST$package - redistribute macro and doc files\n";
  #
  &mv_with_mkdir ("$DEST/tex/latex/$package/hindi.sty",
                  "$DEST/tex/latex/$package/hindi.ldf",
                  => "$DEST/tex/generic/$package");  
  #
  &mv_with_mkdir ("dnmacs.tex" => "$DEST/tex/plain/$package");  
  #
  &mv_with_mkdir ("$DEST/tex/latex/$package/hindicaptions.sty",
                  => "$DEST/tex/xelatex/$package");  
  #
  &mv_with_mkdir ("$DEST/doc/generic/$package/devnag.1",
                  "$DEST/doc/generic/$package/devnag.man1.pdf",
                  => "$DEST/doc/man/man1");  
}

sub POSTxecyr {
  print "POST$package - handling bat, moving language.dat.add from runtime\n";
  &SYSTEM ("$MV $DEST/tex/generic/xecyr/language.dat.add"
           . " $DEST/doc/xelatex/xecyr");

  # Just moving to bin/win32 doesn't work, since we don't want to
  # svn add them -- they exist in xecyr.PLATFORM, not xecyr.  They never
  # change anyway, so just remove until it become an issue.
  #my $wdir = "$TOPDEST/bin/win32";
  #&xmkdir ($wdir);
  #&SYSTEM ("$MV $DEST/bin/xecyr/*.bat $wdir/");
  &SYSTEM ("$RM $DEST/bin/xecyr/*.bat");
}

sub POSTxetexpstricks {
  print "POST$package - need tex/ level\n";
  &xchdir ($DEST);
  &xmkdir ("tex", "doc/generic/$package");
  &SYSTEM ("$MV xelatex xetex tex");
}

# does not work since there is also the rest of the xindy package ...
#sub POST_xindy {
#  print "POST$package - move to xindy module directory\n";
#  &xchdir ("$DEST/$whichformat/$package");
#  &mv_with_mkdir ("*", "$DEST/xindy/modules/lang/persian/");
#}

sub POSTxsim {
  print "POST$package - move code/ subdir\n";
  &mv_with_mkdir ("code/*", "$DEST/tex/latex/$package");
}

sub POSTxymtex {
  print "POST$package - rm .BAK old-doc, move subdirectories\n";
  &SYSTEM ("rm -rf old-doc");
  &SYSTEM ("find . -name '*.BAK' | xargs rm");
  my $rundir = "$DEST/tex/latex/$package";
  my $srcdir = "$DEST/source/latex/$package";
  for my $dir (qw(base chemist xymtxpdf xymtxps)) {
    &mv_with_mkdir ("$dir/*.sty", "$rundir/$dir");
    &mv_with_mkdir ($dir, $srcdir);
  }
}

sub POSTzhmetrics {
  # source seems better than making a doc directory just for the map file.
  print "POST$package - move example ttfonts.map out of runtime\n";
  &SYSTEM ("$MV $DEST/fonts/map/ttf2pk/ttfonts.map $DEST/source/fonts/zhmetrics");
}

# Generic post hook actions follow, with an underscore following POST.

sub POST_otherformat {
  print "POST$package - move macros up a level\n";
  &SYSTEM ("$MV $DEST/tex/$package/$package/* $DEST/tex/$package/");
}

# Move .1 and .5 files from source dir to man dir (if needed), and make
# our pdfs from them.
# 
# has to be post instead of specialman when we use the tds.zip.
# Optional argument is directory where the man pages are as distributed
# on CTAN, else doc/*/$package.
sub POST_do_man {
  my ($src_mandir) = @_;

  if ($src_mandir) {
    ; # explicitly specified, ok.
  } elsif (<$DEST/doc/man/man1/*.1>) {
    $src_mandir = "$DEST/doc/man/man1";
  } elsif (<$DEST/doc/*/$package/*.1>) {
    $src_mandir = "doc/*/$package";
  } elsif (<$DEST/doc/$package/*.1>) {
    $src_mandir = "doc/$package";
  } else {
    warn ("$0: could not find man pages starting from " . `pwd`);
  }
  #
  my $mandest = "$TOPDEST/texmf-dist/doc/man/man1";
  print "POST_do_man - mv *.1 man pages from $src_mandir to $mandest\n";
  &xmkdir ($mandest);
  chomp (my $origdir = `pwd`);
  &xchdir ($DEST);
  &SYSTEM ("$MV $src_mandir/*.1 $mandest") unless $src_mandir eq $mandest;
  &tl_man_to_pdf ();
  &xchdir ($origdir);
  
  # this is for luaotfload, which already has the .5 in the right place.
  # So we just have to rebuild.
  if (<$DEST/doc/man/man5/*.5>) {
    print "POST_do_man - found *.5 man pages in $DEST/doc/man/man5/\n";
    &tl_man_to_pdf ("5");
  }
}

sub POST_preserve_bin {
  # the pmx package includes binaries made from Build, and normal
  # scripts and support files.  The latter can get updated without
  # needing to update the former, so we support it.  Which means
  # preserving the binaries from the Build.
  my (@binaries) = @_;
  chomp (my @platforms = `cd $Master/bin && ls`);
  for my $p (@platforms) {
    my $platdir = "$TOPDEST/bin/$p";
    &xmkdir ($platdir);
    my $exeext = &exeext ($p);
    for my $b (@binaries) {
      &SYSTEM ("$CP $Master/bin/$p/$b$exeext $platdir/");
    }
  }

  # always going to need this anyway, may as well do it here.
  &POST_do_man ();
}

sub POST_rmsymlink {
  print "POST$package - removing symlinks\n";
  &SYSTEM ("find $DEST -type l | xargs --no-run-if-empty $RM");
}


# Allow overrides.  In particular, CTAN can change some hashes to make
# packages with licenses that TL doesn't allow.
# 
# Put the config file "ctan2tds-config.pl" in the dir from which you 
# run this script, or better, set the environment variable "CTAN2TDS_CONFIG".
# 
sub readconfig {
  my ($base,$dir,$ext) = fileparse ($0, '\.pl');

  my $configFileName = "$dir/$base-config.pl";
  $configFileName = $ENV{"CTAN2TDS_CONFIG"} || $configFileName;

  my $result;
  if (-f $configFileName) {
    my $err = "Error: CTAN config file $configFileName";
    $result = eval `cat $configFileName`; # like require, but no look in INC
    die "$err; evaluation in file failed: $@" 
        if $@;
    die "$err; yielded result that is false" 
        unless $result;
  } else {
    $result=1;
  }
  return $result;
}

# vim: set tabstop=8 shiftwidth=2 expandtab: