summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-08-16 08:06:55 +0200
committerGitHub <noreply@github.com>2018-08-16 08:06:55 +0200
commit890c6d407d3851bd22490b211895ce38cbf0c19a (patch)
tree0bae3a98355856faee7cff3ccf115fd716daf2ba /pkgs/development/compilers
parentcd951e39f2205f89e64261a577e289758121df25 (diff)
parentc685f15dc2a7e0c0999f9da91ae9b327546bfa19 (diff)
downloadnixlib-890c6d407d3851bd22490b211895ce38cbf0c19a.tar
nixlib-890c6d407d3851bd22490b211895ce38cbf0c19a.tar.gz
nixlib-890c6d407d3851bd22490b211895ce38cbf0c19a.tar.bz2
nixlib-890c6d407d3851bd22490b211895ce38cbf0c19a.tar.lz
nixlib-890c6d407d3851bd22490b211895ce38cbf0c19a.tar.xz
nixlib-890c6d407d3851bd22490b211895ce38cbf0c19a.tar.zst
nixlib-890c6d407d3851bd22490b211895ce38cbf0c19a.zip
Merge pull request #44904 from ThomasMader/dlang-update
Dlang update
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/dmd/default.nix164
-rw-r--r--pkgs/development/compilers/ldc/default.nix134
2 files changed, 118 insertions, 180 deletions
diff --git a/pkgs/development/compilers/dmd/default.nix b/pkgs/development/compilers/dmd/default.nix
index b391b6eb8455..1e9e62efb636 100644
--- a/pkgs/development/compilers/dmd/default.nix
+++ b/pkgs/development/compilers/dmd/default.nix
@@ -1,34 +1,15 @@
-{ stdenv, fetchFromGitHub, overrideCC, gcc5
+{ stdenv, fetchFromGitHub
 , makeWrapper, unzip, which
 , curl, tzdata, gdb, darwin
-, callPackage, targetPackages
-, bootstrapVersion ? false
-, version ? "2.079.1"
-, dmdSha256 ? "0mlk095aw94d940qkymfp85daggiz3f0xv598nlc7acgp6408kyj"
-, druntimeSha256 ? "18r8gwvb54ar80j5155wx0qbqq4w56hqmbf6wap20xwijg2rw90g"
-, phobosSha256 ? "1x5v1ln51nr8x2vyki864160bakdyq0acmvbfv7jcipaj2w3m9bb"
+, callPackage, targetPackages, ldc
+, version ? "2.081.1"
+, dmdSha256 ? "1xdz7p0pdzwkn57ai93mavgdkd8xb1sr2brlc6y3c12x84h43s8z"
+, druntimeSha256 ? "1vl8ag6rjvqqmc5bn5jk3yfynjb9ggy3hw1awwl7c76bq4f7nbif"
+, phobosSha256 ? "0h1jdc3yai1l42bxjdlyi9hf9qadh76v925rjk2q4ibv2fzl56b7"
 }:
 
 let
 
-  bootstrapDmd = if !bootstrapVersion then
-    # Versions 2.070.2 and up require a working dmd compiler to build so we just
-    # use the last dmd without any D code to bootstrap the actual build.
-    callPackage ./default.nix {
-      stdenv = if stdenv.hostPlatform.isDarwin then
-                 stdenv
-               else
-                 # Doesn't build with gcc6 on linux
-                 overrideCC stdenv gcc5;
-      bootstrapVersion = true;
-      version = "2.067.1";
-      dmdSha256 = "0fm29lg8axfmzdaj0y6vg70lhwb5d9rv4aavnvdd15xjschinlcz";
-      druntimeSha256 = "1n2qfw9kmnql0fk2nxikispqs7vh85nhvyyr00fk227n9lgnqf02";
-      phobosSha256 = "0fywgds9xvjcgnqxmpwr67p3wi2m535619pvj159cgwv5y0nr3p1";
-    }
-  else
-    "";
-
   dmdBuild = stdenv.mkDerivation rec {
     name = "dmdBuild-${version}";
     inherit version;
@@ -74,11 +55,6 @@ let
     usePIC = "-fPIC";
     ROOT_HOME_DIR = "$(echo ~root)";
 
-    datetimePath = if bootstrapVersion then
-      "phobos/std/datetime.d"
-    else
-      "phobos/std/datetime/timezone.d";
-
     phobosPatches = ''
         # Ugly hack so the dlopen call has a chance to succeed.
         # https://issues.dlang.org/show_bug.cgi?id=15391
@@ -89,77 +65,24 @@ let
         substituteInPlace phobos/posix.mak \
             --replace "-soname=libcurl.so.4" "-soname=${curl.out}/lib/libcurl.so.4"
 
-    ''
-
-    + stdenv.lib.optionalString (!bootstrapVersion) ''
-	# Can be removed when https://github.com/dlang/phobos/pull/6224 is included.
-        substituteInPlace ${datetimePath} \
-            --replace "foreach (DirEntry de; dirEntries(tzDatabaseDir, SpanMode.depth))" "import std.path : baseName; foreach (DirEntry de; dirEntries(tzDatabaseDir, SpanMode.depth))"
-
-        substituteInPlace ${datetimePath} \
-            --replace "tzName == \"leapseconds\"" "baseName(tzName) == \"leapseconds\""
-    ''
-
-    + stdenv.lib.optionalString (bootstrapVersion) ''
-        substituteInPlace ${datetimePath} \
-            --replace "import std.traits;" "import std.traits;import std.path;"
-
-        substituteInPlace ${datetimePath} \
-            --replace "tzName == \"+VERSION\"" "baseName(tzName) == \"leapseconds\" || tzName == \"+VERSION\""
-
-        # Ugly hack to fix the hardcoded path to zoneinfo in the source file.
-        # https://issues.dlang.org/show_bug.cgi?id=15391
-        substituteInPlace ${datetimePath} \
-            --replace /usr/share/zoneinfo/ ${tzdata}/share/zoneinfo/
-    ''
-
-    + stdenv.lib.optionalString (bootstrapVersion && stdenv.hostPlatform.isLinux) ''
-        # See https://github.com/dlang/phobos/pull/5960
-        substituteInPlace phobos/std/path.d \
-            --replace "\"/root" "\"${ROOT_HOME_DIR}"
     '';
 
-    dmdPath = if bootstrapVersion then
-      "dmd/src"
-    else
-      "dmd";
-
     postPatch = ''
-    ''
-
-    + stdenv.lib.optionalString (!bootstrapVersion) ''
         substituteInPlace druntime/test/common.mak \
             --replace "DFLAGS:=" "DFLAGS:=${usePIC} "
-    ''
 
-    + stdenv.lib.optionalString (bootstrapVersion) ''
-        # Use proper C++ compiler
-        substituteInPlace ${dmdPath}/posix.mak \
-            --replace g++ $CXX
+        substituteInPlace dmd/src/posix.mak \
+            --replace "DFLAGS :=" "DFLAGS += -link-defaultlib-shared=false"
     ''
 
     + phobosPatches
 
-    + stdenv.lib.optionalString (stdenv.hostPlatform.isLinux && bootstrapVersion) ''
-      substituteInPlace ${dmdPath}/root/port.c \
-        --replace "#include <bits/mathdef.h>" "#include <complex.h>"
-
-      substituteInPlace ${dmdPath}/root/port.c \
-        --replace "#include <bits/nan.h>" "#include <math.h>"
-    ''
-
     + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
-        substituteInPlace ${dmdPath}/posix.mak \
+        substituteInPlace dmd/posix.mak \
             --replace MACOSX_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET_
-    ''
-
-    + stdenv.lib.optionalString (stdenv.hostPlatform.isDarwin && bootstrapVersion) ''
-	    # Was not able to compile on darwin due to "__inline_isnanl"
-	    # being undefined.
-	    substituteInPlace ${dmdPath}/root/port.c --replace __inline_isnanl __inline_isnan
     '';
 
-    nativeBuildInputs = [ bootstrapDmd makeWrapper unzip which gdb ]
+    nativeBuildInputs = [ ldc makeWrapper unzip which gdb ]
 
     ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
       Foundation
@@ -173,23 +96,22 @@ let
     else
       stdenv.hostPlatform.parsed.kernel.name;
     top = "$(echo $NIX_BUILD_TOP)";
-    pathToDmd = if bootstrapVersion then
-      "${top}/dmd/src/dmd"
-    else
-      "${top}/dmd/generated/${osname}/release/${bits}/dmd";
+    pathToDmd = "${top}/dmd/generated/${osname}/release/${bits}/dmd";
 
     # Buid and install are based on http://wiki.dlang.org/Building_DMD
     buildPhase = ''
         cd dmd
-        make -j$NIX_BUILD_CORES -f posix.mak INSTALL_DIR=$out
+        make -j$NIX_BUILD_CORES -f posix.mak INSTALL_DIR=$out BUILD=release ENABLE_RELEASE=1 PIC=1 HOST_DMD=ldmd2
         cd ../druntime
-        make -j$NIX_BUILD_CORES -f posix.mak PIC=1 INSTALL_DIR=$out DMD=${pathToDmd}
+        make -j$NIX_BUILD_CORES -f posix.mak BUILD=release ENABLE_RELEASE=1 PIC=1 INSTALL_DIR=$out DMD=${pathToDmd}
         cd ../phobos
-        make -j$NIX_BUILD_CORES -f posix.mak PIC=1 INSTALL_DIR=$out DMD=${pathToDmd} TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
+        make -j$NIX_BUILD_CORES -f posix.mak BUILD=release ENABLE_RELEASE=1 PIC=1 INSTALL_DIR=$out DMD=${pathToDmd} TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
         cd ..
     '';
 
-    doCheck = !bootstrapVersion;
+    # Disable tests on Darwin for now because of
+    # https://github.com/NixOS/nixpkgs/issues/41099
+    doCheck = !stdenv.hostPlatform.isDarwin;
 
     checkPhase = ''
         cd dmd
@@ -198,9 +120,9 @@ let
         make -j$NIX_BUILD_CORES -f posix.mak unittest PIC=1 DMD=${pathToDmd} BUILD=release
         cd ..
     '';
-    
-    extension = if stdenv.hostPlatform.isDarwin then "a" else "{a,so}";
 
+    extension = if stdenv.hostPlatform.isDarwin then "a" else "{a,so}";
+    
     dontStrip = true;
 
     installPhase = ''
@@ -250,34 +172,40 @@ let
 
   # Need to test Phobos in a fixed-output derivation, otherwise the
   # network stuff in Phobos would fail if sandbox mode is enabled.
-  phobosUnittests = stdenv.mkDerivation rec {
-    name = "phobosUnittests-${version}";
-    version = dmdBuild.version;
+  #
+  # Disable tests on Darwin for now because of
+  # https://github.com/NixOS/nixpkgs/issues/41099
+  phobosUnittests = if !stdenv.hostPlatform.isDarwin then
+    stdenv.mkDerivation rec {
+      name = "phobosUnittests-${version}";
+      version = dmdBuild.version;
 
-    enableParallelBuilding = dmdBuild.enableParallelBuilding;
-    preferLocalBuild = true;
-    inputString = dmdBuild.outPath;
-    outputHashAlgo = "sha256";
-    outputHash = builtins.hashString "sha256" inputString;
+      enableParallelBuilding = dmdBuild.enableParallelBuilding;
+      preferLocalBuild = true;
+      inputString = dmdBuild.outPath;
+      outputHashAlgo = "sha256";
+      outputHash = builtins.hashString "sha256" inputString;
 
-    srcs = dmdBuild.srcs;
+      srcs = dmdBuild.srcs;
 
-    sourceRoot = ".";
+      sourceRoot = ".";
 
-    postPatch = dmdBuild.phobosPatches;
+      postPatch = dmdBuild.phobosPatches;
 
-    nativeBuildInputs = dmdBuild.nativeBuildInputs;
-    buildInputs = dmdBuild.buildInputs;
+      nativeBuildInputs = dmdBuild.nativeBuildInputs;
+      buildInputs = dmdBuild.buildInputs;
 
-    buildPhase = ''
-        cd phobos
-        make -j$NIX_BUILD_CORES -f posix.mak unittest PIC=1 DMD=${dmdBuild}/bin/dmd BUILD=release TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
-    '';
+      buildPhase = ''
+          cd phobos
+          make -j$NIX_BUILD_CORES -f posix.mak unittest BUILD=release ENABLE_RELEASE=1 PIC=1 DMD=${dmdBuild}/bin/dmd TZ_DATABASE_DIR=${tzdata}/share/zoneinfo/
+      '';
 
-    installPhase = ''
-        echo -n $inputString > $out
-    '';
-  };
+      installPhase = ''
+          echo -n $inputString > $out
+      '';
+    }
+  else
+    "";
 
 in
 
diff --git a/pkgs/development/compilers/ldc/default.nix b/pkgs/development/compilers/ldc/default.nix
index dc6a933a9345..bb3649302187 100644
--- a/pkgs/development/compilers/ldc/default.nix
+++ b/pkgs/development/compilers/ldc/default.nix
@@ -2,8 +2,8 @@
 , python, libconfig, lit, gdb, unzip, darwin, bash
 , callPackage, makeWrapper, targetPackages
 , bootstrapVersion ? false
-, version ? "1.8.0"
-, ldcSha256 ? "0zswjlibj8zcdj06nn09jjhbd99chsa5f4kps8xifzgrpgsa28g4"
+, version ? "1.10.0"
+, ldcSha256 ? "0wc3vlblsz4qdwa9ay9plv9nvfd07zj2byqqffaa4a5gvjwf5dlr"
 }:
 
 let
@@ -155,7 +155,10 @@ let
 
     makeFlags = [ "DMD=$DMD" ];
 
-    doCheck = true;
+    # Disable tests on Darwin for now because of
+    # https://github.com/NixOS/nixpkgs/issues/41099
+    # https://github.com/NixOS/nixpkgs/pull/36378#issuecomment-385034818
+    doCheck = !bootstrapVersion && !stdenv.hostPlatform.isDarwin;
 
     checkPhase = ''
       # Build and run LDC D unittests.
@@ -184,65 +187,72 @@ let
 
   # Need to test Phobos in a fixed-output derivation, otherwise the
   # network stuff in Phobos would fail if sandbox mode is enabled.
-  ldcUnittests = stdenv.mkDerivation rec {
-    name = "ldcUnittests-${version}";
-
-    enableParallelBuilding = ldcBuild.enableParallelBuilding;
-    preferLocalBuild = true;
-    inputString = ldcBuild.outPath;
-    outputHashAlgo = "sha256";
-    outputHash = builtins.hashString "sha256" inputString;
-
-    src = ldcBuild.src;
-
-    postUnpack = ldcBuild.postUnpack;
-
-    postPatch = ldcBuild.postPatch;
-
-    nativeBuildInputs = ldcBuild.nativeBuildInputs
-
-    ++ [
-      ldcBuild
-    ];
-
-    buildInputs = ldcBuild.buildInputs;
-
-    preConfigure = ''
-      cmakeFlagsArray=( "-DINCLUDE_INSTALL_DIR=$out/include/dlang/ldc"
-                        "-DCMAKE_BUILD_TYPE=Release"
-                        "-DCMAKE_SKIP_RPATH=ON"
-                        "-DBUILD_SHARED_LIBS=OFF"
-                        "-DLDC_WITH_LLD=OFF"
-                        # Xcode 9.0.1 fixes that bug according to ldc release notes
-                        "-DRT_ARCHIVE_WITH_LDC=OFF"
-                        "-DD_COMPILER=${ldcBuild.out}/bin/ldmd2"
-                      )
-    '';
-
-    postConfigure = ldcBuild.postConfigure;
-
-    makeFlags = ldcBuild.makeFlags;
-
-    buildCmd = if bootstrapVersion then
-      "ctest -V -R \"build-druntime-ldc-unittest|build-phobos2-ldc-unittest\""
-    else
-      "make -j$NIX_BUILD_CORES DMD=${ldcBuild.out}/bin/ldc2 phobos2-test-runner phobos2-test-runner-debug";
-
-    testCmd = if bootstrapVersion then
-      "ctest -j$NIX_BUILD_CORES --output-on-failure -E \"dmd-testsuite|lit-tests|ldc2-unittest|llvm-ir-testsuite\""
-    else
-      "ctest -j$NIX_BUILD_CORES --output-on-failure -E \"dmd-testsuite|lit-tests|ldc2-unittest\"";
-
-    buildPhase = ''
-        ${buildCmd}
-        ln -s ${ldcBuild.out}/bin/ldmd2 $PWD/bin/ldmd2
-        ${testCmd}
-    '';
-
-    installPhase = ''
-        echo -n $inputString > $out
-    '';
-  };
+  #
+  # Disable tests on Darwin for now because of
+  # https://github.com/NixOS/nixpkgs/issues/41099
+  # https://github.com/NixOS/nixpkgs/pull/36378#issuecomment-385034818
+  ldcUnittests = if (!bootstrapVersion && !stdenv.hostPlatform.isDarwin) then
+    stdenv.mkDerivation rec {
+      name = "ldcUnittests-${version}";
+
+      enableParallelBuilding = ldcBuild.enableParallelBuilding;
+      preferLocalBuild = true;
+      inputString = ldcBuild.outPath;
+      outputHashAlgo = "sha256";
+      outputHash = builtins.hashString "sha256" inputString;
+
+      src = ldcBuild.src;
+
+      postUnpack = ldcBuild.postUnpack;
+
+      postPatch = ldcBuild.postPatch;
+
+      nativeBuildInputs = ldcBuild.nativeBuildInputs
+
+      ++ [
+        ldcBuild
+      ];
+
+      buildInputs = ldcBuild.buildInputs;
+
+      preConfigure = ''
+        cmakeFlagsArray=( "-DINCLUDE_INSTALL_DIR=$out/include/dlang/ldc"
+                          "-DCMAKE_BUILD_TYPE=Release"
+                          "-DCMAKE_SKIP_RPATH=ON"
+                          "-DBUILD_SHARED_LIBS=OFF"
+                          "-DLDC_WITH_LLD=OFF"
+                          # Xcode 9.0.1 fixes that bug according to ldc release notes
+                          "-DRT_ARCHIVE_WITH_LDC=OFF"
+                          "-DD_COMPILER=${ldcBuild.out}/bin/ldmd2"
+                        )
+      '';
+
+      postConfigure = ldcBuild.postConfigure;
+
+      makeFlags = ldcBuild.makeFlags;
+
+      buildCmd = if bootstrapVersion then
+        "ctest -V -R \"build-druntime-ldc-unittest|build-phobos2-ldc-unittest\""
+      else
+        "make -j$NIX_BUILD_CORES DMD=${ldcBuild.out}/bin/ldc2 phobos2-test-runner phobos2-test-runner-debug";
+
+      testCmd = if bootstrapVersion then
+        "ctest -j$NIX_BUILD_CORES --output-on-failure -E \"dmd-testsuite|lit-tests|ldc2-unittest|llvm-ir-testsuite\""
+      else
+        "ctest -j$NIX_BUILD_CORES --output-on-failure -E \"dmd-testsuite|lit-tests|ldc2-unittest\"";
+
+      buildPhase = ''
+          ${buildCmd}
+          ln -s ${ldcBuild.out}/bin/ldmd2 $PWD/bin/ldmd2
+          ${testCmd}
+      '';
+
+      installPhase = ''
+          echo -n $inputString > $out
+      '';
+    }
+  else
+    "";
 
 in