getting julia 1.1.0 in guix
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

522 lines
16 KiB

(use-modules ((guix licenses)
#:prefix license:))
(guix packages))
(guix download))
(guix utils))
(guix git-download))
(guix build-system gnu))
(gnu packages))
(gnu packages algebra))
(gnu packages base))
(gnu packages compression))
(gnu packages elf))
(gnu packages gcc))
(gnu packages llvm))
(gnu packages libevent))
(gnu packages libunwind))
(gnu packages maths))
(gnu packages multiprecision)) ; mpfr)
(gnu packages pcre))
(gnu packages perl))
(gnu packages pkg-config))
(gnu packages python))
(gnu packages python-xyz))
(gnu packages textutils))
(gnu packages tls))
(gnu packages version-control))
(gnu packages wget))
(ice-9 match))
;; (define openblas-julia
;; (package
;; (inherit openblas)
;; (name "openblas-julia")
;; ))
;; This works *BUT* we need to apply a lot of patches. Compiling this
;; with julia applies the patches automatically
(define llvm-julia
(inherit llvm-6)
(name "llvm-julia")
(method url-fetch)
(patches '("./patches/llvm-6.0-D44650.patch"
(package-arguments llvm-6)
((#:configure-flags flags)
'(list ;; Taken from NixOS. Only way I could get
;; "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
;; "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
(define libuv-julia
((commit "2348256acf5759a544e5ca7935f638d2bc091d60"))
(inherit libuv)
(name "libuv-julia")
(version commit)
(method url-fetch)
(uri (string-append
(build-system gnu-build-system)
(package-arguments libuv)
((#:phases phases)
`(modify-phases ,phases
(delete 'autogen)))))
(home-page ""))))
(name "julia")
(version "1.1.0")
(method url-fetch)
version "/julia-" version ".tar.gz"))
(build-system gnu-build-system)
`(#:test-target "test"
((ice-9 match)
(guix build gnu-build-system)
(guix build utils))
;; Do not strip binaries to keep support for full backtraces.
;; See
#:strip-binaries? #f
;; The DSOs use $ORIGIN to refer to each other, but (guix build
;; gremlin) doesn't support it yet, so skip this phase.
#:validate-runpath? #f
(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'prepare-deps
(#:key inputs #:allow-other-keys)
(mkdir "deps/srccache")
(assoc-ref inputs "dsfmt")
(assoc-ref inputs "virtualenv")
(assoc-ref inputs "libwhich")
(string-append "deps/srccache/libwhich-"
(copy-file (assoc-ref inputs "rmath")
(assoc-ref inputs "objconv")
(assoc-ref inputs "suitesparse")
;; needed by libwhich
(map (lambda (pkg)
(string-append (assoc-ref inputs pkg) "/lib"))
"arpack-ng" "fftw" "gmp" "lapack"
"libgit2" "mpfr" "openblas" "openlibm"
"openspecfun" "pcre2"
;; (copy-file
;; (assoc-ref inputs "llvm")
;; "deps/srccache/llvm-6.0.0.src.tar.xz")
;; FIXME: Building the documentation requires Julia packages that
;; would be downloaded from the Internet. We should build them in a
;; separate build phase.
(add-after 'unpack 'disable-documentation
(lambda _
(substitute* "Makefile"
(("(install: .*) \\$\\(BUILDROOT\\)/doc/_build/html/en/index.html" _ line)
(string-append line "\n"))
(("src ui doc deps")
"src ui deps"))
(add-before 'check 'set-home
;; Some tests require a home directory to be set.
(lambda _
(setenv "HOME" "/tmp")
(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.
;; Populate 'sonameMap'.
(map (match-lambda
((input libname soname)
"sonameMap[\"" libname "\"] = "
"\"" (assoc-ref inputs input) "/lib/" soname "\";")))
'(("libc" "libc" "")
("pcre2" "libpcre2-8" "")
("mpfr" "libmpfr" "")
("openblas" "libblas" "")
("arpack-ng" "libarpack" "")
("lapack" "liblapack" "")
("libgit2" "libgit2" "")
("gmp" "libgmp" "")
;; ("openlibm" "libopenlibm" "")
("openspecfun" "libopenspecfun" "")
("fftw" "libfftw3" "")
("fftwf" "libfftw3f" ""))))))
;; (substitute* "base/fft/FFTW.jl"
;; (("const libfftw = Base.libfftw_name")
;; (string-append "const libfftw = \""
;; (assoc-ref inputs "fftw") "/lib/"
;; "\""))
;; (("const libfftwf = Base.libfftwf_name")
;; (string-append "const libfftwf = \""
;; (assoc-ref inputs "fftwf") "/lib/"
;; "\"")))
(substitute* "base/math.jl"
(("const libm = Base.libm_name")
(string-append "const libm = \""
(assoc-ref inputs "openlibm")
(("const openspecfun = \"libopenspecfun\"")
(string-append "const openspecfun = \""
(assoc-ref inputs "openspecfun")
;; (substitute* "base/pcre.jl"
;; (("const PCRE_LIB = \"libpcre2-8\"")
;; (string-append "const PCRE_LIB = \""
;; (assoc-ref inputs "pcre2")
;; "/lib/" "\"")))
(add-before 'build 'fix-include-and-link-paths
(#: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/ ")))
(substitute* "base/Makefile"
(assoc-ref inputs "libuv")
(add-before 'build 'replace-default-shell
(lambda _
(substitute* "base/client.jl"
(which "sh")))
(add-after 'unpack 'hardcode-paths
(lambda _
(substitute* "stdlib/InteractiveUtils/src/InteractiveUtils.jl"
(("`which") (string-append "`" (which "which")))
(("`wget") (string-append "`" (which "wget"))))
(add-before 'check 'disable-broken-tests
(lambda _
(define (touch file-name)
(call-with-output-file file-name (const #t)))
;; Don't know why FIXME
;; (substitute* "stdlib/LibGit2/test/libgit2.jl"
;; (("!LibGit2.use_http_path(cfg, github_cred)")
;; "true")
;; (("LibGit2.use_http_path(cfg, mygit_cred)")
;; "true"))
(map (lambda (test)
(delete-file test)
(touch test))
(substitute* "test/choosetests.jl"
;; These tests fail, probably because some of the input
;; binaries have been stripped and thus backtraces don't look
;; as expected.
(string-append "prefix=" (assoc-ref %outputs "out"))
(string-append "PREFIX=" (assoc-ref %outputs "out"))
;; Passing the MARCH flag is necessary to build binary substitutes for
;; the supported architectures.
("x86_64-linux" "MARCH=x86-64")
("i686-linux" "MARCH=pentium4")
("aarch64-linux" "MARCH=armv8-a")
;; Prevent errors when querying this package on unsupported
;; platforms, e.g. when running "guix package --search="
"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.
;; TODO: What about building blas with 64 support?
"USE_BLAS64=0" ;needed when USE_SYSTEM_BLAS=1
;; TODO: Suitesparse does not install shared libraries, so we cannot
;; use the suitesparse package.
;; (string-append "SUITESPARSE_INC=-I "
;; (assoc-ref %build-inputs "suitesparse")
;; "/include")
"USE_GPL_LIBS=1" ;proudly
(string-append "UTF8PROC_INC="
(assoc-ref %build-inputs "utf8proc")
;; "LLVM_VER=6.0.0"
"USE_LLVM_SHLIB=1" ; FIXME: fails when set to 1
(string-append "LIBUV="
(assoc-ref %build-inputs "libuv")
(string-append "LIBUV_INC="
(assoc-ref %build-inputs "libuv")
`( ("llvm" ,llvm-julia)
;; The bundled version is 3.3.0 so stick to that version. With other
;; versions, we get test failures in 'linalg/arnoldi' as described in
;; <>.
("arpack-ng" ,arpack-ng-3.3.0)
("coreutils" ,coreutils)
;for bindings to "mkdir" and the like
("lapack" ,lapack)
("openblas" ,openblas)
;Julia does not build with Atlas
("libunwind" ,libunwind)
("openlibm" ,openlibm)
("openspecfun" ,openspecfun)
("libuv", libuv-julia)
("libgit2" ,libgit2)
("fftw" ,fftw)
("fftwf" ,fftwf)
("fortran" ,gfortran)
("pcre2" ,pcre2)
("utf8proc" ,utf8proc)
("mpfr" ,mpfr)
("wget" ,wget)
("which" ,which)
("zlib" ,zlib)
("gmp" ,gmp)
("virtualenv" ,python2-virtualenv)
;; FIXME: The following inputs are downloaded from upstream to allow us
;; to use the lightweight Julia release tarball. Ideally, these inputs
;; would eventually be replaced with proper Guix packages.
;; TODO: run "make -f contrib/repackage_system_suitesparse4.make" to copy static lib
(method url-fetch)
(uri "")
(method url-fetch)
(uri "")
(method url-fetch)
;; No versioned URL, see <> for updates.
(uri "")
(file-name "")
(method url-fetch)
;; ("llvm"
;; ,(origin
;; (method url-fetch)
;; (uri
;; (string-append
;; ""))
;; (sha256
;; (base32
;; "0224xvfg6h40y5lrbnb9qaq3grmdc5rg00xq03s1wxjfbf8krx8z"))))
;; ("cmake" ,cmake) ;; required to build llvm
(method url-fetch)
`(("openssl" ,openssl)
("perl" ,perl)
("patchelf" ,patchelf)
("pkg-config" ,pkg-config)
("python" ,python-2)))
;; Julia is not officially released for ARM and MIPS.
;; See
'("i686-linux" "x86_64-linux" "aarch64-linux"))
(home-page "")
(synopsis "High-performance dynamic language for technical computing")
"Julia is a high-level, high-performance dynamic programming language for
technical computing, with syntax that is familiar to users of other technical
computing environments. It provides a sophisticated compiler, distributed
parallel execution, numerical accuracy, and an extensive mathematical function
(license license:expat))