gnu: julia: Add missing path to JULIA_LOAD_PATH.

This commit is contained in:
nixo 2019-10-10 17:49:15 +02:00
parent fc1fe722a0
commit e78c808796
1 changed files with 72 additions and 71 deletions

View File

@ -158,7 +158,7 @@
(define-public julia
(package
(name "julia")
(version "1.1.1")
(version "1.1.1") ;; Update also JULIA_LOAD_PATH with it
(source (origin
(method url-fetch)
(uri (string-append
@ -229,77 +229,77 @@
;; Some tests require a home directory to be set.
(lambda _ (setenv "HOME" "/tmp") #t))
(add-after 'unpack 'hardcode-soname-map
;; ./src/runtime_ccall.cpp creates a map from library names to paths
;; using the output of "/sbin/ldconfig -p". Since ldconfig is not
;; used in Guix, we patch runtime_ccall.cpp to contain a static map.
(lambda* (#:key inputs #:allow-other-keys)
(use-modules (ice-9 match))
(substitute* "src/runtime_ccall.cpp"
;; Patch out invocations of '/sbin/ldconfig' to avoid getting
;; error messages about missing '/sbin/ldconfig' on Guix System.
(("popen\\(.*ldconfig.*\\);")
"NULL;\n")
;; ./src/runtime_ccall.cpp creates a map from library names to paths
;; using the output of "/sbin/ldconfig -p". Since ldconfig is not
;; used in Guix, we patch runtime_ccall.cpp to contain a static map.
(lambda* (#:key inputs #:allow-other-keys)
(use-modules (ice-9 match))
(substitute* "src/runtime_ccall.cpp"
;; Patch out invocations of '/sbin/ldconfig' to avoid getting
;; error messages about missing '/sbin/ldconfig' on Guix System.
(("popen\\(.*ldconfig.*\\);")
"NULL;\n")
;; Populate 'sonameMap'.
(("jl_read_sonames.*;")
(string-join
(map (match-lambda
((input libname soname)
(string-append
"sonameMap[\"" libname "\"] = "
"\"" (assoc-ref inputs input) "/lib/" soname "\";")))
'(("libc" "libc" "libc.so.6")
("pcre2" "libpcre2-8" "libpcre2-8.so")
("mpfr" "libmpfr" "libmpfr.so")
("openblas" "libblas" "libopenblas.so")
("arpack-ng" "libarpack" "libarpack.so")
("lapack" "liblapack" "liblapack.so")
("libgit2" "libgit2" "libgit2.so")
("gmp" "libgmp" "libgmp.so")
("openspecfun" "libopenspecfun" "libopenspecfun.so")
("fftw" "libfftw3" "libfftw3_threads.so")
("fftwf" "libfftw3f" "libfftw3f_threads.so"))))))
(substitute* "base/math.jl"
(("const libm = Base.libm_name")
(string-append "const libm = \""
(assoc-ref inputs "openlibm")
"/lib/libopenlibm.so"
"\""))
(("const openspecfun = \"libopenspecfun\"")
(string-append "const openspecfun = \""
(assoc-ref inputs "openspecfun")
"/lib/libopenspecfun.so"
"\"")))
#t))
;; Populate 'sonameMap'.
(("jl_read_sonames.*;")
(string-join
(map (match-lambda
((input libname soname)
(string-append
"sonameMap[\"" libname "\"] = "
"\"" (assoc-ref inputs input) "/lib/" soname "\";")))
'(("libc" "libc" "libc.so.6")
("pcre2" "libpcre2-8" "libpcre2-8.so")
("mpfr" "libmpfr" "libmpfr.so")
("openblas" "libblas" "libopenblas.so")
("arpack-ng" "libarpack" "libarpack.so")
("lapack" "liblapack" "liblapack.so")
("libgit2" "libgit2" "libgit2.so")
("gmp" "libgmp" "libgmp.so")
("openspecfun" "libopenspecfun" "libopenspecfun.so")
("fftw" "libfftw3" "libfftw3_threads.so")
("fftwf" "libfftw3f" "libfftw3f_threads.so"))))))
(substitute* "base/math.jl"
(("const libm = Base.libm_name")
(string-append "const libm = \""
(assoc-ref inputs "openlibm")
"/lib/libopenlibm.so"
"\""))
(("const openspecfun = \"libopenspecfun\"")
(string-append "const openspecfun = \""
(assoc-ref inputs "openspecfun")
"/lib/libopenspecfun.so"
"\"")))
#t))
(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
;; included in the LIBFILES_* variable which is used as a
;; collection of build targets and a list of libraries to link
;; against.
(substitute* "src/flisp/Makefile"
(("\\$\\(BUILDDIR\\)/\\$\\(EXENAME\\): \\$\\(OBJS\\) \\$\\(LIBFILES_release\\)")
"$(BUILDDIR)/$(EXENAME): $(OBJS) $(LLT_release)")
(("\\$\\(BUILDDIR\\)/\\$\\(EXENAME\\)-debug: \\$\\(DOBJS\\) \\$\\(LIBFILES_debug\\)")
"$(BUILDDIR)/$(EXENAME)-debug: $(DOBJS) $(LLT_debug)"))
(lambda* (#:key inputs #:allow-other-keys)
;; LIBUTF8PROC is a linker flag, not a build target. It is
;; included in the LIBFILES_* variable which is used as a
;; collection of build targets and a list of libraries to link
;; against.
(substitute* "src/flisp/Makefile"
(("\\$\\(BUILDDIR\\)/\\$\\(EXENAME\\): \\$\\(OBJS\\) \\$\\(LIBFILES_release\\)")
"$(BUILDDIR)/$(EXENAME): $(OBJS) $(LLT_release)")
(("\\$\\(BUILDDIR\\)/\\$\\(EXENAME\\)-debug: \\$\\(DOBJS\\) \\$\\(LIBFILES_debug\\)")
"$(BUILDDIR)/$(EXENAME)-debug: $(DOBJS) $(LLT_debug)"))
;; The REPL must be linked with libuv.
(substitute* "ui/Makefile"
(("JLDFLAGS \\+= ")
(string-append "JLDFLAGS += "
(assoc-ref %build-inputs "libuv")
"/lib/libuv.so ")))
;; The REPL must be linked with libuv.
(substitute* "ui/Makefile"
(("JLDFLAGS \\+= ")
(string-append "JLDFLAGS += "
(assoc-ref %build-inputs "libuv")
"/lib/libuv.so ")))
(substitute* "base/Makefile"
(("\\$\\(build_includedir\\)/uv/errno.h")
(string-append (assoc-ref inputs "libuv")
"/include/uv/errno.h")))
#t))
(substitute* "base/Makefile"
(("\\$\\(build_includedir\\)/uv/errno.h")
(string-append (assoc-ref inputs "libuv")
"/include/uv/errno.h")))
#t))
(add-before 'build 'replace-default-shell
(lambda _
(substitute* "base/client.jl"
(("/bin/sh") (which "sh")))
#t))
(lambda _
(substitute* "base/client.jl"
(("/bin/sh") (which "sh")))
#t))
(add-after 'unpack 'hardcode-paths
(lambda _
(substitute* "stdlib/InteractiveUtils/src/InteractiveUtils.jl"
@ -345,9 +345,9 @@
;; platforms, e.g. when running "guix package --search="
(_ "MARCH=UNSUPPORTED"))
"CONFIG_SHELL=bash" ;needed to build bundled libraries
"USE_SYSTEM_DSFMT=0" ;not packaged for Guix and upstream has no
;build system for a shared library.
"CONFIG_SHELL=bash" ;needed to build bundled libraries
"USE_SYSTEM_DSFMT=0" ;not packaged for Guix and upstream has no
;build system for a shared library.
"USE_SYSTEM_LAPACK=1"
"USE_SYSTEM_BLAS=1"
"USE_BLAS64=0" ;needed when USE_SYSTEM_BLAS=1
@ -485,7 +485,8 @@
(native-search-paths
(list (search-path-specification
(variable "JULIA_LOAD_PATH")
(files (list "share/julia/packages/")))))
(files (list "share/julia/packages/"
"share/julia/stdlib/v1.1/")))))
;; Julia is not officially released for ARM and MIPS.
;; See https://github.com/JuliaLang/julia/issues/10639
(supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux"))