Difference between revisions of "Building DMD"

From D Wiki
Jump to: navigation, search
(reword to better fit title)
m (Update redirect)
 
(89 intermediate revisions by 23 users not shown)
Line 1: Line 1:
If you're looking for a stable version of D, you probably want to download the [http://dlang.org/download.html official releases]. This page is for those who want to try out D on platforms that aren't yet officially supported, those who are adventurous and wish to try out the latest development (unstable!) version of D, and developers who wish to contribute to D development.
+
#REDIRECT [[Starting as a Contributor#Building from source]]
 
 
==Getting the sources==
 
 
 
The source code for the D compiler, runtime library, and standard library are available on [https://github.com/D-Programming-Language GitHub]. To build a working D compiler toolchain, you will need to checkout at least dmd, druntime, and phobos.
 
 
 
==Source code structure==
 
 
 
The D source code assumes a particular directory structure, which you probably would want to adopt so that you don't have to fiddle with the Makefiles all the time.
 
 
 
===Posix===
 
 
 
For Posix, it is assumed that you will have a common root directory where the compiler and library sources will sit under. For example, you can choose the common root directory to be /usr/src/d, then you can checkout the sources under this directory:
 
 
 
<pre>
 
% mkdir /usr/src/d
 
% cd /usr/src/d
 
% git clone git://github.com/D-Programming-Language/dmd.git
 
% git clone git://github.com/D-Programming-Language/druntime.git
 
% git clone git://github.com/D-Programming-Language/phobos.git
 
</pre>
 
 
 
Note that if you're planning to submit [[Pull Requests|pull requests]], you should replace the above URLs with the URLs for your ''fork'' of the official sources, not the official sources themselves.
 
 
 
You should end up with this directory structure:
 
 
 
<pre>
 
/usr/src/d/
 
/usr/src/d/dmd
 
/usr/src/d/druntime
 
/usr/src/d/phobos
 
</pre>
 
 
 
===Windows===
 
 
 
'''TBD'''
 
 
 
==Building the sources==
 
 
 
===Posix===
 
 
 
Assuming your sources are checked out in /usr/src/d, you can do the following to build them:
 
 
 
<pre>
 
% cd /usr/src/d/dmd/src
 
% make -f posix.mak
 
% cd ../../druntime
 
% make -f posix.mak
 
% cd ../phobos
 
% make -f posix.mak
 
</pre>
 
 
 
Note that the compiler, runtime library, and standard library have to be built in that order, as each depends on the previous one.
 
 
 
If you're using a 64-bit platform, you may want to append "MODEL=64" to your make commands, as the default makefiles will build for 32-bit:
 
 
 
<pre>
 
% cd /usr/src/d/dmd/src
 
% make -f posix.mak MODEL=64
 
% cd ../../druntime
 
% make -f posix.mak MODEL=64
 
% cd ../phobos
 
% make -f posix.mak MODEL=64
 
</pre>
 
 
 
After building, you should have a working D compiler in /usr/src/d/dmd/src/dmd. You may need to edit dmd.conf so that the compiler can find druntime and phobos. ('''TBD''': expand on this)
 
 
 
===Windows===
 
 
 
'''TBD'''
 

Latest revision as of 12:50, 5 May 2019