From a06db9c1ee8b36021d384e7552f1cf1c41208517 Mon Sep 17 00:00:00 2001 From: nixo Date: Tue, 19 Jan 2021 11:23:10 +0100 Subject: gnu: Add julia-jllwrappers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/julia-xyz.scm (julia-jllwrappers): New variable. * doc/guix.texi (julia-build-system): Document how to use jllwrappers to use to guix binary packages. Co-authored-by: Ludovic Courtès --- doc/guix.texi | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 843f2cfb87..94ecd2c247 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7752,10 +7752,31 @@ The Julia package name is read from the file @file{Project.toml}. This value can be overridden by passing the argument @code{#:julia-package-name} (which must be correctly capitalized). -For packages requiring shared library dependencies, you may need to write the -@file{/deps/deps.jl} file manually. It's usually a line of @code{const -variable = /gnu/store/library.so} for each dependency, plus a void function -@code{check_deps() = nothing}. +Julia packages usually manage they binary dependencies via +@code{JLLWrappers.jl}, a Julia package that creates a module (named +after the wrapped library followed by @code{_jll.jl}. + +To add the binary path @code{_jll.jl} packages, you need to patch the +files under @file{src/wrappers/}, replacing the call to the macro +@code{JLLWrappers.@@generate_wrapper_header}, adding as a secound +argument containing the store path the binary. + +As an example, in the MbedTLS Julia package, we add a build phase +(@pxref{Build Phases}) to insert the absolute file name of the wrapped +MbedTLS package: + +@lisp +(add-after 'unpack 'override-binary-path + (lambda* (#:key inputs #:allow-other-keys) + (for-each (lambda (wrapper) + (substitute* wrapper + (("generate_wrapper_header.*") + (string-append + "generate_wrapper_header(\"MbedTLS\", \"" + (assoc-ref inputs "mbedtls-apache") "\")\n")))) + ;; There's a Julia file for each platform, override them all. + (find-files "src/wrappers/" "\\.jl$")))) +@end lisp Some older packages that aren't using @file{Package.toml} yet, will require this file to be created, too. The function @code{julia-create-package-toml} -- cgit v1.2.3