diff mbox series

[bug#56807,WIP] Update Julia to 1.8.0

Message ID Yu8nrbgv/gN0+YTu@pbp
State New
Headers show
Series [bug#56807,WIP] Update Julia to 1.8.0 | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Efraim Flashner Aug. 7, 2022, 2:47 a.m. UTC
I started with your patch and made a few changes on top of it. I haven't
started looking into the test suite yet.
diff mbox series

Patch

diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
index 68d6d7316d..738a4389b1 100644
--- a/gnu/packages/julia.scm
+++ b/gnu/packages/julia.scm
@@ -179,10 +179,10 @@  (define-public julia
                                                         "/lib"))
                                        '("curl" "dsfmt"
                                          "gmp" "lapack"
+                                         "libblastrampoline"
                                          "libssh2" "libnghttp2" "libgit2"
-                                         "mbedtls" "mpfr"
-                                         "openblas" "openblas" "libblastrampoline"
-                                         "openlibm" "pcre2"
+                                         "mbedtls-apache" "mpfr"
+                                         "openblas" "openlibm" "pcre2"
                                          "suitesparse" "gfortran:lib"))
                                   ":"))))
          ;; FIXME: Building the documentation requires Julia packages that
@@ -211,12 +211,11 @@  (define-public julia
                                   "base/Makefile")
                      ((".*libquadmath.*") ""))
                    (substitute* "Makefile"
-                     (("libquadmath ") ""))
-                   #t)))
+                     (("libquadmath ") "")))))
              '())
          (add-before 'check 'set-home
            ;; Some tests require a home directory to be set.
-           (lambda _ (setenv "HOME" "/tmp") #t))
+           (lambda _ (setenv "HOME" "/tmp")))
          (add-before 'build 'fix-include-and-link-paths
            (lambda* (#:key inputs #:allow-other-keys)
              ;; LIBUTF8PROC is a linker flag, not a build target.  It is
@@ -273,9 +272,9 @@  (define-public julia
                (substitute* (jlpath "MPFR")
                  (((from "libmpfr")) (to "mpfr" "libmpfr")))
                (substitute* (jlpath "MbedTLS")
-                 (((from "libmbedcrypto")) (to "mbedtls" "libmbedcrypto"))
-                 (((from "libmbedtls")) (to "mbedtls" "libmbedtls"))
-                 (((from "libmbedx509")) (to "mbedtls" "libmbedx509")))
+                 (((from "libmbedcrypto")) (to "mbedtls-apache" "libmbedcrypto"))
+                 (((from "libmbedtls")) (to "mbedtls-apache" "libmbedtls"))
+                 (((from "libmbedx509")) (to "mbedtls-apache" "libmbedx509")))
                (substitute* (jlpath "nghttp2")
                  (((from "libnghttp2")) (to "libnghttp2" "libnghttp2")))
                (substitute* (jlpath "OpenBLAS")
@@ -313,27 +312,22 @@  (define-public julia
                      (getenv "JULIA_CPU_THREADS"))))
          (add-after 'unpack 'adjust-test-suite
            (lambda* (#:key inputs #:allow-other-keys)
-             (let ((pcre2 (assoc-ref inputs "pcre2"))
-                   (mbedtls-julia (assoc-ref inputs "mbedtls"))
-                   (mpfr (assoc-ref inputs "mpfr"))
-                   (gmp (assoc-ref inputs "gmp"))
-                   (nghttp2 (assoc-ref inputs "libnghttp2"))
-                   (suitesparse (assoc-ref inputs "suitesparse")))
-               ;; Some tests only check to see if the input is the correct version.
-               (substitute* "stdlib/PCRE2_jll/test/runtests.jl"
-                 (("10.36.0") ,(package-version pcre2)))
-               (substitute* "stdlib/MbedTLS_jll/test/runtests.jl"
-                 (("2.28.0") ,(package-version mbedtls-apache)))
-               (substitute* "stdlib/MPFR_jll/test/runtests.jl"
-                 (("4.1.0") ,(package-version mpfr)))
-               (substitute* "stdlib/GMP_jll/test/runtests.jl"
-                 (("6.2.0") ,(package-version gmp)))
-               (substitute* "stdlib/nghttp2_jll/test/runtests.jl"
-                 (("1.41.0") ,(package-version nghttp2)))
-               (substitute* "stdlib/SuiteSparse_jll/test/runtests.jl"
-                 (("5004") ,(string-replace-substring
-                              (version-major+minor
-                                (package-version suitesparse)) "." "0"))))))
+             ;; Some tests only check to see if the input is the correct version.
+             (substitute* "stdlib/PCRE2_jll/test/runtests.jl"
+               (("10.40.0") ,(package-version (this-package-input "pcre2"))))
+             (substitute* "stdlib/MbedTLS_jll/test/runtests.jl"
+               (("2.28.0") ,(package-version (this-package-input "mbedtls-apache"))))
+             (substitute* "stdlib/MPFR_jll/test/runtests.jl"
+               (("4.1.0") ,(package-version (this-package-input "mpfr"))))
+             (substitute* "stdlib/GMP_jll/test/runtests.jl"
+               (("6.2.1") ,(package-version (this-package-input "gmp"))))
+             (substitute* "stdlib/nghttp2_jll/test/runtests.jl"
+               (("1.47.0") ,(package-version (this-package-input "libnghttp2"))))
+             (substitute* "stdlib/SuiteSparse_jll/test/runtests.jl"
+               (("5010") ,(string-replace-substring
+                            (version-major+minor
+                              (package-version
+                                (this-package-input "suitesparse"))) "." "0")))))
 ;         (add-before 'check 'disable-broken-tests
 ;           (lambda _
 ;             ;; disabling REPL tests because they require a stdin
@@ -418,7 +412,7 @@  (define-public julia
                                                               (basename file)))))
                         (find-files (string-append (assoc-ref inputs pkgname)
                                                    "/lib") pred)))))
