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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>How to build Ghostscript from source code</title>
<!-- $Id$ -->
<!-- Originally: make.txt -->
<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style">
</head>
<body>
<!-- [1.0 begin visible header] ============================================ -->
<!-- [1.1 begin headline] ================================================== -->
<h1>How to build Ghostscript from source code</h1>
<!-- [1.1 end headline] ==================================================== -->
<!-- [1.2 begin table of contents] ========================================= -->
<h2>Table of contents</h2>
<blockquote><ul>
<li><a href="#General_overview">General overview</a>
<li><a href="#Acquiring">How to acquire the source code</a>
<ul>
<li><a href="#Ghostscript_source">Ghostscript source code</a>
<li><a href="#Third-party_libraries">Third-party library source code</a>
</ul>
<li><a href="#Unpack">How to unpack the source code</a>
<ul>
<li><a href="#Tarfiles">How to unpack compressed tar files generally</a>
<li><a href="#Zipfiles">How to unpack zip files generally</a>
<li><a href="#Unpack_Ghostscript">How to unpack Ghostscript itself</a>
<li><a href="#Unpack_libraries">How to unpack the third-party libraries</a>
</ul>
<li><a href="#Bug_check">How to check for post-release bug fixes</a>
<li><a href="#Makefile_overview">How to prepare the makefiles</a>
<ul>
<li><a href="#Preparing_makefiles">Changes for your environment</a>
<li><a href="#Features_and_devices">Selecting features and devices</a>
<ul>
<li><a href="#Precompiled_data">Precompiled run-time data</a>
<li><a href="#GNU_readline">GNU readline</a>
</ul>
<li><a href="#Makefile_setup">Setting up "makefile"</a>
<li><a href="#Invoke_make">Invoking "make"</a>
<li><a href="#Cross-compiling">Cross-compiling</a>
</ul>
<li><a href="#PC_build">How to build Ghostscript from source (PC version)</a>
<ul>
<li><a href="#Borland_build">Borland/Inprise environment</a>
<li><a href="#Microsoft_build">Microsoft environment</a>
<li><a href="#Self-extracting_executables">Making self-extracting executables</a>
<li><a href="#Watcom_build">Watcom environment</a>
<li><a href="#Cygwin32_build">Cygwin32 gcc</a>
<li><a href="#IntelWin32_build">Intel C/C++ compiler</a>
</ul>
<li><a href="#Mac_build">How to build Ghostscript from source (MacOS version)</a>
<ul>
<li><a href="#MacOS">Traditional MacOS</a>
<li><a href="#MacOSX">MacOS X</a>
</ul>
<li><a href="#Unix_build">How to build Ghostscript from source (Unix version)</a>
<ul>
<li><a href="#Multi_architecture_makefile">The multi-architecture makefile</a>
<li><a href="#UNIX_makefile">Setting up "makefile"</a>
<li><a href="#Shared_object">Shared object</a>
<li><a href="#Tool_specific_issues">Tool-specific issues</a>
<ul>
<li><a href="#gcc_27x">gcc 2.7.*</a>
<li><a href="#GNU_make">GNU make</a>
</ul>
<li><a href="#OS_specific_issues">OS-specific issues</a>
<ul>
<li><a href="#386_Unix">386 Unix</a>
<li><a href="#BSDI">BSDI</a>
<li><a href="#Digital_Unix">Digital Unix (Alpha)</a>
<li><a href="#FreeBSD">FreeBSD</a>
<li><a href="#Linux">Linux</a>
<li><a href="#NeXTSTEP">NeXTSTEP / OpenSTEP</a>
<li><a href="#SCO">SCO Unix/Xenix</a>
<li><a href="#SVR4">SVR4 Unix</a>
<li><a href="#System_V">System V Unix platforms</a>
<li><a href="#Unixware">Unixware</a>
</ul>
<li><a href="#Hardware_specific_issues">Hardware-specific issues</a>
<ul>
<li><a href="#Alpha_with_gcc">Alpha with gcc</a>
<li><a href="#Apollo">H-P Apollo</a>
<li><a href="#ATT_7040">AT&T 7040 R3</a>
<li><a href="#Convex">Convex</a>
<li><a href="#DECStations">DECStations with Ultrix</a>
<li><a href="#HP_RISC">H-P RISC workstations</a>
<li><a href="#Intergraph">Intergraph Clipper</a>
<li><a href="#MIPS">MIPS</a>
<li><a href="#NCR_3550">NCR 3550</a>
<li><a href="#Pyramid">Pyramid MIServer-S</a>
<li><a href="#RS6000">IBM RS/6000 with AIX</a>
<li><a href="#Silicon_Graphics">Silicon Graphics</a>
<li><a href="#Sun">Sun</a>
<li><a href="#SunOS">SunOS</a>
<li><a href="#Solaris">Solaris</a>
<li><a href="#VAX_Ultrix">VAX with Ultrix</a>
</ul>
</ul>
<li><a href="#OS2_build">How to build Ghostscript from source (OS/2 version)</a>
<li><a href="#VMS_build">How to build Ghostscript from source (OpenVMS version)</a>
<ul>
<li><a href="#GNU_make_VMS">Building with GNU make on OpenVMS</a>
<li><a href="#MMK_MMS_VMS">Building with MMK or MMS on OpenVMS</a>
</ul>
<li><a href="#Other_environments">Other environments</a>
<ul>
<li><a href="#No_multi_thread">Environments lacking multi-threading</a>
<li><a href="#Plan_9">Plan 9</a>
<li><a href="#QNX">QNX</a>
</ul>
<li><a href="#UFST_build">How to build Ghostscript with UFST</a>
</ul></blockquote>
<!-- [1.2 end table of contents] =========================================== -->
<!-- [1.3 begin hint] ====================================================== -->
<p>For other information, see the <a href="Readme.htm">Ghostscript
overview</a> and the instructions on how to <a href="Install.htm">install
Ghostscript</a>.
<!-- [1.3 end hint] ======================================================== -->
<hr>
<!-- [1.0 end visible header] ============================================== -->
<!-- [2.0 begin contents] ================================================== -->
<h2><a name="General_overview"></a>General overview</h2>
<p>
This document describes how to build a Ghostscript executable from source
code. There are four major steps to building Ghostscript:
<ol>
<li>Acquire the compressed archive files of source code for Ghostscript and
the required third-party libraries.
<li>Unpack the archive files into the Ghostscript directory and correctly
named subdirectories.
<li>Prepare the makefiles, including specific changes for your operating
environment and your choice of configuration options.
<li>Invoke "<b><tt>make</tt></b>" to build the software.
</ol>
<p>
The remainder of this document describes each of these steps in detail.
Note that some of this process is platform-dependent. After building
Ghostscript you must then install it; for that, see the
<a href="Install.htm">installation instructions</a>.
<hr>
<h2><a name="Acquiring"></a>How to acquire the source code</h2>
<p>
Building Ghostscript requires the Ghostscript source code itself, and also
the source code for some third-party libraries that Ghostscript uses.
<h3><a name="Ghostscript_source"></a>Ghostscript source code</h3>
<p><a name="Authoritative_distribution_site"></a>
There are two kinds of Ghostscript distributions available, called "AFPL
Ghostscript" and "GNU Ghostscript"; the distinction between them is
explained in the <a href="Commprod.htm">conditions for distributing
Ghostscript</a>. The authoritative distribution site for AFPL
Ghostscript is
<blockquote>
<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/"
class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/</a>gs###
</blockquote>
<p>
where "###" is the unpunctuated version number. GNU Ghostscript should be
available on all GNU sites, such as
<blockquote>
<a href="ftp://ftp.gnu.org/pub/gnu/"
class="offsite">ftp://ftp.gnu.org/pub/gnu/</a>
</blockquote>
<p>
Ghostscript source code is packaged in two different formats:
gzip-compressed tar files (*<b><tt>.tar.gz</tt></b>) and zip files
(*<b><tt>.zip</tt></b>). For all versions there are gzip-compressed tar
files:
<blockquote>
<b><tt>ghostscript-</tt></b>#.##<b><tt>.tar.gz</tt></b><br>
<b><tt>ghostscript-fonts-std-</tt></b>#.##<b><tt>.tar.gz</tt></b><br>
<b><tt>ghostscript-fonts-other-</tt></b>#.##<b><tt>.tar.gz</tt></b>
</blockquote>
<p>For recent versions of Ghostscript there are also zip files
<blockquote>
<b><tt>gs</tt></b>###<b><tt>src.zip</tt></b><br>
<b><tt>gs</tt></b>###<b><tt>w32.exe</tt></b>
</blockquote>
<p>
("#.##" and "###" are version numbers in punctuated and unpunctuated form.)
Software to decompress and extract both formats is available for almost
every platform for which Ghostscript is available -- including Unix, DOS,
MS Windows, and VMS -- so you can choose the format most convenient for
you; but it's up to you to locate that software. See the section on <a
href="#Unpack">unpacking the source code</a>.
<h3><a name="Third-party_libraries"></a>Third-party library source code</h3>
<p>
To build Ghostscript you need the source code for the <a
href="http://www.ijg.org/">Independent JPEG Group</a> (IJG) library, the
<a href="http://www.libpng.org/pub/png/">Portable Network Graphics</a>
(PNG)
library, and the <a
href="http://www.gzip.org/zlib/">zlib</a>
compression and decompression library. Here are authoritative distribution
points for these libraries, where as elsewhere, "#" is used for version
numbers. The JPEG source code is quite stable, so the reference
here includes the latest version number. The zlib references are
version-independent and should always provide the latest version.
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Third-party libraries: authoritative sources</font><hr>
<tr> <td valign=top>JPEG
<td>
<td><a href="ftp://ftp.uu.net/graphics/jpeg/"
class="offsite">ftp://ftp.uu.net/graphics/jpeg/</a><a
href="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz"
class="offsite">jpegsrc.v6b.tar.gz</a><br>
<a href="ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/"
class="offsite">ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/</a><a
href="ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/jpegsr6b.zip">jpegsr6b.zip</a>
<tr> <td valign=top>PNG
<td>
<td><a href="http://www.libpng.org/pub/png/src/"
class="offsite">http://www.libpng.org/pub/png/src/</a>libpng-#.#.#.tar.gz<br>
<a href="http://www.libpng.org/pub/png/src/"
class="offsite">http://www.libpng.org/pub/png/src/</a>lpng###.zip<br>
<a href="ftp://swrinde.nde.swri.edu/pub/png/src/"
class="offsite">ftp://swrinde.nde.swri.edu/pub/png/src/</a>libpng-#.#.#.tar.gz<br>
<a href="ftp://swrinde.nde.swri.edu/pub/png/src/"
class="offsite">ftp://swrinde.nde.swri.edu/pub/png/src/</a>lpng###.zip
<tr> <td valign=top>zlib (latest)
<td>
<td> <a href="http://www.gzip.org/zlib/zlib.tar.gz"
class="offsite">http://www.gzip.org/zlib/zlib.tar.gz</a><br>
<a href="http://www.gzip.org/zlib/zlib.zip"
class="offsite">http://www.gzip.org/zlib/zlib.zip</a><br>
<a href="ftp://swrinde.nde.swri.edu/pub/png/src/" class="offsite">ftp://swrinde.nde.swri.edu/pub/png/src/zlib-#.#.#.tar.gz</a><br>
<a href="ftp://swrinde.nde.swri.edu/pub/png/src/" class="offsite">ftp://swrinde.nde.swri.edu/pub/png/src/zlib###.zip</a>
</table></blockquote>
<p>
On DOS or MS Windows one ordinarily uses the zip file kits, in other
environments the compressed tar files, but this is simply a matter of
convenience, since for the same version of the software the compressed tar
file has the same contents as the zip file. Note that each of these
libraries has <b><em>its own version number</em></b> that has
<b><em>nothing to do with Ghostscript's version number</em></b>; you should
get the highest numbered version. (If you encounter difficulties in the
build process you might have to use a lower-numbered version, but don't
worry about this yet.) If you're running Linux, you might check whether
these libraries are already available in source form on your system, since
many Linux distributors include them; but we advise you to get the highest
version from the Net if you can.
<p>
Although the zip archives of an old version of the PNG library may not be
named <b><tt>lpng</tt></b>###<b><tt>.zip</tt></b>, we refer to it as
<b><tt>lpng</tt></b>###<b><tt>.zip</tt></b>.
<p>
On MacOS, the .sit source archive includes the appropriate source versions
of these libraries, so no additional downloads are necessary.
<hr>
<h2><a name="Unpack"></a>How to unpack the source code</h2>
<p>
Unfortunately there are no generally accepted standards for how to package
source code into archives, so the instructions for unpacking Ghostscript are
longer than they should be. We begin with a brief explanation of how to
extract the two kinds of archive files.
<h3><a name="Tarfiles"></a>How to unpack compressed tar files generally</h3>
<p>
Tar (<b><tt>.tar</tt></b>) files are the <em>de facto</em> standard for
archiving files on Unix (every Unix system has the <b><tt>tar</tt></b>
program), and programs to extract their contents are also widely available
for DOS, MS Windows, and VMS. To economize on space and downloading time,
Ghostscript's tar files are compressed with GNU <b><tt>gzip</tt></b>, which
adds the suffix "<b><tt>.gz</tt></b>" to the file name, giving
"<b><tt>.tar.gz</tt></b>".
<p>
To unpack a compressed tar file <b><tt>MyArchive.tar.gz</tt></b> you
must both decompress it and extract the contents. You can do this in two
steps, one to decompress the file and another to unpack it:
<blockquote>
<b><tt>gzip -d MyArchive.tar.gz</tt></b>
<br><b><tt>tar -xf MyArchive.tar</tt></b>
</blockquote>
<p>
or in a pipeline:
<blockquote>
<b><tt>gzip -d -c MyArchive.tar.gz | tar -xf -</tt></b>
</blockquote>
<p>
or, if you have a program like GNU <b><tt>tar</tt></b> that can handle
compressed tar files, with a single command:
<blockquote>
<b><tt>tar -zxf MyArchive.tar.gz</tt></b>
</blockquote>
<p>
The <b><tt>tar</tt></b> program automatically preserves directory structure
in extracting files. The Ghostscript source archive puts all files under a
directory <b><tt>gs</tt></b>#.##, so using <b><tt>tar</tt></b> to unpack a
compressed archive should always properly create that directory, which we
will call the "gs directory". Make sure you're positioned in the
<b><em>parent</em></b> of the gs directory <b><em>before</em></b> unpacking
the files. If a subdirectory doesn't already exist, <b><tt>tar</tt></b>
creates it.
<p>
Some other programs -- under MS Windows, for instance -- can also unpack
compressed tar files, but they may not automatically preserve directory
structure nor even extract files into the current directory. If you use
one of these, you must
<ul>
<li>set the program's options to "Use folder names" or the equivalent, and
<li>check that it is extracting files into the right place.
</ul>
<h3><a name="Zipfiles"></a>How to unpack zip files generally</h3>
<p>
Zip files are the <em>de facto</em> standard for archiving files on DOS and
MS Windows, and programs to extract their contents are widely available for
DOS, MS Windows, Unix, VMS, and other platforms. Zip files are at once an
archive format and a compressed format, so an unzipping program
decompresses and extracts archived files as a single step.
<p>
One common 16-bit DOS program is <b><tt>pkunzip</tt></b>, which comes in
the <b><tt>pkzip</tt></b> package. If you use this, you should ensure that
you have at least version 2.04g, because with its <b><tt>-d</tt></b>
switch, that version of <b><tt>pkunzip</tt></b> preserves the directory
structure of archived files when extracting them; see below. Another
popular free program to unpack zip archives, available for DOS and MS
Windows (16-bit and 32-bit), Unix, VMS, and other platforms, is InfoZIP
<b><tt>unzip</tt></b>:
<blockquote>
<a href="http://www.info-zip.org/pub/infozip/UnZip.html"
class="offsite">http://www.info-zip.org/pub/infozip/UnZip.html</a>
</blockquote>
<p>
Unlike <b><tt>pkunzip</tt></b>, InfoZIP <b><tt>unzip</tt></b> automatically
preserves the directory structure of extracted files. So if you have a zip
archive <b><tt>MyArchive.zip</tt></b>:
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Extracting zipped files</font><hr>
<tr valign=bottom>
<th align=left>Command
<td>
<th align=left>Preserves directory structure
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>pkunzip MyArchive.zip</tt></b>
<td>
<td>Does <b><em>NOT</em></b>
<tr valign=top> <td><b><tt>pkunzip -d MyArchive.zip</tt></b>
<td>
<td><b><em>DOES</em></b> (note the <b><tt>-d</tt></b> switch)
<tr valign=top> <td><b><tt>unzip MyArchive.zip</tt></b>
<td>
<td><b><em>DOES</em></b>
</table></blockquote>
<p>
As with the compressed tar files, make sure you're positioned in the
<b><em>parent</em></b> of the gs directory <b><em>before</em></b> unpacking
the files. If a subdirectory doesn't already exist, <b><tt>zip</tt></b> or
<b><tt>pkunzip -d</tt></b> creates it.
<h3><a name="Unpack_Ghostscript"></a>How to unpack Ghostscript itself</h3>
<p>
At this point you have <a href="#Acquiring">acquired all the source code</a>
and are ready to unpack it according to the preceding guidelines for <a
href="#Tarfiles">tar files</a> or <a href="#Zipfiles">zip files</a>. To
unpack the Ghostscript source, make the <b><em>parent</em></b> of the (new)
gs directory the current directory.
<blockquote><table cellpadding=0 cellspacing=0>
<tr> <th align=left valign=top>2-step:
<td>
<td><b><tt>gzip -d ghostscript-</tt></b>#.##<b><tt>.tar.gz</tt></b><br><b><tt>tar -xf ghostscript-</tt></b>#.##<b><tt>.tar</tt></b>
<tr><td>
<tr> <th align=left valign=top>Pipe:
<td>
<td><b><tt>gzip -d -c ghostscript-</tt></b>#.##<b><tt>.tar.gz | tar -xf -</tt></b>
<tr><td>
<tr> <th align=left valign=top>GNU <b><tt>tar</tt></b>:
<td>
<td><b><tt>tar -zxf ghostscript-</tt></b>#.##<b><tt>.tar.gz</tt></b>
<tr><td>
<tr> <th align=left valign=top><b><tt>pkunzip</tt></b>:
<td>
<td><b><tt>pkunzip -d gs</tt></b>###<b><tt>sr1.zip</tt></b><br><b><tt>pkunzip -d gs</tt></b>###<b><tt>sr2.zip</tt></b><br>...
<tr><td>
<tr> <th align=left valign=top><tt>unzip</tt>:
<td>
<td><b><tt>unzip gs</tt></b>###<b><tt>src.zip</tt></b>
</table></blockquote>
<p>
All the Ghostscript source files are now in subdirectories of the gs
directory.
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Source subdirectories</font><hr>
<tr> <th valign=bottom align=left>Subdirectory
<td>
<th valign=bottom align=left>Contents
<tr> <td colspan=5><hr>
<tr> <td><b><tt>src/</tt></b>
<td>
<td>C source code and makefiles
<tr> <td><b><tt>lib/</tt></b>
<td>
<td>PostScript files and scripts used when running Ghostscript
<tr> <td><b><tt>doc/</tt></b>
<td>
<td>Documentation
<tr> <td><b><tt>man/</tt></b>
<td>
<td>Unix <b><tt>man</tt></b> pages
<tr> <td><b><tt>examples/</tt></b>
<td>
<td>Sample PostScript files
</table></blockquote>
<h3><a name="Unpack_libraries"></a>How to unpack the third-party libraries</h3>
<p>
The Ghostscript makefiles expect to find the JPEG, PNG, and zlib source code
in specific subdirectories of the <b><tt>gs</tt></b> directory, and this
means you must pay careful attention to unpacking the source code for these
packages. Use the same method for all of them, no matter how they're
packaged:
<ol>
<li>Make the gs directory current.
<li>Unpack the archive file, creating a subdirectory (which will include a
version number).
<li>Whatever the subdirectory's original name, rename it to the versionless
name shown just below.
</ol>
<p>
If you're uncertain how to unpack an archive, review the sections on <a
href="#Tarfiles">compressed tar files</a> and <a href="#Zipfiles">zip
files</a>.
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">3d-party software subdirectories</font><hr>
<tr> <th valign=bottom align=left>Package
<td>
<th valign=bottom align=left>Possible<br>original name
<td>
<th valign=bottom align=left>Rename to
<tr> <td colspan=5><hr>
<tr> <td>JPEG
<td>
<td><b><tt>./jpeg-6b</tt></b>
<td>
<td><b><tt>./jpeg</tt></b>
<tr> <td>PNG
<td>
<td><b><tt>./libpng-</tt></b>#.##
<td>
<td><b><tt>./libpng</tt></b>
<tr> <td>zlib
<td>
<td><b><tt>./zlib-</tt></b>#.#.#
<td>
<td><b><tt>./zlib</tt></b>
</table></blockquote>
<hr>
<h2><a name="Bug_check"></a>How to check for post-release bug fixes</h2>
<p>
Bug information and fixes are tracked on SourceForge.
For more information, please visit
<blockquote>
<a href="http://sourceforge.net/projects/ghostscript">
http://sourceforge.net/projects/ghostscript</a>
</blockquote>
<hr>
<h2><a name="Makefile_overview"></a>How to prepare the makefiles</h2>
<p>
The Ghostscript makefiles are very large and complex in order to deal with
the diverse requirements of all the different systems where they may be
used.
<p>
New with this release is support for the GNU autoconf tool for generating
an automatic configuration script. If you're on unix or a related system
that supports unix shell scripts, this is the easiest option to use.
Simply type:
<blockquote>
<tt>./configure</tt>
</blockquote>
from the top level of the ghostscript source directory. It should configure
itself based on what's available on your system, warn you of any missing
dependencies, and generate a Makefile. At this point you can skip to the
section <a href="#Invoke_make">invoking make</a> below. Note that the
autoconfiguration option is only available with the unix .tar distribution
of the source.
<p>
If your system doesn't support the configure script or you don't wish to
use it, you can use the traditional ghostscript makefile system, editing
the options by hand to match your system as described below.
Fortunately, the only makefiles you're likely to want to change are
relatively small ones containing platform-specific information.
<blockquote><a name="Platform-specific_makefiles"></a><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Platform-specific makefiles</font><hr>
<tr> <th align=left>Makefile
<td>
<th align=left>Used for
<tr> <td colspan=3><hr>
<tr> <td><b><tt>bcwin32.mak</tt></b>
<td>
<td>MS Windows with Borland/Inprise compilers
<tr> <td><b><tt>msvc32.mak</tt></b>
<td>
<td>MS Windows with Microsoft Visual C++ version 4 to 7.
<tr> <td><b><tt>openvms.mak</tt></b>
<td>
<td>OpenVMS
<tr> <td><b><tt>os2.mak</tt></b>
<td>
<td>OS/2 with the gcc/emx compiler
<tr> <td><b><tt>unix-gcc.mak</tt></b>
<td>
<td>Unix with gcc
<tr> <td><b><tt>unixansi.mak</tt></b>
<td>
<td>Unix with ANSI C compilers other than gcc
<tr> <td><b><tt>watc.mak</tt></b>
<td>
<td>DOS with Watcom compilers
<tr> <td><b><tt>watcw32.mak</tt></b>
<td>
<td>MS Windows with Watcom compilers
<tr> <td>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Platform-independent makefiles</font><hr>
<tr> <td><b><tt>contrib.mak</tt></b>
<td>
<td>Contributed device drivers
<tr> <td><b><tt>devs.mak</tt></b>
<td>
<td>Maintained device drivers
<tr> <td><b><tt>gs.mak</tt></b>
<td>
<td>Documentation and miscellany
<tr> <td><b><tt>int.mak</tt></b>
<td>
<td>Main makefile for the PostScript & PDF interpreter
<tr> <td><b><tt>jpeg.mak</tt></b>
<td>
<td>JPEG library
<tr> <td><b><tt>lib.mak</tt></b>
<td>
<td>Graphics engine
<tr> <td><b><tt>libpng.mak</tt></b>
<td>
<td>PNG library
<tr> <td><b><tt>version.mak</tt></b>
<td>
<td>Version and release date
<tr> <td><b><tt>zlib.mak</tt></b>
<td>
<td>zlib library
</table></blockquote>
<p>
Since these files change from one Ghostscript version to another, sometimes
substantially, and since they all include documentation for the various
options, here we don't duplicate most of that documentation: we recommend
strongly that you review the entire makefile specific for your operating
system and compiler before building Ghostscript.
<h3><a name="Preparing_makefiles"></a>Changes for your environment</h3>
<p>
You must edit the platform-specific makefile to change any of these:
<ul>
<li>The name of the makefile itself (<b><tt>MAKEFILE</tt></b> macro)
<li>The locations to install Ghostscript files (<b><tt>prefix</tt></b> etc.)
<li>The default search paths for the initialization and font files
(<b><tt>GS_LIB_DEFAULT</tt></b> macro)
<li>The debugging options (<b><tt>DEBUG</tt></b> and <b><tt>TDEBUG</tt></b>
macros)
<li>Which optional features to include (<b><tt>FEATURE_DEVS</tt></b>)
<li>Which device drivers to include (<b><tt>DEVICE_DEVS</tt></b> and
<b><tt>DEVICE_DEVS</tt></b>{<em>1--20</em>} macros)
<li>Default resolution parameters for some printer drivers
(<b><tt>devs.mak</tt></b> or <b><tt>contrib.mak</tt></b>, whichever defines
the driver)
</ul>
<p>
The <a href="#Platform-specific_makefiles">platform-specific makefiles</a>
include comments describing all these except the
<b><tt>DEVICE_DEVS</tt></b> options. These are described in
<b><tt>devs.mak</tt></b> and <b><tt>contrib.mak</tt></b>, even though the
file that must be edited to select them is the <a
href="#Platform-specific_makefiles">platform-specific makefile</a>. Check
also the <b><tt>JVERSION</tt></b> and <b><tt>PVERSION</tt></b> macros in
the platform-specific makefile, and adjust them if they don't match the
JPEG and PNG library versions you're using: see <b><tt>jpeg.mak</tt></b>
and <b><tt>libpng.mak</tt></b> for more information.
<p>
Some platform-specific options are described in the sections for individual
platforms. See the "Options" section near the beginning of the relevant
makefile for more information.
<h3><a name="Features_and_devices"></a>Selecting features and devices</h3>
<p>
You may build Ghostscript with any of a variety of features and with any
subset of the available device drivers. The complete list of features is
in a comment at the beginning of <b><tt>gs.mak</tt></b>, and the complete
list of drivers in comments at the beginning of <b><tt>devs.mak</tt></b>
and <b><tt>contrib.mak</tt></b>. To find what devices a platform-specific
makefile selects to include in the executable, look in it for all lines of
the form
<blockquote>
<b><tt>FEATURE_DEVS=</tt></b><em>{list of features}</em><br>
<b><tt>DEVICE_DEVS</tt></b>*<b><tt>=</tt></b><em>{list of devices}</em>
</blockquote>
<p>
For example, if the makefile has
<blockquote><b><tt>
FEATURE_DEVS=$(PSD)level2.dev
</tt></b></blockquote>
<p>
indicating that only the PostScript Level 2 facilities should be included,
you might make it
<blockquote><b><tt>
FEATURE_DEVS=$(PSD)level2.dev $(PSD)pdf.dev
</tt></b></blockquote>
<p>
to add the ability to interpret PDF files. (In fact,
<b><tt>FEATURE_DEVS</tt></b> in the current Unix makefiles already includes
<b><tt>$(PSD)pdf.dev</tt></b>.) The Unix makefile also defines
<blockquote><b><tt>
DEVICE_DEVS=$(DD)x11.dev
</tt></b></blockquote>
<p>
indicating that the X Windows driver should be included, but since
platform-specific makefiles as distributed normally include many of the
possible features and drivers, you will probably rather remove from the
makefile the features and drivers you don't want. It does no harm to
include unneeded features and devices, but the resulting executable will be
larger than needed.
<p>
You may edit the <b><tt>FEATURE_DEVS</tt></b> line to select or omit any of
the features listed near the beginning of <b><tt>gs.mak</tt></b>, and the
<b><tt>DEVICE_DEVS</tt></b>* lines to select or omit any of the device
drivers listed near the beginning of <b><tt>devs.mak</tt></b> and
<b><tt>contrib.mak</tt></b>. The first device listed in the definition of
<b><tt>DEVICE_DEVS</tt></b> becomes the default device for this executable;
see the usage documentation for <a href="Use.htm#Output_device">how to
select an output device</a> at run time using the
<a href="Use.htm#DEVICE_switch"><b><tt>-sDEVICE=</tt></b></a> switch. If
you can't fit all the devices on a single line, you may add lines defining
<blockquote>
<b><tt>DEVICE_DEVS1=$(DD)</tt></b><em>{dev11}</em><b><tt>.dev</tt></b> ... <b><tt>$(DD)</tt></b><em>{dev1n}</em><b><tt>.dev</tt></b>
<br><b><tt>DEVICE_DEVS2=$(DD)</tt></b><em>{dev21}</em><b><tt>.dev</tt></b> ... <b><tt>$(DD)</tt></b><em>{dev2n}</em><b><tt>.dev</tt></b>
</blockquote>
<p>
etc., up to <b><tt>DEVICE_DEVS15</tt></b>. Don't use continuation lines --
on some platforms they don't work.
<p>
Note that if you want to include a driver named <em>xxx</em>, you must put
<b><tt>$(DD)</tt></b><em>xxx</em><b><tt>.dev</tt></b> in
<b><tt>DEVICE_DEVS</tt></b>*. Similarly, if you want to include a feature
related to the PostScript or PDF language interpreters (PostScript level
1 .. 3, or other language features such as the ability to read EPSF files or
TrueType font files), you must represent it as
<b><tt>$(PSD)</tt></b><em>xxx</em><b><tt>.dev</tt></b>. If you are linking
only the graphics library -- not the language interpreter(s) -- with an
application and want to include optional graphics library features such as
CIE color, you represent them as
<b><tt>$(GLD)</tt></b><em>xxx</em><b><tt>.dev</tt></b>.
<h4><a name="Precompiled_data"></a>Precompiled run-time data</h4>
<p>
Ghostscript normally reads a number of external data files at run time:
initialization files containing PostScript code, fonts, and other resources
such as halftones. By changing options in the top-level makefile for the
platform, you can cause some of these files to be compiled into the
executable: this simplifies installation, improves security, may reduce
memory requirements, and may be essential if you are planning on putting
Ghostscript into ROM.
<p>
To compile the initialization files (<b><tt>lib/gs_init.ps</tt></b>, etc.)
into the executable, change the <b><tt>0</tt></b> to a <b><tt>1</tt></b> in
the line
<blockquote><b><tt>
COMPILE_INITS=0
</tt></b></blockquote>
<p>
To compile fonts into the executable, see <a
href="Fonts.htm#Precompiling">Precompiling fonts</a>.
<p>
To compile threshold-array halftones into the executable, see the "Compiled
halftone" section of <b><tt>int.mak</tt></b> for a sample makefile fragment,
<b><tt>genht.c</tt></b> for the syntax of halftone data files, and
<b><tt>lib/ht_ccsto.ps</tt></b> for a sample data file. Note that even
though the data files use PostScript syntax, compiled halftones do not
require the PostScript interpreter and may be used with the graphics library
alone.
<h4><a name="GNU_readline"></a>GNU readline</h4>
<p>
AFPL Ghostscript does not include an interface to GNU readline. A user
contributed code for this purpose, which we spent significant time debugging
and then updating to track internal architectural changes in Ghostscript.
The contributor was willing to assign the copyright to Aladdin Enterprises
(the copyright holder of Ghostscript at the time), and to allow the code to
be distributed with the Aladdin Free Public License (AFPL) as well as the
GNU License (GPL). However, even though the GPL allows linking GPLed code
(such as the GNU readline library package) with non-GPLed code (such as all
the rest of AFPL Ghostscript) if one doesn't distribute the result, the Free
Software Foundation, creators of the GPL, have told us that in their
opinion, the GPL forbids distributing non-GPLed code that is merely
<em>intended</em> to be linked with GPLed code. We understand that FSF
takes this position in order to prevent the construction of software that is
partly GPLed and partly not GPLed, even though the text of the GPL does not
actually forbid this (it only forbids <em>distribution</em> of such
software). We think that FSF's position is legally questionable and not in
the best interest of users, but we do not have the resources to challenge
it, especially since FSF's attorney apparently supports it. Therefore, even
though we added the user-contributed interface to GNU readline in internal
Aladdin Ghostscript version 5.71 and had it working in version 5.93 (one of
the last beta versions before the 6.0 release), we removed it from the
Aladdin Ghostscript 6.0 distribution.
<p>
GNU Ghostscript distributions will include support for GNU readline. As
with other GNU Ghostscript components that are not included in AFPL
Ghostscript, the maintainers of Ghostscript will not attempt to run, link,
or even compile this code, or keep it current across changes in the rest of
Ghostscript. We will, however, welcome bug fixes or updates, and distribute
them with subsequent releases of GNU Ghostscript.
<p>
The first GNU Ghostscript distribution that will include GNU readline
support will be GNU Ghostscript 6.0, currently scheduled for release along
with AFPL Ghostscript 7.0 in the first or second quarter of 2001. Before
that time, we may return the copyright of Ghostscript's GNU readline
interface module, which the original author assigned to Aladdin Enterprises,
to the author, so that users of GNU Ghostscript will have have access to it.
However, since it requires internal changes not available in any released
GNU Ghostscript version before 6.0, any user who gets this code and links it
with Aladdin Ghostscript 6.0 will, according to FSF, be violating the intent
(though not the letter) of the GPL.
<p>
We put considerable work into making it possible for Ghostscript to use GNU
readline, including the creation and adjustment of internal software
interfaces specifically to serve this purpose. In principle, we should have
undone this work in AFPL Ghostscript, lest FSF object to it too as
intended to facilitate linking AFPL Ghostscript with GNU readline (as the
U.S. government has been said to do for code that merely provides APIs where
encryption may be added). However, we are willing to take this risk rather
than spend the time to undo the interface changes.
<p>
If you have comments or questions about this situation, please feel free to
contact the Free Software Foundation, authors of the GPL and copyright
holders of GNU readline, at <a href="mailto:gnu@gnu.org">gnu@gnu.org</a>,
and/or artofcode LLC, copyright holder of Ghostscript, at <a
href="mailto:raph@artofcode.com">raph@artofcode.com</a>.
<h3><a name="Makefile_setup"></a>Setting up "makefile"</h3>
<p>
After going through the steps just described to <a href="#Unpack">unpack
the
sources</a>, make any desired <a href="#Preparing_makefiles">changes to
the
makefiles</a>, and unpack or create links to the <a
href="#Unpack_libraries">third party libraries</a>, as the final step in
preparing to build Ghostscript you must usually associate the name
"<b><tt>makefile</tt></b>" with the correct makefile for your environment so
the <b><tt>make</tt></b> command can find it. See the section on your
particular platform for how to do that if necessary.
<h3><a name="Invoke_make"></a>Invoking "make"</h3>
<dl>
<dt><b><tt>make</tt></b>
<dd>Builds Ghostscript without debugging options.
</dl>
<dl>
<dt><a name="Debugging"></a><b><tt>make debug</tt></b>
<dd>Builds Ghostscript with debugging options and additional internal error
checks. The program will be somewhat larger and slower, but it will behave
no differently unless you actually turn on debugging options at execution
time with the <b><tt>-DDEBUG</tt></b> or
<a href="Use.htm#Debugging"><b><tt>-Z</tt></b> command line switches</a>
described in the usage documentation.
</dl>
<dl>
<dt><b><tt>make pg</tt></b>
<dd>On Unix platforms, builds with the <b><tt>-pg</tt></b> compiler
switch, creating an executable for time profiling.
</dl>
<dl>
<dt><b><tt>make begin</tt></b>
<dd>On PC platforms, attempts a quick and dirty compilation of all the
<b><tt>.c</tt></b> files in the current directory. See the
<a href="#Make_begin">more detailed explanation</a>.
</dl>
<dl>
<dt><b><tt>make install</tt></b>
<dd>After building, installs the Ghostscript executables, support files,
and documentation, but does <b><em>not</em></b> install fonts. See the
<a href="Install.htm">installation documentation</a>.
</dl>
<dl>
<dt><b><tt>make clean</tt></b>
<dd>Deletes all the files created by the build process (relocatables,
executables, and miscellaneous temporary files). If you've built an
executable and want to save it, move it first to another place, because
"<b><tt>make clean</tt></b>" deletes it.
</dl>
<p>
<b><em>Note:</em></b> on most platforms some of these simple instructions don't
quite work in one way or another. Read the section on your specific
platform.
<h3><a name="Cross-compiling"></a>Cross-compiling</h3>
<p>
If you are compiling Ghostscript on machines <b>X1</b> ... <b>X</b><em>n</em> with
cross-compilers that generate code for machine <b>Y</b>, you must first
perform several extra steps on some machine <b>Z</b> (not necessarily of the
same type as either <b>X</b><em>i</em> or <b>Y</b>). First of all, choose a makefile
appropriate for <b>Z</b> and edit it to reflect the run-time options you
wish to include (<b><tt>FEATURE_DEVS</tt></b>, <b><tt>DEVICE_DEVS*</tt></b>,
and any other relevant options), just as for non-cross-compilation.
<p>
If <b>Z</b> runs Unix, perform the following steps:
<ol>
<li>On <b>Z</b>,
<blockquote>
<b><tt>make clean</tt></b><br>
<b><tt>make obj/arch.h obj/genconf obj/echogs</tt></b>
</blockquote>
<li>Edit <b><tt>obj/arch.h</tt></b> to reflect the architecture of <b>Y</b>.
<li>On <b>Z</b>,
<blockquote>
<b><tt>make CC=: CCLD=:</tt></b>
</blockquote>
<li>Copy the files <b><tt>obj/*.h</tt></b> from <b>Z</B> to the directory on
each <b>X</b><em>i</em> that will be used for compilation.
<li>Extract from the file <b><tt>obj/ldt.tr</tt></b> (on <b>Z</b>) the list
of <b><tt>.o</tt></b> files that will be linked: this gives the list of
source files that must be compiled.
<li>Do the compilations on <b>X</b><em>i</em>.
</ol>
<p>
If <b>Z</b> runs some version of Microsoft Windows with Microsoft Visual
C++, use the following steps. <em>NOTE: We have not actually tested
this.</em>
<ol>
<li>On <b>Z</b>,
<blockquote>
<b><tt>nmake clean</tt></b><br>
<b><tt>nmake obj\arch.h obj\genconf.exe obj\echogs.exe</tt></b>
</blockquote>
<li>Edit <b><tt>obj\arch.h</tt></b> to reflect the architecture of <b>Y</b>.
<li>On <b>Z</b>,
<blockquote>
<b><tt>nmake CC=rem LINK=rem</tt></b>
</blockquote>
<li>Copy the files <b><tt>obj\*.h</tt></b> from <b>Z</B> to the directory on
each <b>X</b><em>i</em> that will be used for compilation.
<li>Extract from the file <b><tt>obj\ldt.tr</tt></b> (on <b>Z</b>) the list
of <b><tt>.obj</tt></b> files that will be linked: this gives the list of
source files that must be compiled.
<li>Do the compilations on <b>X</b><em>i</em>.
</ol>
<hr>
<h2><a name="PC_build"></a>How to build Ghostscript from source (PC version)</h2>
<p>
All Ghostscript builds in PC (DOS and MS Windows) environments are 32- or
64-bit: 16-bit builds are not supported. The relevant makefiles are
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">PC makefiles</font><hr>
<tr> <th align=left>Makefile
<td>
<th align=left>Construction tools
<td>
<th align=left>For environment
<tr> <td colspan=5><hr>
<tr> <td valign=top><b><tt>bcwin32.mak</tt></b>
<td>
<td valign=top><a href="#Borland_build">Borland/Inprise C++ 4.x</a>
<td>
<td valign=top>32-bit MS Windows 3.1 + Win32s, 95, 98, NT
<tr> <td valign=top><b><tt>msvc32.mak</tt></b>
<td>
<td valign=top><a href="#Microsoft_build">Microsoft Visual C++ 4 to 7</a>
<td>
<td valign=top>MS Windows 32-bit
<tr> <td valign=top><b><tt>watc.mak</tt></b>
<td>
<td valign=top><a href="#Watcom_build">Watcom C/386 or C++</a>
<td>
<td valign=top>MS-DOS 32-bit (extended)
<tr> <td valign=top><b><tt>watcw32.mak</tt></b>
<td>
<td valign=top><a href="#Watcom_build">Watcom C/386 or C++</a>
<td>
<td valign=top>MS Windows 32-bit
<tr> <td valign=top><b><tt>unix-gcc.mak</tt></b>
<td>
<td valign=top><a href="#Cygwin32_build">Cygnus gcc</a>
<td>
<td valign=top><a href="http://sourceware.cygnus.com/cygwin/">Cygnus gnu-win32</a>
</table></blockquote>
<p>
To build Ghostscript you need MS-DOS version 3.3 or later and
Borland/Inprise C/C++ (4.0 or later); Microsoft Visual C++ (version 4.0 or
later); Watcom C/386 (version 8.5 or later) or C++ (any version); or the
free djgpp + go32 development system. The options in the makefiles are
chosen to strike a balance between RAM consumption and likely usefulness.
If you run <b><tt>make</tt></b> in directory <em>{dir}</em>, the default
configuration generates an executable that assumes the Ghostscript
initialization and font files are in directory
<em>{dir}</em><b><tt>\lib</tt></b>.
<p>
Note that the <b><tt>make</tt></b> program supplied with each PC compiler
has a different name. We refer to this program generically as
<b><tt>make</tt></b> everywhere else in this document, but you will find the
correct name for each compiler in the relevant section below that discusses
that compiler.
<p>
You must have <b><tt>COMMAND.COM</tt></b> in your path to build Ghostscript.
After making the changes needed to choose features and devices to build into
the executable, you must create the directory where the compiler will do its
work (normally the <b><tt>obj</tt></b> subdirectory of the current
directory) and the directory where the compiled code will be placed
(normally the <b><tt>bin</tt></b> subdirectory). Then to build the
Ghostscript executable all you need do is give the <b><tt>make</tt></b>
command.
<p><a name="Make_begin"></a>
A special make target "<b><tt>begin</tt></b>" attempts to compile all the
<b><tt>.c</tt></b> files in the current directory. Some of these
compilations will fail, but the ones that succeed will go considerably
faster because they don't individually pay the overhead of starting up the
compiler. So a good strategy for building the executable for the first
time, or after changing a widely used <b><tt>.h</tt></b> file, is to do the
fast compilation of everything possible, then the controlled compilation of
everything that failed in the first step:
<blockquote><b><tt>
make begin<br>
make
</tt></b></blockquote>
<p>
<b><em>Note:</em></b> if you unpack the Ghostscript sources on a DOS or MS Windows
system from a Unix tar file, the unpacked files have linefeed alone as the
line terminator (the Unix convention) instead of carriage return + linefeed
(the Microsoft convention), which may make the C compiler unhappy. One
simple way to fix this, if you have the InfoZIP <b><tt>zip</tt></b> and
<b><tt>unzip</tt></b> programs, is
<blockquote><table cellpadding=0 cellspacing=0>
<tr> <td><b><tt>zip -l CVTEMP.zip *.bat *.c *.h *.def *.rc</tt></b>
<td>
<td>(Letter "l", not the digit "1")
<tr> <td><b><tt>unzip -o CVTEMP.zip</tt></b>
<td>
<td>(Rewrite all the same files correctly)
<tr> <td><b><tt>del CVTEMP.zip</tt></b>
<td>
<td>(Delete the temporary zip file)
</table></blockquote>
<h3><a name="Borland_build"></a>Borland/Inprise environment</h3>
<p>
To compile Ghostscript with the Borland/Inprise environment (hereafter
referred to as just "Borland"), you need Borland C++ (version 4.0 or later);
specifically the compiler, <b><tt>make</tt></b> utility, and linker. You
also need either the Borland assembler (version 1.0 or later) or the
Microsoft assembler (version 4.0 or later).
<p>
To create "<b><tt>makefile</tt></b>", give the command
<blockquote><b><tt>
echo !include "src\bcwin32.mak" >makefile
</tt></b></blockquote>
<p>
To run the <b><tt>make</tt></b> program, give the commmand
<blockquote><b><tt>
make
</tt></b></blockquote>
<p>
Besides the source files and the makefiles, you need:
<blockquote><table cellpadding=0 cellspacing=0>
<tr valign=top> <td>*<b><tt>.bat</tt></b>
<td>
<td>(a variety of batch files used in the build process)
</table></blockquote>
<p>
Comments in the makefiles describe the configuration parameters. If your
configuration is different from the following, you should definitely read
those comments and see if you want or need to change any of this:
<ul>
<li>The compiler files are in <b><tt>C:\BC</tt></b> and its subdirectories.
<li>You are using the Borland assembler <b><tt>tasm</tt></b>.
<li>You want an executable that will run on any 32-bit PC-compatible,
regardless of processor type (80386, 80486, Pentium, or compatible) and
regardless of whether a math coprocessor (80x87) is present -- an issue only
with 80386 processors.
</ul>
<p>
<b>Notes</b>
<ul>
<li>A user reports that the Borland C++ 4.00 with patch 1-6 doesn't
produce a working executable of Ghostscript 5.03. We can't test this,
since we no longer have this compiler.
<li>Borland C++ 4.5 has a bug or bugs that cause(s) the 32-bit Windows
executable to crash if you give any @-files on the command line. Among
other things, this makes the uniprint driver unusable, because it references
the .upp configuration files this way. This problem may possibly be fixed
by one or more of the patch files on
<blockquote>
<a href="ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/"
class="offsite">ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/</a>
</blockquote>
<li>Borland C++ 4.52 has a bug that causes the 32-bit Windows executable to
fail during startup. Borland (now Inprise) provides a patch for this bug
in
<blockquote>
<a
href="ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/bc45xp1.zip"
class="offsite">ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/bc45xp1.zip</a>
</blockquote>
<li>Borland C++ 5.0 and 5.01 have a code generator bug that generates
incorrect code for the construct <b><tt>!file_is_valid()</tt></b>. Do not
attempt to compile Ghostscript with these compilers. If you want to report
this bug to Borland, send them the result of compiling
<b><tt>ziodev.c</tt></b> and tell them to look at the code generated for
<b><tt>file_is_valid()</tt></b> and <b><tt>!file_is_valid()</tt></b>. We
don't know whether Borland C++ 5.02 still has this problem.
<li>When building for the MS Windows Win32s environment, the make
process will stop after it has created <b><tt>genarch.exe</tt></b>.
You should then run "<b><tt>_genarch.bat</tt></b>", wait until
<b><tt>genarch</tt></b> has finished and then exit MS Windows. Then type
"<b><tt>make</tt></b>" again to restart the make process.
</ul>
<h3><a name="Microsoft_build"></a>Microsoft Environment</h3>
<p> NOTE: We have received reports that the Microsoft Visual C++ 5.0 and 6.0 compilers
produce incorrect code for Ghostscript version 6.0 and later, from the same
source code that compiles and runs correctly with other compilers. In spite
of these reports, several members of the Artifex staff use version 6.0 of the
MSVC compiler on a regular basis and we have not found any problems. You may
also want to try out the <a href="#IntelWin32_build">Intel C/C++ compiler</a>,
which can be integrated into the Microsoft Visual C++ environment.
<p>To compile Ghostscript using the Microsoft environment, you need Microsoft
Visual C++ 4.0 or later with its associated "<b><tt>nmake</tt></b>" utility
and linker.
<h4><a name="Using_the_MS_Development_Environment"> </a>Using Microsoft Developer
Studio</h4>
<p>Microsoft Developer Studio is the Microsoft Visual C++ integrated development
environment. To use it to build Ghostscript: it is first necessary to create
a new workspace/project. To create the workspace/project, open Microsoft Developer
Studio and select <b><tt>File/New</tt></b>. In the dialog window that is opened,
select 'Makefile' as the type of project. Specify a name for the project. (Microsoft
does not allow special characters such as ., *, ?, /, or \ as part of project
names.) Also specify the location of the master directory for your Ghostscript
files. Then select OK.
<p> In the next dialog window, specify the build command line as <b><tt>nmake
/f src/msvc32.mak DEVSTUDIO= </tt></b> Note the value for <b><tt>DEVSTUDIO</tt></b>
is empty. Then select <b><tt>Finish</tt></b>.
<p>At this point, it is now possible to build Ghostscript using Developer Studio.
To build, press F7 or select the build icon. Note: multiple warnings will also
given about things like double to float data conversions. Ignore them. We have
not found a way to create a single set of sources that does not create warnings
with the different compilers and operating systems supported by Ghostscript.
We are working to reduce the number of the warning messages.
<p>To run Ghostscript inside of Developer Studio, it is necessary to specify the
name of the executable program . Select <b><tt>Project/Settings</tt></b>. Select
the <b><tt>Debug</tt></b> tab. Then for <b><tt>Executable for debug session:</tt></b>
specify <b><tt>bin/gswin32.exe</tt></b>
<p>To use all of the features of Microsoft Developer Studio for debugging, and
modifying Ghostscriptt, you need to finish the remaining steps.
<p>To add the Ghostscript DLL to the project, select <b><tt>Project/Settings</tt></b>.
Select the <b><tt>Debug</tt></b> tab. Change the <b><tt>Category</tt></b> to
<b><tt>Additional DLLs</tt></b>. Then specify <b><tt>bin/gsdll32.dll</tt></b>.
<p> To specify the Ghostscript program arguments, select <b><tt>Project/Settings</tt></b>.
Select the <b><tt>Debug</tt></b> tab. Change the <b><tt>Category</tt></b> to
<b><tt>General</tt></b>. Then specify the desired program arguments. For example,
specifying: <b><tt>examples/tiger.eps</tt></b> will result in the tiger example
file being displayed when Ghostscript is executed. .
<p> A final note: it is possible to create a command file (build.bat) to be used
for the build command line. If many different workspaces/projects are created,
it is simpler to use a build batch command file rather than retyping the build
command line for each new project. Here is an example used by one of Artifex's
staff members. This file is one line:
<blockquote><b><tt> nmake -f src/msvc32.mak DEVSTUDIO= DEBUG=1 GS_LIB_DEFAULT="./lib/;./font;$(GSROOTDIR)/lib;$(AROOTDIR)/fonts"
</tt></b></blockquote>
<p> The <b><tt>DEBUG=1</tt></b> enables many debugging features built into Ghostscript.
Please note the double quotes around the value for <b><tt>GS_LIB_DEFAULT</tt></b>
and the addition of <b><tt>./lib;./fonts;</tt></b> to its definition. This uses
the local (within the project) copy of the <b><tt>lib</tt></b> and <b><tt>fonts</tt></b>
directories. This is convenient if any changes need to be made in these directories.
<h4><a name="Using_the_command_line"></a>Using the command line</h4>
<p>Ghostscript can be made using either the DOS shell or one one of the various
command line shells made for Windows.
<p>In order for the makefiles to work properly, two items may have to be changed.
If you are not using version 6.x then before building, in <b><tt>src\msvc32.mak</tt></b>
find the line "<b><tt>MSVC_VERSION=6</tt></b>" and change it to "<b><tt>MSVC_VERSION=4</tt></b>",
"<b><tt>MSVC_VERSION=5</tt></b>" or "<b><tt>MSVC_VERSION=7</tt></b>".
<p>In some cases the location of the Microsoft Developer Studio, needs to be changed.
The location of Microsoft Developer Studio is defined by the value of <b><tt>DEVSTUDIO</tt></b>.
There are four different definitions of <b><tt>DEVSTUDIO</tt></b> in src\msvc32.mak.
There is one for each of the currently supported versions of Microsoft Visual
C++ (4, 5, 6 and 7).
<p>The normal installation process for Microsoft Visual C++ includes setting the
location of the Microsoft Visual C++ executables (cl.exe, link.exe, nmake.exe,
rc.exe) in your PATH definition and the LIB and INCLUDE environment variables
are set to point to the Microsoft Visual C++ directories. If this is true then
the value for <b><tt>DEVSTUDIO</tt></b> can be changed to empty. I.e. <b><tt>DEVSTUDIO=</tt></b>
<p> If PATH, LIB, and INCLUDE are not correctly set then the value for <b><tt>DEVSTUDIO</tt></b>
needs to be defined. For example, for version 6.0, the default definition for
the location for the Microsoft Developer Studio is: <b><tt>DEVSTUDIO=C:\Program
Files\Microsoft Visual Studio </tt></b> If the path to Microsoft Developer Studio
on your system differs from the default then change the appropriate definition
of <b><tt>DEVSTUDIO</tt></b>. (Remember that there is a separate definition
of <b><tt>DEVSTUDIO</tt></b> for each version of MSVC, so be sure to change
the correct definition.)
<p>To run the <b><tt>make</tt></b> program, give the command
<blockquote><b><tt>
nmake -f src\msvc32.mak
</tt></b></blockquote>
<p>
Rather than changing src/msvc32.mak, these values can be specified on the make
command line, I.e.
<blockquote><b><tt> nmake -f src\msvc32.mak MSVC_VERSION=6 DEVSTUDIO="C:\Program Files\Microsoft Visual Studio" <br>
nmake -f src\msvc32.mak MSVC_VERSION=7 DEVSTUDIO="C:\Program Files\Microsoft Visual Studio .NET"
</tt></b></blockquote>
<p> Note that double quotes have been added around the path for <b><tt>DEVSTUDIO</tt></b>
due to the spaces in the path value.
<p>
This command line can also be put into a batch file.
<p> You may get warning messages during compilation about <b><tt>/QI0f</tt></b>
being an undefined switch, or the message "dwmain32.def: EXETYPE not supported
for platform; ignored" during linking. Multiple warnings will also given about
things like double to float data conversions. Ignore them. We have not found
a way to create a single set of sources that does not create warnings with the
different compilers and operating systems supported by Ghostscript.
<p>
The Microsoft VC++ 5.0 compiler locks up when compiling
<b><tt>gxi12bit.c</tt></b> with <b><tt>/O2</tt></b>. Compile this file
without <b><tt>/O2</tt></b>.
<p> The Microsoft VC++ 5.0 compiler produces a non-working executable if compiling
without stack checking. Don't change the setting <b><tt>TDEBUG=1</tt></b> in
<b><tt>msvc32.mak</tt></b>.
<h4><a name="Self-extracting_executables"></a>Making self-extracting executables</h4>
<p>
You can build self-extracting Windows executables of Ghostscript. (This is
not needed to use Ghostscript.) Currently this requires both the
Borland/Inprise and the Microsoft compilers, and also two pieces of
third-party software:
<ul>
<li><b><tt>WinZipSE</tt></b>, available from <a
href="http://www.winzip.com/winzipse.html"
class="offsite">http://www.winzip.com/winzipse.html</a>.
This is not free.
<li><b><tt>zip</tt></b>, available from <a
href="http://www.info-zip.org/pub/infozip/Zip.html" class="offsite">
http://www.info-zip.org/pub/infozip/Zip.html</a>. This is free.
</ul>
<p>
You will have to edit <b><tt>src/winint.mak</tt></b> to define
<b><tt>WINZIPSE_XE</tt></b> and <b><tt>ZIP_XE</tt></b> respectively as the
path names of these programs. See <a href="Release.htm">Release.htm</a> for
the detailed procedure.
<h3><a name="Watcom_build"></a>Watcom environment</h3>
<p>
Because of limitations in the way that Watcom implemented their
<b><tt>wmake</tt></b> program, you must run the Watcom tools under MS
Windows, even if you are generating a DOS executable. This is very
unfortunate, and there is no good technical reason for it, but we were
unable to persuade Watcom (now Powersoft) to do anything about it.
<p>
To use the Watcom compiler, add to <b><tt>AUTOEXEC.BAT</tt></b> the line
"<b><tt>set DOS4G=quiet</tt></b>". Check that
<b><tt>AUTOEXEC.BAT</tt></b> also contains a line of the form
"<b><tt>set WATCOM=</tt></b><em>{wcdir}</em>" where <em>{wcdir}</em> is
the directory where you installed the Watcom tools, and that the setting of
<b><tt>PATH</tt></b> includes <em>{wcdir}</em><b><tt>\binnt</tt></b> (or
<b><tt>%WATCOM%\binnt</tt></b>) before <em>{wcdir}</em><b><tt>\binw</tt></b>
(or <b><tt>%WATCOM%\binw</tt></b>). Then to create
"<b><tt>makefile</tt></b>":
<blockquote><table cellpadding=0 cellspacing=0>
<tr> <th align=left>For
<td>
<th align=left>Give the command
<tr> <td colspan=3><hr>
<tr> <td>DOS
<td>
<td nowrap><b><tt>echo !include src\watc.mak >makefile</tt></b>
<tr> <td>MS Windows
<td>
<td nowrap><b><tt>echo !include src\watcw32.mak >makefile</tt></b>
</table></blockquote>
<p>
Before compiling, change the definition of the <b><tt>WCVERSION</tt></b>
macro in the makefile (<b><tt>watc.mak</tt></b> or
<b><tt>watcw32.mak</tt></b>) to the version of the Watcom compiler you are
using. This is necessary to handle some minor incompatibilities between
versions.
<p>
To run the <b><tt>make</tt></b> program, give the commmand
<blockquote>
<b><tt>wmake -u</tt></b>
</blockquote>
<p>
For information on using the GNU <b><tt>make</tt></b> program with the
Watcom compiler to build MS-DOS executables, which avoids the limitations in
<b><tt>wmake</tt></b>, see <a href="New-user.htm#MS-DOS">here</a>.
<h3><a name="Cygwin32_build"></a>Cygwin32 gcc</h3>
<p>
A user reports that it is possible to compile Ghostscript for MS Windows NT
using the Cygwin32 gcc compiler, GNU <b><tt>make</tt></b>, and the
<b><tt>unix-gcc.mak</tt></b> makefile, with only two small source code
changes:
<ul>
<li>Add "<b><tt>b</tt></b>" to the call to <b><tt>fopen</tt></b> in <b><tt>gp_open_scratch</tt></b>
<li>Mirror the <b><tt>gp_ntfs</tt></b> logic for <b><tt>gp_file_name_is_absolute</tt></b>
</ul>
<p>
Information about this compiler and environment is at the Cygnus site:
<blockquote>
<a href="http://sources.redhat.com/cygwin/">http://sources.redhat.com/cygwin/</a>
</blockquote>
<p>
Please note that Cygnus's licensing terms aren't quite as liberal about
redistribution as either the GNU
<a href="http://www.gnu.org/copyleft/gpl.html">General Public License</a>
or the Aladdin <a href="Public.htm">Free Public License</a>, so read their
license carefully if you want to redistribute the results of using their
compiler.
<h3><a name="IntelWin32_build"></a>Intel C/C++ environment</h3>
<p>
Intel provides a C/C++ compiler that is compatible with the <a
href="#Microsoft_build">Microsoft Visual C++ environment</a>. The main
advantage of this compiler over MSVC 5.0 and 6.0 is that it produces
working code even when all optimizations are enabled and when stack checking
is disabled.
<p>
To build Ghostscript using the Intel C/C++ compiler, you have to make the
following small changes in the makefiles:
<ul>
<li>Find and change the second occurrence of
"<b><tt>COMPILE_FULL_OPTIMIZED</tt></b>" to "<b><tt>/O2</tt></b>" in file
<b><tt>msvccmd.mak</tt></b>. <li>Override "<b><tt>TDEBUG</tt></b>",
"<b><tt>COMP</tt></b>", and "<b><tt>COMPAUX</tt></b>" when invoking
<b><tt>nmake</tt></b>.
</ul>
<p>
More specifically, use "<b><tt>TDEBUG=0</tt></b>" and set both
"<b><tt>COMP</tt></b>" and "<b><tt>COMPAUX</tt></b>" to the full path of
<b><tt>icl</tt></b> (for example
"<b><tt>COMP=C:\intel\compiler45\bin\icl</tt></b>" if the Intel C/C++
compiler V4.5 was installed to <b><tt>C:\intel</tt></b>). It is suggested
that you use a batch file to launch <b><tt>nmake</tt></b>, since the command
line processes the "<b><tt>=</tt></b>" on its own. Also, you may need to
execute <b><tt>vcvars32.bat</tt></b> and <b><tt>iccvars.bat</tt></b> to
register the proper paths for the compiler, its include files and its
libraries.
<p>
You can buy or download a 30-day evaluation version of the Intel C/C++
compiler from Intel's Software Performance Tools web site:
<blockquote>
<a href="http://www.intel.com/vtune/">http://www.intel.com/vtune/</a>
</blockquote>
<hr>
<h2><a name="Mac_build"></a>How to build Ghostscript from source (MacOS version)</h2>
<h3><a name="MacOS"></a>Traditional MacOS</h3>
<p>
The Macintosh version of Ghostscript requires the <a href="http://www.metrowerks.com/"
class="offsite">Metrowerks Codewarrior</a> development suite. Download the
<tt>macgs-7xx-src.sit</tt> source archive from the location listed
below. This includes a Codewarrior .mcp project file than can be used to build both
Carbon and CFM versions of the ghostscript shared library component.
<blockquote>
<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/currenti/"
class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/current/</a>
</blockquote>
<p>
If your system doesn't automatically unpack the source archive, you can
download the free <a href="http://stuffit.com/download.html"
class="offsite">Stuffit Expander</a> to open it.
<p>
This archive includes appropriate versions of the jpeg, zlib and libpng 3rd party
library source for convenience. You must still download the fonts and place them in an
appropriate location, along with the contents of the <tt>lib</tt> directory from the source
archive.
<p>
Note that since this is just a library component, you will need a front-end application, such as
MacGSView, to actually view or convert postscript and pdf documents.
<h3><a name="MacOSX"></a>MacOS X</h3>
<p>
The unix source distribution (.tar.gz) builds fine on Darwin/MacOS X,
albeit without a display device. You can generally just use the <tt>Makefile</tt>
generated by ./configure or <tt>macosx.mak</tt>
as your top-level makefile and get a reasonable default build. This will
allow you to use Ghostscript from the command line as a BSD-layer tool
to rasterize postscript and pdf to image files, and convert between the
high-level formats supported by Ghostscript. See the instructions for the
unix build below for details of how to customize this build.
<p>
There is also a support for building Ghostscript as a framework. This is
a special encapsulated shared library format specific to MacOS X. To build
the framework, copy <tt>macosx.mak</tt> to the top-level directory, rename it to
<tt>makefile</tt> and issue 'make framework' from Terminal.app. This will result
in a <tt>Ghostscript.framework</tt> in the <tt>sobin</tt> directory. It must be
manually copied to /Library/Frameworks/ before applications
can use it. You may need to create the Frameworks/ directory on some systems.
<p>
Finally, there is a <tt>macos-mcp.mak</tt> makefile that can be
used to set up the Codewarrior shared library component build described
in the section on <a href="#MacOS">Classic MacOS</a> above. Currently
this makefile is distributed only with the MacOS-specific <tt>.sit</tt>
source archive, but with be included generally in future releases.
<p>
To set up the shlib build, download and uncompress the Ghostscript source.
If the archive doesn't contain the 3rd party jpeg, png, and zlib source,
you must download them as described at the beginning of this document and
unpack them under the macgs-###-src directory under the specific names
<tt>jpeg</tt>, <tt>zlib</tt> and <tt>libpng</tt>. You cannot use symlinks as
Codewarrior will not be able to follow them for some of the needed header
files.
<p>
Copy <tt>src/macos-mcp.mak</tt> to the top-level directory and rename
it <tt>makefile</tt>. Then run 'make' in that directory, either from
within Terminal.app or through Project Builder. This will set up the
generated code required for the build and run a shell script to generate
<tt>ghostscript.mcp.xml</tt>. Launch Metrowerks Codewarrior, and select
'Import Project...' from the File menu, and open the xml project file.
When asked, save the results as <tt>ghostscript.mcp</tt> in the same
directory and you should be ready to build the shared library component.
</p>
Tradtional ('PPC') applications based on the Code Fragment Manager
will not be able to open the shlib linked with CarbonLib, so two
targets are provided, one with carbon and one without.
<hr>
<h2><a name="Unix_build"></a>How to build Ghostscript from source (Unix version)</h2>
<p>
Before issuing the <b><tt>make</tt></b> command to build Ghostscript, you
have to make some choices, for instance
<ul>
<li>which compiler to use;
<li>what features and devices to include;
<li>whether to use system libraries for PNG and zlib;
<li>and how to handle issues for your particular platform.
</ul>
<p>
Be sure to check the sections on <a
href="#Tool_specific_issues">tool-</a>, <a
href="#OS_specific_issues">OS-</a>, and <a
href="#Hardware_specific_issues">hardware-</a>specific issues for notes
on your particular platform and compiler. In fact, that is the
<b><em>first</em></b> place to check if you build Ghostscript and it crashes
or produces obviously incorrect results.
<h3><a name="Multi_architecture_makefile"></a>The multi-architecture makefile</h3>
<p>
Especially if you are working in a Unix environment with multiple CPU types,
operating systems, and/or C compilers, you may find the file
<b><tt>all-arch.mak</tt></b> useful. This user-contributed file includes
"wrappers" for the Unix makefiles for many different common environments.
The author of this file notes:
<blockquote>
<p>
This makefile allows you to execute
<pre>
make `hostname`
</pre>
<p>
on any machine on a network, without having to examine the Makefile for a
specific target name. Also, some of the targets in the Makefile incorporate
special changes in compiler options for certain files, to work around
compiler bugs that Ghostscript has been so good at exposing. Having that
special handling written down in a Makefile proves very convenient.
<p>
I don't do "make install" until I've done
<pre>
cd ...build-directory.../gs-x.yz
cd lib
../bin/gs ../examples/tiger.eps
</pre>
<p>
and verified that the famous tiger can be correctly displayed. Also, the
"make install" step is careful to first remove any existing
<b><tt>$(BINDIR)/gs</tt></b>, then install a new gs there with a hard link
to gs-x.yz.
<p>
That way, each installation makes gs a synonym for the latest release,
but earlier ones remain in place in case backtracking is needed, which
I've fairly often wanted to do when investigating changed behavior, or
a suspected bug.
<p>
When I've been experimenting with a new feature, such as GNU readline
support, I change the setting of GS from gs to ngs (new gs), so as not
to break any existing programs by the installation of an experimental
version.
</blockquote>
<h3><a name="UNIX_makefile"></a>Setting up "makefile"</h3>
<p>
The files <b><tt>src/unix</tt></b>*<b><tt>.mak</tt></b> are the makefiles for
Unix platforms, and you choose one based on what compiler you use. To
build Ghostscript, however, you must use the simple command
"<b><tt>make</tt></b>", which must find the file "<b><tt>makefile</tt></b>"
(or "<b><tt>Makefile</tt></b>"). If your system supports symbolic links,
set up "<b><tt>makefile</tt></b>" like this.
<blockquote><table cellpadding=0 cellspacing=0>
<tr> <td>GNU gcc:
<td>
<td nowrap><b><tt>ln -s src/unix-gcc.mak makefile</tt></b>
<tr> <td>Non-gcc ANSI C compiler:
<td>
<td nowrap><b><tt>ln -s src/unixansi.mak makefile</tt></b>
</table></blockquote>
<p>
If your system doesn't support symbolic links, first finish all changes to
the compiler-specific makefile, then make a hard link, omitting the
<b><tt>-s</tt></b> switch.
<p>
The makefile distributed with Ghostscript selects the following devices
to include in the build:
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Devices included as distributed</font><hr>
<tr valign=bottom>
<th align=left>Type
<td>
<th align=left>Devices
<tr> <td colspan=3><hr>
<tr valign=top> <td>Display
<td>
<td>X Windows
<tr valign=top> <td>Printers
<td>
<td>H-P DeskJets, LaserJets, and color DeskJets and PaintJets; Canon BubbleJets
<tr valign=top> <td>File formats
<td>
<td>Group 3 & Group 4 fax; JPEG; PCX; PBM, PGM, PKM, & PPM; TIFF; PostScript images; PNG; distilled PDF, PostScript, and EPS; PCL XL ("PCL 6")
</table></blockquote>
<p>
The <b><tt>unix</tt></b>*<b><tt>.mak</tt></b> files explicitly compile and
link the JPEG, PNG, and zlib libraries into the executable. If your Unix
system already includes the PNG and zlib libraries -- probably in
<b><tt>/usr/lib/libpng.</tt></b>{<b><tt>a</tt></b>,<b><tt>so</tt></b>} and
<b><tt>/usr/lib/libz.</tt></b>{<b><tt>a</tt></b>,<b><tt>so</tt></b>} -- and
you would rather use those copies, change the definition of
<b><tt>SHARE_LIBPNG</tt></b> and <b><tt>SHARE_ZLIB</tt></b> from 0 to 1 in
the relevant <b><tt>unix</tt></b>*<b><tt>.mak</tt></b> file before
compiling. Note that if you do this, you will get non-debug versions of
these libraries even if you selected <b><tt>DEBUG</tt></b> in the makefile.
At the insistence of some users, we have also provided the ability to do
this with the JPEG library (<b><tt>SHARE_JPEG</tt></b>), but should not use
it: in order to be compatible with Adobe interpreters (which do not follow
the JPEG standard exactly), Ghostscript has to compile the IJG code with
the non-standard definition
<blockquote><b><tt>
#define D_MAX_BLOCKS_IN_MCU 64
</tt></b></blockquote>
<p>
and since shared versions of this library will not have been compiled this
way, you will get errors on some valid PostScript and PDF input files. Note
also that because not all the JPEG library header files that Ghostscript
uses are normally installed in <b><tt>/usr/include</tt></b>, you must have
the source code for this library available even if you set
<b><tt>SHARE_JPEG</tt></b> to 1.
<p>
If the X11 client header files are located in some directory which your
compiler does not automatically search, you must change the
<b><tt>XINCLUDE</tt></b> macro in the makefile to include a specific
<b><tt>-I</tt></b> switch. See the comment preceding
<b><tt>XINCLUDE</tt></b> in the makefile.
<p>
Currently Ghostscript is set up to compile and link in a generic Unix
environment. Some Unix environments may require changing the
<b><tt>LDFLAGS</tt></b> macro in the makefile; be sure to check the <a
href="#Unix_build">Unix section</a> for your specific tools, operating
system, and hardware.
<h3><a name="Shared_object"></a>Shared object</h3>
To build Ghostscript as a shared object with gcc
(instead of as a single large executable) use:
<pre>
ln -s src/unix-gcc.mak makefile
make so
</pre>
<p>
This will build <b><tt>libgs.so</tt></b> and two programs which use the
shared object, <b><tt>gsx</tt></b> which uses Gtk+ and <b><tt>gsc</tt></b>
which does not.
<p>
Do not use <tt>make -f src/unix-gcc.mak</tt> because this will
break the recursive make used in building the shared object.
<p>
To install the shared object and these two programs:
<pre>
make soinstall
</pre>
To delete files created by the build process:
<pre>
make soclean
</pre>
<p>
For more details see <a href="../src/unix-dll.mak">unix-dll.mak</a>.
<h3><a name="Tool_specific_issues"></a>Tool-specific issues</h3>
<h4><a name="gcc_27x"></a>gcc 2.7.*</h4>
<p>
Some of the issues in using gcc are very specific to the particular
computer, the particular version of the operating system, and the
particular version of gcc available to you. You can check the version of
gcc with the <b><tt>gcc --version</tt></b> command.
<p>
An optimizer bug in gcc versions 2.7.0, 2.7.1, and 2.7.2 causes the
compiler to generate incorrect code. The makefile works around this, but
we recommend that if possible you use either an earlier or a later version
of gcc; for instance, gcc 2.5.8, gcc 2.6.3, 2.7.2.1 or later which don't
have this bug. Note, however, that gcc has other problems on some
platforms, so please read the section for your specific platform.
<h4><a name="GNU_make"></a>GNU make</h4>
<p>
Current versions of GNU <b><tt>make</tt></b> have no problems, but GNU
<b><tt>make</tt></b> 3.59 can't handle the final linking step in some
cases; if this happens, use the platform's standard <b><tt>make</tt></b>,
typically <b><tt>/bin/make</tt></b>.
<h3><a name="OS_specific_issues"></a>OS-specific issues</h3>
<h4><a name="386_Unix"></a>386 Unix</h4>
<ul>
<li>gcc versions older than 1.38 on Intel 80386 systems do not compile
Ghostscript correctly with the <b><tt>-O</tt></b> option.
<li>gcc 1.39 under <b><tt>386BSD</tt></b> has a bug that causes
float-to-integer conversions to compile incorrectly, rendering the
executable unusable.
<li>X11R5 may need "<b><tt>#include <stddef.h></tt></b>" in <b><tt>x_.h</tt></b>.
<li>Also see regarding <a href="#System_V">System V</a> platforms.
</ul>
<h4><a name="BSDI"></a>BSDI</h4>
<ul>
<li>Use <b><tt>unix-gcc.mak</tt></b> and set<blockquote><b><tt>
STDLIBS=-lm<br>
XINCLUDE=-I/usr/X11R6/include<br>
XLIBDIRS=-L/usr/X11R6/lib<br>
XLIBS=Xt SM ICE Xext X11<br></tt></b></blockquote>
<li>If you want to use the shared versions of the PNG and zlib libraries, set
<b><tt>SHARE_LIBPNG=1</tt></b> and <b><tt>SHARE_ZLIB=1</tt></b>
as discussed <a href="#UNIX_makefile">previously</a>.
<li>BSD <b><tt>make</tt></b> uses a different syntax for its
<b><tt>include</tt></b> directive than Ghostscript;
use <b><tt>gmake</tt></b> instead.
</ul>
<h4><a name="Digital_Unix"></a>Digital Unix (Alpha)</h4>
<ul>
<li>Use <b><tt>unixansi.mak</tt></b> for all Digital Unix compilers.
<li>For versions of Digital Unix before 4.0, set
<p>
<b><tt>CFLAGS=-std -migrate -Olimit 1000 -g3 -O2 $(XCFLAGS)<br>
LDFLAGS=-lots $(XLDFLAGS)</tt></b>
<p>
You may be able to omit <b><tt>-g3</tt></b>. For later versions of Digital
Unix, users have reported that the proper flags are
<p>
<b><tt>CFLAGS=-std1 -Olimit 1000 -g3 -O2 $(XCFLAGS)</tt></b>
<p>
again, optionally omitting the <b><tt>-g3</tt></b>.
<li>If you get compiler error messages about "ANSI aliasing rules", please
see the section about <a href="#VMS_build">building under OpenVMS</a> below.
</ul>
<h4><a name="FreeBSD"></a>FreeBSD</h4>
<p>
On FreeBSD systems, in the top-level makefile (<b><tt>unixansi.mak</tt></b>
or <b><tt>unix-gcc.mak</tt></b>), change the value of
<b><tt>STDLIBS</tt></b> from <b><tt>-lpthread -lm</tt></b> to <b><tt>-lc_r
-lm</tt></b> before building.
<h4><a name="Linux"></a>Linux</h4>
<ul>
<li>If you build on Linux with X11 R6 or later, you may get link-time error
messages about undefined references to various functions beginning with
"SMC" and "ICE". If this happens, make sure that <b><tt>XLIBS</tt></b> in
the makefile is set to
"<b><tt>Xt SM ICE Xext X11</tt></b>" rather than
"<b><tt>Xt Xext X11</tt></b>".
<li>With gcc version 2.6.3 or later, you may encounter an incompatibility
in object formats (<b><tt>a.out</tt></b> vs. ELF) with the XFree86 library.
Typically, <b><tt>ld</tt></b> complains that some X library is not found,
or that many <b><tt>Xlib</tt></b> or <b><tt>Xt</tt></b> functions are not
found in the library (similar to the messages for omitting
<b><tt>SM</tt></b> and <b><tt>ICE</tt></b> from <b><tt>XLIBS</tt></b>). Or
you get a message when you start Ghostscript that the program or the shared
library is an unrecognized format.
If this happens, edit <b><tt>unix-gcc.mak</tt></b> to add the switches
"<b><tt>-b i486-linuxaout</tt></b>" to both <b><tt>CFLAGS</tt></b> and
<b><tt>LDFLAGS</tt></b>, then "<b><tt>make clean</tt></b>" followed by
"<b><tt>make</tt></b>"). If this doesn't help, or if other strange things
happen, contact your Linux supplier or support resource.
<li>A few of Ghostscript's drivers are multi-threaded (currently only those
whose names begin with "bmpa"). These drivers require <b><tt>libc</tt></b>
version 6 or higher. Some Linux distributions, including Red Hat
distributions before 5.0, have <b><tt>libc</tt></b> version 5, so these
drivers may not compile. If this happens, remove these drivers (from the
definitions of <b><tt>DEVICE_DEVS*</tt></b> in
<b><tt>unix-gcc.mak</tt></b>), and, if you wish, substitute the
corresponding single-threaded drivers, whose names don't include the "a".
</ul>
<p>
You may want to create <a href="http://www.rpm.org">RPM</a> (<b>R</b>ed Hat
<b>P</b>ackage <b>M</b>anager) files for Ghostscript. Because of the lack
of standardization of installation directory names between Linux releases,
Ghostscript does not come with any RPM specification files. You may wish to
contact the following people who have created RPM spec files in the past:
<blockquote>
Henri Gomez <a href="mailto:hgomez@slib.fr">hgomez@slib.fr</a><br>
Russell Lang <a href="mailto:gsview@ghostgum.com.au">gsview@ghostgum.com.au</a><br>
Cristian Gafton <a href="mailto:gafton@redhat.com">gafton@redhat.com</a><br>
Preston Brown <a href="mailto:pbrown@redhat.com">pbrown@redhat.com</a><br>
</blockquote>
<p>
The following instructions may work for the Ghostscript 6.0x distributions,
once you have RPM spec files that you believe are appropriate.
<p>
To create RPMs for Ghostscript N.NN:
<ul>
<li>Change to your source directory (<b><tt>/usr/src/redhat</tt></b> for Red Hat
Linux 5.1).
<li>Copy <b><tt>ghostscript-N.NN*.tar.gz</tt></b> (4 source files) to the
<b><tt>SOURCES</tt></b> subdirectory.
<li>Copy <b><tt>ghostscript-fonts-std-6.0.tar.gz</tt></b> and
<b><tt>ghostscript-fonts-other-6.0.tar.gz</tt></b> to the
<b><tt>SOURCES</tt></b> subdirectory.
<li>From <b><tt>SOURCES/ghostscript-N.NN.tar.gz</tt></b>,
<ul>
<li>extract <b><tt>rpm-conf.dif</tt></b> and copy to
<b><tt>SOURCES/ghostscript-N.NN-config.patch</tt></b>
<li>extract <b><tt>gs.rps</tt></b> and copy to
<b><tt>SPECS/ghostscript-N.NN.spec</tt></b>
<li>extract <b><tt>gs-fonts.rps</tt></b> and copy to
<b><tt>SPECS/ghostscript-fonts-N.NN.spec</tt></b>
</ul>
If the contents of these files have become out of date, you
will need to update the version number N.NN in the spec files,
and update the patch file.
<li> Change to the SPECS subdirectory and then execute the commands
<blockquote><b><tt>
rpm -ba ghostscript-N.NN.spec<br>
rpm -ba ghostscript-fonts-N.NN.spec
</tt></b></blockquote>
This will create the RPM files
<blockquote><b><tt>
RPMS/i386/ghostscript-N.NN-1.i386.rpm<br>
RPMS/noarch/ghostscript-fonts-N.NN-1.noarch.rpm<br>
SRPMS/ghostscript-N.NN-1.src.rpm<br>
SRPMS/ghostscript-fonts-N.NN-1.src.rpm<br>
</tt></b></blockquote>
<li> See instructions on how to <a href="Install.htm#Install_Unix">install
Ghostscript under Unix</a>.
</ul>
<p>
Bruce Babcock
<<a href="mailto:babcock@math.psu.edu">babcock@math.psu.edu</a>> has
made available everything needed to build Ghostscript under Linux Slackware
3.*, Red Hat 4.* and 5.*, and Debian 1.* and 2.0; the files include
instructions and shell scripts to build and install Ghostscript, as well as
all the source and font kits and patches needed:
<blockquote>
<a href="ftp://ykbsb2.yk.psu.edu/pub/ghost/GS-5.10/"
class="offsite">ftp://ykbsb2.yk.psu.edu/pub/ghost/GS-5.10/</a><br>
<a href="ftp://ykbsb2.yk.psu.edu/pub/ghost/GS-5.10-Extra/"
class="offsite">ftp://ykbsb2.yk.psu.edu/pub/ghost/GS-5.10-Extra/</a>
</blockquote>
<h4><a name="NeXTSTEP"></a>NeXTSTEP / OpenSTEP</h4>
<ul>
<li>If you are using a NeXTSTEP version before 3.3, please get a no-cost
upgrade (along with Y2K patches) from Apple.
<li>For all NeXTSTEP systems, use <b><tt>unix-gcc.mak</tt></b>. Make the
following changes:
<ul>
<li>In <b><tt>unix-aux.mak</tt></b> (and <b><tt>ugcclib.mak</tt></b>, if you
are using only the library) change the definition of <b><tt>INCLUDE</tt></b>
to "<b><tt>INCLUDE=/usr/include/bsd</tt></b>";
<li>in <b><tt>unix-gcc.mak</tt></b>:
<ul>
<li>change <b><tt>CC=gcc</tt></b> to <b><tt>CC=cc</tt></b>;
<li>change the definition of <b><tt>STDLIBS</tt></b> to only
<b><tt>-lm</tt></b>;
<li>change <b><tt>SYNC=posync</tt></b> to <b><tt>SYNC=nosync</tt></b>;
<li>add <b><tt>-D_POSIX_SOURCE</tt></b> to <b><tt>CFLAGS</tt></b> and remove
<b><tt>-g</tt></b>;
<li>remove <b><tt>-Wstrict-prototypes</tt></b> from <b><tt>GCFLAGS</tt></b>,
and if you are using NeXTSTEP 3.3 (with gcc 2.5.8), also remove
<b><tt>-Wmissing-declarations</tt></b>;
</ul>
<li>to the end of <b><tt>Fontmap.GS</tt></b> add the line
"<b><tt>/Ohlfs /Courier ;</tt></b>".
</ul>
<li>If you are running the Pencom co-Xist X server (development version),
the X headers and libraries are in the default places, so change the
makefile definitions of <b><tt>XINCLUDE</tt></b> and
<b><tt>XLIBDIRS</tt></b> to empty strings.
</ul>
<h4><a name="SCO"></a>SCO Unix/Xenix</h4>
<ul>
<li>See also "<a href="#386_Unix">386 Unix</a>" and
"<a href="#System_V">System V Unix platforms</a>".
<li>The standard cc compiler on SCO OpenServer v5 has optimizer bugs.
Compile without -O.
<li>The SCO Unix C compiler apparently can't handle the
<b><tt>P</tt></b><em>n</em> macros in <b><tt>std.h</tt></b>. If you get
strange compilation errors on SCO Unix, ask SCO for a compiler fix.
<li>Meanwhile, to use gcc with SCO ODT, see <b><tt>unix-gcc.mak</tt></b>
for the appropriate switch settings.
<li>Because of a bug in SCO's floating point emulator, gcc 2.3.3 produces
code that causes crashes on machines without hardware floating point. Use
a different compiler on these machines.
<li>If you aren't using the X11 driver, you must add
<b><tt>-lsocket</tt></b> to the value of <b><tt>EXTRALIBS</tt></b> to link
the date and time functions.
<li>If you want to use direct frame buffer addressing instead of X Windows,
include the relevant frame buffer devices (<b><tt>$(DD)ega.dev</tt></b>,
<b><tt>$(DD)vga.dev</tt></b>, etc.) and change the definition of
<b><tt>EGAVGA</tt></b> to <b><tt>$(EGAVGA_SCO)</tt></b> as indicated in
<b><tt>devs.mak</tt></b>. <b>Note</b>: this works with SuperVGA displays
only for 800x600x16 mode.
<li>If the display looks "smeared", try recompiling
<b><tt>gdevpcfb.c</tt></b> with <b><tt>-O0</tt></b>.
<li>If Ghostscript crashes, use the <b><tt>-q</tt></b> switch or redirect
console output to a file.
<li>If your compiler accepts both the <b><tt>-Xt</tt></b> and
<b><tt>-Xa</tt></b> switches, use <b><tt>-Xt</tt></b>. Even though this
causes the compiler to use incorrect rules for computing the result types
of "<b><tt><<</tt></b>" and "<b><tt>>></tt></b>",
<b><tt>-Xa</tt></b> enables optimizations that produce incorrect code.
<li>For SCO ODT 2.0, in addition to <b><tt>-D__SVR3</tt></b> and
<b><tt>-DSYSV</tt></b>, you need to specify <b><tt>-Dsco</tt></b>,
<b><tt>-DUSG</tt></b>, and <b><tt>-DMALLOC_0_RETURNS_NULL</tt></b>. For
SCO ODT, you need
"<b><tt>EXTRALIBS=-lX11 -lsocket -lmalloc</tt></b>", or maybe
only <b><tt>-lsocket</tt></b> depending on the version), and for SCO ODT
2.0, you must also specify <b><tt>-lc_s</tt></b>. For SCO Xenix, you need
"<b><tt>EXTRALIBS=-lmalloc</tt></b>".
<li>For SCO OpenServer 5.0.5, add <b><tt>-L/usr/local/lib</tt></b> to
<b><tt>LDFLAGS</tt></b>.
<li>For all SCO systems, set "<b><tt>XINCLUDE=</tt></b>" and
"<b><tt>XLIBDIRS=</tt></b>".
</ul>
<h4><a name="SVR4"></a>SVR4 Unix</h4>
<ul>
<li>You may need to set <b><tt>EXTRALIBS=-lnsl</tt></b>.
<li>Do <b><em>not</em></b> change <b><tt>PLATFORM=unix_</tt></b> to <b><tt>PLATFORM=sysv_</tt></b>.
<li>On SVR4 Unix platforms with dynamic linking, you may need to define
<b><tt>XLIBDIR</tt></b> as the name of the directory that holds the X
Windows libraries. Do <b><em>not</em></b> prefix the name with
"<b><tt>-L</tt></b>".
<li>For SVR4.0 systems, set <b><tt>-DSVR4</tt></b> and
<b><tt>-DSVR4_0</tt></b> in the makefile; do <b><em>not</em></b> set
<b><tt>-DSYSV</tt></b>. For SVR4.2 (or later) and Solaris 2.<em>n</em>
systems, set only <b><tt>-DSVR4</tt></b> (<b><em>not</em></b>
<b><tt>-DSVR4_0</tt></b> nor <b><tt>-DSYSV</tt></b>).
</ul>
<h4><a name="System_V"></a>System V Unix platforms</h4>
<ul>
<li>If you are using a stock System V platform that lacks
<b><tt>rename</tt></b> and <b><tt>gettimeofday</tt></b>, in the makefile
change "<b><tt>PLATFORM=unix_</tt></b>" to
"<b><tt>PLATFORM=sysv_</tt></b>".
<li>You will probably need to change the definition of
<b><tt>INSTALL</tt></b> from "<b><tt>install</tt></b>" to
"<b><tt>/usr/ucb/install</tt></b>".
</ul>
<h4><a name="Unixware"></a>Unixware</h4>
<ul>
<li>The standard cc compiler has optimizer bugs. Compile without
<b><tt>-O</tt></b>.
</ul>
<h3><a name="Hardware_specific_issues"></a>Hardware-specific issues</h3>
<h4><a name="Alpha_with_gcc"></a>Alpha with gcc</h4>
<ul>
<li>You don't have to use gcc on Alpha systems, because the bundled
compiler works.
<li>The Alpha code generator in gcc 2.7.2.1 is broken. gcc 2.5.8 and 2.6.3
are probably usable. Versions before 2.5.0 are believed not to work. We
suggest you use a recent version.
<li>If you really want to use gcc 2.7.x, here is a patch for that version
from gcc maintainer Jim Wilson
<<a href="mailto:wilson@cygnus.com">wilson@cygnus.com</a>>.
<pre>
*** reload.c.orig Sun Mar 9 14:05:23 1997
--- reload.c Sun Mar 9 14:06:54 1997
*************** push_secondary_reload (in_p, x, opnum, o
*** 589,600 ****
set it up now. */
if (in_p && icode == CODE_FOR_nothing
! && SECONDARY_MEMORY_NEEDED (class, reload_class, reload_mode))
! get_secondary_mem (x, reload_mode, opnum, type);
if (! in_p && icode == CODE_FOR_nothing
! && SECONDARY_MEMORY_NEEDED (reload_class, class, reload_mode))
! get_secondary_mem (x, reload_mode, opnum, type);
#endif
}
--- 589,600 ----
set it up now. */
if (in_p && icode == CODE_FOR_nothing
! && SECONDARY_MEMORY_NEEDED (class, reload_class, mode))
! get_secondary_mem (x, mode, opnum, type);
if (! in_p && icode == CODE_FOR_nothing
! && SECONDARY_MEMORY_NEEDED (reload_class, class, mode))
! get_secondary_mem (x, mode, opnum, type);
#endif
}
</pre>
</ul>
<h4><a name="Apollo"></a>H-P Apollo</h4>
<ul>
<li>You must run the compiler in ANSI-compatible mode (that is, set <b><tt>AK=</tt></b>{null string} in the makefile); otherwise it gives incorrect error
messages for any function declared as returning a float value.
<li>The H-P Apollo compiler may not compile Ghostscript correctly. If you
get unexpected crashes at run time, use gcc.
</ul>
<h4><a name="ATT_7040"></a>AT&T 7040 R3</h4>
<ul>
<li>If Ghostscript crashes on startup, recompile with <b><tt>-O0</tt></b>
to work around compiler bugs.
</ul>
<h4><a name="Convex"></a>Convex</h4>
<ul>
<li>Use <b><tt>unixansi.mak</tt></b>. Do not invoke optimization
(<b><tt>-O1</tt></b>) because the compiler will produce incorrect code.
<li>Set <b><tt>CFLAGS</tt></b> to
"<b><tt>-no -fn -tm c1</tt></b>".
</ul>
<h4><a name="DECStations"></a>DECStations with Ultrix</h4>
<ul>
<li>If you get the compiler message "cfe: Fatal: _temp_19086.c:
Segmentation violation" or a similar one, try compiling with the
<b><tt>-oldc</tt></b> switch.
<li>You may wish to set
<p>
<b><tt>GS_LIB_DEFAULT=$(gsdatadir):/usr/lib/DPS/outline/decwin:$(gsdatadir)/fonts</tt></b>
<p>
in the makefile to add the Display PostScript font directory to the font
search path.
<li>Set
<p>
<b><tt>CFLAGS="-Olimit 2500"</tt></b>
<p>
to make the optimizer allocate enough table space.
<li>The Ultrix 4.4 C compiler compiles <b><tt>gdevm1.c</tt></b>
incorrectly. Insert the following line in the makefile rule for
"<b><tt>gdevm1.$(OBJ)</tt></b>" (the body of the rule is empty in the
standard distribution):
<p>
<b><tt>$(CCC) -oldc gdevm1.c</tt></b>
</ul>
<h4><a name="HP_RISC"></a>H-P RISC workstations</h4>
<ul>
<li>HP-UX versions before 11.0 do not support POSIX threads. Set
<b><tt>SYNC=nosync</tt></b> in the makefile before building.
<li>Ghostscript builds on H-P machines with either GNU gcc or H-P's
ANSI-capable <b><tt>cc</tt></b>. The minimal, non-ANSI-capable
<b><tt>cc</tt></b> that ships with a basic HPUX system does <b><em>not</em></b>
work. If <b><tt>cc</tt></b> on your system doesn't accept the
<b><tt>-Aa</tt></b> switch, then you need to get the full
<b><tt>cc</tt></b> or gcc.
<li>If you use H-P's compiler, be sure you have upgraded to a recent
release. Many bizarre symptoms have been reported trying to build
Ghostscript with older, buggier compilers, for example:
<ul>
<li>The link step fails with a message about "<b><tt>max</tt></b>" not being defined.
<li>The build succeeds, but the resulting executable fails to start up,
with an error message like "Initializing... Unrecoverable error: typecheck
in .registerencoding".
<li>The build succeeds, but the resulting executable produces a black
background on the first page of output.
</ul>
<li>It is reported that On HPUX 9.* you need at least compiler patch
PHSS_5723 and dld.sl patch PHSS_5734 to build Ghostscript. (As of late
1997, those patches are long obsolete; the current patches are compiler
PHSS_10357 and dld.sl PHSS_11246. It is unknown whether current
Ghostscript releases work with compiler/dld.sl versions older than these.)
<li>On HPUX 10.*, we don't know what combinations of compiler version and
switches work. It is reported that On HPUX 10.20, setting
"<b><tt>CC=c89</tt></b>" and "<b><tt>CFLAGS=+O3 $(XCFLAGS)</tt></b>"
works, contradicting the information in the next paragraph, but this may be
dependent on the specific compiler version.
<li>In either HPUX version, you need to set
"<b><tt>CC=cc -Aa</tt></b>" (or use <b><tt>-Ae</tt></b> if you
prefer), and set
"<b><tt>CFLAGS=-D_HPUX_SOURCE -O $(XCFLAGS)</tt></b>". Higher
levels of optimization than <b><tt>-O</tt></b> may work depending on your
compiler revision; some users have reported success with
<b><tt>+O3</tt></b>, some have not.
<li>Some users have reported needing <b><tt>-DNOSYSTIME</tt></b> and
<b><tt>-D_POSIX_SOURCE</tt></b> in <b><tt>CFLAGS</tt></b>, but recent tests
do not show these to be necessary.
<li>If you use gcc, it's a good idea to have a recent release -- 2.7.2.1 or
later -- but gcc 2.6.3 has been known to work with past releases of
Ghostscript. gcc versions earlier than 2.6.3, and 2.7.* earlier than
2.7.2.1, are known <b><em>not</em></b> to work. You may be able to get a working
executable with an older gcc by removing <b><tt>-O</tt></b> from
<b><tt>CFLAGS</tt></b>.
</ul>
<h4><a name="Intergraph"></a>Intergraph Clipper</h4>
<ul>
<li>Recommended settings are:
<p>
<b><tt>XCFLAGS=-w -Q -DSYSV -D__SVR3<br>
EXTRALIBS=-lbsd -lc_s<br>
CC=acc -knr<br>
PLATFORM=sysv_</tt></b><br>
<li>You will probably need to change the value of <b><tt>XLIBS</tt></b> from
"<b><tt>XLIBS=Xt X11 Xext</tt></b>" to "<b><tt>XLIBS=Xt_s X11_s Xext</tt></b>".
</ul>
<h4><a name="MIPS"></a>MIPS</h4>
<ul>
<li>There is apparently a bug in older versions of the MIPS C compiler
which causes <b><tt>gxdither.c</tt></b> to compile incorrectly if
optimization is enabled (<b><tt>-O</tt></b>). However, this bug is
definitely fixed in MipsPRO C version 6.00; with this version, compiling
with "<b><tt>-O2 -mips2</tt></b>" produces good output.
</ul>
<h4><a name="NCR_3550"></a>NCR 3550</h4>
<ul>
<li>With the NCR C Development Toolkit you must use <b><tt>-O0</tt></b>.
</ul>
<h4><a name="Pyramid"></a>Pyramid MIServer-S</h4>
<p>
See "<a href="#ATT_7040">AT&T 7040 R3</a>".
<h4><a name="RS6000"></a>IBM RS/6000 with AIX</h4>
<ul>
<li>Many versions of the AIX C compiler have bugs that have prevented
Ghostscript from compiling and linking properly. We believe that the
current Ghostscript release works around these bugs, and that
<b><tt>unixansi.mak</tt></b> with <b><tt>CC=cc</tt></b> should work.
<li>You must also edit the makefile (<b><tt>unixansi.mak</tt></b>) to change
<b><tt>INSTALL</tt></b> to <b><tt>/usr/ucb/install</tt></b>.
<li>AIX doesn't use a separate library for multi-thread support: set
<b><tt>STDLIBS=-lm</tt></b> in the makefile.
<li>If <b><tt>-DSYSV</tt></b> produces a complaint about the functions
<b><tt>index</tt></b> and <b><tt>rindex</tt></b> not being defined, try
removing it.
<li>If the xlc 1.2.1 optimizer runs out of memory, you may need to add
<b><tt>-qmaxmem=4000</tt></b> to <b><tt>CFLAGS</tt></b>.
<li>A user reports that the AIX C compiler shipped with AIX 3.2.5 compiles
Ghostscript only if invoked with "<b><tt>c89 -D_POSIX_SOURCE</tt></b>"
and <b><em>without</em></b> <b><tt>-O</tt></b>. On the other hand, another
user reports successful compilation using <b><tt>unix-ansi.mak</tt></b> and
the command line
<p>
<b><tt>make CC=c89 XCFLAGS="-DOSY_AIX -D_ALL_SOURCE -qnoro -qmaxmem=3000 -bfl" $*</tt></b><br>
<li>Apparently some (but not all) releases of the C library declare the
<b><tt>hypot</tt></b> function: if the declaration in
<b><tt>math_.h</tt></b> produces an error message, try removing it.
<li>The IBM X11R3 server is known to be buggy: use the MIT X server if
possible.
<li>The xlc 1.3.0.x compiler provided in AIX 3.2.5+ definitely will not
compile Ghostscript correctly if <b><tt>-O</tt></b> is used on all files.
A user reports that compiling <b><tt>z</tt></b>*<b><tt>.c</tt></b>,
<b><tt>gsmatrix.c</tt></b>, <b><tt>gxstroke.c</tt></b> without
<b><tt>-O</tt></b> is sufficient to produce a working executable:.
<li>Some installations of AIX 3.2.5 have what appears to be an incorrect or
inconsistent version of <b><tt>libXt.a</tt></b> in
<b><tt>/usr/lpp/X11/lib</tt></b>. If linking shows
<b><tt>XtShellStrings</tt></b> and <b><tt>XtStrings</tt></b> as unresolved
externals, set
"<b><tt>XLIBDIRS=-L/usr/lpp/X11/lib/R5 -L/usr/lpp/X11/lib</tt></b>"
rather than just "<b><tt>XLIBDIRS=-L/usr/lpp/X11/lib</tt></b>".
<li>Ghostscript has been successfully compiled and runs under AIX 4.3.3 and
the IBM C compiler version 5. The following changes were required in
unixansi.mak:
<p>
<b><tt>CC=xlc</tt></b>
<br>
<b><tt>XCFLAGS=-qalign=natural</tt></b>
</ul>
<h4>
<a NAME="Silicon_Graphics"></a>Silicon Graphics</h4>
<p>
Users have had a lot of problems with the MIPSpro compilers on SGI systems.
We recommend using gcc. If you do choose to use the MIPSpro compiler,
please read the following carefully.
<ul>
<li>
To make the optimizer allocate enough table space, set
<p><b><tt>CFLAGS="-Olimit 2500"</tt></b> (for older compilers)
<br><b><tt>CFLAGS="-OPT:Olimit=2500"</tt></b> (for newer compilers)
<p>
MIPSpro compiler version 3.19 is "older", and 7.1 is "newer"; we aren't
sure at what point in between the latter syntax was introduced.
<li>
With the compiler shipped with Irix 5.2, use the <b><tt>-ansi</tt></b>
option.
<li>
The SGI C compiler may produce warnings about "Undefined the ANSI standard
library defined macro stdin/stdout/stderr". To suppress these warnings, add
"<b><tt>-woff 608</tt></b>" to the definition of <b><tt>CFLAGS</tt></b>.
<li>
The SGI C compiler shipped with Irix 6.1 and 6.2 will not compile
<b><tt>zlib/deflate.c</tt></b> properly with optimization. Compile this file
separately without <b><tt>-O</tt></b>.
<li>
With IRIX 6.5.x and the MIPSpro 7.x compilers there have been reports about
incorrect output and binaries that cause segmentation faults. Various
solutions have been suggested and you may want to try them in this order,
until you get a working binary:
<ul>
<li>
Compile <b><tt>idict.c</tt></b> and <b><tt>isave.c</tt></b> separately
without optimization after doing a normal compile; then relink.e.g.:
<p>
<b><tt>cc -OPT:Olimit=2500 -I. -I./obj -o ./obj/idict.o -c ./idict.c</tt></b><br>
<b><tt>cc -OPT:Olimit=2500 -I. -I./obj -o ./obj/isave.o -c ./isave.c</tt></b>
<li>
Set <b><tt>CFLAGS=</tt></b> (no optimization).
<li>
Use only <b><tt>-O2</tt></b>. Compiler produces incorrect output
with <b><tt>-O3</tt></b> or "<b><tt>-Ofast=ip32 -show</tt></b>".
<li>
Irix 6.5.1m with MIPSpro compiler 7.2.1.1m, Irix 6.5.3m with MIPSpro
compiler 7.2.1, and probably other 6.5x / 7.2x combinations require
compiling with the <b><tt>-o32</tt></b> option. Compiling with the (default)
<b><tt>-n32</tt></b> option produces non-working executables.
<b><tt>-O2</tt></b> is OK (possibly except for <b><tt>idict.c</tt></b>), but
not <b><tt>-O3</tt></b>.
</ul>
</ul>
<h4><a name="Sun"></a>Sun</h4>
<ul>
<li>The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript
properly with the <b><tt>-fast</tt></b> option: Ghostscript core-dumps in
<b><tt>build_gs_font</tt></b>. With that compiler use <b><tt>-g</tt></b>,
or use gcc instead.
<li>The Sun version of <b><tt>dbx</tt></b> often gives up with an error
message when trying to load Ghostscript. If this happens, use GNU
<b><tt>gdb</tt></b> instead. (<b><tt>gdb</tt></b> is more reliable than
<b><tt>dbx</tt></b> in other ways as well.)
<li>A bug in some versions of <b><tt>zlib</tt></b> results in an undefined
symbol <b><tt>zmemcmp</tt></b> when compiling with Sun cc. Use gcc
instead.
</ul>
<h4><a name="SunOS"></a>SunOS</h4>
<ul>
<li>The <tt><b>tar</b></tt> program provided with SunOS 4.1.3 may not be
able to unpack the archives in the standard Ghostscript distribution.
Get a more recent version of <tt><b>tar</b></tt>, such as GNU
<tt><b>tar</b></tt>.
<li>In SunOS 4.1.[23], you may get undefined symbols
<b><tt>_get_wmShellWidgetClass</tt></b> and
<b><tt>_get_applicationShellWidgetClass</tt></b> when linking. Compiling
"<b><tt>-Bstatic -lXmu -Bdynamic</tt></b>" appears to work for
SC1.0. For gcc, try adding <b><tt>-static</tt></b> to
<b><tt>CFLAGS</tt></b>. To solve the problem if you are using OpenWindows
3.0 (X11R4-based Xt), ask Sun for patches 100512-02 and 100573-03.
</ul>
<h4><a name="Solaris"></a>Solaris</h4>
<ul>
<li>Solaris 2.2 may require setting "<b><tt>EXTRALIBS=-lsocket</tt></b>".
Solaris 2.3 and later seem to require "<b><tt>EXTRALIBS=-lnsl -lsocket -lposix4</tt></b>".
<li>For Solaris 2.6 (and possibly some other versions), if you set
<b><tt>SHARE_LIBPNG=1</tt></b>, <b><tt>SHARE_ZLIB=1</tt></b>, or
<b><tt>SHARE_JPEG=1</tt></b>, you may need to set
<p>
<b><tt>XLDFLAGS=-R /usr/local/</tt></b>xxx<b><tt>/lib:/usr/local/lib</tt></b>
<p>
using the full path names of the relevant directories.
<li>Solaris 2.<em>n</em> uses <b><tt>/usr/openwin/share/include</tt></b>
for the X11 libraries rather than <b><tt>/usr/local/X/include</tt></b>.
<li>Solaris 2.<em>n</em> typically has Type 1 fonts in
<b><tt>/usr/openwin/lib/X11/fonts/Type1/outline</tt></b>.
<li>For Solaris 2.<b><tt>n</tt></b> in the makefile you must change
the definition of <b><tt>INSTALL</tt></b> from "<b><tt>install -c</tt></b>" to
"<b><tt>/usr/ucb/install -c</tt></b>".
<li>You may need to set <b><tt>XLIBDIR</tt></b> to the directory that holds
the X11 libraries, as for other SVR4 systems. Set <b><tt>-DSVR4</tt></b>
in <b><tt>CFLAGS</tt></b>.
<li>If you are using the SunPRO C compiler, don't use optimization level
<b><tt>-xO3</tt></b>. On SPARC platforms the compiler hangs; on Intel
platforms the generated code is incorrect. With this compiler on Intel, do
not use the <b><tt>-native</tt></b> flag: floating point computations
become unacceptably inaccurate. You can use <b><tt>-xcg92</tt></b> (SPARC
V8) and <b><tt>-dalign</tt></b> for better performance.
</ul>
<h4><a name="VAX_Ultrix"></a>VAX with Ultrix</h4>
<ul>
<li>You may wish to set
<p>
<b><tt>GS_LIB_DEFAULT=$(gsdatadir):/usr/lib/DPS/outline/decwin:$(gsdatadir)/fonts</tt></b>
<p>
in the makefile to add the Display PostScript font directory to the font
search path.
</ul>
<hr>
<h2><a name="OS2_build"></a>How to build Ghostscript from source (OS/2 version)</h2>
<p>
<em>Note: This section was contributed by a user: please e-mail Hermann
Ulrichskötter <<a
href="mailto:ulrichsk@t-online.de">ulrichsk@t-online.de</a>> if you have
questions or problems.</em>
<p>
The following instructions are for building with emx 0.9d/Fix2. Be warned
that with this version of gcc/emx, compiler optimization flags '-O' or '-O1'
will produce non-working output.
<ul>
<li>The relevant makefile is <b><tt>os2.mak</tt></b> The gcc/emx 0.9b (or
later) compiler and IBM <b><tt>NMAKE.EXE</tt></b> are required.
<li>For gcc/emx versions 0.9c and later, the <b><tt>LINK386</tt></b>
command must <b><em>include</em></b>
"<b><tt>$(COMPBASE)\lib\end.lib</tt></b>"; version 0.9b requires
<b><em>omitting</em></b> it. The current <b><tt>os2.mak</tt></b> file does
include this file in the <b><tt>LINK386</tt></b> command, so if you are
using 0.9b, delete this file reference before building.
<li>Be sure you are using the standard OS/2 shell, <b><tt>CMD.EXE</tt></b>.
Some other shells have bugs or differences that cause the makefile not to
work.
<li>Make sure you followed the instructions in "How to unpack the source
code" and "How to unpack the third-party libraries".
<li>Use jpegsrc_v6b.tar.gz, zlib.tar.gz and libpng-1.0.3.tar.gz. Earlier
versions may not work.
<li>If you wish to include support for XFree86, edit the makefile
to change <b>BUILD_X11=0</b> to <b>BUILD_X11=1</b>.
XFree86 for OS/2 can be obtained from
<a href="http://borneo.gmd.de/~veit/os2/xf86os2.html">
http://borneo.gmd.de/~veit/os2/xf86os2.html</a>
You must use emx 0.9d.
</ul>
<p>
Before compiling or linking, execute <b><tt>md bin</tt></b> and <b><tt>md
obj</tt></b> in the <b><tt>gs</tt></b> directory to create the directories
for the binaries.
<p>
First, build the standard configuration:
<ul>
<li>Edit gs/src/os2.mak: find line with 'CO=-O' (Optimizer flag) and edit
this line to 'CO=-O2' (-O or -O1 do not work!).
<li>To start the make process, type <b><tt>nmake -f .\src\os2.mak</tt></b>,
from the gs-directory.
<li>One DLL and two EXEs will be produced in <b><tt>gs/bin</tt></b>:
<b><tt>gsdll2.dll</tt></b> (the Ghostscript DLL), <b><tt>gsos2.exe</tt></b>
(the Ghostscript executable) and <b><tt>gspmdrv.exe</tt></b> (the
Presentation Manager display driver). All other newly generated files will
be produced in <b><tt>gs/obj</tt></b>.
</ul>
<p>
Now, if you wish, you can edit OS2.MAK to suit your needs, and then perform
<b><tt>nmake -f .\src\os2.mak clean</tt></b> and then <b><tt>nmake -f
.\src\os2.mak</tt></b>.
<hr>
<h2><a name="VMS_build"></a>How to build Ghostscript from source (OpenVMS version)</h2>
<p>The DECC6.2-003 compiler has an optimization problem that may lead to
warnings about the "ANSI aliasing rules". DEC (Compaq) can provide a fix
for this problem. The DECC6.2-006 compiler apparently does not have the
problem.
<p>
DEC C runtime library versions 5.5 and newer have an <b><tt>exit</tt></b>
function that is compatible with all other C systems, but some older ones
don't. If you get error messages from VMS when auxiliary programs such as
<b><tt>genarch</tt></b> or <b><tt>echogs</tt></b> finish executing, find the
line in stdpre.h that reads
<blockquote><b><tt>
/*#define OLD_VMS_C*/
</tt></b></blockquote>
and remove the <b><tt>/*</tt></b> and <b><tt>*/</tt></b>, changing it to
<blockquote><b><tt>
#define OLD_VMS_C
</tt></b></blockquote>
<p>
Some versions of DEC's X server have bugs that produce broad bands of color
where dither patterns should appear, or characters displayed white on top
of black rectangles or not displayed at all. If this happens, consult the
usage documentation for how to <a href="Use.htm#X_server_bugs">work around
X server bugs</a> using X resources; also report the problem to DEC, or
whomever supplied your X server.
<p>
You may also wish to turn off the use of a backing pixmap with Ghostscript,
either to work around X server memory limitations or bugs, or to obtain
faster displaying at the expense of no redrawing when a Ghostscript window
is restored from an icon or exposed after being occluded by another window.
Again, the <a href="Use.htm">usage documentation</a> tells how to do this.
<p>
You can <a href="Fonts.htm#Precompiling">precompile any Type 1 font</a>
into C, then compile and build it into Ghostscript, as described in the
<a href="Fonts.htm">fonts documentation</a>. If you do this, then add
"<b><tt>$(PSD)ccfonts.dev</tt></b>" to <b><tt>FEATURE_DEVS</tt></b> in
<b><tt>OPENVMS.MAK</tt></b>:
<blockquote><b><tt>
$ FEATURE_DEVS = "$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)ccfonts.dev"
</tt></b></blockquote>
<p>
Specify the font names with <b><tt>ccfonts1</tt></b>:
<blockquote><b><tt>
$ ccfonts1 = "Courier Courier_Oblique Courier_Bold Courier_BoldOblique"
</tt></b></blockquote>
<p>
If this makes the line too long, add another line of the same form, such as
<blockquote><b><tt>
$ ccfonts1 = "Courier Courier_Oblique Courier_Bold Courier_BoldOblique"
$ ccfonts2 = "Times_Roman Times_Italic Times_Bold Times_BoldItalic"
</tt></b></blockquote>
<h3><a name="GNU_make_VMS"></a>Building with GNU make on OpenVMS</h3>
<p>
<em>Note: GNU make on OpenVMS apparently has bugs that make it stop with an
error when building Ghostscript version 5.80 or later. Until further
notice, use MMS or MMK for building Ghostscript on OpenVMS. See <a
href="#MMK_MMS_VMS">below</a> for details.</em>
<p>
As of Ghostscript version 5.0 you can use GNU make -- with the file
<b><tt>OPENVMS.MAK</tt></b> and some auxiliary <b><tt>.COM</tt></b> files
-- to build Ghostscript on OpenVMS. Use the command:
<blockquote>
<b><tt>make -fopenvms.mak "DECWINDOWS=</tt></b><em>[</em><b><tt>1.2</tt></b><em>]</em><b><tt>"</tt></b>
</blockquote>
<p>
That is, specify either "<b><tt>1.2</tt></b>" or nothing (blank) as the
value of <b><tt>DECWINDOWS</tt></b>. In Europe and other parts of the world
where ISO standard paper sizes are used, append "<b><tt>A4_PAPER=1</tt></b>"
to that line to make A4 the default paper size at run time.
<p>
If you haven't a prebuilt copy of GNU make, you'll have to build it
yourself; as of Version 3.76 (but not earlier) it is said to build properly
under OpenVMS on both VAX and Alpha. The kit is available at the
<a href="http://www.gnu.org/">Free Software Foundation's</a> ftp site and
its mirrors. See
<blockquote>
<a href="ftp://ftp.gnu.org/pub/gnu/"
class="offsite">ftp://ftp.gnu.org/pub/gnu/</a>
</blockquote>
<h3><a name="MMK_MMS_VMS"></a>Building with MMK or MMS on OpenVMS</h3>
<p>
As of Ghostscript version 5.68 you can use MMK or MMS to build Ghostscript on
OpenVMS. MMS is a utility available from Compaq (Digital);
MMK is a free program largely compatible with MMS.
<p>
Building Ghostscript with MMK or MMS uses the file
<b><tt>OPENVMS.MMK</tt></b> and some auxiliary <b><tt>.COM</tt></b> files.
To build Ghostscript with MMK or MMS, use the command:
<blockquote>
<b><tt>###/descrip=[.src]openvms.mmk/macro=("DECWINDOWS1_2=</tt></b><em>{</em><b><tt>0</tt></b>,<b><tt>1</tt></b><em>}</em><b><tt>")</tt></b>
</blockquote>
where <b><tt>###</tt></b> is either <b><tt>mmk</tt></b> or <b><tt>mms</tt></b>.
<p>
Specify <b><tt>DECWINDOWS1_2=1</tt></b> for DECWINDOWS 1.2,
<b><tt>DECWINDOWS1_2=0</tt></b> for other DECWINDOWS versions. In Europe
and other parts of the world where ISO standard paper sizes are used, add
<b><tt>,"A4_PAPER=1"</tt></b> just before the final closing parenthesis to
make A4 the default paper size at run time.
<p>
To download MMK (source code, and VAX and Alpha executables), visit
<blockquote>
<a href="http://www.madgoat.com/mmk.html">http://www.madgoat.com/mmk.html</a>
</blockquote>
<hr>
<h2><a name="Other_environments"></a>Other environments</h2>
<h3><a name="No_multi_thread"></a>Environments lacking multi-threading</h3>
<p>
All environments mentioned here by name have multi-threading capability.
However, if your environment doesn't, you can remove all need for
multi-threading by setting <b><tt>SYNC=nosync</tt></b> in the top-level
makefile. Note that you will not be able to use any so-called "async"
drivers (drivers that overlap interpretation and rasterization) if you do
this. No such drivers are in the <b><tt>DEVICE_DEVS*</tt></b> lists of any
makefile that we distribute.
<h3><a name="Plan_9"></a>Plan 9</h3>
<p>
Use <b><tt>unix-gcc.mak</tt></b>, editing it to define
<blockquote><b><tt>
CC=cc
GCFLAGS=-D_BSD_EXTENSION -DPlan9
</tt></b></blockquote>
<p>
You will also probably have to edit many path names.
<h3><a name="QNX"></a>QNX</h3>
<p>
David J. Hawkey Jr. writes that he built Ghostscript 4.03 and 5.0 under QNX
4.22, 4.23, and 4.24 using Watcom C 10.6 and that "it works quite well,
after figuring out the <b><tt>/etc/config/lpsrvr</tt></b> directives,
except for color printing to my HP DeskJet some-number-or-another". Here
is a concise presentation of changes based on the ones he made for
Ghostscript 4.03.
<dl>
<dt><b><tt>unixansi.mak</tt></b>
<dd><table cellpadding=0 cellspacing=0>
<tr valign=bottom>
<th align=left>Original lines
<td>
<th align=left>Change to
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>INSTALL = install -c<br>INSTALL_PROGRAM = $(INSTALL) -m 755<br>INSTALL_DATA = $(INSTALL) -m 644</tt></b>
<td>
<td><b><tt>INSTALL = cp<br>INSTALL_PROGRAM = $(INSTALL)<br>INSTALL_DATA = $(INSTALL)</tt></b>
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>datadir = $(prefix)/share</tt></b>
<td>
<td><b><tt>datadir = $(prefix)/lib</tt></b>
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>CFLAGS_STANDARD=-O</tt></b>
<td>
<td><b><tt>CFLAGS_STANDARD=-Otx -zp1 -mf</tt></b>
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>LDFLAGS=$(XLDFLAGS)</tt></b>
<td>
<td><b><tt>LDFLAGS=-mf -N32k $(XLDFLAGS)</tt></b>
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>EXTRALIBS=</tt></b>
<td>
<td><b><tt>EXTRALIBS=-lXqnx_s -lsocket</tt></b>
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>XINCLUDE=-I/usr/local/X/include</tt></b>
<td>
<td><b><tt>#XINCLUDE=-I/usr/local/X/include</tt></b>
<tr> <td colspan=3><hr>
<tr valign=top> <td><b><tt>XLIBDIRS=-L/usr/local/X/lib<br>XLIBDIR=<br>XLIBS=Xt Xext X11</tt></b>
<td>
<td><b><tt>#XLIBDIRS=-L/usr/local/X/lib<br>#XLIBDIR=<br>XLIBS=Xt_s Xext X11_s</tt></b>
<tr> <td colspan=3><hr>
</table>
</dl>
<dl>
<dt><b><tt>gp_unifs.c</tt></b>
<dd>After the line
<blockquote>
<b><tt>#include <sys/param.h></tt></b>
</blockquote>
<p>
add these lines:
<blockquote>
<b><tt>#if defined(__QNX__)<br>
#include <unix.h><br>
#endif</tt></b><br>
</blockquote>
</dl>
<dl>
<dt><b><tt>gp_unix.c</tt></b>
<dd>After the line
<blockquote>
<b><tt>#include "time.h"</tt></b>
</blockquote>
<p>
add these lines:
<blockquote>
<b><tt>#if defined(__QNX__)<br>
#include <sys/time.h><br>
#endif</tt></b><br>
</blockquote>
</dl>
<dl>
<dt><b><tt>time_.h</tt></b>
<dd>Modify the line beginning
<blockquote>
<b><tt># if defined(Plan9) ||</tt></b>
</blockquote>
<p>
to begin
<blockquote>
<b><tt># if defined(__QNX__) || defined(Plan9) ||</tt></b>
</blockquote>
</dl>
<dl>
<dt><b><tt>/etc/config/lpsrvr</tt></b>
<dd>Here is Hawkey's <b><tt>lpsrvr</tt></b> as an example.
<blockquote>
<pre># lpsrvr
#
# Defines the print queues and their devices
#
# Queues
# ink-jet: Ghostscript interpreter for mono DeskJet - LaserJet works
# better than DeskJet!
[ij-monops]
ta=lpt1
co=/usr/local/bin/gs -q -sDEVICE=laserjet -sOutputFile=- -dNOPAUSE $(spfile) quit.ps | cat > $(device)
# Devices
[-lpt1]
dv=/dev/par1
[-lpt2]
dv=/dev/par2
</pre></blockquote>
</dl>
<h2><a name="UFST_build"></a>How to build Ghostscript with UFST</h2>
<p>
<em>Note: This section is only for customers who have licensed Agfa's UFST.
Other users please skip this section.
</em>
<p>
Ghostscript sources do not include UFST sources. You need to obtain them from Agfa.
Ghostscript includes only some source modules that provide a bridge to UFST.
<p>
Ghostscript makefiles do not include any script for building UFST libraries.
Refer to Agfa's manual how to build them. UFST object libraries must be built
before building Ghostscript with the UFST bridge.
<p>
To build Ghostscript with UFST, specify additional options for "make":
<blockquote>
<b><tt>UFST_BRIDGE=1</tt></b>
</blockquote>
<dd><dd> - forces the UFST bridge to build.
<blockquote>
<b><tt>UFST_ROOT=path</tt></b>
</blockquote>
<dd><dd> - specifies the path to UFST root directory or folder.
<blockquote>
<b><tt>UFST_CFLAG=options</tt></b>
</blockquote>
<dd><dd> - specifies C compiler options for UFST library. Refer to Agfa's manual for information about them.
<blockquote>
<b><tt>UFST_LIB_EXT=extension</tt></b>
</blockquote>
<dd><dd> - sets the file name extension for object libraries. You must use the appropriate one for your platform and linker.
<p>An example for Unix/GCC :
<blockquote>
<b><tt>UFST_BRIDGE=1 UFST_ROOT=../Agfa UFST_CFLAG=-DGCCx86 UFST_LIB_EXT=.a</tt></b>
</blockquote>
<p>For Windows/MSVC you need only specify UFST_ROOT.
msvc32.mak sets the other options automatically.
<p>
<!-- [2.0 end contents] ==================================================== -->
<!-- [3.0 begin visible trailer] =========================================== -->
<hr>
<p>
<small>Copyright © 1996, 2000 Aladdin Enterprises.
All rights reserved.</small>
<p>
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
For more information about licensing, please refer to
http://www.ghostscript.com/licensing/. For information on
commercial licensing, go to http://www.artifex.com/licensing/ or
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
<p>
<small>Ghostscript version 7.20, 3 April 2002
<!-- [3.0 end visible trailer] ============================================= -->
</body>
</html>
|