public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
Install the latest version of MinGW to C:\MinGW. You should select MSYS in the installation options when asked:
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110211/mingw-get-inst-20110211.exe/download
 
If you want to use Mercurial (you don't have to), download and install Python 2.x first (if you don't have it already), then download and install Mercurial.
 
Run msys from C:\MinGW\msys\1.0\msys.bat.
 
Create a gdcbuild directory under msys directory and cd to it:
cd /
mkdir -p gdcbuild
cd gdcbuild
Checkout GDC from bitbucket (this might take a while):
hg clone http://bitbucket.org/goshawk/gdc/
*Or* use 'get source' from the bitbucket website https://bitbucket.org/goshawk/gdc/overview.
 
Download this new relocatable patch (this fixes some import errors):
https://bitbucket-assetroot.s3.amazonaws.com/goshawk/gdc/20110303/158/relocatable.patch
Extract it to /gdcbuild/gdc. Then in msys run:
cd /gdcbuild/gdc
patch -p1 < relocatable.patch
Download this new stdio patch (beta):
https://bitbucket-assetroot.s3.amazonaws.com/goshawk/gdc/20110306/160/dirty_stdio.patch
Extract it to /gdcbuild/gdc. Run the msys commands:
cd /gdcbuild/gdc
patch -p1 < dirty_stdio.patch
Note: -p1 removes a number of prefix directories from the target location. If you open the patch file with notepad you'll see:
--- a/d/Make-lang.in Mon Feb 28 22:12:21 2011 +0000
+++ b/d/Make-lang.in Thu Mar 03 13:32:44 2011 -0500
Using -p1 removes 'a' and 'b', so Patch will just look for a /d/ subdir.
 
Download these dependencies:
ftp://ftp.gmplib.org/pub/gmp-5.0.1/gmp-5.0.1.tar.bz2
http://www.mpfr.org/mpfr-current/mpfr-3.0.0.tar.bz2
http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz
 
Extract the contents of each zipped file to:
C:\MinGW\msys\1.0\gdcbuild
 
Download GCC sources (currently v4.5.2) from one of the following mirrors:
http://gcc.gnu.org/mirrors.html
 
Extract the gcc-4.5.2 folder that's located in the archive (it's actually an archive within an archive) to /gdcbuild.
 
Download TDM-GCC 4.5.1 patch files (yes, there are no 4.5.2 patch files yet):
http://sourceforge.net/projects/tdm-gcc/files/Sources/TDM%20Sources/gcc-4.5.1-tdmsrc-1.zip/download
Extract the zip to /gdcbuild.
 
Your directory structure should now look like this:
C:\MinGW\msys\1.0\gdcbuild\gcc-4.5.1-tdmsrc-1
C:\MinGW\msys\1.0\gdcbuild\gcc-4.5.2
C:\MinGW\msys\1.0\gdcbuild\gdc
C:\MinGW\msys\1.0\gdcbuild\gmp-5.0.1
C:\MinGW\msys\1.0\gdcbuild\mpc-0.9
C:\MinGW\msys\1.0\gdcbuild\mpfr-3.0.0
 
Copy the following patch files to \gdcbuild\gcc-4.5.2:
\gdcbuild\gcc-4.5.1-tdmsrc-1\gcc\pathfix.patch and
\gdcbuild\gcc-4.5.1-tdmsrc-1\gcc\make-rel-pref.patch
 
Then in msys run:
cd /gdcbuild/gcc-4.5.2
patch -p1 < pathfix.patch
patch -p1 < make-rel-pref.patch
Finally, copy the directory /gdcbuild/gdc/d to /gdcbuild/gcc-4.5.2/gcc/, so now you'll have /d/ directory under /gcc-4-5-2/gcc/. You can do this manually or try the following:
cp -R /gdcbuild/gdc/d/ /gdcbuild/gcc-4.5.2/gcc
 
