unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add Julia.
@ 2015-03-20 11:16 Ricardo Wurmus
  2015-03-23  9:29 ` Ludovic Courtès
  2015-03-23 21:35 ` Mark H Weaver
  0 siblings, 2 replies; 13+ messages in thread
From: Ricardo Wurmus @ 2015-03-20 11:16 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

Hi Guix,

attached is a patch to add Julia, a language for technical computing,
and one more library it depends on: double-conversion.

The release tarball comes with all dependencies bundled, but I tried
hard to make it build against system libraries.  This didn't always
work, unfortunately.

libuv : Julia comes with a modified version of libuv and it won't build
        with our libuv package at this point.  This has been confirmed
        upstream[1].

dSMFT : Upstream's Makefile does not have targets to build dSMFT as a
        library.  The Makefile is only used to build test programmes.  I
        have a rudimentary package for dSMFT ready, but it would have to
        include a patch to the Makefile to actually build libraries.

rmath : Julia uses a version of rmath that is patched to use the dSMFT
        random number generator.  Upstream highly recommends using the
        patched library.

suitesparse : Unfortunately, suitesparse only builds static libraries,
        not shared ones, while Julia expects to find shared libraries.
        I'm not sure what to patch here: Julia's build system so that it
        builds shared libs from the suitesparse package output (rather
        than the bundled tarball) or suitesparse such that it also
        provides shared libs.

This package depends on a couple of other packages that are still
awaiting review:

- double-conversion (patch attached below)
- openblas[2] (needed because Julia doesn't build against Atlas)
- utf8proc[3]

TIA for the review!

~~ Ricardo

----------
[1]: https://github.com/JuliaLang/julia/issues/10246#issuecomment-75029026
[2]: http://lists.gnu.org/archive/html/guix-devel/2015-03/msg00557.html
[3]: http://lists.gnu.org/archive/html/guix-devel/2015-03/msg00563.html



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-double-conversion.patch --]
[-- Type: text/x-patch, Size: 1818 bytes --]

From dfe39329d60b38b684141cc0ce1d2bccd7ab637e Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 20 Mar 2015 12:11:35 +0100
Subject: [PATCH 1/2] gnu: Add double-conversion.

* gnu/packages/maths.scm (double-conversion): New variable.
---
 gnu/packages/maths.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 0d2efdd..cb6fa66 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -92,6 +92,32 @@ effectively as a scientific calculator.")
    (license license:gpl3+)
    (home-page "http://www.gnu.org/software/units/")))
 
