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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sconsdoc [
<!ENTITY % scons SYSTEM "../scons.mod">
%scons;
<!ENTITY % builders-mod SYSTEM "builders.mod">
%builders-mod;
<!ENTITY % functions-mod SYSTEM "functions.mod">
%functions-mod;
<!ENTITY % tools-mod SYSTEM "tools.mod">
%tools-mod;
<!ENTITY % variables-mod SYSTEM "variables.mod">
%variables-mod;
]>
<variablelist xmlns="http://www.scons.org/dbxsd/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
<varlistentry id="b-CFile">
<term>
<function>CFile()</function>
</term>
<term>
<function>env.CFile()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a C source file given a lex (<filename>.l</filename>)
or yacc (<filename>.y</filename>) input file.
The suffix specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-CFILESUFFIX"><envar>$CFILESUFFIX</envar></link> construction variable
(<filename>.c</filename> by default)
is automatically added to the target
if it is not already present.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# builds foo.c
env.CFile(target = 'foo.c', source = 'foo.l')
# builds bar.c
env.CFile(target = 'bar', source = 'bar.y')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Command">
<term>
<function>Command()</function>
</term>
<term>
<function>env.Command()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The <function xmlns="http://www.scons.org/dbxsd/v1.0">Command</function> "Builder" is actually implemented
as a function that looks like a Builder,
but actually takes an additional argument of the action
from which the Builder should be made.
See the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="f-Command"><function>Command</function></link> function description
for the calling syntax and details.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-CXXFile">
<term>
<function>CXXFile()</function>
</term>
<term>
<function>env.CXXFile()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a C++ source file given a lex (<filename>.ll</filename>)
or yacc (<filename>.yy</filename>)
input file.
The suffix specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-CXXFILESUFFIX"><envar>$CXXFILESUFFIX</envar></link> construction variable
(<filename>.cc</filename> by default)
is automatically added to the target
if it is not already present.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# builds foo.cc
env.CXXFile(target = 'foo.cc', source = 'foo.ll')
# builds bar.cc
env.CXXFile(target = 'bar', source = 'bar.yy')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookEpub">
<term>
<function>DocbookEpub()</function>
</term>
<term>
<function>env.DocbookEpub()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for EPUB output.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookEpub('manual.epub', 'manual.xml')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
or simply
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookEpub('manual')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookHtml">
<term>
<function>DocbookHtml()</function>
</term>
<term>
<function>env.DocbookHtml()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for HTML output.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtml('manual.html', 'manual.xml')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
or simply
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtml('manual')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookHtmlChunked">
<term>
<function>DocbookHtmlChunked()</function>
</term>
<term>
<function>env.DocbookHtmlChunked()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for chunked HTML output.
It supports the <literal>base.dir</literal> parameter. The
<filename>chunkfast.xsl</filename> file (requires "EXSLT") is used as the
default stylesheet. Basic syntax:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtmlChunked('manual')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
where <filename>manual.xml</filename> is the input file.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">If you use the <literal>root.filename</literal>
parameter in your own stylesheets you have to specify the new target name.
This ensures that the dependencies get correct, especially for the cleanup via <quote><literal>scons -c</literal></quote>:
</para>
<screen xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtmlChunked('mymanual.html', 'manual', xsl='htmlchunk.xsl')
</screen>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Some basic support for the <literal>base.dir</literal> is provided. You
can add the <literal>base_dir</literal> keyword to your Builder
call, and the given prefix gets prepended to all the created filenames:
</para>
<screen xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtmlChunked('manual', xsl='htmlchunk.xsl', base_dir='output/')
</screen>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Make sure that you don't forget the trailing slash for the base folder, else
your files get renamed only!
</para>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookHtmlhelp">
<term>
<function>DocbookHtmlhelp()</function>
</term>
<term>
<function>env.DocbookHtmlhelp()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for HTMLHELP output.
Its basic syntax is:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtmlhelp('manual')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
where <filename>manual.xml</filename> is the input file.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">If you use the <literal>root.filename</literal>
parameter in your own stylesheets you have to specify the new target name.
This ensures that the dependencies get correct, especially for the cleanup via <quote><literal>scons -c</literal></quote>:
</para>
<screen xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtmlhelp('mymanual.html', 'manual', xsl='htmlhelp.xsl')
</screen>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Some basic support for the <literal>base.dir</literal> parameter
is provided. You can add the <literal>base_dir</literal> keyword to
your Builder call, and the given prefix gets prepended to all the
created filenames:
</para>
<screen xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookHtmlhelp('manual', xsl='htmlhelp.xsl', base_dir='output/')
</screen>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Make sure that you don't forget the trailing slash for the base folder, else
your files get renamed only!
</para>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookMan">
<term>
<function>DocbookMan()</function>
</term>
<term>
<function>env.DocbookMan()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for Man page output.
Its basic syntax is:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookMan('manual')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
where <filename>manual.xml</filename> is the input file. Note, that
you can specify a target name, but the actual output names are automatically
set from the <literal>refname</literal> entries in your XML source.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookPdf">
<term>
<function>DocbookPdf()</function>
</term>
<term>
<function>env.DocbookPdf()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for PDF output.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookPdf('manual.pdf', 'manual.xml')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
or simply
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookPdf('manual')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookSlidesHtml">
<term>
<function>DocbookSlidesHtml()</function>
</term>
<term>
<function>env.DocbookSlidesHtml()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for HTML slides output.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookSlidesHtml('manual')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">If you use the <literal>titlefoil.html</literal> parameter in
your own stylesheets you have to give the new target name. This ensures
that the dependencies get correct, especially for the cleanup via
<quote><literal>scons -c</literal></quote>:
</para>
<screen xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookSlidesHtml('mymanual.html','manual', xsl='slideshtml.xsl')
</screen>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Some basic support for the <literal>base.dir</literal> parameter
is provided. You
can add the <literal>base_dir</literal> keyword to your Builder
call, and the given prefix gets prepended to all the created filenames:
</para>
<screen xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookSlidesHtml('manual', xsl='slideshtml.xsl', base_dir='output/')
</screen>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Make sure that you don't forget the trailing slash for the base folder, else
your files get renamed only!
</para>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookSlidesPdf">
<term>
<function>DocbookSlidesPdf()</function>
</term>
<term>
<function>env.DocbookSlidesPdf()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, providing a Docbook toolchain for PDF slides output.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookSlidesPdf('manual.pdf', 'manual.xml')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
or simply
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookSlidesPdf('manual')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookXInclude">
<term>
<function>DocbookXInclude()</function>
</term>
<term>
<function>env.DocbookXInclude()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, for resolving XIncludes in a separate processing step.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookXInclude('manual_xincluded.xml', 'manual.xml')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-DocbookXslt">
<term>
<function>DocbookXslt()</function>
</term>
<term>
<function>env.DocbookXslt()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A pseudo-Builder, applying a given XSL transformation to the input file.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['docbook'])
env.DocbookXslt('manual_transformed.xml', 'manual.xml', xsl='transform.xslt')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Note, that this builder requires the <literal>xsl</literal> parameter
to be set.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-DVI">
<term>
<function>DVI()</function>
</term>
<term>
<function>env.DVI()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a <filename>.dvi</filename> file
from a <filename>.tex</filename>,
<filename>.ltx</filename> or <filename>.latex</filename> input file.
If the source file suffix is <filename>.tex</filename>,
<filename xmlns="http://www.scons.org/dbxsd/v1.0">scons</filename>
will examine the contents of the file;
if the string
<literal>\documentclass</literal>
or
<literal>\documentstyle</literal>
is found, the file is assumed to be a LaTeX file and
the target is built by invoking the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-LATEXCOM"><envar>$LATEXCOM</envar></link> command line;
otherwise, the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-TEXCOM"><envar>$TEXCOM</envar></link> command line is used.
If the file is a LaTeX file,
the
<function xmlns="http://www.scons.org/dbxsd/v1.0">DVI</function>
builder method will also examine the contents
of the
<filename>.aux</filename>
file and invoke the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-BIBTEX"><envar>$BIBTEX</envar></link> command line
if the string
<literal>bibdata</literal>
is found,
start <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MAKEINDEX"><envar>$MAKEINDEX</envar></link> to generate an index if a
<filename>.ind</filename>
file is found
and will examine the contents
<filename>.log</filename>
file and re-run the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-LATEXCOM"><envar>$LATEXCOM</envar></link> command
if the log file says it is necessary.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The suffix <filename>.dvi</filename>
(hard-coded within TeX itself)
is automatically added to the target
if it is not already present.
Examples:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# builds from aaa.tex
env.DVI(target = 'aaa.dvi', source = 'aaa.tex')
# builds bbb.dvi
env.DVI(target = 'bbb', source = 'bbb.ltx')
# builds from ccc.latex
env.DVI(target = 'ccc.dvi', source = 'ccc.latex')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Gs">
<term>
<function>Gs()</function>
</term>
<term>
<function>env.Gs()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A Builder for explicitly calling the <literal>gs</literal> executable.
Depending on the underlying OS, the different names <literal>gs</literal>,
<literal>gsos2</literal> and <literal>gswin32c</literal>
are tried.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">env = Environment(tools=['gs'])
env.Gs('cover.jpg','scons-scons.pdf',
GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -q')
)
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Install">
<term>
<function>Install()</function>
</term>
<term>
<function>env.Install()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Installs one or more source files or directories
in the specified target,
which must be a directory.
The names of the specified source files or directories
remain the same within the destination directory. The
sources may be given as a string or as a node returned by
a builder.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Install('/usr/local/bin', source = ['foo', 'bar'])
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-InstallAs">
<term>
<function>InstallAs()</function>
</term>
<term>
<function>env.InstallAs()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Installs one or more source files or directories
to specific names,
allowing changing a file or directory name
as part of the installation.
It is an error if the
target
and
source
arguments list different numbers of files or directories.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.InstallAs(target = '/usr/local/bin/foo',
source = 'foo_debug')
env.InstallAs(target = ['../lib/libfoo.a', '../lib/libbar.a'],
source = ['libFOO.a', 'libBAR.a'])
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-InstallVersionedLib">
<term>
<function>InstallVersionedLib()</function>
</term>
<term>
<function>env.InstallVersionedLib()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Installs a versioned shared library. The symlinks appropriate to the
architecture will be generated based on symlinks of the source library.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.InstallVersionedLib(target = '/usr/local/bin/foo',
source = 'libxyz.1.5.2.so')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Jar">
<term>
<function>Jar()</function>
</term>
<term>
<function>env.Jar()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a Java archive (<filename>.jar</filename>) file
from the specified list of sources.
Any directories in the source list
will be searched for <filename>.class</filename> files).
Any <filename>.java</filename> files in the source list
will be compiled to <filename>.class</filename> files
by calling the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-Java"><function>Java</function></link> Builder.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
If the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-JARCHDIR"><envar>$JARCHDIR</envar></link> value is set, the
<application xmlns="http://www.scons.org/dbxsd/v1.0">jar</application>
command will change to the specified directory using the
<option>-C</option>
option.
If <envar xmlns="http://www.scons.org/dbxsd/v1.0">$JARCHDIR</envar> is not set explicitly,
<application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> will use the top of any subdirectory tree
in which Java <filename>.class</filename>
were built by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-Java"><function>Java</function></link> Builder.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
If the contents any of the source files begin with the string
<literal>Manifest-Version</literal>,
the file is assumed to be a manifest
and is passed to the
<application xmlns="http://www.scons.org/dbxsd/v1.0">jar</application>
command with the
<option>m</option>
option set.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Jar(target = 'foo.jar', source = 'classes')
env.Jar(target = 'bar.jar',
source = ['bar1.java', 'bar2.java'])
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Java">
<term>
<function>Java()</function>
</term>
<term>
<function>env.Java()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds one or more Java class files.
The sources may be any combination of explicit
<filename>.java</filename> files,
or directory trees which will be scanned
for <filename>.java</filename> files.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
SCons will parse each source <filename>.java</filename> file
to find the classes
(including inner classes)
defined within that file,
and from that figure out the
target <filename>.class</filename> files that will be created.
The class files will be placed underneath
the specified target directory.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
SCons will also search each Java file
for the Java package name,
which it assumes can be found on a line
beginning with the string
<literal>package</literal>
in the first column;
the resulting <filename>.class</filename> files
will be placed in a directory reflecting
the specified package name.
For example,
the file
<filename>Foo.java</filename>
defining a single public
<classname>Foo</classname>
class and
containing a package name of
<classname>sub.dir</classname>
will generate a corresponding
<filename>sub/dir/Foo.class</filename>
class file.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Examples:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Java(target = 'classes', source = 'src')
env.Java(target = 'classes', source = ['src1', 'src2'])
env.Java(target = 'classes', source = ['File1.java', 'File2.java'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Java source files can use the native encoding for the underlying OS.
Since SCons compiles in simple ASCII mode by default,
the compiler will generate warnings about unmappable characters,
which may lead to errors as the file is processed further.
In this case, the user must specify the <literal>LANG</literal>
environment variable to tell the compiler what encoding is used.
For portibility, it's best if the encoding is hard-coded
so that the compile will work if it is done on a system
with a different encoding.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env = Environment()
env['ENV']['LANG'] = 'en_GB.UTF-8'
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-JavaH">
<term>
<function>JavaH()</function>
</term>
<term>
<function>env.JavaH()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds C header and source files for
implementing Java native methods.
The target can be either a directory
in which the header files will be written,
or a header file name which
will contain all of the definitions.
The source can be the names of <filename>.class</filename> files,
the names of <filename>.java</filename> files
to be compiled into <filename>.class</filename> files
by calling the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-Java"><function>Java</function></link> builder method,
or the objects returned from the
<function xmlns="http://www.scons.org/dbxsd/v1.0">Java</function>
builder method.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
If the construction variable
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-JAVACLASSDIR"><envar>$JAVACLASSDIR</envar></link>
is set, either in the environment
or in the call to the
<function xmlns="http://www.scons.org/dbxsd/v1.0">JavaH</function>
builder method itself,
then the value of the variable
will be stripped from the
beginning of any <filename>.class</filename> file names.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Examples:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# builds java_native.h
classes = env.Java(target = 'classdir', source = 'src')
env.JavaH(target = 'java_native.h', source = classes)
# builds include/package_foo.h and include/package_bar.h
env.JavaH(target = 'include',
source = ['package/foo.class', 'package/bar.class'])
# builds export/foo.h and export/bar.h
env.JavaH(target = 'export',
source = ['classes/foo.class', 'classes/bar.class'],
JAVACLASSDIR = 'classes')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Library">
<term>
<function>Library()</function>
</term>
<term>
<function>env.Library()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A synonym for the
<function xmlns="http://www.scons.org/dbxsd/v1.0">StaticLibrary</function>
builder method.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-LoadableModule">
<term>
<function>LoadableModule()</function>
</term>
<term>
<function>env.LoadableModule()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
On most systems,
this is the same as
<function xmlns="http://www.scons.org/dbxsd/v1.0">SharedLibrary</function>.
On Mac OS X (Darwin) platforms,
this creates a loadable module bundle.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-M4">
<term>
<function>M4()</function>
</term>
<term>
<function>env.M4()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds an output file from an M4 input file.
This uses a default <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-M4FLAGS"><envar>$M4FLAGS</envar></link> value of
<option>-E</option>,
which considers all warnings to be fatal
and stops on the first warning
when using the GNU version of m4.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.M4(target = 'foo.c', source = 'foo.c.m4')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Moc">
<term>
<function>Moc()</function>
</term>
<term>
<function>env.Moc()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds an output file from a moc input file. Moc input files are either
header files or cxx files. This builder is only available after using the
tool 'qt'. See the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-QTDIR"><envar>$QTDIR</envar></link> variable for more information.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Moc('foo.h') # generates moc_foo.cc
env.Moc('foo.cpp') # generates foo.moc
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-MOFiles">
<term>
<function>MOFiles()</function>
</term>
<term>
<function>env.MOFiles()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
This builder belongs to <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msgfmt"><literal>msgfmt</literal></link> tool. The builder compiles
<literal>PO</literal> files to <literal>MO</literal> files.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 1</emphasis>.
Create <filename>pl.mo</filename> and <filename>en.mo</filename> by compiling
<filename>pl.po</filename> and <filename>en.po</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.MOFiles(['pl', 'en'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 2</emphasis>.
Compile files for languages defined in <filename>LINGUAS</filename> file:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.MOFiles(LINGUAS_FILE = 1)
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 3</emphasis>.
Create <filename>pl.mo</filename> and <filename>en.mo</filename> by compiling
<filename>pl.po</filename> and <filename>en.po</filename> plus files for
languages defined in <filename>LINGUAS</filename> file:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.MOFiles(['pl', 'en'], LINGUAS_FILE = 1)
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 4</emphasis>.
Compile files for languages defined in <filename>LINGUAS</filename> file
(another version):
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env['LINGUAS_FILE'] = 1
env.MOFiles()
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-MSVSProject">
<term>
<function>MSVSProject()</function>
</term>
<term>
<function>env.MSVSProject()</function>
</term>
<listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0"> Builds a Microsoft Visual Studio project
file, and by default builds a solution file as well. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> This
builds a Visual Studio project file, based on the version of Visual Studio
that is configured (either the latest installed version, or the version
specified by <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link> in the Environment constructor). For
Visual Studio 6, it will generate a <filename>.dsp</filename> file. For Visual
Studio 7 (.NET) and later versions, it will generate a
<filename>.vcproj</filename> file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> By default, this also
generates a solution file for the specified project, a
<filename>.dsw</filename> file for Visual Studio 6 or a
<filename>.sln</filename> file for Visual Studio 7 (.NET). This behavior may
be disabled by specifying <literal>auto_build_solution=0</literal> when you
call <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function>, in which case you presumably want to build the solution
file(s) by calling the <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSSolution</function> Builder (see below). </para> <para xmlns="http://www.scons.org/dbxsd/v1.0">
The <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> builder takes several lists of filenames to be placed into
the project file. These are currently limited to <literal>srcs</literal>,
<literal>incs</literal>, <literal>localincs</literal>,
<literal>resources</literal>, and <literal>misc</literal>. These are pretty
self-explanatory, but it should be noted that these lists are added to the
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SOURCES"><envar>$SOURCES</envar></link> construction variable as strings, NOT as SCons File Nodes.
This is because they represent file names to be added to the project file, not
the source files used to build the project file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> The above
filename lists are all optional, although at least one must be specified for
the resulting project file to be non-empty. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> In addition to the
above lists of values, the following values may be specified:
</para><variablelist xmlns="http://www.scons.org/dbxsd/v1.0">
<varlistentry>
<term>target</term>
<listitem>
<para>The name of the target <filename>.dsp</filename> or
<filename>.vcproj</filename> file. The correct suffix for the version
of Visual Studio must be used, but the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSPROJECTSUFFIX"><envar>$MSVSPROJECTSUFFIX</envar></link>
construction variable will be defined to the correct value (see
example below).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>variant</term>
<listitem>
<para>The name of this particular variant. For Visual Studio 7
projects, this can also be a list of variant names. These are
typically things like "Debug" or "Release", but really can be anything
you want. For Visual Studio 7 projects, they may also specify a target
platform separated from the variant name by a <literal>|</literal>
(vertical pipe) character: <literal>Debug|Xbox</literal>. The default
target platform is Win32. Multiple calls to <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> with
different variants are allowed; all variants will be added to the
project file with their appropriate build targets and
sources.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>cmdargs</term>
<listitem>
<para>Additional command line arguments for the different
variants. The number of <literal>cmdargs</literal> entries must match
the number of <literal>variant</literal> entries, or be empty (not
specified). If you give only one, it will automatically be propagated
to all variants.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>buildtarget</term>
<listitem>
<para>An optional string, node, or list of strings or nodes (one
per build variant), to tell the Visual Studio debugger what output
target to use in what build variant. The number of
<literal>buildtarget</literal> entries must match the number of
<literal>variant</literal> entries.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>runfile</term>
<listitem>
<para>The name of the file that Visual Studio 7 and later will
run and debug. This appears as the value of the
<literal>Output</literal> field in the resulting Visual Studio project
file. If this is not specified, the default is the same as the
specified <literal>buildtarget</literal> value.</para>
</listitem>
</varlistentry>
</variablelist><para xmlns="http://www.scons.org/dbxsd/v1.0"> Note that because <application xmlns="http://www.scons.org/dbxsd/v1.0">SCons</application> always executes its build
commands from the directory in which the <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename> file is located, if you
generate a project file in a different directory than the <filename xmlns="http://www.scons.org/dbxsd/v1.0">SConstruct</filename>
directory, users will not be able to double-click on the file name in
compilation error messages displayed in the Visual Studio console output
window. This can be remedied by adding the Visual C/C++ <literal>/FC</literal>
compiler option to the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-CCFLAGS"><envar>$CCFLAGS</envar></link> variable so that the compiler will
print the full path name of any files that cause compilation errors. </para>
<para xmlns="http://www.scons.org/dbxsd/v1.0"> Example usage: </para> <example_commands xmlns="http://www.scons.org/dbxsd/v1.0">barsrcs = ['bar.cpp'],
barincs = ['bar.h'],
barlocalincs = ['StdAfx.h']
barresources = ['bar.rc','resource.h']
barmisc = ['bar_readme.txt']
dll = env.SharedLibrary(target = 'bar.dll',
source = barsrcs)
env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'],
srcs = barsrcs,
incs = barincs,
localincs = barlocalincs,
resources = barresources,
misc = barmisc,
buildtarget = dll,
variant = 'Release')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">Starting with version 2.4 of
SCons it's also possible to specify the optional argument
<parameter>DebugSettings</parameter>, which creates files for debugging under
Visual Studio:</para><variablelist xmlns="http://www.scons.org/dbxsd/v1.0">
<varlistentry>
<term>DebugSettings</term>
<listitem>
<para>A dictionary of debug settings that get written to the
<filename>.vcproj.user</filename> or the
<filename>.vcxproj.user</filename> file, depending on the version
installed. As it is done for cmdargs (see above), you can specify a
<parameter>DebugSettings</parameter> dictionary per variant. If you
give only one, it will be propagated to all variants.</para>
</listitem>
</varlistentry>
</variablelist><para xmlns="http://www.scons.org/dbxsd/v1.0">Currently, only Visual Studio v9.0 and Visual Studio
version v11 are implemented, for other versions no file is generated. To
generate the user file, you just need to add a
<parameter>DebugSettings</parameter> dictionary to the environment with the
right parameters for your MSVS version. If the dictionary is empty, or does
not contain any good value, no file will be generated.</para><para xmlns="http://www.scons.org/dbxsd/v1.0">Following
is a more contrived example, involving the setup of a project for variants and
DebugSettings:</para><example_commands xmlns="http://www.scons.org/dbxsd/v1.0"># Assuming you store your defaults in a file
vars = Variables('variables.py')
msvcver = vars.args.get('vc', '9')
# Check command args to force one Microsoft Visual Studio version
if msvcver == '9' or msvcver == '11':
env = Environment(MSVC_VERSION=msvcver+'.0', MSVC_BATCH=False)
else:
env = Environment()
AddOption('--userfile', action='store_true', dest='userfile', default=False,
help="Create Visual Studio Project user file")
#
# 1. Configure your Debug Setting dictionary with options you want in the list
# of allowed options, for instance if you want to create a user file to launch
# a specific application for testing your dll with Microsoft Visual Studio 2008 (v9):
#
V9DebugSettings = {
'Command':'c:\\myapp\\using\\thisdll.exe',
'WorkingDirectory': 'c:\\myapp\\using\\',
'CommandArguments': '-p password',
# 'Attach':'false',
# 'DebuggerType':'3',
# 'Remote':'1',
# 'RemoteMachine': None,
# 'RemoteCommand': None,
# 'HttpUrl': None,
# 'PDBPath': None,
# 'SQLDebugging': None,
# 'Environment': '',
# 'EnvironmentMerge':'true',
# 'DebuggerFlavor': None,
# 'MPIRunCommand': None,
# 'MPIRunArguments': None,
# 'MPIRunWorkingDirectory': None,
# 'ApplicationCommand': None,
# 'ApplicationArguments': None,
# 'ShimCommand': None,
# 'MPIAcceptMode': None,
# 'MPIAcceptFilter': None,
}
#
# 2. Because there are a lot of different options depending on the Microsoft
# Visual Studio version, if you use more than one version you have to
# define a dictionary per version, for instance if you want to create a user
# file to launch a specific application for testing your dll with Microsoft
# Visual Studio 2012 (v11):
#
V10DebugSettings = {
'LocalDebuggerCommand': 'c:\\myapp\\using\\thisdll.exe',
'LocalDebuggerWorkingDirectory': 'c:\\myapp\\using\\',
'LocalDebuggerCommandArguments': '-p password',
# 'LocalDebuggerEnvironment': None,
# 'DebuggerFlavor': 'WindowsLocalDebugger',
# 'LocalDebuggerAttach': None,
# 'LocalDebuggerDebuggerType': None,
# 'LocalDebuggerMergeEnvironment': None,
# 'LocalDebuggerSQLDebugging': None,
# 'RemoteDebuggerCommand': None,
# 'RemoteDebuggerCommandArguments': None,
# 'RemoteDebuggerWorkingDirectory': None,
# 'RemoteDebuggerServerName': None,
# 'RemoteDebuggerConnection': None,
# 'RemoteDebuggerDebuggerType': None,
# 'RemoteDebuggerAttach': None,
# 'RemoteDebuggerSQLDebugging': None,
# 'DeploymentDirectory': None,
# 'AdditionalFiles': None,
# 'RemoteDebuggerDeployDebugCppRuntime': None,
# 'WebBrowserDebuggerHttpUrl': None,
# 'WebBrowserDebuggerDebuggerType': None,
# 'WebServiceDebuggerHttpUrl': None,
# 'WebServiceDebuggerDebuggerType': None,
# 'WebServiceDebuggerSQLDebugging': None,
}
#
# 3. Select the dictionary you want depending on the version of visual Studio
# Files you want to generate.
#
if not env.GetOption('userfile'):
dbgSettings = None
elif env.get('MSVC_VERSION', None) == '9.0':
dbgSettings = V9DebugSettings
elif env.get('MSVC_VERSION', None) == '11.0':
dbgSettings = V10DebugSettings
else:
dbgSettings = None
#
# 4. Add the dictionary to the DebugSettings keyword.
#
barsrcs = ['bar.cpp', 'dllmain.cpp', 'stdafx.cpp']
barincs = ['targetver.h']
barlocalincs = ['StdAfx.h']
barresources = ['bar.rc','resource.h']
barmisc = ['ReadMe.txt']
dll = env.SharedLibrary(target = 'bar.dll',
source = barsrcs)
env.MSVSProject(target = 'Bar' + env['MSVSPROJECTSUFFIX'],
srcs = barsrcs,
incs = barincs,
localincs = barlocalincs,
resources = barresources,
misc = barmisc,
buildtarget = [dll[0]] * 2,
variant = ('Debug|Win32', 'Release|Win32'),
cmdargs = 'vc=%s' % msvcver,
DebugSettings = (dbgSettings, {}))
</example_commands> </listitem>
</varlistentry>
<varlistentry id="b-MSVSSolution">
<term>
<function>MSVSSolution()</function>
</term>
<term>
<function>env.MSVSSolution()</function>
</term>
<listitem> <para xmlns="http://www.scons.org/dbxsd/v1.0">Builds a Microsoft Visual Studio solution
file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0">This builds a Visual Studio solution file, based on the
version of Visual Studio that is configured (either the latest installed
version, or the version specified by <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVS_VERSION"><envar>$MSVS_VERSION</envar></link> in the
construction environment). For Visual Studio 6, it will generate a
<filename>.dsw</filename> file. For Visual Studio 7 (.NET), it will generate a
<filename>.sln</filename> file. </para> <para xmlns="http://www.scons.org/dbxsd/v1.0"> The following values must be
specified: </para><variablelist xmlns="http://www.scons.org/dbxsd/v1.0">
<varlistentry>
<term>target</term>
<listitem>
<para>The name of the target .dsw or .sln file. The correct
suffix for the version of Visual Studio must be used, but the value
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-MSVSSOLUTIONSUFFIX"><envar>$MSVSSOLUTIONSUFFIX</envar></link> will be defined to the correct value (see
example below).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>variant</term>
<listitem>
<para>The name of this particular variant, or a list of variant
names (the latter is only supported for MSVS 7 solutions). These are
typically things like "Debug" or "Release", but really can be anything
you want. For MSVS 7 they may also specify target platform, like this
"Debug|Xbox". Default platform is Win32.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>projects</term>
<listitem>
<para>A list of project file names, or Project nodes returned by
calls to the <function xmlns="http://www.scons.org/dbxsd/v1.0">MSVSProject</function> Builder, to be placed into the solution
file. It should be noted that these file names are NOT added to the
$SOURCES environment variable in form of files, but rather as strings.
This is because they represent file names to be added to the solution
file, not the source files used to build the solution
file.</para>
</listitem>
</varlistentry>
</variablelist> <para xmlns="http://www.scons.org/dbxsd/v1.0"> Example Usage: </para> <example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.MSVSSolution(target = 'Bar' + env['MSVSSOLUTIONSUFFIX'], projects = ['bar'
+ env['MSVSPROJECTSUFFIX']], variant = 'Release')
</example_commands></listitem>
</varlistentry>
<varlistentry id="b-Object">
<term>
<function>Object()</function>
</term>
<term>
<function>env.Object()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
A synonym for the
<function xmlns="http://www.scons.org/dbxsd/v1.0">StaticObject</function>
builder method.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-Package">
<term>
<function>Package()</function>
</term>
<term>
<function>env.Package()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a Binary Package of the given source files.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Package(source = FindInstalledFiles())
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds software distribution packages.
Packages consist of files to install and packaging information.
The former may be specified with the <varname xmlns="http://www.scons.org/dbxsd/v1.0">source</varname> parameter and may be left out,
in which case the <function xmlns="http://www.scons.org/dbxsd/v1.0">FindInstalledFiles</function> function will collect
all files that have an <function xmlns="http://www.scons.org/dbxsd/v1.0">Install</function> or <function xmlns="http://www.scons.org/dbxsd/v1.0">InstallAs</function> Builder attached.
If the <varname xmlns="http://www.scons.org/dbxsd/v1.0">target</varname> is not specified
it will be deduced from additional information given to this Builder.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The packaging information is specified
with the help of construction variables documented below.
This information is called a tag to stress that
some of them can also be attached to files with the <function xmlns="http://www.scons.org/dbxsd/v1.0">Tag</function> function.
The mandatory ones will complain if they were not specified.
They vary depending on chosen target packager.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The target packager may be selected with the "PACKAGETYPE" command line
option or with the <envar xmlns="http://www.scons.org/dbxsd/v1.0">$PACKAGETYPE</envar> construction variable. Currently
the following packagers available:
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
* msi - Microsoft Installer
* rpm - Redhat Package Manger
* ipkg - Itsy Package Management System
* tarbz2 - compressed tar
* targz - compressed tar
* zip - zip file
* src_tarbz2 - compressed tar source
* src_targz - compressed tar source
* src_zip - zip file source
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
An updated list is always available under the "package_type" option when
running "scons --help" on a project that has packaging activated.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env = Environment(tools=['default', 'packaging'])
env.Install('/bin/', 'my_program')
env.Package( NAME = 'foo',
VERSION = '1.2.3',
PACKAGEVERSION = 0,
PACKAGETYPE = 'rpm',
LICENSE = 'gpl',
SUMMARY = 'balalalalal',
DESCRIPTION = 'this should be really really long',
X_RPM_GROUP = 'Application/fu',
SOURCE_URL = 'http://foo.org/foo-1.2.3.tar.gz'
)
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-PCH">
<term>
<function>PCH()</function>
</term>
<term>
<function>env.PCH()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a Microsoft Visual C++ precompiled header.
Calling this builder method
returns a list of two targets: the PCH as the first element, and the object
file as the second element. Normally the object file is ignored.
This builder method is only
provided when Microsoft Visual C++ is being used as the compiler.
The PCH builder method is generally used in
conjunction with the PCH construction variable to force object files to use
the precompiled header:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env['PCH'] = env.PCH('StdAfx.cpp')[0]
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-PDF">
<term>
<function>PDF()</function>
</term>
<term>
<function>env.PDF()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a <filename>.pdf</filename> file
from a <filename>.dvi</filename> input file
(or, by extension, a <filename>.tex</filename>,
<filename>.ltx</filename>,
or
<filename>.latex</filename> input file).
The suffix specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-PDFSUFFIX"><envar>$PDFSUFFIX</envar></link> construction variable
(<filename>.pdf</filename> by default)
is added automatically to the target
if it is not already present. Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# builds from aaa.tex
env.PDF(target = 'aaa.pdf', source = 'aaa.tex')
# builds bbb.pdf from bbb.dvi
env.PDF(target = 'bbb', source = 'bbb.dvi')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-POInit">
<term>
<function>POInit()</function>
</term>
<term>
<function>env.POInit()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
This builder belongs to <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msginit"><literal>msginit</literal></link> tool. The builder initializes missing
<literal>PO</literal> file(s) if <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POAUTOINIT"><envar>$POAUTOINIT</envar></link> is set. If
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POAUTOINIT"><envar>$POAUTOINIT</envar></link> is not set (default), <function xmlns="http://www.scons.org/dbxsd/v1.0">POInit</function> prints instruction for
user (that is supposed to be a translator), telling how the
<literal>PO</literal> file should be initialized. In normal projects
<emphasis>you should not use <function xmlns="http://www.scons.org/dbxsd/v1.0">POInit</function> and use <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POUpdate"><function>POUpdate</function></link>
instead</emphasis>. <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POUpdate"><function>POUpdate</function></link> chooses intelligently between
<command>msgmerge(1)</command> and <command>msginit(1)</command>. <function xmlns="http://www.scons.org/dbxsd/v1.0">POInit</function>
always uses <command>msginit(1)</command> and should be regarded as builder for
special purposes or for temporary use (e.g. for quick, one time initialization
of a bunch of <literal>PO</literal> files) or for tests.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Target nodes defined through <function xmlns="http://www.scons.org/dbxsd/v1.0">POInit</function> are not built by default (they're
<literal>Ignore</literal>d from <literal>'.'</literal> node) but are added to
special <literal>Alias</literal> (<literal>'po-create'</literal> by default).
The alias name may be changed through the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POCREATE_ALIAS"><envar>$POCREATE_ALIAS</envar></link>
construction variable. All <literal>PO</literal> files defined through
<function xmlns="http://www.scons.org/dbxsd/v1.0">POInit</function> may be easily initialized by <command>scons po-create</command>.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 1</emphasis>.
Initialize <filename>en.po</filename> and <filename>pl.po</filename> from
<filename>messages.pot</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POInit(['en', 'pl']) # messages.pot --> [en.po, pl.po]
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 2</emphasis>.
Initialize <filename>en.po</filename> and <filename>pl.po</filename> from
<filename>foo.pot</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POInit(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.po]
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 3</emphasis>.
Initialize <filename>en.po</filename> and <filename>pl.po</filename> from
<filename>foo.pot</filename> but using <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POTDOMAIN"><envar>$POTDOMAIN</envar></link> construction
variable:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po]
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 4</emphasis>.
Initialize <literal>PO</literal> files for languages defined in
<filename>LINGUAS</filename> file. The files will be initialized from template
<filename>messages.pot</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 5</emphasis>.
Initialize <filename>en.po</filename> and <filename>pl.pl</filename>
<literal>PO</literal> files plus files for languages defined in
<filename>LINGUAS</filename> file. The files will be initialized from template
<filename>messages.pot</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POInit(['en', 'pl'], LINGUAS_FILE = 1)
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 6</emphasis>.
You may preconfigure your environment first, and then initialize
<literal>PO</literal> files:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env['POAUTOINIT'] = 1
env['LINGUAS_FILE'] = 1
env['POTDOMAIN'] = 'foo'
env.POInit()
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
which has same efect as:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POInit(POAUTOINIT = 1, LINGUAS_FILE = 1, POTDOMAIN = 'foo')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-PostScript">
<term>
<function>PostScript()</function>
</term>
<term>
<function>env.PostScript()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a <filename>.ps</filename> file
from a <filename>.dvi</filename> input file
(or, by extension, a <filename>.tex</filename>,
<filename>.ltx</filename>,
or
<filename>.latex</filename> input file).
The suffix specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-PSSUFFIX"><envar>$PSSUFFIX</envar></link> construction variable
(<filename>.ps</filename> by default)
is added automatically to the target
if it is not already present. Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# builds from aaa.tex
env.PostScript(target = 'aaa.ps', source = 'aaa.tex')
# builds bbb.ps from bbb.dvi
env.PostScript(target = 'bbb', source = 'bbb.dvi')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-POTUpdate">
<term>
<function>POTUpdate()</function>
</term>
<term>
<function>env.POTUpdate()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The builder belongs to <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-xgettext"><literal>xgettext</literal></link> tool. The builder updates target
<literal>POT</literal> file if exists or creates one if it doesn't. The node is
not built by default (i.e. it is <literal>Ignore</literal>d from
<literal>'.'</literal>), but only on demand (i.e. when given
<literal>POT</literal> file is required or when special alias is invoked). This
builder adds its targe node (<filename>messages.pot</filename>, say) to a
special alias (<literal>pot-update</literal> by default, see
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POTUPDATE_ALIAS"><envar>$POTUPDATE_ALIAS</envar></link>) so you can update/create them easily with
<command>scons pot-update</command>. The file is not written until there is no
real change in internationalized messages (or in comments that enter
<literal>POT</literal> file).
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<note> <para>You may see <command>xgettext(1)</command> being invoked by the
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-xgettext"><literal>xgettext</literal></link> tool even if there is no real change in internationalized
messages (so the <literal>POT</literal> file is not being updated). This
happens every time a source file has changed. In such case we invoke
<command>xgettext(1)</command> and compare its output with the content of
<literal>POT</literal> file to decide whether the file should be updated or
not.</para></note>
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 1.</emphasis>
Let's create <filename>po/</filename> directory and place following
<filename>SConstruct</filename> script there:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConstruct in 'po/' subdir
env = Environment( tools = ['default', 'xgettext'] )
env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp'])
env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Then invoke scons few times:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
user@host:$ scons # Does not create foo.pot nor bar.pot
user@host:$ scons foo.pot # Updates or creates foo.pot
user@host:$ scons pot-update # Updates or creates foo.pot and bar.pot
user@host:$ scons -c # Does not clean foo.pot nor bar.pot.
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
the results shall be as the comments above say.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 2.</emphasis>
The <function xmlns="http://www.scons.org/dbxsd/v1.0">POTUpdate</function> builder may be used with no target specified, in which
case default target <filename>messages.pot</filename> will be used. The
default target may also be overridden by setting <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POTDOMAIN"><envar>$POTDOMAIN</envar></link> construction
variable or providing it as an override to <function xmlns="http://www.scons.org/dbxsd/v1.0">POTUpdate</function> builder:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConstruct script
env = Environment( tools = ['default', 'xgettext'] )
env['POTDOMAIN'] = "foo"
env.POTUpdate(source = ["a.cpp", "b.cpp"]) # Creates foo.pot ...
env.POTUpdate(POTDOMAIN = "bar", source = ["c.cpp", "d.cpp"]) # and bar.pot
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 3.</emphasis>
The sources may be specified within separate file, for example
<filename>POTFILES.in</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# POTFILES.in in 'po/' subdirectory
../a.cpp
../b.cpp
# end of file
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The name of the file (<filename>POTFILES.in</filename>) containing the list of
sources is provided via <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-XGETTEXTFROM"><envar>$XGETTEXTFROM</envar></link>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConstruct file in 'po/' subdirectory
env = Environment( tools = ['default', 'xgettext'] )
env.POTUpdate(XGETTEXTFROM = 'POTFILES.in')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 4.</emphasis>
You may use <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-XGETTEXTPATH"><envar>$XGETTEXTPATH</envar></link> to define source search path. Assume, for
example, that you have files <filename>a.cpp</filename>,
<filename>b.cpp</filename>, <filename>po/SConstruct</filename>,
<filename>po/POTFILES.in</filename>. Then your <literal>POT</literal>-related
files could look as below:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# POTFILES.in in 'po/' subdirectory
a.cpp
b.cpp
# end of file
</example_commands>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConstruct file in 'po/' subdirectory
env = Environment( tools = ['default', 'xgettext'] )
env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH='../')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 5.</emphasis>
Multiple search directories may be defined within a list, i.e.
<literal>XGETTEXTPATH = ['dir1', 'dir2', ...]</literal>. The order in the list
determines the search order of source files. The path to the first file found
is used.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Let's create <filename>0/1/po/SConstruct</filename> script:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConstruct file in '0/1/po/' subdirectory
env = Environment( tools = ['default', 'xgettext'] )
env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../', '../../'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
and <filename>0/1/po/POTFILES.in</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# POTFILES.in in '0/1/po/' subdirectory
a.cpp
# end of file
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Write two <filename>*.cpp</filename> files, the first one is
<filename>0/a.cpp</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
/* 0/a.cpp */
gettext("Hello from ../../a.cpp")
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
and the second is <filename>0/1/a.cpp</filename>:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
/* 0/1/a.cpp */
gettext("Hello from ../a.cpp")
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
then run scons. You'll obtain <literal>0/1/po/messages.pot</literal> with the
message <literal>"Hello from ../a.cpp"</literal>. When you reverse order in
<varname>$XGETTEXTFOM</varname>, i.e. when you write SConscript as
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConstruct file in '0/1/po/' subdirectory
env = Environment( tools = ['default', 'xgettext'] )
env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
then the <filename>messages.pot</filename> will contain
<literal>msgid "Hello from ../../a.cpp"</literal> line and not
<literal>msgid "Hello from ../a.cpp"</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-POUpdate">
<term>
<function>POUpdate()</function>
</term>
<term>
<function>env.POUpdate()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The builder belongs to <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msgmerge"><literal>msgmerge</literal></link> tool. The builder updates
<literal>PO</literal> files with <command>msgmerge(1)</command>, or initializes
missing <literal>PO</literal> files as described in documentation of
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-msginit"><literal>msginit</literal></link> tool and <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POInit"><function>POInit</function></link> builder (see also
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POAUTOINIT"><envar>$POAUTOINIT</envar></link>). Note, that <function xmlns="http://www.scons.org/dbxsd/v1.0">POUpdate</function> <emphasis>does not add its
targets to <literal>po-create</literal> alias</emphasis> as <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POInit"><function>POInit</function></link>
does.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Target nodes defined through <function xmlns="http://www.scons.org/dbxsd/v1.0">POUpdate</function> are not built by default
(they're <literal>Ignore</literal>d from <literal>'.'</literal> node). Instead,
they are added automatically to special <literal>Alias</literal>
(<literal>'po-update'</literal> by default). The alias name may be changed
through the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POUPDATE_ALIAS"><envar>$POUPDATE_ALIAS</envar></link> construction variable. You can easily
update <literal>PO</literal> files in your project by <command>scons
po-update</command>.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 1.</emphasis>
Update <filename>en.po</filename> and <filename>pl.po</filename> from
<filename>messages.pot</filename> template (see also <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POTDOMAIN"><envar>$POTDOMAIN</envar></link>),
assuming that the later one exists or there is rule to build it (see
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POTUpdate"><function>POTUpdate</function></link>):
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POUpdate(['en','pl']) # messages.pot --> [en.po, pl.po]
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 2.</emphasis>
Update <filename>en.po</filename> and <filename>pl.po</filename> from
<filename>foo.pot</filename> template:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POUpdate(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.pl]
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 3.</emphasis>
Update <filename>en.po</filename> and <filename>pl.po</filename> from
<filename>foo.pot</filename> (another version):
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POUpdate(['en', 'pl'], POTDOMAIN='foo') # foo.pot -- > [en.po, pl.pl]
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 4.</emphasis>
Update files for languages defined in <filename>LINGUAS</filename> file. The
files are updated from <filename>messages.pot</filename> template:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POUpdate(LINGUAS_FILE = 1) # needs 'LINGUAS' file
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 5.</emphasis>
Same as above, but update from <filename>foo.pot</filename> template:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POUpdate(LINGUAS_FILE = 1, source = ['foo'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 6.</emphasis>
Update <filename>en.po</filename> and <filename>pl.po</filename> plus files for
languages defined in <filename>LINGUAS</filename> file. The files are updated
from <filename>messages.pot</filename> template:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# produce 'en.po', 'pl.po' + files defined in 'LINGUAS':
env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1)
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 7.</emphasis>
Use <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POAUTOINIT"><envar>$POAUTOINIT</envar></link> to automatically initialize <literal>PO</literal> file
if it doesn't exist:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env.POUpdate(LINGUAS_FILE = 1, POAUTOINIT = 1)
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 8.</emphasis>
Update <literal>PO</literal> files for languages defined in
<filename>LINGUAS</filename> file. The files are updated from
<filename>foo.pot</filename> template. All necessary settings are
pre-configured via environment.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# ...
env['POAUTOINIT'] = 1
env['LINGUAS_FILE'] = 1
env['POTDOMAIN'] = 'foo'
env.POUpdate()
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Program">
<term>
<function>Program()</function>
</term>
<term>
<function>env.Program()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds an executable given one or more object files
or C, C++, D, or Fortran source files.
If any C, C++, D or Fortran source files are specified,
then they will be automatically
compiled to object files using the
<function xmlns="http://www.scons.org/dbxsd/v1.0">Object</function>
builder method;
see that builder method's description for
a list of legal source file suffixes
and how they are interpreted.
The target executable file prefix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-PROGPREFIX"><envar>$PROGPREFIX</envar></link> construction variable; nothing by default)
and suffix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-PROGSUFFIX"><envar>$PROGSUFFIX</envar></link> construction variable;
by default, <filename>.exe</filename> on Windows systems,
nothing on POSIX systems)
are automatically added to the target if not already present.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Program(target = 'foo', source = ['foo.o', 'bar.c', 'baz.f'])
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-RES">
<term>
<function>RES()</function>
</term>
<term>
<function>env.RES()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a Microsoft Visual C++ resource file.
This builder method is only provided
when Microsoft Visual C++ or MinGW is being used as the compiler. The
<filename>.res</filename>
(or
<filename>.o</filename>
for MinGW) suffix is added to the target name if no other suffix is given.
The source
file is scanned for implicit dependencies as though it were a C file.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.RES('resource.rc')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-RMIC">
<term>
<function>RMIC()</function>
</term>
<term>
<function>env.RMIC()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds stub and skeleton class files
for remote objects
from Java <filename>.class</filename> files.
The target is a directory
relative to which the stub
and skeleton class files will be written.
The source can be the names of <filename>.class</filename> files,
or the objects return from the
<function xmlns="http://www.scons.org/dbxsd/v1.0">Java</function>
builder method.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
If the construction variable
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-JAVACLASSDIR"><envar>$JAVACLASSDIR</envar></link>
is set, either in the environment
or in the call to the
<function xmlns="http://www.scons.org/dbxsd/v1.0">RMIC</function>
builder method itself,
then the value of the variable
will be stripped from the
beginning of any <filename>.class </filename>
file names.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
classes = env.Java(target = 'classdir', source = 'src')
env.RMIC(target = 'outdir1', source = classes)
env.RMIC(target = 'outdir2',
source = ['package/foo.class', 'package/bar.class'])
env.RMIC(target = 'outdir3',
source = ['classes/foo.class', 'classes/bar.class'],
JAVACLASSDIR = 'classes')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-RPCGenClient">
<term>
<function>RPCGenClient()</function>
</term>
<term>
<function>env.RPCGenClient()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Generates an RPC client stub (<filename>_clnt.c</filename>) file
from a specified RPC (<filename>.x</filename>) source file.
Because rpcgen only builds output files
in the local directory,
the command will be executed
in the source file's directory by default.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# Builds src/rpcif_clnt.c
env.RPCGenClient('src/rpcif.x')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-RPCGenHeader">
<term>
<function>RPCGenHeader()</function>
</term>
<term>
<function>env.RPCGenHeader()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Generates an RPC header (<filename>.h</filename>) file
from a specified RPC (<filename>.x</filename>) source file.
Because rpcgen only builds output files
in the local directory,
the command will be executed
in the source file's directory by default.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# Builds src/rpcif.h
env.RPCGenHeader('src/rpcif.x')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-RPCGenService">
<term>
<function>RPCGenService()</function>
</term>
<term>
<function>env.RPCGenService()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Generates an RPC server-skeleton (<filename>_svc.c</filename>) file
from a specified RPC (<filename>.x</filename>) source file.
Because rpcgen only builds output files
in the local directory,
the command will be executed
in the source file's directory by default.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# Builds src/rpcif_svc.c
env.RPCGenClient('src/rpcif.x')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-RPCGenXDR">
<term>
<function>RPCGenXDR()</function>
</term>
<term>
<function>env.RPCGenXDR()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Generates an RPC XDR routine (<filename>_xdr.c</filename>) file
from a specified RPC (<filename>.x</filename>) source file.
Because rpcgen only builds output files
in the local directory,
the command will be executed
in the source file's directory by default.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# Builds src/rpcif_xdr.c
env.RPCGenClient('src/rpcif.x')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-SharedLibrary">
<term>
<function>SharedLibrary()</function>
</term>
<term>
<function>env.SharedLibrary()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a shared library
(<filename>.so</filename> on a POSIX system,
<filename>.dll</filename> on Windows)
given one or more object files
or C, C++, D or Fortran source files.
If any source files are given,
then they will be automatically
compiled to object files.
The static library prefix and suffix (if any)
are automatically added to the target.
The target library file prefix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SHLIBPREFIX"><envar>$SHLIBPREFIX</envar></link> construction variable;
by default, <filename>lib</filename> on POSIX systems,
nothing on Windows systems)
and suffix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SHLIBSUFFIX"><envar>$SHLIBSUFFIX</envar></link> construction variable;
by default, <filename>.dll</filename> on Windows systems,
<filename>.so</filename> on POSIX systems)
are automatically added to the target if not already present.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.SharedLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
On Windows systems, the
<function xmlns="http://www.scons.org/dbxsd/v1.0">SharedLibrary</function>
builder method will always build an import
(<filename>.lib</filename>) library
in addition to the shared (<filename>.dll</filename>) library,
adding a <filename>.lib</filename> library with the same basename
if there is not already a <filename>.lib</filename> file explicitly
listed in the targets.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
On Cygwin systems, the
<function xmlns="http://www.scons.org/dbxsd/v1.0">SharedLibrary</function>
builder method will always build an import
(<filename>.dll.a</filename>) library
in addition to the shared (<filename>.dll</filename>) library,
adding a <filename>.dll.a</filename> library with the same basename
if there is not already a <filename>.dll.a</filename> file explicitly
listed in the targets.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Any object files listed in the
<literal>source</literal>
must have been built for a shared library
(that is, using the
<function xmlns="http://www.scons.org/dbxsd/v1.0">SharedObject</function>
builder method).
<filename xmlns="http://www.scons.org/dbxsd/v1.0">scons</filename>
will raise an error if there is any mismatch.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
On some platforms, there is a distinction between a shared library
(loaded automatically by the system to resolve external references)
and a loadable module (explicitly loaded by user action).
For maximum portability, use the <function xmlns="http://www.scons.org/dbxsd/v1.0">LoadableModule</function> builder for the latter.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
When the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SHLIBVERSION"><envar>$SHLIBVERSION</envar></link> construction variable is defined a versioned
shared library is created. This modifies the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SHLINKFLAGS"><envar>$SHLINKFLAGS</envar></link> as required,
adds the version number to the library name, and creates the symlinks that
are needed.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.SharedLibrary(target = 'bar', source = ['bar.c', 'foo.o'], SHLIBVERSION='1.5.2')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
On a POSIX system, versions with a single token create exactly one symlink:
libbar.so.6 would have symlinks libbar.so only.
On a POSIX system, versions with two or more
tokens create exactly two symlinks: libbar.so.2.3.1 would have symlinks
libbar.so and libbar.so.2; on a Darwin (OSX) system the library would be
libbar.2.3.1.dylib and the link would be libbar.dylib.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
On Windows systems, specifying
<literal>register=1</literal>
will cause the <filename>.dll</filename> to be
registered after it is built using REGSVR32.
The command that is run
("regsvr32" by default) is determined by <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-REGSVR"><envar>$REGSVR</envar></link> construction
variable, and the flags passed are determined by <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-REGSVRFLAGS"><envar>$REGSVRFLAGS</envar></link>. By
default, <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-REGSVRFLAGS"><envar>$REGSVRFLAGS</envar></link> includes the <option>/s</option> option,
to prevent dialogs from popping
up and requiring user attention when it is run. If you change
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-REGSVRFLAGS"><envar>$REGSVRFLAGS</envar></link>, be sure to include the <option>/s</option> option.
For example,
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.SharedLibrary(target = 'bar',
source = ['bar.cxx', 'foo.obj'],
register=1)
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
will register <filename>bar.dll</filename> as a COM object
when it is done linking it.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-SharedObject">
<term>
<function>SharedObject()</function>
</term>
<term>
<function>env.SharedObject()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds an object file for
inclusion in a shared library.
Source files must have one of the same set of extensions
specified above for the
<function xmlns="http://www.scons.org/dbxsd/v1.0">StaticObject</function>
builder method.
On some platforms building a shared object requires additional
compiler option
(e.g. <option>-fPIC</option> for gcc)
in addition to those needed to build a
normal (static) object, but on some platforms there is no difference between a
shared object and a normal (static) one. When there is a difference, SCons
will only allow shared objects to be linked into a shared library, and will
use a different suffix for shared objects. On platforms where there is no
difference, SCons will allow both normal (static)
and shared objects to be linked into a
shared library, and will use the same suffix for shared and normal
(static) objects.
The target object file prefix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SHOBJPREFIX"><envar>$SHOBJPREFIX</envar></link> construction variable;
by default, the same as <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-OBJPREFIX"><envar>$OBJPREFIX</envar></link>)
and suffix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-SHOBJSUFFIX"><envar>$SHOBJSUFFIX</envar></link> construction variable)
are automatically added to the target if not already present.
Examples:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.SharedObject(target = 'ddd', source = 'ddd.c')
env.SharedObject(target = 'eee.o', source = 'eee.cpp')
env.SharedObject(target = 'fff.obj', source = 'fff.for')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Note that the source files will be scanned
according to the suffix mappings in the
<literal>SourceFileScanner</literal>
object.
See the section "Scanner Objects,"
below, for more information.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-StaticLibrary">
<term>
<function>StaticLibrary()</function>
</term>
<term>
<function>env.StaticLibrary()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a static library given one or more object files
or C, C++, D or Fortran source files.
If any source files are given,
then they will be automatically
compiled to object files.
The static library prefix and suffix (if any)
are automatically added to the target.
The target library file prefix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-LIBPREFIX"><envar>$LIBPREFIX</envar></link> construction variable;
by default, <filename>lib</filename> on POSIX systems,
nothing on Windows systems)
and suffix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-LIBSUFFIX"><envar>$LIBSUFFIX</envar></link> construction variable;
by default, <filename>.lib</filename> on Windows systems,
<filename>.a</filename> on POSIX systems)
are automatically added to the target if not already present.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.StaticLibrary(target = 'bar', source = ['bar.c', 'foo.o'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Any object files listed in the
<literal>source</literal>
must have been built for a static library
(that is, using the
<function xmlns="http://www.scons.org/dbxsd/v1.0">StaticObject</function>
builder method).
<filename xmlns="http://www.scons.org/dbxsd/v1.0">scons</filename>
will raise an error if there is any mismatch.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-StaticObject">
<term>
<function>StaticObject()</function>
</term>
<term>
<function>env.StaticObject()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a static object file
from one or more C, C++, D, or Fortran source files.
Source files must have one of the following extensions:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
.asm assembly language file
.ASM assembly language file
.c C file
.C Windows: C file
POSIX: C++ file
.cc C++ file
.cpp C++ file
.cxx C++ file
.cxx C++ file
.c++ C++ file
.C++ C++ file
.d D file
.f Fortran file
.F Windows: Fortran file
POSIX: Fortran file + C pre-processor
.for Fortran file
.FOR Fortran file
.fpp Fortran file + C pre-processor
.FPP Fortran file + C pre-processor
.m Object C file
.mm Object C++ file
.s assembly language file
.S Windows: assembly language file
ARM: CodeSourcery Sourcery Lite
.sx assembly language file + C pre-processor
POSIX: assembly language file + C pre-processor
.spp assembly language file + C pre-processor
.SPP assembly language file + C pre-processor
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The target object file prefix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-OBJPREFIX"><envar>$OBJPREFIX</envar></link> construction variable; nothing by default)
and suffix
(specified by the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-OBJSUFFIX"><envar>$OBJSUFFIX</envar></link> construction variable;
<filename>.obj</filename> on Windows systems,
<filename>.o</filename> on POSIX systems)
are automatically added to the target if not already present.
Examples:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.StaticObject(target = 'aaa', source = 'aaa.c')
env.StaticObject(target = 'bbb.o', source = 'bbb.c++')
env.StaticObject(target = 'ccc.obj', source = 'ccc.f')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Note that the source files will be scanned
according to the suffix mappings in
<literal>SourceFileScanner</literal>
object.
See the section "Scanner Objects,"
below, for more information.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-Substfile">
<term>
<function>Substfile()</function>
</term>
<term>
<function>env.Substfile()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The <function xmlns="http://www.scons.org/dbxsd/v1.0">Substfile</function> builder creates a single text file from another file or set of
files by concatenating them with <envar xmlns="http://www.scons.org/dbxsd/v1.0">$LINESEPARATOR</envar> and replacing text
using the <envar xmlns="http://www.scons.org/dbxsd/v1.0">$SUBST_DICT</envar> construction variable. Nested lists of source files
are flattened. See also <function xmlns="http://www.scons.org/dbxsd/v1.0">Textfile</function>.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
If a single source file is present with an <filename>.in</filename> suffix,
the suffix is stripped and the remainder is used as the default target name.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The prefix and suffix specified by the <envar xmlns="http://www.scons.org/dbxsd/v1.0">$SUBSTFILEPREFIX</envar>
and <envar xmlns="http://www.scons.org/dbxsd/v1.0">$SUBSTFILESUFFIX</envar> construction variables
(the null string by default in both cases)
are automatically added to the target if they are not already present.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
If a construction variable named <envar xmlns="http://www.scons.org/dbxsd/v1.0">$SUBST_DICT</envar> is present,
it may be either a Python dictionary or a sequence of (key,value) tuples.
If it is a dictionary it is converted into a list of tuples in an arbitrary order,
so if one key is a prefix of another key
or if one substitution could be further expanded by another subsitition,
it is unpredictable whether the expansion will occur.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Any occurrences of a key in the source
are replaced by the corresponding value,
which may be a Python callable function or a string.
If the value is a callable, it is called with no arguments to get a string.
Strings are <emphasis>subst</emphasis>-expanded
and the result replaces the key.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env = Environment(tools = ['default', 'textfile'])
env['prefix'] = '/usr/bin'
script_dict = {'@prefix@': '/bin', @exec_prefix@: '$prefix'}
env.Substfile('script.in', SUBST_DICT = script_dict)
conf_dict = {'%VERSION%': '1.2.3', '%BASE%': 'MyProg'}
env.Substfile('config.h.in', conf_dict, SUBST_DICT = conf_dict)
# UNPREDICTABLE - one key is a prefix of another
bad_foo = {'$foo': '$foo', '$foobar': '$foobar'}
env.Substfile('foo.in', SUBST_DICT = bad_foo)
# PREDICTABLE - keys are applied longest first
good_foo = [('$foobar', '$foobar'), ('$foo', '$foo')]
env.Substfile('foo.in', SUBST_DICT = good_foo)
# UNPREDICTABLE - one substitution could be futher expanded
bad_bar = {'@bar@': '@soap@', '@soap@': 'lye'}
env.Substfile('bar.in', SUBST_DICT = bad_bar)
# PREDICTABLE - substitutions are expanded in order
good_bar = (('@bar@', '@soap@'), ('@soap@', 'lye'))
env.Substfile('bar.in', SUBST_DICT = good_bar)
# the SUBST_DICT may be in common (and not an override)
substutions = {}
subst = Environment(tools = ['textfile'], SUBST_DICT = substitutions)
substitutions['@foo@'] = 'foo'
subst['SUBST_DICT']['@bar@'] = 'bar'
subst.Substfile('pgm1.c', [Value('#include "@foo@.h"'),
Value('#include "@bar@.h"'),
"common.in",
"pgm1.in"
])
subst.Substfile('pgm2.c', [Value('#include "@foo@.h"'),
Value('#include "@bar@.h"'),
"common.in",
"pgm2.in"
])
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Tar">
<term>
<function>Tar()</function>
</term>
<term>
<function>env.Tar()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a tar archive of the specified files
and/or directories.
Unlike most builder methods,
the
<function xmlns="http://www.scons.org/dbxsd/v1.0">Tar</function>
builder method may be called multiple times
for a given target;
each additional call
adds to the list of entries
that will be built into the archive.
Any source directories will
be scanned for changes to
any on-disk files,
regardless of whether or not
<filename xmlns="http://www.scons.org/dbxsd/v1.0">scons</filename>
knows about them from other Builder or function calls.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Tar('src.tar', 'src')
# Create the stuff.tar file.
env.Tar('stuff', ['subdir1', 'subdir2'])
# Also add "another" to the stuff.tar file.
env.Tar('stuff', 'another')
# Set TARFLAGS to create a gzip-filtered archive.
env = Environment(TARFLAGS = '-c -z')
env.Tar('foo.tar.gz', 'foo')
# Also set the suffix to .tgz.
env = Environment(TARFLAGS = '-c -z',
TARSUFFIX = '.tgz')
env.Tar('foo')
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Textfile">
<term>
<function>Textfile()</function>
</term>
<term>
<function>env.Textfile()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The <function xmlns="http://www.scons.org/dbxsd/v1.0">Textfile</function> builder generates a single text file.
The source strings constitute the lines;
nested lists of sources are flattened.
<envar xmlns="http://www.scons.org/dbxsd/v1.0">$LINESEPARATOR</envar> is used to separate the strings.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
If present, the <envar xmlns="http://www.scons.org/dbxsd/v1.0">$SUBST_DICT</envar> construction variable
is used to modify the strings before they are written;
see the <function xmlns="http://www.scons.org/dbxsd/v1.0">Substfile</function> description for details.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The prefix and suffix specified by the <envar xmlns="http://www.scons.org/dbxsd/v1.0">$TEXTFILEPREFIX</envar>
and <envar xmlns="http://www.scons.org/dbxsd/v1.0">$TEXTFILESUFFIX</envar> construction variables
(the null string and <filename>.txt</filename> by default, respectively)
are automatically added to the target if they are not already present.
Examples:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# builds/writes foo.txt
env.Textfile(target = 'foo.txt', source = ['Goethe', 42, 'Schiller'])
# builds/writes bar.txt
env.Textfile(target = 'bar',
source = ['lalala', 'tanteratei'],
LINESEPARATOR='|*')
# nested lists are flattened automatically
env.Textfile(target = 'blob',
source = ['lalala', ['Goethe', 42 'Schiller'], 'tanteratei'])
# files may be used as input by wraping them in File()
env.Textfile(target = 'concat', # concatenate files with a marker between
source = [File('concat1'), File('concat2')],
LINESEPARATOR = '====================\n')
Results are:
foo.txt
....8<----
Goethe
42
Schiller
....8<---- (no linefeed at the end)
bar.txt:
....8<----
lalala|*tanteratei
....8<---- (no linefeed at the end)
blob.txt
....8<----
lalala
Goethe
42
Schiller
tanteratei
....8<---- (no linefeed at the end)
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Translate">
<term>
<function>Translate()</function>
</term>
<term>
<function>env.Translate()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
This pseudo-builder belongs to <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="t-gettext"><literal>gettext</literal></link> toolset. The builder extracts
internationalized messages from source files, updates <literal>POT</literal>
template (if necessary) and then updates <literal>PO</literal> translations (if
necessary). If <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POAUTOINIT"><envar>$POAUTOINIT</envar></link> is set, missing <literal>PO</literal> files
will be automatically created (i.e. without translator person intervention).
The variables <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-LINGUAS_FILE"><envar>$LINGUAS_FILE</envar></link> and <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-POTDOMAIN"><envar>$POTDOMAIN</envar></link> are taken into
acount too. All other construction variables used by <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POTUpdate"><function>POTUpdate</function></link>, and
<link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="b-POUpdate"><function>POUpdate</function></link> work here too.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 1</emphasis>.
The simplest way is to specify input files and output languages inline in
a SCons script when invoking <function xmlns="http://www.scons.org/dbxsd/v1.0">Translate</function>
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConscript in 'po/' directory
env = Environment( tools = ["default", "gettext"] )
env['POAUTOINIT'] = 1
env.Translate(['en','pl'], ['../a.cpp','../b.cpp'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 2</emphasis>.
If you wish, you may also stick to conventional style known from
<productname>autotools</productname>, i.e. using
<filename>POTFILES.in</filename> and <filename>LINGUAS</filename> files
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# LINGUAS
en pl
#end
</example_commands>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# POTFILES.in
a.cpp
b.cpp
# end
</example_commands>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConscript
env = Environment( tools = ["default", "gettext"] )
env['POAUTOINIT'] = 1
env['XGETTEXTPATH'] = ['../']
env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
The last approach is perhaps the recommended one. It allows easily split
internationalization/localization onto separate SCons scripts, where a script
in source tree is responsible for translations (from sources to
<literal>PO</literal> files) and script(s) under variant directories are
responsible for compilation of <literal>PO</literal> to <literal>MO</literal>
files to and for installation of <literal>MO</literal> files. The "gluing
factor" synchronizing these two scripts is then the content of
<filename>LINGUAS</filename> file. Note, that the updated
<literal>POT</literal> and <literal>PO</literal> files are usually going to be
committed back to the repository, so they must be updated within the source
directory (and not in variant directories). Additionaly, the file listing of
<filename>po/</filename> directory contains <filename>LINGUAS</filename> file,
so the source tree looks familiar to translators, and they may work with the
project in their usual way.
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<emphasis>Example 3</emphasis>.
Let's prepare a development tree as below
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
project/
+ SConstruct
+ build/
+ src/
+ po/
+ SConscript
+ SConscript.i18n
+ POTFILES.in
+ LINGUAS
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
with <filename>build</filename> being variant directory. Write the top-level
<filename>SConstruct</filename> script as follows
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# SConstruct
env = Environment( tools = ["default", "gettext"] )
VariantDir('build', 'src', duplicate = 0)
env['POAUTOINIT'] = 1
SConscript('src/po/SConscript.i18n', exports = 'env')
SConscript('build/po/SConscript', exports = 'env')
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
the <filename>src/po/SConscript.i18n</filename> as
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# src/po/SConscript.i18n
Import('env')
env.Translate(LINGUAS_FILE=1, XGETTEXTFROM='POTFILES.in', XGETTEXTPATH=['../'])
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
and the <filename>src/po/SConscript</filename>
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
# src/po/SConscript
Import('env')
env.MOFiles(LINGUAS_FILE = 1)
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Such setup produces <literal>POT</literal> and <literal>PO</literal> files
under source tree in <filename>src/po/</filename> and binary
<literal>MO</literal> files under variant tree in
<filename>build/po/</filename>. This way the <literal>POT</literal> and
<literal>PO</literal> files are separated from other output files, which must
not be committed back to source repositories (e.g. <literal>MO</literal>
files).
</para>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
<note><para>In above example, the <literal>PO</literal> files are not updated,
nor created automatically when you issue <command>scons '.'</command> command.
The files must be updated (created) by hand via <command>scons
po-update</command> and then <literal>MO</literal> files can be compiled by
running <command>scons '.'</command>.</para></note>
</para>
</listitem>
</varlistentry>
<varlistentry id="b-TypeLibrary">
<term>
<function>TypeLibrary()</function>
</term>
<term>
<function>env.TypeLibrary()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a Windows type library (<filename>.tlb</filename>)
file from an input IDL file (<filename>.idl</filename>).
In addition, it will build the associated interface stub and
proxy source files,
naming them according to the base name of the <filename>.idl</filename> file.
For example,
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.TypeLibrary(source="foo.idl")
</example_commands>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Will create <filename>foo.tlb</filename>,
<filename>foo.h</filename>,
<filename>foo_i.c</filename>,
<filename>foo_p.c</filename>
and
<filename>foo_data.c</filename>
files.
</para>
</listitem>
</varlistentry>
<varlistentry id="b-Uic">
<term>
<function>Uic()</function>
</term>
<term>
<function>env.Uic()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a header file, an implementation file and a moc file from an ui file.
and returns the corresponding nodes in the above order.
This builder is only available after using the tool 'qt'. Note: you can
specify <filename>.ui</filename> files directly as source
files to the <function xmlns="http://www.scons.org/dbxsd/v1.0">Program</function>,
<function xmlns="http://www.scons.org/dbxsd/v1.0">Library</function> and <function xmlns="http://www.scons.org/dbxsd/v1.0">SharedLibrary</function> builders
without using this builder. Using this builder lets you override the standard
naming conventions (be careful: prefixes are always prepended to names of
built files; if you don't want prefixes, you may set them to ``).
See the <link xmlns="http://www.scons.org/dbxsd/v1.0" linkend="cv-QTDIR"><envar>$QTDIR</envar></link> variable for more information.
Example:
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Uic('foo.ui') # -> ['foo.h', 'uic_foo.cc', 'moc_foo.cc']
env.Uic(target = Split('include/foo.h gen/uicfoo.cc gen/mocfoo.cc'),
source = 'foo.ui') # -> ['include/foo.h', 'gen/uicfoo.cc', 'gen/mocfoo.cc']
</example_commands>
</listitem>
</varlistentry>
<varlistentry id="b-Zip">
<term>
<function>Zip()</function>
</term>
<term>
<function>env.Zip()</function>
</term>
<listitem>
<para xmlns="http://www.scons.org/dbxsd/v1.0">
Builds a zip archive of the specified files
and/or directories.
Unlike most builder methods,
the
<function xmlns="http://www.scons.org/dbxsd/v1.0">Zip</function>
builder method may be called multiple times
for a given target;
each additional call
adds to the list of entries
that will be built into the archive.
Any source directories will
be scanned for changes to
any on-disk files,
regardless of whether or not
<filename xmlns="http://www.scons.org/dbxsd/v1.0">scons</filename>
knows about them from other Builder or function calls.
</para>
<example_commands xmlns="http://www.scons.org/dbxsd/v1.0">
env.Zip('src.zip', 'src')
# Create the stuff.zip file.
env.Zip('stuff', ['subdir1', 'subdir2'])
# Also add "another" to the stuff.tar file.
env.Zip('stuff', 'another')
</example_commands>
</listitem>
</varlistentry>
</variablelist>
|