Subject: [bug#32286] [PATCH] Updating ldc to 1.10.0

From: Pjotr Prins <[email-masked]>
Date: Sun, 9 Sep 2018 17:57:42 +0200

* gnu/packages/ldc.scm (ldc): Update ldc to 1.10.0 and have it compile with latest llvm.
---
 gnu/packages/ldc.scm                               | 26 ++++---
 .../patches/ldc-1.7.0-disable-phobos-tests.patch   | 88 ----------------------
 .../patches/ldc-disable-phobos-tests.patch         | 22 ++++++
 3 files changed, 36 insertions(+), 100 deletions(-)
 delete mode 100644 gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch
 create mode 100644 gnu/packages/patches/ldc-disable-phobos-tests.patch

diff --git a/gnu/packages/ldc.scm b/gnu/packages/ldc.scm
index 2613db0..8dcdf90 100644
--- a/gnu/packages/ldc.scm
+++ b/gnu/packages/ldc.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015, 2016 Roel Janssen <[email-masked]>
-;;; Copyright © 2015 Pjotr Prins <[email-masked]>
+;;; Copyright © 2015, 2018 Pjotr Prins <[email-masked]>
 ;;; Copyright © 2017 Frederick Muriithi <[email-masked]>
 ;;; Copyright © 2017 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <[email-masked]>
@@ -172,9 +172,9 @@ and freshness without requiring additional information from the user.")
               (base32
                "0z6ch930wjkg2vlnqkbliwxxxifad6ydsdpwdxwnajkb2kaxsjx4"))))))
       (home-page "http://wiki.dlang.org/LDC")