Create build dirs for the depenencies:
mkdir -p /gdcbuild/build/gmp
mkdir -p /gdcbuild/build/mpfr
mkdir -p /gdcbuild/build/mpc
CD to the GMP dir and run configure for GMP (use shift+insert for pasting in Msys)
cd /gdcbuild/build/gmp
../../gmp-5.0.1/configure --prefix="/crossdev/gmp-5.0.1" --build=mingw32 --enable-fat --enable-static CFLAGS="-O2 -mtune=generic"
Run make and make install (don't forget this step):
make && make install
 
CD to MPFR dir and run configure:
cd /gdcbuild/build/mpfr
../../mpfr-3.0.0/configure --prefix="/crossdev/mpfr-3.0.0" --build=mingw32 --with-gmp="/crossdev/gmp-5.0.1" CFLAGS="-O2 -mtune=generic"
Run make and make install (don't forget this step):
make && make install
 
CD to MPC dir and run configure:
cd /gdcbuild/build/mpc
../../mpc-0.9/configure --prefix="/crossdev/mpc-0.9" --with-gmp="/crossdev/gmp-5.0.1" --with-mpfr="/crossdev/mpfr-3.0.0" --build=mingw32 CFLAGS="-O2 -m32" LDFLAGS="-m32 -s"
Run make and make install (don't forget this step):
make && make install
 
There is a large commented out block of code in /gdcbuild/gdc/d/druntime/rt/monitor_.d. Uncomment the code, otherwise you won't be able to compile even a simple project file.
 
CD to gcc-4.5.2 and run configure (replace language version number to 1 if you want to use D1):
cd /gdcbuild/gcc-4.5.2
./gcc/d/setup-gcc.sh --d-language-version=2
 
Create a gcc directory in gdcbuild/build:
mkdir -p /gdcbuild/build/gcc
cd /gdcbuild/build/gcc
Make sure you disable any antivirus apps or configuring and compiling GDC will take ages (it will be slow even without antiviruses, but not as slow).
Shift+insert won't work on this one for me, for some some reason. After you've copied the following, click on the icon in top-left of Msys, and select Edit>Paste. Hit enter after pasting:
../../gcc-4.5.2/configure --prefix="/mingw" \
--enable-languages=d \
--enable-sjlj-exceptions \
--disable-symvers \
--disable-werror \
--disable-win32-registry \
--disable-nls \
--enable-threads \
--enable-version-specific-runtime-libs \
--with-gmp="/crossdev/gmp-5.0.1" --with-mpfr="/crossdev/mpfr-3.0.0" \
--with-mpc="/crossdev/mpc-0.9" \
--with-pkgversion="GDC 483:4a268e8f2389 DMD 1.067"\
--with-bugurl="http://bitbucket.org/goshawk/gdc/issues" \
--disable-bootstrap
 
Then run the two following commands:
make STAGE1_CFLAGS="-g3 -O0" 2>&1 | tee build.log
make DESTDIR="/crossdev/Mingw32" install
 
If all goes well you should have GDC installed in:
C:\MinGW\msys\1.0\crossdev\Mingw32\mingw
 
 
Also need GDB dependencies if you will use GDB:
* libexpat-2.0.1-1-mingw32-dll-1.tar.gz
 
Latest GDB binaries are here:
http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GDB/
 
A PDF Manual of GDB can be found here:
http://sourceware.org/gdb/current/onlinedocs/
 
You need runtime libraries to run GDC, in particular:
* binutils 2.20.51+
* mingw-runtime 3.18+
* w32api 3.14+
If you've installed MinGW via the mingw-get-inst-20110211.exe installer, you should have these zipped dependencies located in:
C:\MinGW\var\cache\mingw-get\packages
 
Otherwise you'll have to hunt them down on these MinGW sourceforge pages:
http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/RuntimeLibrary/ (mingwrt + winapi)
http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GNU-Binutils/ (binutils)
http://sourceforge.net/projects/mingw/files/MinGW/BaseSystem/GCC/Version4/gcc-4.5.2-1/ (libstdc+)
 
Extract all of the needed dependencies into C:\MinGW\msys\1.0\crossdev\Mingw32\mingw, overwriting any folders when prompted.
 
For GDMD support, you need to install Perl. Afterwards create a batch file called "gdmd.bat", put it inside some directory and add that directory to PATH. The contents of gdmd.bat should be:
@echo off
perl C:\MinGW\msys\1.0\crossdev\Mingw32\mingw\gdmd
@echo on
 
Add C:\MinGW\msys\1.0\crossdev\Mingw32\mingw\bin to the PATH, and now GDC should be working fine.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.