diff options
author | Tobias Geerinckx-Rice <me@tobias.gr> | 2016-11-06 00:29:11 +0100 |
---|---|---|
committer | Tobias Geerinckx-Rice <me@tobias.gr> | 2016-11-06 00:44:32 +0100 |
commit | a66f9b2a02872fe010455bd033807a937da1eb0c (patch) | |
tree | 0933e4197c5033fc0d661828fa9ecdc3161da1fe /pkgs/development/compilers | |
parent | c9bb753584de7075dd12f7e6aaa8ef66b47fb017 (diff) | |
download | nixpkgs-a66f9b2a02872fe010455bd033807a937da1eb0c.tar nixpkgs-a66f9b2a02872fe010455bd033807a937da1eb0c.tar.gz nixpkgs-a66f9b2a02872fe010455bd033807a937da1eb0c.tar.bz2 nixpkgs-a66f9b2a02872fe010455bd033807a937da1eb0c.tar.lz nixpkgs-a66f9b2a02872fe010455bd033807a937da1eb0c.tar.xz nixpkgs-a66f9b2a02872fe010455bd033807a937da1eb0c.tar.zst nixpkgs-a66f9b2a02872fe010455bd033807a937da1eb0c.zip |
dmd: 2.067.1 -> 2.070.2
dmd 2.070.2 requires a working dmd compiler to build. Instead of downloading a pre-compiled binary blob, keep the previous version (which does properly build from source) around as dmd_2_067_1, and use that to bootstrap the new version.
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/dmd/2.067.1.nix | 74 | ||||
-rw-r--r-- | pkgs/development/compilers/dmd/default.nix | 17 |
2 files changed, 85 insertions, 6 deletions
diff --git a/pkgs/development/compilers/dmd/2.067.1.nix b/pkgs/development/compilers/dmd/2.067.1.nix new file mode 100644 index 00000000000..66264346102 --- /dev/null +++ b/pkgs/development/compilers/dmd/2.067.1.nix @@ -0,0 +1,74 @@ +{ stdenv, fetchurl, unzip, makeWrapper }: + +stdenv.mkDerivation { + name = "dmd-2.067.1"; + + src = fetchurl { + url = http://downloads.dlang.org/releases/2015/dmd.2.067.1.zip; + sha256 = "0ny99vfllvvgcl79pwisxcdnb3732i827k9zg8c0j4s0n79k5z94"; + }; + + nativeBuildInputs = [ unzip makeWrapper ]; + + postPatch = stdenv.lib.optionalString stdenv.isDarwin '' + # Allow to use "clang++", commented in Makefile + substituteInPlace src/dmd/posix.mak \ + --replace g++ clang++ \ + --replace MACOSX_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET_ + + # Was not able to compile on darwin due to "__inline_isnanl" + # being undefined. + substituteInPlace src/dmd/root/port.c --replace __inline_isnanl __inline_isnan + ''; + + # Buid and install are based on http://wiki.dlang.org/Building_DMD + 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 + mkdir $out + mkdir $out/bin + cp dmd $out/bin + + cd ../druntime + mkdir $out/include + mkdir $out/include/d2 + cp -r import/* $out/include/d2 + + cd ../phobos + mkdir $out/lib + ${let bits = if stdenv.is64bit then "64" else "32"; + osname = if stdenv.isDarwin then "osx" else "linux"; in + "cp generated/${osname}/release/${bits}/libphobos2.a $out/lib" + } + + cp -r std $out/include/d2 + cp -r etc $out/include/d2 + + wrapProgram $out/bin/dmd \ + --prefix PATH ":" "${stdenv.cc}/bin" \ + --set CC "$""{CC:-$CC""}" + + cd $out/bin + tee dmd.conf << EOF + [Environment] + DFLAGS=-I$out/include/d2 -L-L$out/lib ${stdenv.lib.optionalString (!stdenv.cc.isClang) "-L--no-warn-search-mismatch -L--export-dynamic"} + EOF + ''; + + meta = with stdenv.lib; { + description = "D language compiler"; + homepage = http://dlang.org/; + license = licenses.free; # parts under different licenses + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/compilers/dmd/default.nix b/pkgs/development/compilers/dmd/default.nix index 66264346102..3435b94c32e 100644 --- a/pkgs/development/compilers/dmd/default.nix +++ b/pkgs/development/compilers/dmd/default.nix @@ -1,14 +1,19 @@ -{ stdenv, fetchurl, unzip, makeWrapper }: +{ stdenv, fetchurl +, makeWrapper, unzip, which -stdenv.mkDerivation { - name = "dmd-2.067.1"; +# Versions 2.070.2 and up require a working dmd compiler to build: +, bootstrapDmd }: + +stdenv.mkDerivation rec { + name = "dmd-${version}"; + version = "2.070.2"; src = fetchurl { - url = http://downloads.dlang.org/releases/2015/dmd.2.067.1.zip; - sha256 = "0ny99vfllvvgcl79pwisxcdnb3732i827k9zg8c0j4s0n79k5z94"; + url = "http://downloads.dlang.org/releases/2.x/${version}/dmd.${version}.zip"; + sha256 = "1pbhxxf41v816j0aky3q2pcd8a6phy3363l7vr5r5pg8ps3gl701"; }; - nativeBuildInputs = [ unzip makeWrapper ]; + nativeBuildInputs = [ bootstrapDmd makeWrapper unzip which ]; postPatch = stdenv.lib.optionalString stdenv.isDarwin '' # Allow to use "clang++", commented in Makefile |