[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/12: gnu: Add julia-jllwrappers.
From: |
guix-commits |
Subject: |
06/12: gnu: Add julia-jllwrappers. |
Date: |
Sat, 20 Mar 2021 17:29:46 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit a06db9c1ee8b36021d384e7552f1cf1c41208517
Author: nixo <nicolo@nixo.xyz>
AuthorDate: Tue Jan 19 11:23:10 2021 +0100
gnu: Add julia-jllwrappers.
* 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 <ludo@gnu.org>
---
doc/guix.texi | 29 +++++++++++++++++++++++++----
gnu/packages/julia-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 843f2cf..94ecd2c 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}
diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 09043c5..b89733c 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -147,6 +147,49 @@ scaled by a constant factor. Consequently, they have a
fixed number of
digits (bits) after the decimal (radix) point.")
(license license:expat)))
+(define-public julia-jllwrappers
+ (package
+ (name "julia-jllwrappers")
+ (version "1.2.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/JuliaPackaging/JLLWrappers.jl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1sj3mi2dcc13apqfpy401wic5n0pgbck1p98b2g3zw0mln9s83m4"))))
+ (arguments
+ ;; Wants to download stuff
+ '(#:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'custom-override-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Make @generate_wrapper_header take an optional argument that
+ ;; guix packagers can pass to override the default "override"
+ ;; binary path. This won't be needed when something like
+ ;; https://github.com/JuliaPackaging/JLLWrappers.jl/pull/27
+ ;; will be merged.
+ (substitute* "src/wrapper_generators.jl"
+ (("generate_wrapper_header.*")
+ "generate_wrapper_header(src_name, override_path = nothing)\n")
+ (("pkg_dir = .*" all)
+ (string-append
+ all "\n" "override = something(override_path,"
+ "joinpath(dirname(pkg_dir), \"override\"))\n"))
+ (("@static if isdir.*") "@static if isdir($override)\n")
+ (("return joinpath.*") "return $override\n"))
+ #t)))))
+ (build-system julia-build-system)
+ (home-page "https://github.com/JuliaPackaging/JLLWrappers.jl")
+ (synopsis "Julia macros used by JLL packages")
+ (description "This package contains Julia macros that enable JLL packages
+to generate themselves. It is not intended to be used by users, but rather is
+used in autogenerated packages via @code{BinaryBuilder.jl}.")
+ (license license:expat)))
+
(define-public julia-json
(package
(name "julia-json")
- branch master updated (25db3b2 -> d4987a5), guix-commits, 2021/03/20
- 01/12: doc: Fix syntax of '.guix-channel' dependency example., guix-commits, 2021/03/20
- 05/12: gnu: Add julia-benchmarktools., guix-commits, 2021/03/20
- 02/12: gnu-maintenance: Accept underscores as package/version separators., guix-commits, 2021/03/20
- 03/12: doc: Fix typo in julia-build-system., guix-commits, 2021/03/20
- 04/12: gnu: julia-adapt: Set file-name according to standards., guix-commits, 2021/03/20
- 06/12: gnu: Add julia-jllwrappers.,
guix-commits <=
- 08/12: gnu: Add julia-mbedtls., guix-commits, 2021/03/20
- 07/12: gnu: Add julia-mbedtls-jll., guix-commits, 2021/03/20
- 09/12: gnu: Add julia-uris., guix-commits, 2021/03/20
- 10/12: gnu: Add julia-inifile., guix-commits, 2021/03/20
- 11/12: gnu: Add julia-bufferedstreams., guix-commits, 2021/03/20
- 12/12: gnu: Add julia-http., guix-commits, 2021/03/20