Note: This website is archived. For up-to-date information about D projects and development, please visit

Ticket #8 (closed enhancement: fixed)

Opened 9 years ago

Last modified 9 years ago

[patch] Enhanced build script

Reported by: Abscissa Assigned to: somebody
Priority: major Milestone:
Component: component1 Version:
Keywords: Cc:


I've created a new buildscript for DDMD that should automate most of steps in building ddmd making it much easier for new people to get started. I'd like to submit it for inclusion. What this does (in order):

- Optionally (via command-line arg) downloads (or any other version) from if it isn't already in the main ddmd directory (requires wget to be installed. If it isn't, the user can just download the file to dmd's main directory manually).

- Extracts the dmd zip.

- Applies the necessary patches/modifications to build dmd.lib, then builds it and copies it to the main ddmd directory.

- Copies necessary library files and config file (and makes a minor adjustment to the config file) so that ddmd will be able to compile and link out-of-the-box without having to manually point it to the phobos/druntime source/libs.

- Compiles the debug and/or release versions of ddmd.

Upon subsequent runs, it will remember it did all of the setup and will just simply recompile ddmd (unless you give it the --setup arg). Help screen is shown with "build --help" (win) or "./ --help" (lin), which is reproduced here (for the windows version):

This script will compile DDMD

To run this script, you must download a copy of to this
directory. It can be obtained from:
Or just use --download if you have wget installed.

Note that this script must be run from the main DDMD directory.

Also, make sure you have GNU patch installed and current versions
of DMC and DMD (D2) on the PATH.

    build.bat [options...]
    --help,-h,-H,-?  Display this help message
    --debug,-d       Only build debug version
    --release,-r     Only build release version
    --ver={ver}      Base DDMD off specific DMD version (default: 2.039)
    --setup          Re-run initial setup
    --download       If running initial setup and the dmd zip doesn't exist,
                     use wget to download it
    --dmbase={path}  Path to directory containing 'dm' for building dmd.lib
                     (Optional if --setup is used, otherwise ignored)

This does introduce a reliance on RDMD, but that shouldn't be a problem since building DDMD requires DMD anyway (which includes RDMD). No other requirements are introduced.

This does assume that the appropriate DMC and DMD compilers and the DM library tool are on the PATH.

It works on Windows. It "mostly" works on Linux, but since I haven't been able to compile DDMD manually on Linux yet ( ) I haven't been able to get this 100% on Linux yet either.

Example session, starting in a directory with nothing more than the files attached to this ticket and a hello world, and with GNU patch, HG, DMD 2.048+ and DMC on the PATH:

C:\test> dir /b

C:\test> type hello.d
import std.stdio;
void main()

C:\test> hg clone 
[downloads ddmd]

C:\test> copy *.* ddmd
["yes" to all]

C:\test> cd ddmd

C:\test\ddmd> rem Either download here manually and
run "build --debug", or do the following if you have wget:

C:\test\ddmd> build --debug --download
[builds ddmd]

C:\test\ddmd> bin\ddmd hello.d
[compiles hello]

C:\test\ddmd> hello


build.2.bat (156 bytes) - added by Abscissa on 09/26/10 05:21:10.
build.bat (156 bytes) - added by Abscissa on 09/26/10 05:21:43. (44 bytes) - added by Abscissa on 09/26/10 05:22:15.
buildHelper.d (7.9 kB) - added by Abscissa on 09/26/10 19:52:26.

Change History

09/26/10 05:21:10 changed by Abscissa

  • attachment build.2.bat added.

09/26/10 05:21:43 changed by Abscissa

  • attachment build.bat added.

09/26/10 05:22:15 changed by Abscissa

  • attachment added.

09/26/10 05:23:42 changed by Abscissa

Disregard "build.2.bat". The other three files are the needed ones: "buildHelper.d", "build.bat" and ""

09/26/10 19:52:26 changed by Abscissa

  • attachment buildHelper.d added.

10/03/10 22:02:01 changed by Abscissa

  • status changed from new to closed.
  • resolution set to fixed.

I just noticed that the DDMD repo has commit access for all dsource users, so I committed the change myself. I did use slightly different versions of the files attached here, though. They have been modified to ensure that the semantics of running the buildscript without any arguments are exactly the same as before. The only differences are when you add an argument (See "build --help" for details).