-               (link "llvm" "libLLVM-11jl\\.so")
+               (link "llvm" "libLLVM-13jl\\.so")
                (link "utf8proc" "libutf8proc\\.so"))))
          (add-after 'install 'make-wrapper
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -465,7 +459,7 @@  (define-public julia
          "USE_SYSTEM_LAPACK=1"
          "USE_SYSTEM_GMP=1"
          "USE_SYSTEM_MPFR=1"
-         "USE_SYSTEM_LIBBLASTRAMPOLINE:=1"
+         "USE_SYSTEM_LIBBLASTRAMPOLINE=1"
          "USE_SYSTEM_LIBSUITESPARSE=1"
          "USE_SYSTEM_LIBUV=1"
          "USE_SYSTEM_UTF8PROC=1"
@@ -475,7 +469,7 @@  (define-public julia
          "USE_SYSTEM_CURL=1"
          "USE_SYSTEM_LIBGIT2=1"
          "USE_SYSTEM_PATCHELF=1"
-         "USE_SYSTEM_LIBWHICH:=1"
+         "USE_SYSTEM_LIBWHICH=1"
          "USE_SYSTEM_ZLIB=1"
          "USE_SYSTEM_P7ZIP=1"
          "VERBOSE=1"
@@ -508,21 +502,23 @@  (define-public julia
        ("gfortran:lib" ,gfortran "lib")
        ("gmp" ,gmp)
        ("lapack" ,lapack)
-       ("libgit2" ,libgit2-1.1)
+       ("libblastrampoline" ,libblastrampoline)
+       ;("libgit2" ,libgit2-1.1)
+       ("libgit2" ,libgit2)
        ("libnghttp2" ,nghttp2 "lib")
        ("libssh2" ,libssh2)
        ("libunwind" ,libunwind-julia)
        ("libuv" ,libuv-julia)
-       ("llvm" ,llvm-13)
-       ("mbedtls" ,mbedtls-apache)
+       ("llvm" ,llvm-julia)
+       ("mbedtls-apache" ,mbedtls-apache)
        ("mpfr" ,mpfr)
        ("openblas" ,openblas)
-       ("libblastrampoline" ,libblastrampoline)
        ("openlibm" ,openlibm)
        ("p7zip" ,p7zip)
        ("pcre2" ,pcre2)
        ("suitesparse" ,suitesparse)
-       ("utf8proc" ,utf8proc-2.6.1)
+       ;("utf8proc" ,utf8proc-2.6.1)
+       ("utf8proc" ,utf8proc)
        ("wget" ,wget)
        ("which" ,which)
        ("zlib" ,zlib)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 2d6274b33a..b7cdcc03f5 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -60,7 +60,6 @@  (define-module (gnu packages llvm)
   #:use-module (gnu packages bootstrap)           ;glibc-dynamic-linker
   #:use-module (gnu packages check)               ;python-lit
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages julia)               ;julia-patch
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages lua)
@@ -591,9 +590,8 @@  (define-public llvm-14
                 '())
          "-DCMAKE_SKIP_BUILD_RPATH=FALSE"
          "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
+         "-DBUILD_SHARED_LIBS:BOOL=TRUE"
          "-DLLVM_ENABLE_FFI:BOOL=TRUE"
-         "-DLLVM_BUILD_LLVM_DYLIB=ON"
-         "-DLLVM_LINK_LLVM_DYLIB=ON"
          "-DLLVM_REQUIRES_RTTI=1"       ;for some third-party utilities
          "-DLLVM_INSTALL_UTILS=ON")     ;needed for rustc
       ;; Don't use '-g' during the build, to save space.
@@ -1925,6 +1923,23 @@  (define-public ocaml-llvm-9 (make-ocaml-llvm llvm-9))
 (define-public ocaml-llvm-10 (make-ocaml-llvm llvm-10))
 (define-public ocaml-llvm-11 (make-ocaml-llvm llvm-11))
 
+(define-public llvm-julia
+  (package
+    (inherit llvm-13)
+    (arguments
+     (substitute-keyword-arguments (package-arguments llvm-13)
+       ((#:configure-flags flags ''())
+        #~(cons* "-DLLVM_BUILD_LLVM_DYLIB=ON"
+                 "-DLLVM_LINK_LLVM_DYLIB=ON"
+                 ;; "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=NVPTX"
+                 "-DLLVM_VERSION_SUFFIX:STRING=jl"  ; Perhaps not needed.
+                 #$(string-append "-DLLVM_TARGETS_TO_BUILD="
+                                  (system->llvm-target))
+                 (delete "-DBUILD_SHARED_LIBS:BOOL=TRUE" #$flags)))
+       ((#:build-type _) "Release")))
+    (properties `((hidden? . #t)
+                  ,@(package-properties llvm-13)))))
+
 (define %cling-version "0.9")
 
 (define llvm-cling             ;LLVM 9 with approximately 10 patches for cling
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 745c908cfd..e04897de1d 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -4651,35 +4651,6 @@  (define-public openblas
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
-(define-public libblastrampoline
-  (package
-    (name "libblastrampoline")
-    (version "5.1.1")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/JuliaLinearAlgebra/libblastrampoline")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32
-         "0mf79zw11kxyil72y2ly5x8bbz3ng3nsqmp0zcps16b69wvfs19c"))))
-    (build-system gnu-build-system)
-    (arguments
-     '(#:make-flags (list "-C" "src"
-                          (string-append "prefix=" (assoc-ref %outputs "out"))
-                          "CC=gcc")
-       #:tests? #f ;no check target
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
-    (home-page "https://github.com/JuliaLinearAlgebra/libblastrampoline")
-    (synopsis "Using PLT trampolines to provide a BLAS and LAPACK demuxing library. ")
-    (description
-     "Using PLT trampolines to provide a BLAS and LAPACK demuxing library. ")
-    (license license:expat)))
-
 (define-public openblas-ilp64
   (package/inherit openblas
     (name "openblas-ilp64")
@@ -4692,6 +4663,35 @@  (define-public openblas-ilp64
     (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
     (license license:bsd-3)))
 
+(define-public libblastrampoline
+  (package
+    (name "libblastrampoline")
+    (version "5.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/JuliaLinearAlgebra/libblastrampoline")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0mf79zw11kxyil72y2ly5x8bbz3ng3nsqmp0zcps16b69wvfs19c"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list "-C" "src"
+                          (string-append "prefix=" (assoc-ref %outputs "out"))
+                          (string-append "CC=" ,(cc-for-target)))
+       #:tests? #f ;no check target
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (home-page "https://github.com/JuliaLinearAlgebra/libblastrampoline")
+    (synopsis "Using PLT trampolines to provide a BLAS and LAPACK demuxing library.")
+    (description
+     "Using PLT trampolines to provide a BLAS and LAPACK demuxing library.")
+    (license license:expat)))
+
 (define-public blis
   (package
     (name "blis")
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index 7eb6f03f5c..d8123864fc 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -1007,8 +1007,7 @@  (define-public mbedtls-apache
        (modify-phases %standard-phases
          (add-after 'unpack 'make-source-writable
            (lambda _
-             (for-each make-file-writable (find-files "."))
-             #t)))))
+             (for-each make-file-writable (find-files ".")))))))
     (native-inputs
      (list perl python))
     (synopsis "Small TLS library")