summary refs log tree commit diff
path: root/pkgs/development/compilers/dmd/default.nix
blob: 96a3d2abfc661b24d8ea134734615df75dd2a7c3 (plain) (blame)
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
{ stdenv, fetchurl, gcc, unzip, curl }:

stdenv.mkDerivation {
  name = "dmd-2.064.2";

  src = fetchurl {
    url = http://downloads.dlang.org/releases/2013/dmd.2.064.2.zip;
    sha256 = "1i0jdybigffwyb7c43j0c4aayxx3b93zzqrjxyw6zgp06yhi06pm";
  };

  buildInputs = [ gcc unzip curl ];

  configurePhase = "";
  patchPhase = ''
      cp src/VERSION src/dmd/
      cp license.txt src/phobos/LICENSE_1_0.txt
  '';
  buildPhase = ''
      cd src/dmd
      make -f posix.mak INSTALL_DIR=$out
      export DMD=$PWD/dmd
      cd ../druntime 
      make -f posix.mak INSTALL_DIR=$out DMD=$DMD
      cd ../phobos
      make -f posix.mak INSTALL_DIR=$out DMD=$DMD
      cd ../..
  '';

  installPhase = ''
      cd src/dmd
      tee dmd.conf.default << EOF
          [Environment]
          DFLAGS=-I$out/import -L-L$out/lib
      EOF

      make -f posix.mak INSTALL_DIR=$out install
      export DMD=$PWD/dmd
      cd ../druntime 
      make -f posix.mak INSTALL_DIR=$out install
      cd ../phobos
      make -f posix.mak INSTALL_DIR=$out install
      cd ../..
  '';

  meta = {
    description = "D language compiler";
    homepage = http://dlang.org/;
    license = "open source, see included files";
    maintainers = with stdenv.lib.maintainers; [ vlstill ];
    platforms = stdenv.lib.platforms.unix;
  };
}