There are times when you may need to compile the Derelict packages into static libraries. An example is when using an IDE that has a two-step compile and link process. In such cases, D support is usually an extension and the IDE is not aware of tools like Bud and Rebuild. One such IDE is Code::Blocks. If you find yourself needing to use Derelict in library form, a build script is included in the top-level Derelict directory ($DERELICT_HOME). buildme.d can be used to compile all of the Derelict packages or only those you specify. How to do so is detailed below.
bud myapp.d -IDerelictDir/DerelictGL -IDerelictDir/DerelictSDL -IDerelictDir/DerelictUtilWhen using response files, this is a non-issue. However, many people prefer to have all of their D modules in a single import tree. For a long time, Derelict users who wanted such a setup had to copy the Derelict modules to their import tree manually, or use a custom script. As a result, Derelict now includes a very basic install script written in D. Given a root directory, this script will create a subdirectory 'derelict' and copy all derelict modules into that tree. Then you can add all of the to the import path with a single command line switch, '-IRootDir'. The following command line will execute the install script (if you are using GDC, replace 'dmd' with 'gdmd':
dmd -run install.d RootDir'RootDir' is a required argument and should be the complete path to the directory in which you want to install the Derelict modules. Note that this does not copy any Derelict libraries (remember, you do not need to build the Derelict libraries if you use a build tool like Bud or Rebuild to compile your D apps). This simple script is provided as a convenience. While I will certainly respond to bug reports, I make no promises about enhancing its functionality.
dmd -run buildme.d gdmd -run buildme.dThe first is the command line to use with DMD. The second is for GDC. In the rest of this document, anytime you see 'dmd' in a command line, you can replace it with 'gdmd' to use the same command line with GDC. You can also compile the script with DMD or GDC, but then you'll need to clean up the output files.
bud -clean buildme.dPassing the -clean option to Bud will cause all temporary output files to be deleted once the process completes. You can then execute buildme like any other executable.
rebuild -clean buildme.dThe -clean option will cause most of the temporary output files to be deleted. But Rebuild currently does not delete MAP files generated by DMD on Windows, so you will have a buildme.map lying around in the directory after execution.
By default, each package will be built in Release mode. You can specify debug mode by passing 'debug' on the command line:
dmd -run buildme.d debugOr, for the compiled form:
buildme debugThe script also accepts 'release' as a command line argument.
The build script generates a temporary build response file that is deleted at the end of execution. Sometimes, when debugging problems with the build script, it is necessary to see the contents of this file. You can prevent the script from deleting the file by passing 'nodelbrf' on the command line:
dmd -run buildme.d nodelbrfOr for the compiled form:
buildme nodelbrfYou can also pass options to both Bud and the compiler, though not via the command line. This is done through the following three options files:
$(DERELICT_HOME)/buildopts/bud_common.txt $(DERELICT_HOME)/buildopts/bud_release.txt $(DERELICT_HOME)/buildopts/bud_debug.txtOptions in bud_common.txt are used in both Debug and Release builds. The other two are self-explanatory.
The rules for editing these files are the same as those for editing Bud Response Files, but there are some caveats. Because buildme.d automates the build process, some assumptions are made. The first is that the output directory will be the $DERELICT_HOME/lib subdirectory. Adding -TsomeDir to any of the three files will have no effect. Second, the import paths for building each package are set automatically so that you don't need to. Third, the DerelictUtil package and other dependencies are excluded from the compilation automatically via the -X Bud option (except, of course, when DerelictUtil itself is being compiled).
For most users, the default configuration should suffice.
cd $DERELICT_HOME dmd -run buildme.d DerelictAL DerelictUtilOr for the compiled form:
cd $DERELICT_HOME buildme DerelictAL DerelictUtilThe above will build only the DerelictAL and DerelictUtil libraries.
cd $DERELICT_HOME dmd -run buildme.d cleanlibOr for the compiled form:
cd $DERELICT_HOME buildme cleanlibThis will delete the libraries in $(DERELICT_HOME/lib). Unlike the other command line options, this option is exclusive to other options. If any options precede it, it will be ignored. Likewise, any options following it will be ignored.