| 403 | | |
|---|
| 404 | | |
|---|
| 405 | | -put this somewhere- |
|---|
| 406 | | When a library is installed via DSSS, the .d files are translated into .di (D |
|---|
| 407 | | import) files, which are then installed to /include/d with the appropriate |
|---|
| 408 | | names. These D import files contain references to the library itself, which |
|---|
| 409 | | allows DSSS to include it when necessary without the user specifying it. |
|---|
| 410 | | |
|---|
| 411 | | |
|---|
| 412 | | |
|---|
| 413 | | == OLD CONTENT (please ignore) == |
|---|
| 414 | | |
|---|
| 415 | | DSSS is a tool to: |
|---|
| 416 | | |
|---|
| 417 | | * Build D software. |
|---|
| 418 | | * Install D software. |
|---|
| 419 | | * Configure D software dependencies and libraries. |
|---|
| 420 | | * Maintain a repository of DSSS-compatible D sources to be easily installable |
|---|
| 421 | | via the Internet. |
|---|
| 422 | | |
|---|
| 423 | | To the average software engineer, the most important part is dsss.conf, the |
|---|
| 424 | | file added to your source code to configure how DSSS will compile it. |
|---|
| 425 | | |
|---|
| 426 | | dsss.conf is a plain-text file, with a similar syntax to Windows INI files. It |
|---|
| 427 | | can have any number of sections, each of which is headed with a name in |
|---|
| 428 | | brackets, like so: |
|---|
| 429 | | [foo/bar.d] |
|---|
| 430 | | |
|---|
| 431 | | |
|---|
| 432 | | Most sections are named by a source file or directory. In general, sections |
|---|
| 433 | | named for source files will generate binaries, and sections named for |
|---|
| 434 | | directories will generate libraries. However, you can manually specify a |
|---|
| 435 | | binary, library or sourcelibrary (like a library, but not compiled until it's |
|---|
| 436 | | used in a binary) with the type setting: |
|---|
| 437 | | [wholedirbinary] |
|---|
| 438 | | type=binary |
|---|
| 439 | | |
|---|
| 440 | | [onefilelibrary.d] |
|---|
| 441 | | type=library |
|---|
| 442 | | |
|---|
| 443 | | [onefilesrclib.d] |
|---|
| 444 | | type=sourcelibrary |
|---|
| 445 | | |
|---|
| 446 | | |
|---|
| 447 | | In each section, there can be any number of settings. Each setting is a |
|---|
| 448 | | keyword, possibly followed by = or += and a value. For example, the "target" |
|---|
| 449 | | setting sets the name of the output binary or library in a given section: |
|---|
| 450 | | [main.d] |
|---|
| 451 | | target=dzip |
|---|
| 452 | | |
|---|
| 453 | | (In general, the target setting will be automatically set to something |
|---|
| 454 | | sensible) |
|---|
| 455 | | |
|---|
| 456 | | |
|---|
| 457 | | Sections creating libraries from directories will normally include all the .d |
|---|
| 458 | | files in that directory or any subdirectory of it. It is also possible to |
|---|
| 459 | | specify subdirectories explicitly in dsss.conf, which will cause some .d files |
|---|
| 460 | | to be reassigned. For example, if you have these files: |
|---|
| 461 | | dzip/algorithm.d, foo/compression/zip.d |
|---|
| 462 | | and a section: |
|---|
| 463 | | [dzip] |
|---|
| 464 | | then the produced library will include algorithm.d and zip.d. |
|---|
| 465 | | If you have two sections: |
|---|
| 466 | | [dzip] |
|---|
| 467 | | [dzip/compression] |
|---|
| 468 | | then two libraries will be produced: The library from 'dzip' will contain |
|---|
| 469 | | algorithm.d, and the library from [dzip/compression] will contain zip.d. |
|---|
| 470 | | |
|---|
| 471 | | |
|---|
| 472 | | Furthermore, content in dsss.conf can be set up as version-specific, with a |
|---|
| 473 | | version keyword similar to the version keyword in D. For example, to make sure |
|---|
| 474 | | that a certain binary is only produced on Windows: |
|---|
| 475 | | version (Windows) { |
|---|
| 476 | | [dzip/windows.d] |
|---|
| 477 | | target=dzip_for_windows |
|---|
| 478 | | } |
|---|
| 479 | | |
|---|
| 480 | | The version keyword in dsss.conf also supports negation: |
|---|
| 481 | | version (!Windows) { |
|---|
| 482 | | [dzip/nonwindows.d] |
|---|
| 483 | | target=dzip_for_nonwindows |
|---|
| 484 | | } |
|---|
| 485 | | |
|---|
| 486 | | The version statement also supports an 'else' clause: |
|---|
| 487 | | version (Windows) { |
|---|
| 488 | | [foo/windows.d] |
|---|
| 489 | | target=foo_for_windows |
|---|
| 490 | | } else { |
|---|
| 491 | | [foo/notwindows.d] |
|---|
| 492 | | target=foo_for_notwindows |
|---|
| 493 | | } |
|---|
| 494 | | |
|---|
| 495 | | The version statement in dsss.conf has a fairly strict syntax: the { must be on |
|---|
| 496 | | the same line as the statement, and the version being tested must be in |
|---|
| 497 | | parenthesis. |
|---|
| 498 | | |
|---|
| 499 | | |
|---|
| 500 | | There are quite a few other settings supported: |
|---|
| 501 | | |
|---|
| 502 | | * exclude |
|---|
| 503 | | * Exclude a list of .d files from being included in a library: |
|---|
| 504 | | exclude=foo.d bar.d |
|---|
| 505 | | |
|---|
| 506 | | * buildflags |
|---|
| 507 | | * Flags that will be added to the command line for rebuild when building this |
|---|
| 508 | | section. |
|---|
| 509 | | |
|---|
| 510 | | * prebuild, preinstall, preclean, predigen, postbuild, postinstall, postclean, |
|---|
| 511 | | postdigen |
|---|
| 512 | | * Commands to be run before or after (pre or post) building (build), |
|---|
| 513 | | installing (install), cleaning (clean) or generating .di files (digen) for |
|---|
| 514 | | the current section. Can be any number of ;-separated commands, and |
|---|
| 515 | | supports some special command types: |
|---|
| 516 | | * .d files. If a .d file is specified as a command, it will be compiled and |
|---|
| 517 | | run. |
|---|
| 518 | | * Notably, D files can always use DSSS' headers. That is, the package |
|---|
| 519 | | 'sss'. |
|---|
| 520 | | |
|---|
| 521 | | * install: DSSS has an internal 'install' command, which takes the |
|---|
| 522 | | following syntax: |
|---|
| 523 | | install <file> <target directory> |
|---|
| 524 | | |
|---|
| 525 | | * eval: Run a command (.d file or otherwise), and execute its result |
|---|
| 526 | | * For example, the command could print "install chosen/file/to/install |
|---|
| 527 | | $INCLUDE_PREFIX" |
|---|
| 528 | | |
|---|
| 529 | | * set: Set a setting in DSSS' environment. The syntax is as follows: |
|---|
| 530 | | * set <section>.<setting> <value> |
|---|
| 531 | | * You may use * to apply a setting to all sections, or simply exclude the |
|---|
| 532 | | section (but still include the .) to set a global setting. |
|---|
| 533 | | * This is most useful when used via eval, as in: |
|---|
| 534 | | eval detectsettings.d |
|---|
| 535 | | |
|---|
| 536 | | * add: Like set, but adds to a setting. |
|---|
| 537 | | |
|---|
| 538 | | * In any command, you can use environment variables with a '$', such as |
|---|
| 539 | | $PREFIX. The following environment variables are provided by DSSS: |
|---|
| 540 | | * $DSSS : The dsss binary, if you need to call DSSS recursively. Better |
|---|
| 541 | | than counting on it being on the PATH. |
|---|
| 542 | | |
|---|
| 543 | | * $PREFIX : The prefix to which the software is being installed. |
|---|
| 544 | | |
|---|
| 545 | | * $BIN_PREFIX : The prefix to which binaries are being installed. |
|---|
| 546 | | |
|---|
| 547 | | * $LIB_PREFIX : The prefix to which libraries are being installed. |
|---|
| 548 | | |
|---|
| 549 | | * $INCLUDE_PREFIX : The prefix to which generated .di interface files are |
|---|
| 550 | | being installed. |
|---|
| 551 | | * This is the /base/ prefix, so for example the module foo.bar will be |
|---|
| 552 | | installed to $INCLUDE_PREFIX/foo/bar.di |
|---|
| 553 | | * This directory can also be used for .d files. |
|---|
| 554 | | |
|---|
| 555 | | * $DOC_PREFIX : The prefix to which documentation is installed. |
|---|
| 556 | | |
|---|
| 557 | | * $ETC_PREFIX : The prefix to which configuration files are being |
|---|
| 558 | | installed. |
|---|
| 559 | | |
|---|
| 560 | | |
|---|
| 561 | | Furthermore, there is a global section for settings which are not specific to |
|---|
| 562 | | any binary or library. You can add settings to this section simply by adding |
|---|
| 563 | | them before any section declarations, or by making an empty section declaration |
|---|
| 564 | | like so: |
|---|
| 565 | | [] |
|---|
| 566 | | global_setting=0 |
|---|
| 567 | | |
|---|
| 568 | | The important global settings are 'name' (which will otherwise be gleaned from |
|---|
| 569 | | the directory name) and 'version' (which will otherwise be set to 'latest'). |
|---|
| 570 | | With these settings, a dsss.conf file would conventionally look something like |
|---|
| 571 | | this: |
|---|
| 572 | | name = dzip |
|---|
| 573 | | version = 1.0 |
|---|
| 574 | | [dzip.d] |
|---|
| 575 | | target = dzip |
|---|
| 576 | | |
|---|
| 577 | | |
|---|
| 578 | | There is also a global setting, "requires", which may be used to explicitly |
|---|
| 579 | | list dependencies: |
|---|
| 580 | | requires = bintod |
|---|
| 581 | | In general, it is NOT necessary to use this setting, as DSSS will detect |
|---|
| 582 | | dependencies based on what is imported from the D source. |
|---|
| 583 | | |
|---|
| 584 | | |
|---|
| 585 | | It is possible to add a setting to all sections with the special [*] section: |
|---|
| 586 | | name = dzip |
|---|
| 587 | | version = 1.0 |
|---|
| 588 | | [*] |
|---|
| 589 | | buildflags=-g |
|---|
| 590 | | [main.d] |
|---|
| 591 | | target = dzipper |
|---|
| 592 | | [dzip] |
|---|
| 593 | | |
|---|
| 594 | | |
|---|
| 595 | | You can make 'special' build steps, which do not correspond to D source files |
|---|
| 596 | | and so do not call the build tool, by naming them prefixed with a +. For |
|---|
| 597 | | example: |
|---|
| 598 | | [+genSource] |
|---|
| 599 | | prebuild = gensource.d |
|---|
| 600 | | |
|---|
| 601 | | |
|---|
| 602 | | It is possible to have source files spread out through several directories, and |
|---|
| 603 | | to support this in dsss.conf there is the special type "subdir": |
|---|
| 604 | | [subtool] |
|---|
| 605 | | type = subdir |
|---|
| 606 | | |
|---|
| 607 | | Each subdirectory must have its own dsss.conf . Note that setting type=subdir |
|---|
| 608 | | will cause DSSS to recurse into that directory, but will not cause that |
|---|
| 609 | | directory to be visible at compile time. If you want that feature, you will |
|---|
| 610 | | need to add -I flags to buildflags: |
|---|
| 611 | | name = dzip |
|---|
| 612 | | version = 1.0 |
|---|
| 613 | | [*] |
|---|
| 614 | | buildflags=-g -Isubtool |
|---|
| 615 | | [subtool] |
|---|
| 616 | | type = subdir |
|---|
| 617 | | [main.d] |
|---|
| 618 | | target = dzipper |
|---|
| 619 | | [dzip] |
|---|
| 620 | | |
|---|
| 621 | | |
|---|
| 622 | | At build time, sections will be handled in the order that they appear in the |
|---|
| 623 | | dsss.conf file, with the exception that binaries are always built last. By |
|---|
| 624 | | default, every section will be built. This can be overridden with the global |
|---|
| 625 | | option 'defaulttargets', which allows you to specify a list of targets to build |
|---|
| 626 | | by default. All targets will be built if 'all' is explicitly specified on the |
|---|
| 627 | | command line. |
|---|