-      (synopsis "LLVM compiler for the D programming language")
+      (synopsis "LLVM-based D compiler for the D programming language")
       (description
-       "LDC is a compiler for the D programming language.  It is based on
+       "LDC is an LLVM compiler for the D programming language.  It is based on
 the latest DMD compiler that was written in C and is used for
 bootstrapping more recent compilers written in D.")
       ;; Most of the code is released under BSD-3, except for code originally
@@ -188,11 +188,11 @@ bootstrapping more recent compilers written in D.")
   ;; Phobos, druntime and dmd-testsuite library dependencies do
   ;; not always have a newer release than the compiler, hence we
   ;; retain this variable.
-  (let ((older-version "1.7.0"))
+  (let ((older-version "1.10.0")) ;; retain this because sometimes the libs are older
     (package
       (inherit ldc-bootstrap)
       (name "ldc")
-      (version "1.7.0")
+      (version "1.10.0")
       (source (origin
                 (method url-fetch)
                 (uri (string-append
@@ -201,7 +201,7 @@ bootstrapping more recent compilers written in D.")
                 (file-name (string-append name "-" version ".tar.gz"))
                 (sha256
                  (base32
-                  "0rqchmlbhz1pd8ksl1vfhfd5s3cp9h9pqi4k4w2np9sq0zr7abwn"))))
+                  "16b1h9kwfggjw6ykc6sfs26ak6vypylsx9wmvp5m6x3cvi6g70yi"))))
       (arguments
        `(#:phases
          (modify-phases %standard-phases
@@ -235,6 +235,8 @@ bootstrapping more recent compilers written in D.")
                (delete-file "tests/compilable/ctfe_math.d")
                (delete-file "tests/debuginfo/nested_gdb.d")
                (delete-file "tests/debuginfo/classtypes_gdb.d")
+               ;; the following tests plugins we don't have.
+               (delete-file "tests/plugins/addFuncEntryCall/testPlugin.d")
                ;; the following tests requires AVX instruction set in the CPU.
                (substitute* "tests/d2/dmd-testsuite/runnable/test_cdvecfill.d"
                 (("^// DISABLED: ") "^// DISABLED: linux64 "))
@@ -246,8 +248,8 @@ bootstrapping more recent compilers written in D.")
                       (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
                       (invoke "make" "test" "-j" (number->string (parallel-job-count))))))))
       (native-inputs
-       `(("llvm" ,llvm-3.8)
-         ("clang" ,clang-3.8)
+       `(("llvm" ,llvm)
+         ("clang" ,clang)
          ("ldc" ,ldc-bootstrap)
          ("python-lit" ,python-lit)
          ("python-wrapper" ,python-wrapper)
@@ -261,7 +263,7 @@ bootstrapping more recent compilers written in D.")
                    older-version ".tar.gz"))
              (sha256
               (base32
-               "042hn3v0zk353r0h6yclq56z86hi437y969bckyb2qsnv00h60hi"))
+               "0cpmrww00xf1qx38bcc22rr05qw41p00p45yb5fbwnfaccfwdn0s"))
              ;; This patch deactivates some tests that depend on network access
              ;; to pass.  It also deactivates some tests that have some reliance
              ;; on timezone.
@@ -271,7 +273,7 @@ bootstrapping more recent compilers written in D.")
              ;; that is being pursued at
              ;; <https://forum.dlang.org/post/[email-masked]>.
              ;; It also deactivates a test that requires /root
-             (patches (search-patches "ldc-1.7.0-disable-phobos-tests.patch"))))
+             (patches (search-patches "ldc-disable-phobos-tests.patch"))))
          ("druntime-src"
           ,(origin
              (method url-fetch)
@@ -280,7 +282,7 @@ bootstrapping more recent compilers written in D.")
                    older-version ".tar.gz"))
              (sha256
               (base32
-               "0pvabk70zw8c1gbmvy2i486bg22bn0l5nbacjz0qwmhf0w9y9ylh"))))
+               "1akh2vdi98jih8642yjbvv2vavxzrmq24kz8i3kfidg5ndqyv222"))))
          ("dmd-testsuite-src"
           ,(origin
              (method url-fetch)
@@ -289,7 +291,7 @@ bootstrapping more recent compilers written in D.")
                    older-version ".tar.gz"))
              (sha256
               (base32
-               "1i8j1raah7b26bprwkdick443ivdsihgi1l14sn9rh4a95rnrpd9")))))))))
+               "0z5x07qrbkpksshaymp11ir6jlmg9wjicxn6zhp8cya6i1ha9p99")))))))))
 
 (define-public dub
   (package
diff --git a/gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch b/gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch
deleted file mode 100644
index ccc136c..0000000
--- a/gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-diff --git a/std/path.d b/std/path.d
-index a9f0bd8..f47d103 100644
---- a/std/path.d
-+++ b/std/path.d
-@@ -4041,7 +4041,7 @@ version(unittest) import std.process : environment;
-         else version (Android)
-         {
-         }
--        else
-+        else version (HasRoot)
-         {
-             assert(expandTilde("~root") == "/root", expandTilde("~root"));
-             assert(expandTilde("~root/") == "/root/", expandTilde("~root/"));
-
-diff --git a/std/process.d b/std/process.d
-index df83296..d921cdb 100644
---- a/std/process.d
-+++ b/std/process.d
-@@ -1171,7 +1171,7 @@ version (Posix) @system unittest
-     assert(exists(buildPath(directory, "bar")));
- }
-
--@system unittest // Specifying a bad working directory.
-+@system version(skipunittest) unittest // Specifying a bad working directory.
- {
-     import std.exception : assertThrown;
-     TestScript prog = "/bin/echo";
-diff --git a/std/socket.d b/std/socket.d
-index 8a261d5..c1b87b6 100644
---- a/std/socket.d
-+++ b/std/socket.d
-@@ -484,7 +484,7 @@ class Protocol
- // Skip this test on Android because getprotobyname/number are
- // unimplemented in bionic.
- version(CRuntime_Bionic) {} else
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
-     softUnittest({
-         Protocol proto = new Protocol;
-@@ -804,7 +804,7 @@ class InternetHost
- }
-
- ///
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
-     InternetHost ih = new InternetHost;
-
-@@ -959,7 +959,7 @@ AddressInfo[] getAddressInfo(T...)(in char[] node, T options)
-     return () @trusted { return getAddressInfoImpl(node, service, &hints); }();
- }
-
--@system unittest
-+@system version(hasNetwork) unittest
- {
-     struct Oops
-     {
-@@ -1010,7 +1010,7 @@ private AddressInfo[] getAddressInfoImpl(in char[] node, in char[] service, addr
- }
-
-
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
-     softUnittest({
-         if (getaddrinfoPointer)
-diff --git a/std/stdio.d b/std/stdio.d
-index 10106a5..4b0590e 100644
---- a/std/stdio.d
-+++ b/std/stdio.d
-@@ -1426,8 +1426,7 @@ Removes the lock over the specified file segment.
-         g.unlock();
-     }
-
--    version(Posix)
--    @system unittest
-+    @system version(skip) unittest
-     {
-         static import std.file;
-         auto deleteme = testFilename();
-@@ -1483,7 +1482,6 @@ Removes the lock over the specified file segment.
-         f.unlock();
-     }
-
--
- /**
- Writes its arguments in text format to the file.
diff --git a/gnu/packages/patches/ldc-disable-phobos-tests.patch b/gnu/packages/patches/ldc-disable-phobos-tests.patch
new file mode 100644
index 0000000..f8a9743
--- /dev/null
+++ b/gnu/packages/patches/ldc-disable-phobos-tests.patch
@@ -0,0 +1,22 @@
+diff --git a/std/socket.d b/std/socket.d
+index 111cd17..6d23da9 100644
+--- a/std/socket.d
++++ b/std/socket.d
+@@ -448,7 +448,7 @@ class Protocol
+ // Skip this test on Android because getprotobyname/number are
+ // unimplemented in bionic.
+ version(CRuntime_Bionic) {} else
+-@safe unittest
++@safe version(hasNetwork) unittest
+ {
+     // import std.stdio : writefln;
+     softUnittest({
+@@ -770,7 +770,7 @@ class InternetHost
+ }
+ 
+ ///
+-@safe unittest
++@safe version(hasNetwork) unittest
+ {
+     InternetHost ih = new InternetHost;
+ 
-- 
2.8.4