| 1 |
DSSS is a tool to: |
|---|
| 2 |
|
|---|
| 3 |
* Build D software. |
|---|
| 4 |
* Install D software. |
|---|
| 5 |
* Configure D software dependencies and libraries. |
|---|
| 6 |
* Maintain a repository of DSSS-compatible D sources to be easily installable |
|---|
| 7 |
via the Internet. |
|---|
| 8 |
|
|---|
| 9 |
To the average software engineer, the most important part is dsss.conf, the |
|---|
| 10 |
file added to your source code to configure how DSSS will compile it. |
|---|
| 11 |
|
|---|
| 12 |
dsss.conf is a plain-text file, with a similar syntax to Windows INI files. It |
|---|
| 13 |
can have any number of sections, each of which is headed with the name in |
|---|
| 14 |
brackets, like so: |
|---|
| 15 |
[foo/bar.d] |
|---|
| 16 |
|
|---|
| 17 |
Each section is named by a source file or directory. In general, sections named |
|---|
| 18 |
for source files will generate binaries, and sections named for directories |
|---|
| 19 |
will generate libraries, which are set up through DSSS to be equivalent to D |
|---|
| 20 |
packages. |
|---|
| 21 |
|
|---|
| 22 |
In each section, there can be any number of settings. Each setting is a |
|---|
| 23 |
keyword, possibly followed by = or += and a value. For example, the "target" |
|---|
| 24 |
setting sets the name of the output binary or library in a given section: |
|---|
| 25 |
target=foobar |
|---|
| 26 |
(In general, the target setting will be automatically set to something |
|---|
| 27 |
sensible) |
|---|
| 28 |
|
|---|
| 29 |
Furthermore, any amount of content in dsss.conf can be set up as version- |
|---|
| 30 |
specific, with a version keyword similar to the version keyword in D. For |
|---|
| 31 |
example, to make sure that a certain binary is only produced on Windows: |
|---|
| 32 |
version (Windows) { |
|---|
| 33 |
[foo/windows.d] |
|---|
| 34 |
target=foo_for_windows |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
The version statement in dsss.conf has a fairly strict syntax: the { must be on |
|---|
| 38 |
the same line as the statement, and the version being tested must be in |
|---|
| 39 |
parenthesis. Unlike D, DSSS' version statement supports the ! (not) operator: |
|---|
| 40 |
version (!Windows) { |
|---|
| 41 |
[foo/nowindows.d] |
|---|
| 42 |
target=foo_for_notwindows |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
The version statement also supports an 'else' clause: |
|---|
| 46 |
version (Windows) { |
|---|
| 47 |
[foo/windows.d] |
|---|
| 48 |
target=foo_for_windows |
|---|
| 49 |
} else { |
|---|
| 50 |
[foo/notwindows.d] |
|---|
| 51 |
target=foo_for_notwindows |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
There are quite a few other settings supported, such as: |
|---|
| 56 |
|
|---|
| 57 |
* exclude |
|---|
| 58 |
* Exclude a list of .d files from being included in a library: |
|---|
| 59 |
exclude=foo.d bar.d |
|---|
| 60 |
|
|---|
| 61 |
* prebuild, preinstall, preclean, postbuild, postinstall, postclean |
|---|
| 62 |
* Commands to be run before/after building/installing/cleaning. Can be any |
|---|
| 63 |
number of ;-separated commands, and supports some special command types: |
|---|
| 64 |
* .d files. If a .d file is specified as a command, it will be compiled and |
|---|
| 65 |
run. |
|---|
| 66 |
* Notably, D files can always use DSSS' headers. That is, the package |
|---|
| 67 |
'sss'. |
|---|
| 68 |
|
|---|
| 69 |
* install: DSSS has an internal 'install' command, which takes the |
|---|
| 70 |
following syntax: |
|---|
| 71 |
* install <file> <target directory> |
|---|
| 72 |
|
|---|
| 73 |
* eval: Run a command (.d file or otherwise), and execute its result |
|---|
| 74 |
* For example, the command could print "install chosen/file/to/install |
|---|
| 75 |
$INCLUDE_PREFIX" |
|---|
| 76 |
|
|---|
| 77 |
* set: Set a setting in DSSS' environment. The syntax is as follows: |
|---|
| 78 |
* set <section>.<setting> <value> |
|---|
| 79 |
* You may use * to apply a setting to all sections, or simply exclude the |
|---|
| 80 |
section (but still include the .) to set a global setting. |
|---|
| 81 |
|
|---|
| 82 |
* add: Like set, but adds to a setting. |
|---|
| 83 |
|
|---|
| 84 |
* In any command, you can use environment variables with a '$', such as |
|---|
| 85 |
$PREFIX. The following environment variables are provided by DSSS: |
|---|
| 86 |
* $DSSS : The dsss binary, if you need to call DSSS recursively. Better |
|---|
| 87 |
than counting on it being on the PATH. |
|---|
| 88 |
|
|---|
| 89 |
* $PREFIX : The prefix to which the software is being installed. |
|---|
| 90 |
|
|---|
| 91 |
* $BIN_PREFIX : The prefix to which binaries are being installed. |
|---|
| 92 |
|
|---|
| 93 |
* $LIB_PREFIX : The prefix to which libraries are being installed. |
|---|
| 94 |
|
|---|
| 95 |
* $INCLUDE_PREFIX : The prefix to which generated .di interface files are |
|---|
| 96 |
being installed. |
|---|
| 97 |
* This is the /base/ prefix, so for example the module foo.bar will be |
|---|
| 98 |
installed to $INCLUDE_PREFIX/foo/bar.di |
|---|
| 99 |
* This directory can also be used for .d files. |
|---|
| 100 |
|
|---|
| 101 |
* $ETC_PREFIX : The prefix to which configuration files are being |
|---|
| 102 |
installed. |
|---|
| 103 |
|
|---|
| 104 |
* buildflags |
|---|
| 105 |
* Flags that will be added to the output to build/bud when building this |
|---|
| 106 |
section. |
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
Furthermore, there is a global section for settings which are not specific to |
|---|
| 110 |
any binary or library. You can add settings to this section simply by adding |
|---|
| 111 |
them before any section declarations, or by making an empty section declaration |
|---|
| 112 |
like so: |
|---|
| 113 |
[] |
|---|
| 114 |
global_setting=0 |
|---|
| 115 |
|
|---|
| 116 |
The important global settings are 'name' (which will otherwise be gleaned from |
|---|
| 117 |
the directory name) and 'version' (which will otherwise be set to 'latest'). |
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
It is possible to add a setting to all sections with the special [*] section. |
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
You can make 'special' build steps, which do not correspond to source files, by |
|---|
| 124 |
naming them prefixed with a +. For example: |
|---|
| 125 |
[+genSource] |
|---|
| 126 |
prebuild = gensource.d |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
You can also recurse into subdirectories, by specifying the subdirectory as a |
|---|
| 130 |
section and setting the type to "subdir": |
|---|
| 131 |
[subtool] |
|---|
| 132 |
type = subdir |
|---|