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.

193 lines
7.7 KiB

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Ricardo Wurmus <>
;;; This file is part of GNU Guix.
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <>.
(define-module (gnu packages julia)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages algebra)
#:use-module (gnu packages base)
#:use-module (gnu packages elf)
#:use-module (gnu packages gcc)
#:use-module (gnu packages llvm)
#:use-module (gnu packages libunwind)
#:use-module (gnu packages maths)
#:use-module (gnu packages multiprecision) ; mpfr
#:use-module (gnu packages pcre)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages textutils)
#:use-module (gnu packages version-control)
#:use-module (ice-9 match))
(define-public julia
(name "julia")
(version "0.3.6")
(source (origin
(method url-fetch)
(uri (string-append
version "/julia-" version "_0c24dca65c.tar.gz"))
(build-system gnu-build-system)
`(#:test-target "test"
#:modules ((ice-9 match)
(guix build gnu-build-system)
(guix build utils))
;; 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
'unpack 'hardcode-soname-map
;; ./src/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 ccall.cpp to contain a static map.
(lambda* (#:key inputs #:allow-other-keys)
(use-modules (ice-9 match))
(substitute* "src/ccall.cpp"
(map (match-lambda
((input libname soname)
"sonameMap[\"" libname "\"] = "
"\"" (assoc-ref inputs input) "/lib/" soname "\";")))
'(("libc" "libc" "")
("pcre" "libpcre" "")
("mpfr" "libmpfr" "")
("openblas" "libblas" "")
("arpack-ng" "libarpack" "")
("lapack" "liblapack" "")
("gmp" "libgmp" "")
("openlibm" "libopenlibm" "")
("openspecfun" "libopenspecfun" "")
("fftw" "libfftw3" "")
("fftwf" "libfftw3f" "")))))))
'build 'replace-default-shell
(lambda _
(substitute* "base/client.jl"
(("/bin/sh") (which "sh"))))
'build 'patch-include-path
(lambda _
(substitute* "deps/Makefile"
(string-append (assoc-ref %build-inputs "double-conversion")
'check 'disable-broken-test
;; One test fails because it produces slightly different output.
(lambda _
(substitute* "test/repl.jl"
(("@test output") "# @test output")))
;; no configure script
(alist-delete 'configure %standard-phases)))))
(string-append "prefix=" (assoc-ref %outputs "out"))
;; Passing the MARCH flag is necessary to build binary substitutes for
;; the supported architectures.
,(match (or (%current-target-system)
("x86_64-linux" "MARCH=x86-64")
("i686-linux" "MARCH=pentium4")
;; 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_LIBUV=0" ;Julia expects a modified libuv
"USE_SYSTEM_DSFMT=0" ;not packaged for Guix and upstream has no
;build system for a shared library.
"USE_SYSTEM_RMATH=0" ;Julia uses a bundled version of R's math
;library, patched to use the DSFMT RNG.
"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_SYSTEM_GRISU=1" ;for double-conversion
`(("llvm" ,llvm-3.5)
("arpack-ng" ,arpack-ng)
("lapack" ,lapack)
("openblas" ,openblas) ;Julia does not build with Atlas
("libunwind" ,libunwind)
("openlibm" ,openlibm)
("openspecfun" ,openspecfun)
("double-conversion" ,double-conversion)
("fftw" ,fftw)
("fftwf" ,fftwf)
("fortran" ,gfortran-4.8)
("pcre" ,pcre)
("utf8proc" ,utf8proc)
("git" ,git)
("mpfr" ,mpfr)
("gmp" ,gmp)))
`(("perl" ,perl)
("patchelf" ,patchelf)
("pkg-config" ,pkg-config)
("python" ,python-2)
("which" ,which)))
;; Julia is not officially released for ARM and MIPS.
;; See
(supported-systems '("i686-linux" "x86_64-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)))