Changeset 752

Show
Ignore:
Timestamp:
08/09/07 22:40:06 (1 year ago)
Author:
Gregor
Message:

docs/README.software_engineers: Many improvements thanks to suggestions by Bill Baxter.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docs/README.software_engineers

    r750 r752  
    11= DSSS Documentation for Software Engineers = 
    22 
    3 DSSS is a tool to: 
     3DSSS, the D Shared Software System, is a tool to: 
    44 
    55* Build D software. 
     
    4242 
    4343A section is started with the file name of the source module or package in 
    44 brackets. In general, sections which are named for modules produce binaries, and 
    45 sections which are named for packages produce libraries. Each section may have 
    46 any number of settings, which customize how that section is built. 
     44brackets. File names should always be specified with '/' for the path 
     45separator. '\' will work on Windows, but is not portable. '/' works on all 
     46platforms. 
     47 
     48In general, sections which are named for modules produce binaries, and sections 
     49which are named for packages produce libraries. Each section may have any 
     50number of settings, which customize how that section is built. 
     51 
     52When running `dsss build`, sections are built in the order that they appear in 
     53the dsss.conf file, with the exception that binaries are always built last. 
    4754 
    4855= SETTINGS = 
     
    6572described later. 
    6673 
    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 
     74Settings may include references to environment variables: 
     75a=$PREFIX 
    16076 
    16177DSSS provides several environment variables for this purpose: 
     
    16783ETC_PREFIX: The prefix for configuration files. 
    16884EXE_EXT: The extension for executable files. Empty on POSIX, ".exe" on Windows. 
     85DSSS: The full path to the DSSS binary itself. 
     86DSSS_BUILD: The full path to the build tool being used by DSSS (usually 
     87            rebuild). 
     88 
     89= FLAGS = 
     90 
     91Any section may have a 'buildflags' setting, which specifies the flags to be 
     92used while building that section. For example, 
     93buildflags=-O 
     94 
     95= SECTION TYPES = 
     96 
     97Although section types are usually determined automatically from the section 
     98name, they may also be overridden with the 'type' setting: 
     99[oneFileLib.d] 
     100type=library 
     101 
     102The valid values for 'type' (all described in later sections) are: 
     103binary 
     104library 
     105sourcelibrary 
     106special 
     107subdir 
     108 
     109= BINARIES = 
     110 
     111Sections which are named for D modules (.d files) produce executable binaries 
     112when built with DSSS. The target binary file name will be deduced from the name 
     113of the .d file, or can be set explicitly with a 'target' line, such as: 
     114[example.d] 
     115target=example_binary 
     116 
     117Windows users: Be careful not to set the target of a binary build to the name of 
     118a directory. This will work on Windows because it gains the .exe suffix, but 
     119will fail on other operating systems. 
     120 
     121= LIBRARIES = 
     122 
     123Sections which are named for D packages (directories) produce libraries when 
     124built with DSSS. The name of the library file is derived from the name of the 
     125package and the platform. There is no reason to remember this name, however, 
     126because DSSS will detect library dependencies and link them in automatically. 
     127This name can partially be overridden if desired, in the same way as binaries: 
     128[mydpackage] 
     129target=dlibrary 
     130 
     131However, the platform will always affect the output library name. On POSIX 
     132systems, the above library will be named libSdlibrary.a and libdlibrary.so. On 
     133Windows, the above library will be named Sdlibrary.lib. 
     134 
     135By default, all of the .d files within the directory and any subdirectory will 
     136be included in the library. Files may be excluded with the 'exclude' setting: 
     137[mydpackage] 
     138exclude=mydpackage/broken.d 
     139 
     140Entire directories may also be excluded: 
     141[mydpackage] 
     142exclude=mydpackage/brokenpackage 
     143 
     144The 'exclude' setting is useful in concert with versioning, described in a later 
     145section. 
     146 
     147= SOURCE LIBRARIES = 
     148 
     149Source libraries are libraries which are not compiled until they are used in a 
     150binary. They are installed in their source form. Otherwise, they act identically 
     151to normal libraries. A source library may be specified by setting the 'type' 
     152setting to 'sourcelibrary': 
     153[mydpackage] 
     154type=sourcelibrary 
     155 
     156= SPECIAL SECTIONS = 
     157 
     158It is also possible to create sections which are not associated with compiling 
     159a binary or library. These sections are given names starting with a '+', such 
     160as: 
     161[+generate] 
     162 
     163The utility of these sections will be seen below, in the section on hooks. 
     164 
     165 
     166== INSTALLATION == 
     167 
     168DSSS is capable of installing binaries and libraries to a predetermined 
     169directory, usually the prefix in which it is installed. When libraries are 
     170installed in this way, they will be usable by DSSS without being explicitly 
     171specified. 
     172 
     173 
     174== DEPENDENCIES == 
     175 
     176The primary reason that DSSS exists is to make handling dependencies easier. To 
     177this end, is is never necessary to explicitly specify a dependency upon a 
     178library which is itself set up to use DSSS. Because DSSS traces D imports and 
     179keeps an Internet-accessible repository of package information, installing the 
     180dependencies which are supported by DSSS is as easy as typing: 
     181$ dsss net deps 
     182 
     183However, dependencies on non-DSSS D libraries or C libraries can be more 
     184complicated. 
     185 
     186= INCLUDE PATHS = 
     187 
     188It is possible to specify include paths in the 'buildflags' settings. Import 
     189paths are specified with the -I flag: 
     190buildflags=-I../prerequisite/import 
     191 
     192= PREREQUISITE LIBRARIES = 
     193 
     194Library search paths are specified with the -S flag: 
     195buildflags=-S../prerequisite/lib 
     196 
     197Libraries 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> 
     200will link in a library named 
     201lib<library>.a (or lib<library>.so) 
     202 
     203On Windows (except GDC), the same flag will link a library named 
     204<library>.lib 
     205 
     206Libraries linked in with the -ll flag are searched for in the search paths 
     207specified by the -S flag. 
     208 
     209The -ll flag is only useful for explicitly linking libraries into binaries. If 
     210your 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, 
     212which must always be specified within version(build): 
     213version (build) { 
     214    pragma(link, "example"); 
     215} 
     216 
     217The above example will cause any binary linked against your library to link 
     218against the library named libexample.a (or example.lib on Windows). 
     219 
     220 
     221== HOOKS == 
     222 
     223DSSS can run arbitrary commands while building software. There are a number of 
     224points at which commands can be run: before and after building, before and after 
     225installing, and before and after cleaning up. These commands are added to 
     226'prebuild', 'postbuild', 'preinstall', 'postinstall', 'preclean' and 'postclean' 
     227lines, respectively. 
     228 
     229Hook commands can be anything which can be run on the shell of the host system, 
     230such as: 
     231prebuild = echo Hello 
     232 
     233Any number of hook commands may be strung together between semicolons: 
     234prebuild = echo Hello ; echo World 
     235 
     236And may span multiple lines by ending each line with a backslash: 
     237prebuild = echo \ 
     238    Hello ; \ 
     239    echo World 
     240 
    169241 
    170242 
     
    186258prebuild = cd c_source ; make 
    187259 
     260You do not need to return to the original directory after 'cd'ing. The 
     261directory will be restored after the hook commands have finished. 
     262 
    188263= .d files = 
    189264 
     
    193268= set = 
    194269 
    195 The 'set' command sets a setting in the dsss.conf file on-the-fly. The 
    196 parameters are: 
     270The 'set' command sets a dsss.conf file setting while building. The parameters 
     271are: 
    197272set <section>:<setting> <value> 
    198273 
     
    207282set example.d:postbuild echo Hello 
    208283 
    209 'set' is most useful in concert with the 'eval' command (described below), but 
    210 can also be used alone. 
     284'set' is most useful in concert with the 'eval' command (described below), as 
     285it can then be used to set dsss.conf file settings programatically. It is 
     286also usable independently of 'eval', but is no better than merely specifying 
     287the setting. 
    211288 
    212289= add = 
     
    282359 
    283360 
     361== ADVANCED FEATURES == 
     362 
     363There are several advanced features of DSSS which do not need any modification 
     364to the dsss.conf file to use. 
     365 
     366The flag '--test', when passed to `dsss build`: 
     367$ dsss build --test 
     368will cause all of the unit tests to be run. 
     369 
     370The flag '--doc', when passed to `dsss build`: 
     371$ dsss build --doc 
     372will cause API documentation for every library to be generated with CandyDoc, 
     373which beautifies and organizes the documentation. 
     374 
     375 
    284376To-be-written: 
    285377== SUBDIRECTORIES == 
    286 == INTERNAL OPERATION == 
     378== NET INSTALLATION == 
    287379 
    288380