| 67 | | = FLAGS = |
|---|
| 68 | | |
|---|
| 69 | | Any section may have a 'buildflags' setting, which specifies the flags to be |
|---|
| 70 | | used while building that section. For example, |
|---|
| 71 | | buildflags=-O |
|---|
| 72 | | |
|---|
| 73 | | = BINARIES = |
|---|
| 74 | | |
|---|
| 75 | | Sections which are named for D modules (.d files) produce executable binaries |
|---|
| 76 | | when built with DSSS. The target binary file name will be deduced from the name |
|---|
| 77 | | of the .d file, or can be set explicitly with a 'target' line, such as: |
|---|
| 78 | | [example.d] |
|---|
| 79 | | target=example_binary |
|---|
| 80 | | |
|---|
| 81 | | Windows users: Be careful not to set the target of a binary build to the name of |
|---|
| 82 | | a directory. This will work on Windows because it gains the .exe suffix, but |
|---|
| 83 | | will fail on other operating systems. |
|---|
| 84 | | |
|---|
| 85 | | = LIBRARIES = |
|---|
| 86 | | |
|---|
| 87 | | Sections which are named for D packages (directories) produce libraries when |
|---|
| 88 | | built with DSSS. The name of the library file is derived from the name of the |
|---|
| 89 | | package and the platform. There is no reason to remember this name, however, |
|---|
| 90 | | because DSSS will detect library dependencies and link them in automatically. |
|---|
| 91 | | This name can partially be overridden if desired, in the same way as binaries: |
|---|
| 92 | | [mydpackage] |
|---|
| 93 | | target=dlibrary |
|---|
| 94 | | |
|---|
| 95 | | However, the platform will always affect the output library name. On POSIX |
|---|
| 96 | | systems, the above library will be named libSdlibrary.a and libdlibrary.so. On |
|---|
| 97 | | Windows, the above library will be named Sdlibrary.lib. |
|---|
| 98 | | |
|---|
| 99 | | By default, all of the .d files within the directory and any subdirectory will |
|---|
| 100 | | be included in the library. Files may be excluded with the 'exclude' setting: |
|---|
| 101 | | [mydpackage] |
|---|
| 102 | | exclude=mydpackage/broken.d |
|---|
| 103 | | |
|---|
| 104 | | Entire directories may also be excluded: |
|---|
| 105 | | [mydpackage] |
|---|
| 106 | | exclude=mydpackage/brokenpackage |
|---|
| 107 | | |
|---|
| 108 | | The 'exclude' setting is useful in concert with versioning, described in a later |
|---|
| 109 | | section. |
|---|
| 110 | | |
|---|
| 111 | | = SOURCE LIBRARIES = |
|---|
| 112 | | |
|---|
| 113 | | Source libraries are libraries which are not compiled until they are used in a |
|---|
| 114 | | binary. They are installed in their source form. Otherwise, they act identically |
|---|
| 115 | | to normal libraries. A source library may be specified by setting the 'type' |
|---|
| 116 | | setting to 'sourcelibrary': |
|---|
| 117 | | [mydpackage] |
|---|
| 118 | | type=sourcelibrary |
|---|
| 119 | | |
|---|
| 120 | | = SPECIAL SECTIONS = |
|---|
| 121 | | |
|---|
| 122 | | It is also possible to create sections which are not associated with compiling |
|---|
| 123 | | a binary or library. These sections are given names starting with a '+', such |
|---|
| 124 | | as: |
|---|
| 125 | | [+generate] |
|---|
| 126 | | |
|---|
| 127 | | The utility of these sections will be seen below, in the section on hooks. |
|---|
| 128 | | |
|---|
| 129 | | |
|---|
| 130 | | == INSTALLATION == |
|---|
| 131 | | |
|---|
| 132 | | DSSS is capable of installing binaries and libraries to a predetermined |
|---|
| 133 | | directory, usually the prefix in which it is installed. When libraries are |
|---|
| 134 | | installed in this way, they will be usable by DSSS without being explicitly |
|---|
| 135 | | specified. |
|---|
| 136 | | |
|---|
| 137 | | |
|---|
| 138 | | == HOOKS == |
|---|
| 139 | | |
|---|
| 140 | | DSSS can run arbitrary commands while building software. There are a number of |
|---|
| 141 | | points at which commands can be run: before and after building, before and after |
|---|
| 142 | | installing, and before and after cleaning up. These commands are added to |
|---|
| 143 | | 'prebuild', 'postbuild', 'preinstall', 'postinstall', 'preclean' and 'postclean' |
|---|
| 144 | | lines, respectively. |
|---|
| 145 | | |
|---|
| 146 | | Hook commands can be anything which can be run on the shell of the host system, |
|---|
| 147 | | such as: |
|---|
| 148 | | prebuild = echo Hello |
|---|
| 149 | | |
|---|
| 150 | | Any number of hook commands may be strung together between semicolons: |
|---|
| 151 | | prebuild = echo Hello ; echo World |
|---|
| 152 | | |
|---|
| 153 | | And may span multiple lines by ending each line with a backslash: |
|---|
| 154 | | prebuild = echo \ |
|---|
| 155 | | Hello ; \ |
|---|
| 156 | | echo World |
|---|
| 157 | | |
|---|
| 158 | | Hook commands may include references to environment variables: |
|---|
| 159 | | prebuild = echo $PREFIX |
|---|
| | 74 | Settings may include references to environment variables: |
|---|
| | 75 | a=$PREFIX |
|---|
| | 85 | DSSS: The full path to the DSSS binary itself. |
|---|
| | 86 | DSSS_BUILD: The full path to the build tool being used by DSSS (usually |
|---|
| | 87 | rebuild). |
|---|
| | 88 | |
|---|
| | 89 | = FLAGS = |
|---|
| | 90 | |
|---|
| | 91 | Any section may have a 'buildflags' setting, which specifies the flags to be |
|---|
| | 92 | used while building that section. For example, |
|---|
| | 93 | buildflags=-O |
|---|
| | 94 | |
|---|
| | 95 | = SECTION TYPES = |
|---|
| | 96 | |
|---|
| | 97 | Although section types are usually determined automatically from the section |
|---|
| | 98 | name, they may also be overridden with the 'type' setting: |
|---|
| | 99 | [oneFileLib.d] |
|---|
| | 100 | type=library |
|---|
| | 101 | |
|---|
| | 102 | The valid values for 'type' (all described in later sections) are: |
|---|
| | 103 | binary |
|---|
| | 104 | library |
|---|
| | 105 | sourcelibrary |
|---|
| | 106 | special |
|---|
| | 107 | subdir |
|---|
| | 108 | |
|---|
| | 109 | = BINARIES = |
|---|
| | 110 | |
|---|
| | 111 | Sections which are named for D modules (.d files) produce executable binaries |
|---|
| | 112 | when built with DSSS. The target binary file name will be deduced from the name |
|---|
| | 113 | of the .d file, or can be set explicitly with a 'target' line, such as: |
|---|
| | 114 | [example.d] |
|---|
| | 115 | target=example_binary |
|---|
| | 116 | |
|---|
| | 117 | Windows users: Be careful not to set the target of a binary build to the name of |
|---|
| | 118 | a directory. This will work on Windows because it gains the .exe suffix, but |
|---|
| | 119 | will fail on other operating systems. |
|---|
| | 120 | |
|---|
| | 121 | = LIBRARIES = |
|---|
| | 122 | |
|---|
| | 123 | Sections which are named for D packages (directories) produce libraries when |
|---|
| | 124 | built with DSSS. The name of the library file is derived from the name of the |
|---|
| | 125 | package and the platform. There is no reason to remember this name, however, |
|---|
| | 126 | because DSSS will detect library dependencies and link them in automatically. |
|---|
| | 127 | This name can partially be overridden if desired, in the same way as binaries: |
|---|
| | 128 | [mydpackage] |
|---|
| | 129 | target=dlibrary |
|---|
| | 130 | |
|---|
| | 131 | However, the platform will always affect the output library name. On POSIX |
|---|
| | 132 | systems, the above library will be named libSdlibrary.a and libdlibrary.so. On |
|---|
| | 133 | Windows, the above library will be named Sdlibrary.lib. |
|---|
| | 134 | |
|---|
| | 135 | By default, all of the .d files within the directory and any subdirectory will |
|---|
| | 136 | be included in the library. Files may be excluded with the 'exclude' setting: |
|---|
| | 137 | [mydpackage] |
|---|
| | 138 | exclude=mydpackage/broken.d |
|---|
| | 139 | |
|---|
| | 140 | Entire directories may also be excluded: |
|---|
| | 141 | [mydpackage] |
|---|
| | 142 | exclude=mydpackage/brokenpackage |
|---|
| | 143 | |
|---|
| | 144 | The 'exclude' setting is useful in concert with versioning, described in a later |
|---|
| | 145 | section. |
|---|
| | 146 | |
|---|
| | 147 | = SOURCE LIBRARIES = |
|---|
| | 148 | |
|---|
| | 149 | Source libraries are libraries which are not compiled until they are used in a |
|---|
| | 150 | binary. They are installed in their source form. Otherwise, they act identically |
|---|
| | 151 | to normal libraries. A source library may be specified by setting the 'type' |
|---|
| | 152 | setting to 'sourcelibrary': |
|---|
| | 153 | [mydpackage] |
|---|
| | 154 | type=sourcelibrary |
|---|
| | 155 | |
|---|
| | 156 | = SPECIAL SECTIONS = |
|---|
| | 157 | |
|---|
| | 158 | It is also possible to create sections which are not associated with compiling |
|---|
| | 159 | a binary or library. These sections are given names starting with a '+', such |
|---|
| | 160 | as: |
|---|
| | 161 | [+generate] |
|---|
| | 162 | |
|---|
| | 163 | The utility of these sections will be seen below, in the section on hooks. |
|---|
| | 164 | |
|---|
| | 165 | |
|---|
| | 166 | == INSTALLATION == |
|---|
| | 167 | |
|---|
| | 168 | DSSS is capable of installing binaries and libraries to a predetermined |
|---|
| | 169 | directory, usually the prefix in which it is installed. When libraries are |
|---|
| | 170 | installed in this way, they will be usable by DSSS without being explicitly |
|---|
| | 171 | specified. |
|---|
| | 172 | |
|---|
| | 173 | |
|---|
| | 174 | == DEPENDENCIES == |
|---|
| | 175 | |
|---|
| | 176 | The primary reason that DSSS exists is to make handling dependencies easier. To |
|---|
| | 177 | this end, is is never necessary to explicitly specify a dependency upon a |
|---|
| | 178 | library which is itself set up to use DSSS. Because DSSS traces D imports and |
|---|
| | 179 | keeps an Internet-accessible repository of package information, installing the |
|---|
| | 180 | dependencies which are supported by DSSS is as easy as typing: |
|---|
| | 181 | $ dsss net deps |
|---|
| | 182 | |
|---|
| | 183 | However, dependencies on non-DSSS D libraries or C libraries can be more |
|---|
| | 184 | complicated. |
|---|
| | 185 | |
|---|
| | 186 | = INCLUDE PATHS = |
|---|
| | 187 | |
|---|
| | 188 | It is possible to specify include paths in the 'buildflags' settings. Import |
|---|
| | 189 | paths are specified with the -I flag: |
|---|
| | 190 | buildflags=-I../prerequisite/import |
|---|
| | 191 | |
|---|
| | 192 | = PREREQUISITE LIBRARIES = |
|---|
| | 193 | |
|---|
| | 194 | Library search paths are specified with the -S flag: |
|---|
| | 195 | buildflags=-S../prerequisite/lib |
|---|
| | 196 | |
|---|
| | 197 | Libraries can be explicitly linked in with the -ll flag. -ll works similarly to |
|---|
| | 198 | -l in most compilers. On POSIX and similar platforms, a flag such as |
|---|
| | 199 | -ll<library> |
|---|
| | 200 | will link in a library named |
|---|
| | 201 | lib<library>.a (or lib<library>.so) |
|---|
| | 202 | |
|---|
| | 203 | On Windows (except GDC), the same flag will link a library named |
|---|
| | 204 | <library>.lib |
|---|
| | 205 | |
|---|
| | 206 | Libraries linked in with the -ll flag are searched for in the search paths |
|---|
| | 207 | specified by the -S flag. |
|---|
| | 208 | |
|---|
| | 209 | The -ll flag is only useful for explicitly linking libraries into binaries. If |
|---|
| | 210 | your library depends on a non-DSSS library, you must list that dependency in a |
|---|
| | 211 | .d file which is part of your library. This is done with the 'link' pragma, |
|---|
| | 212 | which must always be specified within version(build): |
|---|
| | 213 | version (build) { |
|---|
| | 214 | pragma(link, "example"); |
|---|
| | 215 | } |
|---|
| | 216 | |
|---|
| | 217 | The above example will cause any binary linked against your library to link |
|---|
| | 218 | against the library named libexample.a (or example.lib on Windows). |
|---|
| | 219 | |
|---|
| | 220 | |
|---|
| | 221 | == HOOKS == |
|---|
| | 222 | |
|---|
| | 223 | DSSS can run arbitrary commands while building software. There are a number of |
|---|
| | 224 | points at which commands can be run: before and after building, before and after |
|---|
| | 225 | installing, and before and after cleaning up. These commands are added to |
|---|
| | 226 | 'prebuild', 'postbuild', 'preinstall', 'postinstall', 'preclean' and 'postclean' |
|---|
| | 227 | lines, respectively. |
|---|
| | 228 | |
|---|
| | 229 | Hook commands can be anything which can be run on the shell of the host system, |
|---|
| | 230 | such as: |
|---|
| | 231 | prebuild = echo Hello |
|---|
| | 232 | |
|---|
| | 233 | Any number of hook commands may be strung together between semicolons: |
|---|
| | 234 | prebuild = echo Hello ; echo World |
|---|
| | 235 | |
|---|
| | 236 | And may span multiple lines by ending each line with a backslash: |
|---|
| | 237 | prebuild = echo \ |
|---|
| | 238 | Hello ; \ |
|---|
| | 239 | echo World |
|---|
| | 240 | |
|---|