+(define-public double-conversion
+  (package
+    (name "double-conversion")
+    (version "1.1.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/floitsch/double-conversion/archive/v"
+                    version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:test-target "test"
+       #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
+                           "-DBUILD_TESTING=ON")))
+    (home-page "https://github.com/floitsch/double-conversion")
+    (synopsis "Conversion routines for IEEE doubles")
+    (description
+     "The double-conversion library provides binary-decimal and decimal-binary
+routines for IEEE doubles.  The library consists of efficient conversion
+routines that have been extracted from the V8 JavaScript engine.")
+    (license license:bsd-3)))
+
 (define-public dionysus
   (package
     (name "dionysus")
-- 
2.1.0


[-- Attachment #3: 0002-gnu-Add-Julia.patch --]
[-- Type: text/x-patch, Size: 8457 bytes --]

From 41550ffafa8da05b2cf8dfad66d44e6f43c9042c Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 20 Mar 2015 11:26:23 +0100
Subject: [PATCH 2/2] gnu: Add Julia.

* gnu/packages/julia.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
---
 gnu-system.am          |   1 +
 gnu/packages/julia.scm | 172 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 gnu/packages/julia.scm

diff --git a/gnu-system.am b/gnu-system.am
index 2bed50f..75a98bf 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -156,6 +156,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/iso-codes.scm			\
   gnu/packages/java.scm				\
   gnu/packages/jrnl.scm				\
+  gnu/packages/julia.scm			\
   gnu/packages/kde.scm				\
   gnu/packages/key-mon.scm			\
   gnu/packages/language.scm			\
diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
new file mode 100644
index 0000000..844f1b2
--- /dev/null
+++ b/gnu/packages/julia.scm
@@ -0,0 +1,172 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;;
+;;; 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
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(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))
+
+(define-public julia
+  (package
+    (name "julia")
+    (version "0.3.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/JuliaLang/julia/releases/download/v"
+                    version "/julia-" version "_0c24dca65c.tar.gz"))
+              (sha256
+               (base32
+                "1hnbc2blzr9bc27m3vsr127fhg0h5imgqlrx00jakf0my0ccw8gr"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:test-target "test"
+       #:modules ((ice-9 match)
+                  (guix build gnu-build-system)
+                  (guix build utils))
+       #:phases
+       (alist-cons-after
+        '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"
+            (("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")
+                     ("pcre"        "libpcre"        "libpcre.so")
+                     ("mpfr"        "libmpfr"        "libmpfr.so")
+                     ("openblas"    "libblas"        "libopenblas.so")
+                     ("arpack-ng"   "libarpack"      "libarpack.so")
+                     ("lapack"      "liblapack"      "liblapack.so")
+                     ("gmp"         "libgmp"         "libgmp.so")
+                     ("openlibm"    "libopenlibm"    "libopenlibm.so")
+                     ("openspecfun" "libopenspecfun" "libopenspecfun.so")
+                     ("fftw"        "libfftw3"       "libfftw3.so")
+                     ("fftwf"       "libfftw3f"      "libfftw3f.so")))))))
+        (alist-cons-before
+         'build 'replace-default-shell
+         (lambda _
+           (substitute* "base/client.jl"
+             (("/bin/sh") (which "sh"))))
+         (alist-cons-before
+          'build 'patch-include-path
+          (lambda _
+            (substitute* "deps/Makefile"
+              (("/usr/include/double-conversion")
+               (string-append (assoc-ref %build-inputs "double-conversion")
+                              "/include/double-conversion"))))
+          (alist-cons-before
+           '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)))))
+       #:make-flags
+       (list
+        (string-append "prefix=" (assoc-ref %outputs "out"))
+        "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_SYSTEM_LAPACK=1"
+        "USE_SYSTEM_BLAS=1"
+        "USE_BLAS64=0"          ;needed when USE_SYSTEM_BLAS=1
+
+        "USE_SYSTEM_FFTW=1"
+        "LIBFFTWNAME=libfftw3"
+        "LIBFFTWFNAME=libfftw3f"
+
+        ;; TODO: Suitesparse does not install shared libraries, so we cannot
+        ;; use the suitesparse package.
+        ;; "USE_SYSTEM_SUITESPARSE=1"
+        ;; (string-append "SUITESPARSE_INC=-I "
+        ;;                (assoc-ref %build-inputs "suitesparse")
+        ;;                "/include")
+
+        "USE_SYSTEM_GRISU=1"    ;for double-conversion
+        "USE_SYSTEM_UTF8PROC=1"
+        "USE_SYSTEM_LLVM=1"
+        "USE_SYSTEM_LIBUNWIND=1"
+        "USE_SYSTEM_PCRE=1"
+        "USE_SYSTEM_OPENLIBM=1"
+        "USE_SYSTEM_GMP=1"
+        "USE_SYSTEM_MPFR=1"
+        "USE_SYSTEM_ARPACK=1"
+        "USE_SYSTEM_LIBGIT2=1"
+        "USE_SYSTEM_OPENSPECFUN=1")))
+    (inputs
+     `(("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)))
+    (native-inputs
+     `(("perl" ,perl)
+       ("patchelf" ,patchelf)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-2)
+       ("which" ,which)))
+    (home-page "http://julialang.org/")
+    (synopsis "High-performance dynamic language for technical computing")
+    (description
+     "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
+library.")
+    (license license:expat)))
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-03-29 13:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 11:16 [PATCH] Add Julia Ricardo Wurmus
2015-03-23  9:29 ` Ludovic Courtès
2015-03-23 21:35 ` Mark H Weaver
2015-03-24 14:56   ` Mark H Weaver
2015-03-24 17:14     ` Ricardo Wurmus
2015-03-24 20:45       ` Ludovic Courtès
2015-03-25 16:20       ` Mark H Weaver
2015-03-25 18:24         ` Ricardo Wurmus
2015-03-25 21:00           ` Mark H Weaver
2015-03-26 15:19         ` Mark H Weaver
2015-03-26 16:58           ` Ludovic Courtès
2015-03-26 21:14           ` Ricardo Wurmus
2015-03-29 13:21             ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).