Compare commits

...

22 Commits

Author SHA1 Message Date
Simon Tournier
93095bf2c1 julia-fillarrays: Pin the version of julia-aqua.
* gnu/packages/julia-xyz.scm (julia-fillarrays)[propagated-inputs]: Move
julia-aqua from here to...
[inputs]: ... to here. Replace julia-aqua by julia-aqua-0.5.

Change-Id: I57911619f915b649e3ce004fe7fd2f40241dc6c2
2025-03-05 16:50:10 +01:00
Simon Tournier
7f7326c049 DRAFT gnu: julia-static: Update to 0.8.6.
* gnu/packages/julia-xyz.scm (julia-static): Update to 0.8.6.

Change-Id: Ie0f97a2d37feb4fd99cfc6b9c1ce378bcf9819aa
2025-03-05 16:12:39 +01:00
Simon Tournier
a8f4bb188f gnu: julia-aqua: Update to 0.8.4.
* gnu/packages/julia-xyz.scm (julia-aqua): Update to 0.8.4.

Change-Id: I5dc1a0e0d72fb24d0e210d06c74b98940a80973b
2025-03-05 16:12:39 +01:00
Simon Tournier
2c35fc2e2c julia-cfitsio: Pin the version of julia-aqua.
* gnu/packages/julia-xyz.sc, (julia-cfitsio)[native-inputs]: Replace
julia-aqua by julia-aqua-0.5.

Change-Id: I400b09fd2480f0406b6cd370c09346ad1df91c15
2025-03-05 16:12:38 +01:00
Simon Tournier
8c4b1cd92f gnu: Add julia-aqua-0.5.
* gnu/packages/julia-xyz.scm (julia-aqua-0.5): New variable.

Change-Id: Id1619d2f34ab25b35922d6b4f410dbaac04071ca
2025-03-05 16:12:38 +01:00
Simon Tournier
9043d7433b gnu: Add julia-commonworldinvalidations.
* gnu/packages/julia-xyz.scm (julia-commonworldinvalidations): New variable.

Change-Id: I10b2a0460ff454344a590e829dff51acc3ae154c
2025-03-05 15:26:28 +01:00
Simon Tournier
5f31ce18b3 gnu: julia-sortingalgorithms: Update to 1.2.1.
* gnu/packages/julia-xyz.scm (julia-sortingalgorithms): Update to 1.2.1.

Change-Id: Ic808dd6a7f73dc9c0afd7101305f1045c60675fb
2025-02-14 18:01:48 +01:00
Simon Tournier
48a949b651 DRAFT TODO gnu: julia-chainrulescore: Update to 1.25.1.
* gnu/packages/julia-xyz.scm (julia-chainrulescore): Update to 1.25.1.

Change-Id: I5f605e8f8637a1901b360c6219b704c476855c57
2025-02-14 17:49:38 +01:00
Simon Tournier
3feb2fa912 gnu: julia-mlstyle: Update to 0.4.17.
* gnu/packages/julia-xyz.scm (julia-mlstyle): Update to 0.4.17.
[arguments]: Turn off parallel tests.

Change-Id: I3cddff80c2e08844afa36d75596994ba91aa609a
2025-02-14 17:37:31 +01:00
Simon Tournier
24daa079d8 DRAFT TODO julia-unitful: Turn off tests.
* gnu/packages/julia-xyz.scm (julia-unitful): TODO.

Change-Id: I7f40133cd7ae29d8205ac62971491a452151eab5
2025-02-14 17:35:13 +01:00
Simon Tournier
f470822ad7 DRAFT TODO julia-exprtools: Turn off tests.
* gnu/packages/julia-xyz.scm (julia-exprtools): TODO.

Change-Id: If5a9b333f2e683c66c271181cbc1c87f9911ec20
2025-02-14 17:24:33 +01:00
Simon Tournier
adc20f216b DRAFT build-system/julia: Create environment file when required.
* guix/build/julia-build-system.scm (link-depot): Create Project.toml file
under environments folder when required.

Change-Id: I52a4253af34b540d454cbf09f38969e45e2b5daf
2025-02-14 16:57:58 +01:00
Simon Tournier
647bba4d05 build-system/julia: Tweak internal 'slug'.
* guix/build/julia-build-system.scm (link-depot): Tweak 'slug'.

Change-Id: I72937a701c86505e7793209509d1592689217b22
2025-02-14 16:54:37 +01:00
Simon Tournier
57ea546604 build-system/julia: Reorder the standard phases.
* guix/build/julia-build-system.scm (%standard-phases): Reorder.

Change-Id: I2d82c0046b07bb2ffa6f7d463e544fc741cad72f
2025-02-14 16:54:36 +01:00
Simon Tournier
c660c2bac9 build-system/julia: Move comment.
Follow up of 63a6b131e5.

* guix/build/julia-build-system.scm (link-depot): Move a comment to the
correct place.
(julia-create-package-toml): Replace 'when not' by 'unless'.

Change-Id: I36acc26934fd35c3051bc0e365cc551745d1febc
2025-02-14 16:54:36 +01:00
Simon Tournier
871bee15ce DRAFT build: julia-build-system: Set DEPOT_PATH and LOAD_PATH variables.
* guix/build/julia-build-system.scm (precompile, check): Set JULIA_DEPOT_PATH
and JULIA_LOAD_PATH.

Change-Id: I2ab490d7905ba30abc8256be9646570be397750c
2025-02-14 16:54:33 +01:00
Ludovic Courtès
8d8ff31e77 DRAFT gnu: julia: Move default load path to the end.
* gnu/packages/julia.scm (julia)[arguments]: In ‘make-wrapper’ phase,
arrange to have the empty entry at the end of JULIA_LOAD_PATH and
JULIA_DEPOT_PATH.

Change-Id: I81e5dbc06535cb9fc7253b2944984cf7890bbe65
2025-02-14 16:33:40 +01:00
Ludovic Courtès
25401aeb8e gnu: julia: Avoid old-style input and output alists.
* gnu/packages/julia.scm (julia)[arguments]: Remove references to
‘%outputs’ and ‘%build-inputs’ in #:make-flags.

Change-Id: I400c038437a1f9f8bc010d22aa874c892958cfe2
2025-02-14 12:40:25 +01:00
Ludovic Courtès
c7101b9c0e build-system/julia: Log more details.
* guix/build/julia-build-system.scm (check): Define ‘test-file’ and
print its value.
(link-depot): Define ‘target’ and print its value.
(julia-create-package-toml): Print package info.

Change-Id: I5fa538ddd56e18ffb1c3eea8f951e991fc4ca4cf
2025-02-14 12:40:24 +01:00
Ludovic Courtès
63a6b131e5 build-system/julia: Detect and report failure to compute “slug”.
* guix/build/julia-build-system.scm (link-depot): Call ‘close-pipe’ and
raise an error when it returns a non-zero status.

Change-Id: I2dc63bfeebf2b290f42ddc2ab23af877ac1c85d0
2025-02-14 12:40:24 +01:00
Ludovic Courtès
8dde68d182 gnu: julia-compat: Update to 4.16.0.
* gnu/packages/julia-xyz.scm (julia-compat): Update to 4.16.0.

Change-Id: Idb079c5fee4c60b1a18fe25f1035ad1eab8a1d0b
2025-02-14 12:40:24 +01:00
Ludovic Courtès
3b6e7eec6e gnu: julia: Update to 1.9.3.
* gnu/packages/julia.scm (julia): Update to 1.9.3.
[arguments]: Use gexps.
[inputs, native-inputs]: Remove labels.
* gnu/packages/llvm.scm (llvm-julia): Rename to…
(llvm-14-julia): … this.  Upgrade to 14.0.6-3.
* gnu/packages/patches/julia-1.9-build-tweaks.patch: New file.
* gnu/packages/patches/julia-Use-MPFR-4.2.patch: Remove.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.

Co-authored-by: Philippe Virouleau <philippe.virouleau@inria.fr>
Change-Id: I6ef35c6cd31741a7725b50364dd0f8fa6a0c6424
2025-02-14 12:40:23 +01:00
7 changed files with 779 additions and 682 deletions

View File

@@ -1644,8 +1644,8 @@ dist_patch_DATA = \
%D%/packages/patches/john-the-ripper-jumbo-with-gcc-11.patch \
%D%/packages/patches/json-c-0.13-CVE-2020-12762.patch \
%D%/packages/patches/json-c-0.12-CVE-2020-12762.patch \
%D%/packages/patches/julia-1.9-build-tweaks.patch \
%D%/packages/patches/julia-SOURCE_DATE_EPOCH-mtime.patch \
%D%/packages/patches/julia-Use-MPFR-4.2.patch \
%D%/packages/patches/libcall-ui-make-it-installable.patch \
%D%/packages/patches/libcamera-ipa_manager-disable-signature-verification.patch \
%D%/packages/patches/libcss-check-format.patch \

View File

@@ -129,7 +129,7 @@ ANSI escape codes to another format.")
(define-public julia-aqua
(package
(name "julia-aqua")
(version "0.5.5")
(version "0.8.4")
(source
(origin
(method git-fetch)
@@ -138,7 +138,7 @@ ANSI escape codes to another format.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "12hng8czkgynsn1pshavma2wijypl6k05hhgivc3rqiyclfpi89z"))))
(base32 "1vxmb3n3qmlfzc12zk66b1wza0nklglglk0xdji121cnciylpiz1"))))
(build-system julia-build-system)
(arguments
(list #:parallel-tests? #f))
@@ -148,6 +148,22 @@ ANSI escape codes to another format.")
provides functions to run a few automatable checks for Julia packages.")
(license license:expat)))
;;; Required by julia-cfitsio
(define julia-aqua-0.5
(package
(inherit julia-aqua)
(name "julia-aqua")
(version "0.5.5")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/JuliaTesting/Aqua.jl")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "12hng8czkgynsn1pshavma2wijypl6k05hhgivc3rqiyclfpi89z"))))))
(define-public julia-argcheck
(package
(name "julia-argcheck")
@@ -955,7 +971,7 @@ variables, both with unordered (nominal variables) and ordered categories
(sha256
(base32 "05bxzzjcc021p3hi092h06r2q7qnvql0xz1alggi83i0pp1mxp6d"))))
(build-system julia-build-system)
(native-inputs (list julia-aqua))
(native-inputs (list julia-aqua-0.5))
(propagated-inputs (list julia-cfitsio-jll))
(home-page "https://github.com/JuliaAstro/CFITSIO.jl")
(synopsis "C-style interface to the libcfitsio library")
@@ -1006,7 +1022,7 @@ execute forward-, reverse-, and mixed-mode primitives.")
(define-public julia-chainrulescore
(package
(name "julia-chainrulescore")
(version "1.12.2")
(version "1.25.1")
(source
(origin
(method git-fetch)
@@ -1015,19 +1031,9 @@ execute forward-, reverse-, and mixed-mode primitives.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0lgfcsb7f6c7knhiz5dbqh8x47d370pn71y9ys2y6763g0b4pm61"))))
(base32 "0pklqnndhx05ask4719d5yqq1p2l5wx9q79paa704q482sh5cgwz"))))
(build-system julia-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'adjust-tests
(lambda _
(substitute* "test/tangent_types/tangent.jl"
;; This test is disabled after the release.
(("@test haskey.*Float.*") "")
(("@test (.*construct)" _ test)
(string-append "@test_broken " test))))))))
(arguments (list #:tests? #f))
(inputs ;required for tests
(list julia-benchmarktools
julia-staticarrays))
@@ -1310,10 +1316,36 @@ clash with SciML if both ecosystems export the solve command.")
common subexpression elimination.")
(license license:expat)))
(define-public julia-commonworldinvalidations
(let ((commit "e462b98bd214e3c6b70c2e4e64831466c21b8c04"))
(package
(name "julia-commonworldinvalidations")
(version (git-version "0.0.0" "1" commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/SciML/CommonWorldInvalidations.jl")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "0wi41ci6mrlkpk2cvvfxbmgja7cggmmlrk509b4kmmhxds6dxjqx"))))
(build-system julia-build-system)
(propagated-inputs
(list julia-macrotools))
(home-page "https://github.com/SciML/CommonWordInvalidations.jl")
(synopsis "Fixing the world one invalidator at a time")
(description "This package fixes the common unfixable invalidators by
simply forcing the invalidations. It's made to be an unchanged dependency
that is then reused by downstream libraries with
@code{PrecompileTools.@@recompile_invalidations} so the common invalidators are
all handled during the precompilation stage a single time.")
(license license:expat))))
(define-public julia-compat
(package
(name "julia-compat")
(version "3.39.0")
(version "4.16.0")
(source
(origin
(method git-fetch)
@@ -1322,7 +1354,7 @@ common subexpression elimination.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0qzvaqi5gqgc747fnajbvvf5vqbh6cwykwky00c7glvmvdsgk3z0"))))
(base32 "1n0s3rv478fwlrpy1v4f5fcydx7lblzljjlmkh6ap7nm2xs1w43c"))))
(build-system julia-build-system)
(arguments
(list
@@ -2314,6 +2346,7 @@ metaprogramming on Julia Expr, the meta programming standard library for
(sha256
(base32 "0sxrhc5dz1v53zs8sym4csfy28ki00b7x7aihm2zmkrx48if63gb"))))
(build-system julia-build-system)
(arguments (list #:tests? #f))
(home-page "https://github.com/invenia/ExprTools.jl")
(synopsis "Light-weight expression manipulation tools")
(description "@code{ExprTools} provides tooling for working with Julia
@@ -2455,10 +2488,9 @@ working with filesystem paths in Julia.")
(sha256
(base32 "1c4i8awmw9qq8dqfhxwjh76mc1nlmzrl5j754fpnbajv8p49gdv5"))))
(build-system julia-build-system)
(propagated-inputs
(list julia-aqua))
(inputs ;required by tests
(list julia-staticarrays))
(list julia-aqua-0.5
julia-staticarrays))
(home-page "https://github.com/JuliaArrays/FillArrays.jl")
(synopsis "Lazy matrix representation")
(description "This package lazily represents matrices filled with
@@ -4563,7 +4595,7 @@ with @code{missing} values in Julia.")
(define-public julia-mlstyle
(package
(name "julia-mlstyle")
(version "0.4.10")
(version "0.4.17")
(source
(origin
(method git-fetch)
@@ -4572,8 +4604,9 @@ with @code{missing} values in Julia.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0h1cd7cr4c4cnpqyj3180113gdbvcc047lqphp8a8gq5smp3c059"))))
(base32 "12xb5gazw3s5sxx5xbk84qr2bg6h20z6xqrlxipn8jl9l6vj2j2g"))))
(build-system julia-build-system)
(arguments (list #:parallel-tests? #f))
(native-inputs
(list julia-datastructures))
(home-page "https://thautwarm.github.io/MLStyle.jl/latest/")
@@ -6278,7 +6311,7 @@ beginners.")
(define-public julia-sortingalgorithms
(package
(name "julia-sortingalgorithms")
(version "1.0.1")
(version "1.2.1")
(source
(origin
(method git-fetch)
@@ -6287,7 +6320,7 @@ beginners.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "173x77a80xnh99viqa3r7rgdaksvxaw8xyfqw09gwvp4p2zrxivb"))))
(base32 "0xf35x67pxm1b7x13il0mi2zn2wdj7dc231chgakfvdiisk9l0k8"))))
(build-system julia-build-system)
(arguments
(list #:tests? #f)) ; cycle with StatsBase.jl
@@ -6422,7 +6455,7 @@ There are multiple ways to understand @code{StackView}:
(define-public julia-static
(package
(name "julia-static")
(version "0.8.3")
(version "0.8.6")
(source
(origin
(method git-fetch)
@@ -6431,8 +6464,9 @@ There are multiple ways to understand @code{StackView}:
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "1ilmging187w37vjff8ilnz1f0qygyhbwl6nhq91z3b5vxyf13zr"))))
(base32 "1szvpyaam138707qyk59jga14fnnad2ib8dcwvk9cb9k1pgwk0zg"))))
(build-system julia-build-system)
(arguments (list #:tests? #f))
(propagated-inputs
(list julia-ifelse))
(native-inputs
@@ -7178,7 +7212,7 @@ working with @acronym{URIs,Uniform Resource Identifiers}, as defined in RFC
(base32 "1b8w6wqc7azqzg2f8zc3bmc72fb01sx0rqh6dv3k54wj01ph15p7"))))
(build-system julia-build-system)
(arguments
(list #:parallel-tests? #f))
(list #:tests? #f #:parallel-tests? #f))
(propagated-inputs
(list julia-constructionbase))
(home-page "https://painterqubits.github.io/Unitful.jl/stable/")

View File

@@ -28,6 +28,7 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module (guix git-download)
#:use-module (guix build-system gnu)
@@ -142,412 +143,495 @@ libraries. It is also a bit like @code{ldd} and @code{otool -L}.")
(define-public julia
(package
(name "julia")
(version "1.8.3")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/JuliaLang/julia/releases/download/v"
version "/julia-" version ".tar.gz"))
(sha256
(base32
"0jf8dr5j7y8cjnr65kn38xps5h9m2qvi8g1yd8qgiip5r87ld3ad"))
(patches (search-patches "julia-SOURCE_DATE_EPOCH-mtime.patch"
"julia-Use-MPFR-4.2.patch"))))
(version "1.9.3")
(source
(origin
(method url-fetch)
(uri (string-append
"https://github.com/JuliaLang/julia/releases/download/v" version
"/julia-" version ".tar.gz"))
(sha256
(base32 "0788hbcr1v89crv2j3insy89lxs0zwjbxk9q73jpj4g7j26bszcd"))
(patches (search-patches "julia-SOURCE_DATE_EPOCH-mtime.patch"
"julia-1.9-build-tweaks.patch"))))
(build-system gnu-build-system)
(arguments
`(#:test-target "test"
#:modules ((ice-9 match)
(guix build gnu-build-system)
(guix build utils))
(list #:test-target "test"
#:modules `((ice-9 match)
(guix build gnu-build-system)
(guix build utils))
;; The test suite takes many times longer than building and
;; can easily fail on smaller machines when they run out of memory.
#:tests? ,(not (or (%current-target-system)
(target-aarch64?)))
;; The test suite takes many times longer than building and
;; can easily fail on smaller machines when they run out of memory.
#:tests? (not (or (%current-target-system)
(target-aarch64?)))
;; Do not strip binaries to keep support for full backtraces.
;; See https://github.com/JuliaLang/julia/issues/17831
#:strip-binaries? #f
;; Do not strip binaries to keep support for full backtraces.
;; See https://github.com/JuliaLang/julia/issues/17831
#: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
;; 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
#:phases
(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'prepare-deps
(lambda* (#:key inputs #:allow-other-keys)
;; needed by libwhich
(setenv "LD_LIBRARY_PATH"
(string-join (map (lambda (pkg)
(string-append (assoc-ref inputs pkg)
"/lib"))
'("curl" "dsfmt"
"gmp" "lapack"
"libssh2" "libnghttp2" "libgit2"
"libblastrampoline"
"mbedtls" "mpfr"
"openblas" "openlibm" "pcre2"
"suitesparse" "gfortran:lib"))
":"))))
;; 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-after 'unpack 'activate-gnu-source-for-loader
(lambda _
(substitute* "cli/Makefile"
(("LOADER_CFLAGS =") "LOADER_CFLAGS = -D_GNU_SOURCE"))))
;; libquadmath is not available on all architectures.
;; https://github.com/JuliaLang/julia/issues/41613
(add-after 'unpack 'make-libquadmath-optional
(lambda _
(substitute* "base/Makefile"
(("libquadmath,0") "libquadmath,0,ALLOW_FAILURE"))))
(add-before 'check 'set-home
;; Some tests require a home directory to be set.
(lambda _ (setenv "HOME" "/tmp")))
(add-before 'build 'fix-include-and-link-paths
(lambda* (#:key inputs #:allow-other-keys)
;; The REPL must be linked with libuv.
(substitute* "cli/Makefile"
(("JLDFLAGS \\+= ")
(string-append "JLDFLAGS += "
(assoc-ref inputs "libuv")
"/lib/libuv.so ")))))
(add-before 'build 'replace-default-shell
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "base/client.jl"
(("/bin/sh") (search-input-file inputs "/bin/sh")))))
(add-before 'build 'shared-objects-paths
(lambda* (#:key inputs #:allow-other-keys)
(let ((jlpath
(lambda (pkgname)
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'prepare-deps
(lambda* (#:key inputs #:allow-other-keys)
;; needed by libwhich
(match inputs
(((labels . directories) ...)
(set-path-environment-variable
"LD_LIBRARY_PATH"
'("lib") directories)))))
(add-before 'check 'set-home
;; Some tests require a home directory to be set.
(lambda _
(setenv "HOME" "/tmp")))
(add-before 'build 'fix-include-and-link-paths
(lambda* (#:key inputs #:allow-other-keys)
;; The REPL must be linked with libuv.
(substitute* "cli/Makefile"
(("JLDFLAGS \\+= ")
(string-append "JLDFLAGS += "
(search-input-file inputs
"/lib/libuv.so") " ")))))
(add-before 'build 'fix-nested-dlopen
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "Make.inc"
;; See the patch comment for the explanation, *must* be updated
;; when updating julia.
(("GUIX_LIBUTF8PROC")
(search-input-file inputs "/lib/libutf8proc.a")))
(substitute* "Makefile"
;; See the patch comment for the explanation, *must* be updated
;; when updating julia.
(("GUIX_LIBCHOLMOD")
(search-input-file inputs "/lib/libcholmod.so"))
(("GUIX_LIBSPQR")
(search-input-file inputs "/lib/libspqr.so"))
(("GUIX_LIBSC")
(search-input-file inputs
"/lib/libsuitesparseconfig.so"))
(("GUIX_LIBUMFPACK")
(search-input-file inputs "/lib/libumfpack.so")))))
(add-before 'build 'replace-default-shell
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "base/client.jl"
(("/bin/sh")
(search-input-file inputs "/bin/sh")))))
(add-before 'build 'shared-objects-paths
(lambda* (#:key inputs #:allow-other-keys)
(let ((jlpath (lambda (pkgname)
(string-append "stdlib/" pkgname
"_jll/src/" pkgname
"_jll.jl")))
(jlbasepath (lambda (pkgname)
(string-append "base/" pkgname
".jl")))
(tolib (lambda (libname)
(search-input-file inputs
(string-append
"/lib/" libname
".so"))))
(toquotedlib (lambda (libname)
(define file
(string-append "/lib/"
libname
".so"))
(string-append "\""
(search-input-file
inputs file)
"\"")))
(from (lambda (libname)
(string-append "const " libname
" = .*\\.so")))
(to (lambda* (libname #:optional libname_jl)
(define file
(string-append "/lib/" libname ".so"))
(string-append "const "
(or libname_jl libname)
" = \""
(search-input-file
inputs file)))))
(substitute* "src/jitlayers.cpp"
(("libatomic.so")
(search-input-file inputs "/lib/libatomic.so")))
(substitute* (list (jlbasepath "linking")
(jlpath "LLD"))
(("\"lld\"")
(string-append "\""
(search-input-file inputs
"/bin/lld")
"\"")))
(substitute* (jlbasepath "pcre")
(("libpcre2-8")
(tolib "libpcre2-8")))
(substitute* (jlbasepath "gmp")
(("libgmp.so.10")
(tolib "libgmp")))
(substitute* (jlbasepath "mpfr")
(("libmpfr.so.6")
(tolib "libmpfr")))
(substitute* (jlbasepath "irrationals")
((":libmpfr")
(toquotedlib "libmpfr")))
(substitute* "stdlib/Random/src/generation.jl"
((":libmpfr")
(toquotedlib "libmpfr")))
(substitute* "stdlib/Printf/src/Printf.jl"
(("\"libmpfr\"")
(toquotedlib "libmpfr")))
(substitute* "stdlib/Random/src/DSFMT.jl"
((":libdSFMT")
(toquotedlib "libdSFMT")))
(for-each (lambda (file)
(substitute* file
((":libgit2")
(toquotedlib "libgit2"))))
(find-files "stdlib/LibGit2/" "\\.jl$"))
(substitute* (jlpath "CompilerSupportLibraries")
(((from "libgomp"))
(to "libgomp"))
(((from "libgfortran"))
(string-append
"const libgfortran = string(\""
(search-input-file inputs
"/lib/libgfortran.so"))))
(substitute* (jlpath "dSFMT")
(((from "libdSFMT"))
(to "libdSFMT")))
(substitute* (jlpath "GMP")
(((from "libgmp"))
(to "libgmp"))
(((from "libgmpxx"))
(to "libgmpxx")))
(substitute* (jlpath "libLLVM")
(((from "libLLVM"))
(to "libLLVM")))
(substitute* (jlbasepath "binaryplatforms")
(("libLLVM-14jl")
(tolib "libLLVM-14jl")))
(substitute* (jlpath "LibCURL")
(((from "libcurl"))
(to "libcurl")))
(substitute* (jlpath "LibGit2")
(((from "libgit2"))
(to "libgit2")))
(substitute* (jlpath "LibSSH2")
(((from "libssh2"))
(to "libssh2")))
(substitute* (jlpath "LibUV")
(((from "libuv"))
(to "libuv")))
(substitute* (jlpath "LibUnwind")
(((from "libunwind"))
(to "libunwind")))
(substitute* (jlpath "MPFR")
(((from "libmpfr"))
(to "libmpfr")))
(substitute* (jlpath "MbedTLS")
(((from "libmbedcrypto"))
(to "libmbedcrypto"))
(((from "libmbedtls"))
(to "libmbedtls"))
(((from "libmbedx509"))
(to "libmbedx509")))
(substitute* (jlpath "nghttp2")
(((from "libnghttp2"))
(to "libnghttp2")))
(substitute* (jlpath "OpenBLAS")
(("libgfortran.so")
(tolib "libgfortran"))
(((from "libopenblas"))
#$@(if (target-x86-64?)
`((to "libopenblas64_" "libopenblas"))
`((to "libopenblas")))))
(substitute* (jlpath "OpenLibm")
(((from "libopenlibm"))
(to "libopenlibm")))
(substitute* (jlpath "PCRE2")
(((from "libpcre2_8"))
(to "libpcre2-8" "libpcre2_8")))
(substitute* (jlpath "SuiteSparse")
(((from "libamd"))
(to "libamd"))
(((from "libbtf"))
(to "libbtf"))
(((from "libcamd"))
(to "libcamd"))
(((from "libccolamd"))
(to "libccolamd"))
(((from "libcholmod"))
(to "libcholmod"))
(((from "libcolamd"))
(to "libcolamd"))
(((from "libklu"))
(to "libklu"))
(((from "libldl"))
(to "libldl"))
(((from "librbio"))
(to "librbio"))
(((from "libspqr"))
(to "libspqr"))
(((from "libsuitesparse"))
(to "libsuitesparse"))
(((from "libsuitesparseconfig"))
(to "libsuitesparseconfig"))
(((from "libumfpack"))
(to "libumfpack")))
(substitute* (jlpath "Zlib")
(((from "libz"))
(to "libz")))
(substitute* (jlpath "libblastrampoline")
(("libblastrampoline\\.so")
(search-input-file inputs
"/lib/libblastrampoline.so"))))))
(add-before 'build 'use-ssl-cert-file
(lambda _
;; We must adapt MozillaCACerts to use SSL_CERT_FILE.
(substitute* "stdlib/MozillaCACerts_jll/src/MozillaCACerts_jll.jl"
(("global cacert = .*")
(string-append
"stdlib/" pkgname "_jll/src/" pkgname "_jll.jl")))
(from
(lambda (libname)
(string-append "const " libname " = .*\\.so")))
(to
(lambda* (pkg libname #:optional libname_jl)
(string-append
"const " (or libname_jl libname) " = \""
(assoc-ref inputs pkg) "/lib/" libname ".so"))))
(substitute* (jlpath "CompilerSupportLibraries")
(((from "libgfortran"))
(string-append "const libgfortran = string(\""
(search-input-file inputs "/lib/libgfortran.so"))))
(substitute* (jlpath "dSFMT")
(((from "libdSFMT")) (to "dsfmt" "libdSFMT")))
(substitute* (jlpath "GMP")
(((from "libgmp")) (to "gmp" "libgmp"))
(((from "libgmpxx")) (to "gmp" "libgmpxx")))
(substitute* (jlpath "libLLVM")
(((from "libLLVM")) (to "llvm" "libLLVM")))
(substitute* (jlpath "LibCURL")
(((from "libcurl")) (to "curl" "libcurl")))
(substitute* (jlpath "LibGit2")
(((from "libgit2")) (to "libgit2" "libgit2")))
(substitute* (jlpath "LibSSH2")
(((from "libssh2")) (to "libssh2" "libssh2")))
(substitute* (jlpath "LibUV")
(((from "libuv")) (to "libuv" "libuv")))
(substitute* (jlpath "LibUnwind")
(((from "libunwind")) (to "libunwind" "libunwind")))
(substitute* (jlpath "MPFR")
(((from "libmpfr")) (to "mpfr" "libmpfr")))
(substitute* (jlpath "MbedTLS")
(((from "libmbedcrypto")) (to "mbedtls" "libmbedcrypto"))
(((from "libmbedtls")) (to "mbedtls" "libmbedtls"))
(((from "libmbedx509")) (to "mbedtls" "libmbedx509")))
(substitute* (jlpath "nghttp2")
(((from "libnghttp2")) (to "libnghttp2" "libnghttp2")))
(substitute* (jlpath "OpenBLAS")
(((from "libopenblas"))
,@(if (target-x86-64?)
`((to "openblas" "libopenblas64_" "libopenblas"))
`((to "openblas" "libopenblas")))))
(substitute* (jlpath "OpenLibm")
(((from "libopenlibm")) (to "openlibm" "libopenlibm")))
(substitute* (jlpath "PCRE2")
(((from "libpcre2_8")) (to "pcre2" "libpcre2-8" "libpcre2_8")))
(substitute* (jlpath "SuiteSparse")
(((from "libamd")) (to "suitesparse" "libamd"))
(((from "libbtf")) (to "suitesparse" "libbtf"))
(((from "libcamd")) (to "suitesparse" "libcamd"))
(((from "libccolamd")) (to "suitesparse" "libccolamd"))
(((from "libcholmod")) (to "suitesparse" "libcholmod"))
(((from "libcolamd")) (to "suitesparse" "libcolamd"))
(((from "libklu")) (to "suitesparse" "libklu"))
(((from "libldl")) (to "suitesparse" "libldl"))
(((from "librbio")) (to "suitesparse" "librbio"))
(((from "libspqr")) (to "suitesparse" "libspqr"))
(((from "libsuitesparse")) (to "suitesparse" "libsuitesparse"))
(((from "libsuitesparseconfig"))
(to "suitesparse" "libsuitesparseconfig"))
(((from "libumfpack")) (to "suitesparse" "libumfpack")))
(substitute* (jlpath "Zlib")
(((from "libz")) (to "zlib" "libz")))
(substitute* (jlpath "libblastrampoline")
(("libblastrampoline\\.so")
(search-input-file inputs "/lib/libblastrampoline.so"))))))
(add-before 'build 'use-ssl-cert-file
(lambda _
;; We must adapt MozillaCACerts to use SSL_CERT_FILE.
(substitute* "stdlib/MozillaCACerts_jll/src/MozillaCACerts_jll.jl"
(("global cacert = .*")
(string-append
"global cacert = get(ENV, \"SSL_CERT_FILE\","
;; our fallback location.
"\"/etc/ssl/certs/ca-certificates.crt\")\n")))))
(add-after 'unpack 'enable-parallel-tests
(lambda* (#:key parallel-tests? #:allow-other-keys)
(when parallel-tests?
(setenv "JULIA_TEST_USE_MULTIPLE_WORKERS" "true"))))
(add-after 'unpack 'adjust-test-suite
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "test/spawn.jl"
(("shcmd = `sh`") (string-append "shcmd = `" (which "sh") "`")))
;; Some tests only check to see if the input is the correct version.
(substitute* "stdlib/PCRE2_jll/test/runtests.jl"
(("10.40.0") ,(package-version (this-package-input "pcre2"))))
(substitute* "stdlib/MbedTLS_jll/test/runtests.jl"
(("2.28.0") ,(package-version (this-package-input "mbedtls"))))
(substitute* "stdlib/MPFR_jll/test/runtests.jl"
(("4.1.0") ,(package-version (this-package-input "mpfr"))))
(substitute* "stdlib/GMP_jll/test/runtests.jl"
(("6.2.1") ,(package-version (this-package-input "gmp"))))
(substitute* "stdlib/LibGit2_jll/test/runtests.jl"
(("1.3.0") ,(package-version (this-package-input "libgit2"))))
(substitute* "stdlib/nghttp2_jll/test/runtests.jl"
(("1.48.0") ,(package-version (this-package-input "libnghttp2"))))
(substitute* "stdlib/Zlib_jll/test/runtests.jl"
(("1.2.12") ,(package-version (this-package-input "zlib"))))
(substitute* "stdlib/SuiteSparse_jll/test/runtests.jl"
(("5010") ,(string-replace-substring
(version-major+minor
(package-version
(this-package-input "suitesparse"))) "." "0")))))
(add-before 'check 'disable-broken-tests
(lambda _
;; disabling REPL tests because they require a stdin
;; There are some read-only precompile issues in the 1.6 series.
;; https://github.com/JuliaLang/julia/pull/41614
;; https://github.com/JuliaLang/julia/issues/41156
(substitute* "test/choosetests.jl"
(("\"cmdlineargs\",") "")
(("\"precompile\",") ""))
;; Dates/io tests fail on master when networking is unavailable
;; https://github.com/JuliaLang/julia/issues/34655
(substitute* "stdlib/Dates/test/io.jl"
(("using Dates") "import Dates
"global cacert = get(ENV, \"SSL_CERT_FILE\","
;; our fallback location.
"\"/etc/ssl/certs/ca-certificates.crt\")\n")))))
(add-after 'unpack 'enable-parallel-tests
(lambda* (#:key parallel-tests? #:allow-other-keys)
(when parallel-tests?
(setenv "JULIA_TEST_USE_MULTIPLE_WORKERS" "true"))))
(add-after 'unpack 'adjust-test-suite
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "test/spawn.jl"
(("shcmd = `sh`")
(string-append "shcmd = `"
(which "sh") "`")))
;; Some tests only check to see if the input is the correct version.
(substitute* "stdlib/PCRE2_jll/test/runtests.jl"
(("10\\.42\\.0")
#$(package-version (this-package-input "pcre2"))))
(substitute* "stdlib/MbedTLS_jll/test/runtests.jl"
(("2\\.28\\.2")
#$(package-version (this-package-input "mbedtls-apache"))))
(substitute* "stdlib/MPFR_jll/test/runtests.jl"
(("4\\.1\\.1")
#$(package-version (this-package-input "mpfr"))))
(substitute* "stdlib/GMP_jll/test/runtests.jl"
(("6\\.2\\.1")
#$(package-version (this-package-input "gmp"))))
(substitute* "stdlib/LibGit2_jll/test/runtests.jl"
(("1\\.5\\.0")
#$(package-version (this-package-input "libgit2"))))
(substitute* "stdlib/nghttp2_jll/test/runtests.jl"
(("1\\.48\\.0")
#$(package-version (this-package-input "nghttp2"))))
(substitute* "stdlib/Zlib_jll/test/runtests.jl"
(("1\\.2\\.13")
#$(package-version (this-package-input "zlib"))))
(substitute* "stdlib/SuiteSparse_jll/test/runtests.jl"
(("5010")
#$(string-replace-substring
(version-major+minor
(package-version
(this-package-input "suitesparse"))) "." "0")))))
(add-before 'check 'disable-broken-tests
(lambda* (#:key inputs #:allow-other-keys)
;; disabling REPL tests because they require a stdin
;; There are some read-only precompile issues in the 1.6 series.
;; https://github.com/JuliaLang/julia/pull/41614
;; https://github.com/JuliaLang/julia/issues/41156
(substitute* "test/choosetests.jl"
(("\"cmdlineargs\",")
"")
(("\"precompile\",")
""))
;; Distributed test with remote execution
(substitute* "usr/share/julia/stdlib/v1.9/Distributed/test/distributed_exec.jl"
(("using Test,")
"exit()\n"))
;; Dates/io tests fail on master when networking is unavailable
;; https://github.com/JuliaLang/julia/issues/34655
(substitute* "stdlib/Dates/test/io.jl"
(("using Dates")
"import Dates
using Dates: @dateformat_str, Date, DateTime, DateFormat, Time"))
;; julia embeds a certificate, we are not doing that
(substitute* "stdlib/MozillaCACerts_jll/test/runtests.jl"
(("@test isfile\\(MozillaCACerts_jll.cacert\\)")
"@test_broken isfile(MozillaCACerts_jll.cacert)"))
;; since certificate is not present some tests are failing in network option
(substitute* "usr/share/julia/stdlib/v1.8/NetworkOptions/test/runtests.jl"
(("@test isfile\\(bundled_ca_roots\\(\\)\\)")
"@test_broken isfile(bundled_ca_roots())")
(("@test ispath\\(ca_roots_path\\(\\)\\)")
"@test_broken ispath(ca_roots_path())")
(("@test ca_roots_path\\(\\) \\!= bundled_ca_roots\\(\\)")
"@test_broken ca_roots_path() != bundled_ca_roots()"))
;; WARNING: failed to select UTF-8 encoding, using ASCII
;; Using 'setlocale' doesn't affect the test failures.
;(setlocale LC_ALL "en_US.utf8")
;(setenv "LC_ALL" "en_US.utf8")
(substitute* "test/cmdlineargs.jl"
(("test v\\[3") "test_broken v[3")
(("test isempty\\(v\\[3") "test_broken isempty(v[3"))
;; These test(s) randomly fails because they depend on CPU.
(substitute* "test/math.jl"
;; @test_broken cannot be used because if the test randomly
;; passes, then it also raises an error.
(("@test isinf\\(log1p\\(-one\\(T\\)\\)\\)")
" "))
;; julia embeds a certificate, we are not doing that
(substitute* "stdlib/MozillaCACerts_jll/test/runtests.jl"
(("@test isfile\\(MozillaCACerts_jll.cacert\\)")
"@test_broken isfile(MozillaCACerts_jll.cacert)"))
;; since certificate is not present some tests are failing in network option
(substitute* "usr/share/julia/stdlib/v1.9/NetworkOptions/test/runtests.jl"
(("@test isfile\\(bundled_ca_roots\\(\\)\\)")
"@test_broken isfile(bundled_ca_roots())")
(("@test ispath\\(ca_roots_path\\(\\)\\)")
"@test_broken ispath(ca_roots_path())")
(("@test ca_roots_path\\(\\) \\!= bundled_ca_roots\\(\\)")
"@test_broken ca_roots_path() != bundled_ca_roots()"))
;; WARNING: failed to select UTF-8 encoding, using ASCII
;; Using 'setlocale' doesn't affect the test failures.
;; (setlocale LC_ALL "en_US.utf8")
;; (setenv "LC_ALL" "en_US.utf8")
(substitute* "test/cmdlineargs.jl"
(("test v\\[3")
"test_broken v[3")
(("test isempty\\(v\\[3")
"test_broken isempty(v[3"))
;; These test(s) randomly fails because they depend on CPU.
(substitute* "test/math.jl"
;; @test_broken cannot be used because if the test randomly
;; passes, then it also raises an error.
(("@test isinf\\(log1p\\(-one\\(T\\)\\)\\)")
" "))
;; These are new test failures for 1.8:
;; This test passes on some architectures and fails on others.
(substitute* "stdlib/LinearAlgebra/test/lu.jl"
(("@test String") "@test_skip String"))
;; These are new test failures for 1.8:
;; This test passes on some architectures and fails on others.
(substitute* "stdlib/LinearAlgebra/test/lu.jl"
(("@test String")
"@test_skip String"))
(substitute* "stdlib/InteractiveUtils/test/runtests.jl"
(("@test !occursin\\(\"Environment")
"@test_broken !occursin(\"Environment")
(("@test occursin\\(\"Environment")
"@test_broken occursin(\"Environment"))
(substitute* "usr/share/julia/stdlib/v1.8/Statistics/test/runtests.jl"
(("@test cov\\(A") "@test_skip cov(A")
(("@test isfinite") "@test_skip isfinite"))
;; LoadError: SuiteSparse threads test failed with nthreads == 4
(substitute* "usr/share/julia/stdlib/v1.8/SuiteSparse/test/runtests.jl"
(("Base\\.USE_GPL_LIBS") "false"))
;; Got exception outside of a @test
;; LinearAlgebra.LAPACKException(16)
;; eliminate all the test bits.
(substitute* "stdlib/LinearAlgebra/test/schur.jl"
(("f = schur\\(A, B\\)") "f = schur(A, A)")
(("@test f\\.Q\\*f\\.S\\*f\\.Z'.*") "\n")
(("@test f\\.Q\\*f\\.T\\*f\\.Z'.*") "\n"))
(substitute* "test/threads.jl"
(("@test success") "@test_broken success"))))
;; Doesn't this just mean they weren't linked correctly?
(add-after 'install 'symlink-missing-libraries
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(link
(lambda (pkgname pred)
(map (lambda (file)
(unless (file-exists?
(string-append out "/lib/julia/"
(basename file)))
(symlink file (string-append out "/lib/julia/"
(basename file)))))
(find-files (string-append (assoc-ref inputs pkgname)
"/lib") pred)))))
(link "libunwind" "libunwind\\.so")
(link "llvm" "libLLVM-13jl\\.so")
(link "utf8proc" "libutf8proc\\.so")
(link "zlib" "libz\\.so"))))
(add-after 'install 'make-wrapper
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(program "julia"))
(with-directory-excursion bin
(wrap-program program
`("JULIA_LOAD_PATH" ":" prefix
("" "$JULIA_LOAD_PATH"))
`("JULIA_DEPOT_PATH" ":" prefix
("" "$JULIA_DEPOT_PATH"))))))))
#:make-flags
(list
"VERBOSE=1" ;; more helpful logging of what make is doing
(string-append "prefix=" (assoc-ref %outputs "out"))
(substitute* "usr/share/julia/stdlib/v1.9/Statistics/test/runtests.jl"
(("@test cov\\(A")
"@test_skip cov(A")
(("@test isfinite")
"@test_skip isfinite"))
;; LoadError: SuiteSparse threads test failed with nthreads == 4
(substitute* "usr/share/julia/stdlib/v1.9/SuiteSparse/test/runtests.jl"
(("Base\\.USE_GPL_LIBS")
"false"))
;; Got exception outside of a @test
;; LinearAlgebra.LAPACKException(16)
;; eliminate all the test bits.
(substitute* "stdlib/LinearAlgebra/test/schur.jl"
(("f = schur\\(A, B\\)")
"f = schur(A, A)")
(("@test f\\.Q\\*f\\.S\\*f\\.Z'.*")
"\n")
(("@test f\\.Q\\*f\\.T\\*f\\.Z'.*")
"\n"))))
;; Doesn't this just mean they weren't linked correctly?
(add-after 'install 'symlink-missing-libraries
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(link (lambda (pkgname pred)
(map (lambda (file)
(unless (file-exists? (string-append
out
"/lib/julia/"
(basename
file)))
(symlink file
(string-append
out
"/lib/julia/"
(basename file)))))
(find-files (string-append (assoc-ref
inputs
pkgname)
"/lib") pred)))))
(link "libunwind-julia" "libunwind\\.so")
(link "llvm" "libLLVM-14jl\\.so")
(link "gmp" "libgmp\\.so.10")
(link "mpfr" "libmpfr\\.so.6")
(link "zlib" "libz\\.so"))))
(add-after 'install 'make-wrapper
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(program "julia"))
;; Always append ":" to the end of the load path. The
;; empty load path entry expands to the default load
;; path, which includes Julia's own modules.
(with-directory-excursion bin
(wrap-program program
`("JULIA_LOAD_PATH" ":" =
("$JULIA_LOAD_PATH" ""))
`("JULIA_DEPOT_PATH" ":" =
("$JULIA_DEPOT_PATH" ""))))))))
;; Passing the MARCH or JULIA_CPU_TARGET flag is necessary to build
;; binary substitutes for the supported architectures. See also
;; https://docs.julialang.org/en/v1/devdocs/sysimg/#Specifying-multiple-system-image-targets
,(match (or (%current-target-system)
(%current-system))
("x86_64-linux"
;; These are the flags that upstream uses for their binaries.
"JULIA_CPU_TARGET=generic;generic,-cx16,clone_all;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)")
("i686-linux" "MARCH=pentium4")
("armhf-linux" "JULIA_CPU_TARGET=armv7-a,neon")
("powerpc64le-linux" "JULIA_CPU_TARGET=pwr8")
;; Prevent errors when querying this package on unsupported
;; platforms, e.g. when running "guix package --search="
;; and also of targeting the builder's architecture.
(_ "JULIA_CPU_TARGET=generic"))
#:make-flags
#~(list (string-append "prefix=" #$output)
"CONFIG_SHELL=bash -x" ; needed to build bundled libraries
"USE_BINARYBUILDER=0"
;; list (and order!) of "USE_SYSTEM_*" is here:
;; https://github.com/JuliaLang/julia/blob/v1.8.2/Make.inc
"USE_SYSTEM_CSL=1"
"USE_SYSTEM_LLVM=1"
"USE_SYSTEM_LIBUNWIND=1"
"USE_SYSTEM_PCRE=1"
"USE_SYSTEM_OPENLIBM=1"
"USE_SYSTEM_DSFMT=1"
"USE_SYSTEM_LIBBLASTRAMPOLINE=1"
"USE_SYSTEM_BLAS=1"
"USE_SYSTEM_LAPACK=1"
"USE_SYSTEM_GMP=1"
"USE_SYSTEM_MPFR=1"
"USE_SYSTEM_LIBSUITESPARSE=1"
"USE_SYSTEM_LIBUV=1"
"USE_SYSTEM_UTF8PROC=1"
"USE_SYSTEM_MBEDTLS=1"
"USE_SYSTEM_LIBSSH2=1"
"USE_SYSTEM_NGHTTP2=1"
"USE_SYSTEM_CURL=1"
"USE_SYSTEM_LIBGIT2=1"
"USE_SYSTEM_PATCHELF=1"
"USE_SYSTEM_LIBWHICH=1"
"USE_SYSTEM_ZLIB=1"
"USE_SYSTEM_P7ZIP=1"
;; Passing the MARCH or JULIA_CPU_TARGET flag is necessary to build
;; binary substitutes for the supported architectures. See also
;; https://docs.julialang.org/en/v1/devdocs/sysimg/#Specifying-multiple-system-image-targets
#$(match (or (%current-target-system)
(%current-system))
("x86_64-linux"
;; These are the flags that upstream uses for their binaries.
"JULIA_CPU_TARGET=generic;generic,-cx16,clone_all;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)")
("i686-linux" "MARCH=pentium4")
("armhf-linux"
"JULIA_CPU_TARGET=armv7-a,neon")
("powerpc64le-linux"
"JULIA_CPU_TARGET=pwr8")
;; Prevent errors when querying this package on unsupported
;; platforms, e.g. when running "guix package --search="
;; and also of targeting the builder's architecture.
(_ "JULIA_CPU_TARGET=generic"))
"USE_LLVM_SHLIB=1"
"CONFIG_SHELL=bash -x" ;needed to build bundled libraries
(string-append "CC=" #$(cc-for-target))
"NO_GIT=1" ; build from release tarball.
"USE_GPL_LIBS=1" ; proudly
#$@(if (target-x86-64?)
`("USE_BLAS64=1"
"LIBBLAS=-lopenblas64_"
"LIBBLASNAME=libopenblas64_")
`("USE_BLAS64=0" "LIBBLAS=-lopenblas"
"LIBBLASNAME=libopenblas"))
,@(if (target-x86-64?)
`("USE_BLAS64=1"
"LIBBLAS=-lopenblas64_"
"LIBBLASNAME=libopenblas64_")
`("USE_BLAS64=0"
"LIBBLAS=-lopenblas"
"LIBBLASNAME=libopenblas"))
(string-append "UTF8PROC_INC="
(assoc-ref %build-inputs "utf8proc")
"/include")
;; Make.inc expects a static library for libuv.
(string-append "LIBUV="
(assoc-ref %build-inputs "libuv")
"/lib/libuv.a")
(string-append "LIBUV_INC="
(assoc-ref %build-inputs "libuv")
"/include"))))
(inputs
`(("bash-minimal" ,bash-minimal)
("coreutils" ,coreutils) ; for bindings to "mkdir" and the like
("curl" ,curl-ssh)
("gfortran" ,gfortran)
;; required for libgcc_s.so
("gfortran:lib" ,gfortran "lib")
("gmp" ,gmp)
("lapack" ,lapack)
("libblastrampoline" ,libblastrampoline)
("libgit2" ,libgit2-1.3)
("libnghttp2" ,nghttp2 "lib")
("libssh2" ,libssh2)
("libunwind" ,libunwind-julia)
("libuv" ,libuv-julia)
("llvm" ,llvm-julia)
("mbedtls" ,mbedtls-lts)
("mpfr" ,mpfr)
,@(if (target-x86-64?)
`(("openblas" ,openblas-ilp64))
`(("openblas" ,openblas)))
("openlibm" ,openlibm)
("p7zip" ,p7zip)
("pcre2" ,pcre2)
("suitesparse" ,suitesparse)
("utf8proc" ,utf8proc-2.7.0)
("wget" ,wget)
("which" ,which)
("zlib" ,zlib)
;; Find dependencies versions here:
;; https://raw.githubusercontent.com/JuliaLang/julia/v1.6.0/deps/Versions.make
("dsfmt" ,dsfmt)
("libwhich" ,libwhich)))
(native-inputs
`(("openssl" ,openssl)
("perl" ,perl)
("patchelf" ,patchelf)
("pkg-config" ,pkg-config)
("python" ,python)))
(string-append "UTF8PROC_INC="
(dirname
(search-input-file %build-inputs
"/include/utf8proc.h")))
;; Make.inc expects a static library for libuv.
(string-append "LIBUV="
(search-input-file %build-inputs
"/lib/libuv.a"))
(string-append "LIBUV_INC="
(dirname
(search-input-file
%build-inputs "/include/uv.h"))))))
(inputs (list coreutils ;for bindings to "mkdir" and the like
curl-ssh
gfortran
`(,gfortran "lib") ;required for libgcc_s.so
gmp
lapack
libblastrampoline
libgit2-1.5
`(,nghttp2 "lib")
libssh2
libunwind-julia
libuv-julia
llvm-14-julia
lld-14
mbedtls-apache
mpfr
(if (target-x86-64?) openblas-ilp64 openblas)
openlibm
p7zip
pcre2
suitesparse
utf8proc-2.7.0
wget
which
zlib
;; Find dependencies versions here:
;; https://raw.githubusercontent.com/JuliaLang/julia/v1.6.0/deps/Versions.make
dsfmt
libwhich))
(native-inputs (list openssl perl patchelf pkg-config python))
(native-search-paths
(list (search-path-specification
(variable "JULIA_LOAD_PATH")
(files (list "share/julia/loadpath/")))
(search-path-specification
(variable "JULIA_DEPOT_PATH")
(files (list "share/julia/")))
$SSL_CERT_FILE))
(list (search-path-specification
(variable "JULIA_LOAD_PATH")
(files (list "share/julia/loadpath/")))
(search-path-specification
(variable "JULIA_DEPOT_PATH")
(files (list "share/julia/")))
$SSL_CERT_FILE))
;; Julia only officially supports some of our platforms:
;; https://julialang.org/downloads/#supported_platforms
(supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux"))

View File

@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2016, 2018 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2017-2021, 2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com>
;;; Copyright © 2016, 2018, 2019, 2020, 2021, 2023, 2025 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
@@ -2337,22 +2337,36 @@ LLVM."))))
LLVM bitcode files.")
(license license:expat)))
(define-public llvm-julia
(define-public llvm-14-julia
(package
(inherit llvm-13)
(inherit llvm-14)
(version "14.0.6-3-julia")
(source
(origin
(method git-fetch)
(uri (git-reference (url "https://github.com/JuliaLang/llvm-project")
(commit "julia-14.0.6-3")))
(file-name (git-file-name "llvm-project-julia" "14.0.6-3"))
(sha256
(base32
"16ynl9g4paksvglk6asfxdr15gy21bzvsjdkqb1msbcnkz2x610x"))))
(arguments
(substitute-keyword-arguments (package-arguments llvm-13)
((#:configure-flags flags ''())
(substitute-keyword-arguments (package-arguments llvm-14)
((#:configure-flags flags
''())
; FIXME: I think we should basically duplicate
; https://github.com/JuliaLang/julia/blob/master/deps/llvm.mk
#~(cons* "-DLLVM_BUILD_LLVM_DYLIB=ON"
"-DLLVM_LINK_LLVM_DYLIB=ON"
;; "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=NVPTX"
"-DLLVM_VERSION_SUFFIX:STRING=jl" ; Perhaps not needed.
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
"-DLLVM_SHLIB_SYMBOL_VERSION:STRING=JL_LLVM_14.0"
"-DLLVM_VERSION_SUFFIX:STRING=jl" ;Perhaps not needed.
#$(string-append "-DLLVM_TARGETS_TO_BUILD=NVPTX;AMDGPU;"
(system->llvm-target))
(delete "-DBUILD_SHARED_LIBS:BOOL=TRUE" #$flags)))
((#:build-type _) "Release")))
(properties `((hidden? . #t)
,@(package-properties llvm-13)))))
(delete "-DBUILD_SHARED_LIBS:BOOL=TRUE"
#$flags)))
((#:build-type _)
"Release")))
(properties `((hidden? . #t) ,@(package-properties llvm-14)))))
(define llvm-cling-base llvm-16)

View File

@@ -0,0 +1,152 @@
Adjust the Julia 1.9 build system to unbundle libraries and otherwise fix things
here and there.
diff --git a/Make.inc b/Make.inc
index 5bbb52617a..7e1215a2de 100644
--- a/Make.inc
+++ b/Make.inc
@@ -40,33 +40,39 @@ OPENBLAS_USE_THREAD:=1
# Flags for using libraries available on the system instead of building them.
# Please read the notes around usage of SYSTEM flags in README.md
# Issues resulting from use of SYSTEM versions will generally not be accepted.
-USE_SYSTEM_CSL:=0
-USE_SYSTEM_LLVM:=0
-USE_SYSTEM_LIBUNWIND:=0
+USE_SYSTEM_CSL:=1
+USE_SYSTEM_LLVM:=1
+USE_SYSTEM_LIBUNWIND:=1
DISABLE_LIBUNWIND:=0
-USE_SYSTEM_PCRE:=0
+USE_SYSTEM_PCRE:=1
USE_SYSTEM_LIBM:=0
-USE_SYSTEM_OPENLIBM:=0
+USE_SYSTEM_OPENLIBM:=1
UNTRUSTED_SYSTEM_LIBM:=0
-USE_SYSTEM_DSFMT:=0
-USE_SYSTEM_LIBBLASTRAMPOLINE:=0
-USE_SYSTEM_BLAS:=0
-USE_SYSTEM_LAPACK:=0
-USE_SYSTEM_GMP:=0
-USE_SYSTEM_MPFR:=0
-USE_SYSTEM_LIBSUITESPARSE:=0
-USE_SYSTEM_LIBUV:=0
-USE_SYSTEM_UTF8PROC:=0
-USE_SYSTEM_MBEDTLS:=0
-USE_SYSTEM_LIBSSH2:=0
-USE_SYSTEM_NGHTTP2:=0
-USE_SYSTEM_CURL:=0
-USE_SYSTEM_LIBGIT2:=0
-USE_SYSTEM_PATCHELF:=0
-USE_SYSTEM_LIBWHICH:=0
-USE_SYSTEM_ZLIB:=0
-USE_SYSTEM_P7ZIP:=0
-USE_SYSTEM_LLD:=0
+USE_SYSTEM_DSFMT:=1
+USE_SYSTEM_LIBBLASTRAMPOLINE:=1
+USE_SYSTEM_BLAS:=1
+USE_SYSTEM_LAPACK:=1
+USE_SYSTEM_GMP:=1
+USE_SYSTEM_MPFR:=1
+USE_SYSTEM_LIBSUITESPARSE:=1
+USE_SYSTEM_LIBUV:=1
+USE_SYSTEM_UTF8PROC:=1
+USE_SYSTEM_MBEDTLS:=1
+USE_SYSTEM_LIBSSH2:=1
+USE_SYSTEM_NGHTTP2:=1
+USE_SYSTEM_CURL:=1
+USE_SYSTEM_LIBGIT2:=1
+USE_SYSTEM_PATCHELF:=1
+USE_SYSTEM_LIBWHICH:=1
+USE_SYSTEM_ZLIB:=1
+USE_SYSTEM_P7ZIP:=1
+USE_SYSTEM_LLD:=1
+
+# Guix override
+USE_INTEL_JITEVENTS:=0
+USE_PERF_JITEVENTS:=0
+USE_BINARYBUILDER:=0
+
# Link to the LLVM shared library
USE_LLVM_SHLIB := 1
@@ -1124,7 +1130,8 @@ else
endif
ifeq ($(USE_SYSTEM_UTF8PROC), 1)
- LIBUTF8PROC := -lutf8proc
+ # Point to the static lib in Guix
+ LIBUTF8PROC := GUIX_LIBUTF8PROC
UTF8PROC_INC := $(LOCALBASE)/include
else
LIBUTF8PROC := $(build_libdir)/libutf8proc.a
diff --git a/Makefile b/Makefile
index ef0ade09e2..6b9177df60 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,8 @@ all: debug release
# sort is used to remove potential duplicates
DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_private_libdir) $(build_libexecdir) $(build_includedir) $(build_includedir)/julia $(build_sysconfdir)/julia $(build_datarootdir)/julia $(build_datarootdir)/julia/stdlib $(build_man1dir))
ifneq ($(BUILDROOT),$(JULIAHOME))
-BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa cli doc deps stdlib test test/clangsa test/embedding test/gcext test/llvmpasses)
+# FIXME: do not build doc yet
+BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa cli deps stdlib test test/clangsa test/embedding test/gcext test/llvmpasses)
BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS)) $(BUILDROOT)/sysimage.mk
DIRS := $(DIRS) $(BUILDDIRS)
$(BUILDDIRMAKE): | $(BUILDDIRS)
@@ -64,6 +65,16 @@ julia-deps: | $(DIRS) $(build_datarootdir)/julia/base $(build_datarootdir)/julia
# `julia-stdlib` depends on `julia-deps` so that the fake JLL stdlibs can copy in their Artifacts.toml files.
julia-stdlib: | $(DIRS) julia-deps
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/stdlib
+ # These files are checked-out during the build phase, but need to be fixed
+ # before the actual build, therefore we sed with a variable we'll fix before
+ # the build phase. It's twisted but it's the only working way I could find.
+ # The " are important to avoid double substitution when doing 'make' then
+ # 'make check'.
+ sed -i 's|"libcholmod"|"GUIX_LIBCHOLMOD"|' usr/share/julia/stdlib/v1.9/SparseArrays/src/solvers/cholmod.jl
+ sed -i 's|:libsuitesparseconfig|"GUIX_LIBSC"|' usr/share/julia/stdlib/v1.9/SparseArrays/src/solvers/cholmod.jl
+ sed -i 's|:libcholmod|"GUIX_LIBCHOLMOD"|' usr/share/julia/stdlib/v1.9/SparseArrays/src/solvers/LibSuiteSparse.jl
+ sed -i 's|:libspqr|"GUIX_LIBSPQR"|' usr/share/julia/stdlib/v1.9/SparseArrays/src/solvers/LibSuiteSparse.jl
+ sed -i 's|:libumfpack|"GUIX_LIBUMFPACK"|' usr/share/julia/stdlib/v1.9/SparseArrays/src/solvers/LibSuiteSparse.jl
julia-base: julia-deps $(build_sysconfdir)/julia/startup.jl $(build_man1dir)/julia.1 $(build_datarootdir)/julia/julia-config.jl
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/base
@@ -236,7 +247,9 @@ define stringreplace
endef
-install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
+# Guix FIXME: building the doc requires internet. We should build them in a
+# separate build phase.
+install: $(build_depsbindir)/stringreplace # $(BUILDROOT)/doc/_build/html/en/index.html
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
mkdir -p $(DESTDIR)$$subdir; \
diff --git a/base/Makefile b/base/Makefile
index 0ea0359c8c..9cee86aeec 100644
--- a/base/Makefile
+++ b/base/Makefile
@@ -239,7 +239,10 @@ endif
ifneq (,$(LIBGFORTRAN_VERSION))
$(eval $(call symlink_system_library,CSL,libgfortran,$(LIBGFORTRAN_VERSION)))
endif
-$(eval $(call symlink_system_library,CSL,libquadmath,0))
+
+# libquadmath is not available on all architectures.
+# https://github.com/JuliaLang/julia/issues/41613
+$(eval $(call symlink_system_library,CSL,libquadmath,0,ALLOW_FAILURE))
$(eval $(call symlink_system_library,CSL,libstdc++,6))
# We allow libssp, libatomic and libgomp to fail as they are not available on all systems
$(eval $(call symlink_system_library,CSL,libssp,0,ALLOW_FAILURE))
diff --git a/cli/Makefile b/cli/Makefile
index 7ba238e0de..6540f6384a 100644
--- a/cli/Makefile
+++ b/cli/Makefile
@@ -7,7 +7,7 @@ include $(JULIAHOME)/deps/llvm-ver.make
HEADERS := $(addprefix $(SRCDIR)/,jl_exports.h loader.h) $(addprefix $(JULIAHOME)/src/,julia_fasttls.h support/platform.h support/dirpath.h jl_exported_data.inc jl_exported_funcs.inc)
-LOADER_CFLAGS = $(JCFLAGS) -I$(BUILDROOT)/src -I$(JULIAHOME)/src -I$(JULIAHOME)/src/support -I$(build_includedir) -ffreestanding
+LOADER_CFLAGS = -D_GNU_SOURCE $(JCFLAGS) -I$(BUILDROOT)/src -I$(JULIAHOME)/src -I$(JULIAHOME)/src/support -I$(build_includedir) -ffreestanding
LOADER_LDFLAGS = $(JLDFLAGS) -ffreestanding -L$(build_shlibdir) -L$(build_libdir)
ifeq ($(OS),WINNT)

View File

@@ -1,228 +0,0 @@
This patch backports part of Julia upstream commit:
1e5fdb29f8858f3244f6aff116ee12e4c8247f3a
Author: Simon Byrne <simon.byrne@gmail.com>
AuthorDate: Tue Jan 10 14:52:36 2023 -0800
Commit: GitHub <noreply@github.com>
CommitDate: Tue Jan 10 17:52:36 2023 -0500
update MPFR to 4.2.0 (#48165)
Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>
6 files changed, 112 insertions(+), 79 deletions(-)
base/mpfr.jl | 34 ++++++++++++++--
deps/checksums/mpfr | 68 ++++++++++++++++----------------
deps/mpfr.version | 2 +-
stdlib/MPFR_jll/Project.toml | 2 +-
stdlib/MPFR_jll/test/runtests.jl | 2 +-
test/math.jl | 83 +++++++++++++++++++++-------------------
diff -ur julia-1.8.3-orig/base/mpfr.jl julia-1.8.3-patch/base/mpfr.jl
--- julia-1.8.3-orig/base/mpfr.jl 2023-04-13 17:50:58.394891391 +0200
+++ julia-1.8.3-patch/base/mpfr.jl 2023-04-13 20:42:52.551833467 +0200
@@ -16,7 +16,8 @@
cosh, sinh, tanh, sech, csch, coth, acosh, asinh, atanh, lerpi,
cbrt, typemax, typemin, unsafe_trunc, floatmin, floatmax, rounding,
setrounding, maxintfloat, widen, significand, frexp, tryparse, iszero,
- isone, big, _string_n, decompose
+ isone, big, _string_n, decompose, minmax,
+ sinpi, cospi, sincospi, sind, cosd, tand, asind, acosd, atand
import ..Rounding: rounding_raw, setrounding_raw
@@ -745,7 +746,7 @@
end
# Functions for which NaN results are converted to DomainError, following Base
-for f in (:sin, :cos, :tan, :sec, :csc, :acos, :asin, :atan, :acosh, :asinh, :atanh)
+for f in (:sin, :cos, :tan, :sec, :csc, :acos, :asin, :atan, :acosh, :asinh, :atanh, :sinpi, :cospi)
@eval begin
function ($f)(x::BigFloat)
isnan(x) && return x
@@ -756,6 +757,7 @@
end
end
end
+sincospi(x::BigFloat) = (sinpi(x), cospi(x))
function atan(y::BigFloat, x::BigFloat)
z = BigFloat()
@@ -763,6 +765,32 @@
return z
end
+# degree functions
+for f in (:sin, :cos, :tan)
+ @eval begin
+ function ($(Symbol(f,:d)))(x::BigFloat)
+ isnan(x) && return x
+ z = BigFloat()
+ ccall(($(string(:mpfr_,f,:u)), :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Culong, MPFRRoundingMode), z, x, 360, ROUNDING_MODE[])
+ isnan(z) && throw(DomainError(x, "NaN result for non-NaN input."))
+ return z
+ end
+ function ($(Symbol(:a,f,:d)))(x::BigFloat)
+ isnan(x) && return x
+ z = BigFloat()
+ ccall(($(string(:mpfr_a,f,:u)), :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Culong, MPFRRoundingMode), z, x, 360, ROUNDING_MODE[])
+ isnan(z) && throw(DomainError(x, "NaN result for non-NaN input."))
+ return z
+ end
+ end
+end
+function atand(y::BigFloat, x::BigFloat)
+ z = BigFloat()
+ ccall((:mpfr_atan2u, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Ref{BigFloat}, Culong, MPFRRoundingMode), z, y, x, 360, ROUNDING_MODE[])
+ return z
+end
+
+
# Utility functions
==(x::BigFloat, y::BigFloat) = ccall((:mpfr_equal_p, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}), x, y) != 0
<=(x::BigFloat, y::BigFloat) = ccall((:mpfr_lessequal_p, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}), x, y) != 0
@@ -1018,7 +1046,7 @@
isfinite(x) || return string(Float64(x))
_prettify_bigfloat(string_mpfr(x, fmt))
end
-_string(x::BigFloat) = _string(x, "%.Re")
+_string(x::BigFloat) = _string(x, "%Re")
_string(x::BigFloat, k::Integer) = _string(x, "%.$(k)Re")
string(b::BigFloat) = _string(b)
diff -ur julia-1.8.3-orig/test/math.jl julia-1.8.3-patch/test/math.jl
--- julia-1.8.3-orig/test/math.jl 2023-04-13 17:50:58.382891276 +0200
+++ julia-1.8.3-patch/test/math.jl 2023-04-13 21:13:55.377279761 +0200
@@ -411,47 +411,51 @@
@test rad2deg(pi + (pi/3)*im) ≈ 180 + 60im
end
+# ensure zeros are signed the same
+⩲(x,y) = typeof(x) == typeof(y) && x == y && signbit(x) == signbit(y)
+⩲(x::Tuple, y::Tuple) = length(x) == length(y) && all(map(⩲,x,y))
+
@testset "degree-based trig functions" begin
- @testset "$T" for T = (Float32,Float64,Rational{Int})
+ @testset "$T" for T = (Float32,Float64,Rational{Int},BigFloat)
fT = typeof(float(one(T)))
fTsc = typeof( (float(one(T)), float(one(T))) )
for x = -400:40:400
- @test sind(convert(T,x))::fT ≈ convert(fT,sin(pi/180*x)) atol=eps(deg2rad(convert(fT,x)))
- @test cosd(convert(T,x))::fT ≈ convert(fT,cos(pi/180*x)) atol=eps(deg2rad(convert(fT,x)))
+ @test sind(convert(T,x))::fT ≈ sin(pi*convert(fT,x)/180) atol=eps(deg2rad(convert(fT,x)))
+ @test cosd(convert(T,x))::fT ≈ cos(pi*convert(fT,x)/180) atol=eps(deg2rad(convert(fT,x)))
s,c = sincosd(convert(T,x))
- @test s::fT ≈ convert(fT,sin(pi/180*x)) atol=eps(deg2rad(convert(fT,x)))
- @test c::fT ≈ convert(fT,cos(pi/180*x)) atol=eps(deg2rad(convert(fT,x)))
+ @test s::fT ≈ sin(pi*convert(fT,x)/180) atol=eps(deg2rad(convert(fT,x)))
+ @test c::fT ≈ cos(pi*convert(fT,x)/180) atol=eps(deg2rad(convert(fT,x)))
end
@testset "sind" begin
- @test sind(convert(T,0.0))::fT === zero(fT)
- @test sind(convert(T,180.0))::fT === zero(fT)
- @test sind(convert(T,360.0))::fT === zero(fT)
- T != Rational{Int} && @test sind(convert(T,-0.0))::fT === -zero(fT)
- @test sind(convert(T,-180.0))::fT === -zero(fT)
- @test sind(convert(T,-360.0))::fT === -zero(fT)
+ @test sind(convert(T,0.0))::fT ⩲ zero(fT)
+ @test sind(convert(T,180.0))::fT ⩲ zero(fT)
+ @test sind(convert(T,360.0))::fT ⩲ zero(fT)
+ T != Rational{Int} && @test sind(convert(T,-0.0))::fT ⩲ -zero(fT)
+ @test sind(convert(T,-180.0))::fT ⩲ -zero(fT)
+ @test sind(convert(T,-360.0))::fT ⩲ -zero(fT)
if T <: AbstractFloat
@test isnan(sind(T(NaN)))
end
end
@testset "cosd" begin
- @test cosd(convert(T,90))::fT === zero(fT)
- @test cosd(convert(T,270))::fT === zero(fT)
- @test cosd(convert(T,-90))::fT === zero(fT)
- @test cosd(convert(T,-270))::fT === zero(fT)
+ @test cosd(convert(T,90))::fT ⩲ zero(fT)
+ @test cosd(convert(T,270))::fT ⩲ zero(fT)
+ @test cosd(convert(T,-90))::fT ⩲ zero(fT)
+ @test cosd(convert(T,-270))::fT ⩲ zero(fT)
if T <: AbstractFloat
@test isnan(cosd(T(NaN)))
end
end
@testset "sincosd" begin
- @test sincosd(convert(T,-360))::fTsc === ( -zero(fT), one(fT) )
- @test sincosd(convert(T,-270))::fTsc === ( one(fT), zero(fT) )
- @test sincosd(convert(T,-180))::fTsc === ( -zero(fT), -one(fT) )
- @test sincosd(convert(T, -90))::fTsc === ( -one(fT), zero(fT) )
- @test sincosd(convert(T, 0))::fTsc === ( zero(fT), one(fT) )
- @test sincosd(convert(T, 90))::fTsc === ( one(fT), zero(fT) )
- @test sincosd(convert(T, 180))::fTsc === ( zero(fT), -one(fT) )
- @test sincosd(convert(T, 270))::fTsc === ( -one(fT), zero(fT) )
+ @test sincosd(convert(T,-360))::fTsc ⩲ ( -zero(fT), one(fT) )
+ @test sincosd(convert(T,-270))::fTsc ⩲ ( one(fT), zero(fT) )
+ @test sincosd(convert(T,-180))::fTsc ⩲ ( -zero(fT), -one(fT) )
+ @test sincosd(convert(T, -90))::fTsc ⩲ ( -one(fT), zero(fT) )
+ @test sincosd(convert(T, 0))::fTsc ⩲ ( zero(fT), one(fT) )
+ @test sincosd(convert(T, 90))::fTsc ⩲ ( one(fT), zero(fT) )
+ @test sincosd(convert(T, 180))::fTsc ⩲ ( zero(fT), -one(fT) )
+ @test sincosd(convert(T, 270))::fTsc ⩲ ( -one(fT), zero(fT) )
if T <: AbstractFloat
@test_throws DomainError sincosd(T(Inf))
@test all(isnan.(sincosd(T(NaN))))
@@ -463,22 +467,22 @@
"sincospi" => (x->sincospi(x)[1], x->sincospi(x)[2])
)
@testset "pi * $x" for x = -3:0.3:3
- @test sinpi(convert(T,x))::fT ≈ convert(fT,sin(pi*x)) atol=eps(pi*convert(fT,x))
- @test cospi(convert(T,x))::fT ≈ convert(fT,cos(pi*x)) atol=eps(pi*convert(fT,x))
+ @test sinpi(convert(T,x))::fT ≈ sin(pi*convert(fT,x)) atol=eps(pi*convert(fT,x))
+ @test cospi(convert(T,x))::fT ≈ cos(pi*convert(fT,x)) atol=eps(pi*convert(fT,x))
end
- @test sinpi(convert(T,0.0))::fT === zero(fT)
- @test sinpi(convert(T,1.0))::fT === zero(fT)
- @test sinpi(convert(T,2.0))::fT === zero(fT)
- T != Rational{Int} && @test sinpi(convert(T,-0.0))::fT === -zero(fT)
- @test sinpi(convert(T,-1.0))::fT === -zero(fT)
- @test sinpi(convert(T,-2.0))::fT === -zero(fT)
+ @test sinpi(convert(T,0.0))::fT ⩲ zero(fT)
+ @test sinpi(convert(T,1.0))::fT ⩲ zero(fT)
+ @test sinpi(convert(T,2.0))::fT ⩲ zero(fT)
+ T != Rational{Int} && @test sinpi(convert(T,-0.0))::fT ⩲ -zero(fT)
+ @test sinpi(convert(T,-1.0))::fT ⩲ -zero(fT)
+ @test sinpi(convert(T,-2.0))::fT ⩲ -zero(fT)
@test_throws DomainError sinpi(convert(T,Inf))
- @test cospi(convert(T,0.5))::fT === zero(fT)
- @test cospi(convert(T,1.5))::fT === zero(fT)
- @test cospi(convert(T,-0.5))::fT === zero(fT)
- @test cospi(convert(T,-1.5))::fT === zero(fT)
+ @test cospi(convert(T,0.5))::fT ⩲ zero(fT)
+ @test cospi(convert(T,1.5))::fT ⩲ zero(fT)
+ @test cospi(convert(T,-0.5))::fT ⩲ zero(fT)
+ @test cospi(convert(T,-1.5))::fT ⩲ zero(fT)
@test_throws DomainError cospi(convert(T,Inf))
end
@testset "Check exact values" begin
@@ -489,8 +493,8 @@
@test sincospi(one(T)/convert(T,6))[1] == 0.5
@test_throws DomainError sind(convert(T,Inf))
@test_throws DomainError cosd(convert(T,Inf))
- T != Float32 && @test cospi(one(T)/convert(T,3)) == 0.5
- T != Float32 && @test sincospi(one(T)/convert(T,3))[2] == 0.5
+ fT == Float64 && @test isapprox(cospi(one(T)/convert(T,3)), 0.5)
+ fT == Float64 && @test isapprox(sincospi(one(T)/convert(T,3))[2], 0.5)
T == Rational{Int} && @test sinpi(5//6) == 0.5
T == Rational{Int} && @test sincospi(5//6)[1] == 0.5
end
@@ -538,8 +542,8 @@
end
end
end
- @test @inferred(sinc(0//1)) === 1.0
- @test @inferred(cosc(0//1)) === -0.0
+ @test @inferred(sinc(0//1)) ⩲ 1.0
+ @test @inferred(cosc(0//1)) ⩲ -0.0
# test right before/after thresholds of Taylor series
@test sinc(0.001) ≈ 0.999998355066745 rtol=1e-15

View File

@@ -1,8 +1,9 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
;;; Copyright © 2021, 2022 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021, 2022, 2025 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2025 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -86,12 +87,18 @@ Project.toml)."
(mkdir-p builddir)
;; With a patch, SOURCE_DATE_EPOCH is honored
(setenv "SOURCE_DATE_EPOCH" "1")
(setenv "JULIA_DEPOT_PATH" builddir)
(setenv "JULIA_DEPOT_PATH"
(if (getenv "JULIA_DEPOT_PATH")
(string-append builddir ":" (getenv "JULIA_DEPOT_PATH"))
builddir))
;; Add new package dir to the load path.
(setenv "JULIA_LOAD_PATH"
(string-append builddir "loadpath/" ":"
(or (getenv "JULIA_LOAD_PATH")
"")))
(let ((loadpath (string-append builddir "loadpath/")))
(setenv "JULIA_LOAD_PATH"
(if (getenv "JULIA_LOAD_PATH")
(string-append (getenv "JULIA_LOAD_PATH") ":" loadpath)
loadpath)))
;; Actual precompilation:
(invoke-julia
;; When using Julia as a user, Julia writes precompile cache to the first
@@ -100,8 +107,7 @@ Project.toml)."
;; element of DEPOT_PATH. Once the cache file exists, this hack is not
;; needed anymore (like in the check phase). If the user install new
;; packages, those will be installed and precompiled in the home dir.
(string-append "pushfirst!(DEPOT_PATH, pop!(DEPOT_PATH)); using "
package))))
(string-append "using " package))))
(define* (check #:key tests? source inputs outputs julia-package-name
parallel-tests? #:allow-other-keys)
@@ -109,6 +115,8 @@ Project.toml)."
(let* ((out (assoc-ref outputs "out"))
(package (or julia-package-name (project.toml->name "Project.toml")))
(builddir (string-append out "/share/julia/"))
(test-file (string-append builddir "loadpath/"
package "/test/runtests.jl"))
(job-count (if parallel-tests?
(parallel-job-count)
1))
@@ -116,15 +124,26 @@ Project.toml)."
;; than specify the exact count to use, so zero must be specified
;; to disable parallel processing...
(additional-procs (max 0 (1- job-count))))
(format (current-error-port) "running tests from '~a'~%"
test-file)
;; With a patch, SOURCE_DATE_EPOCH is honored
(setenv "SOURCE_DATE_EPOCH" "1")
(setenv "JULIA_DEPOT_PATH" builddir)
(setenv "JULIA_LOAD_PATH"
(string-append builddir "loadpath/" ":"
(or (getenv "JULIA_LOAD_PATH")
"")))
(setenv "JULIA_DEPOT_PATH"
(if (getenv "JULIA_DEPOT_PATH")
(string-append (getenv "JULIA_DEPOT_PATH") ":" builddir)
builddir))
(let ((loadpath (string-append builddir "loadpath/")))
(setenv "JULIA_LOAD_PATH"
(if (getenv "JULIA_LOAD_PATH")
(string-append (getenv "JULIA_LOAD_PATH") ":" loadpath)
loadpath)))
(setenv "JULIA_CPU_THREADS" (number->string job-count))
(setenv "HOME" "/tmp")
(apply invoke "julia"
`("--depwarn=yes"
,@(if (and parallel-tests? (< 0 additional-procs))
@@ -133,8 +152,7 @@ Project.toml)."
(list (string-append "--procs="
(number->string additional-procs)))
'())
,(string-append builddir "loadpath/"
package "/test/runtests.jl"))))))
,test-file)))))
(define* (link-depot #:key source inputs outputs
julia-package-name julia-package-uuid
@@ -151,9 +169,16 @@ Project.toml)."
(format #f "using Pkg;
println(Base.version_slug(Base.UUID(\"~a\"),
Base.SHA1(Pkg.GitTools.tree_hash(\".\"))))" uuid)))
(slug (string-trim-right (get-string-all pipe))))
(slug (string-take-right
(string-trim-right (get-string-all pipe))
5)))
(let ((status (close-pipe pipe)))
(unless (zero? status)
(error "failed to compute package slug" status)))
;; Few packages do not have the regular Project.toml file, then when they
;; are propagated, dependencies do not find them and an raise error.
;; are propagated, dependencies do not find them and an error is raised.
(unless (file-exists? "Project.toml")
(julia-create-package-toml (getcwd)
julia-package-name julia-package-uuid
@@ -161,14 +186,28 @@ println(Base.version_slug(Base.UUID(\"~a\"),
julia-package-dependencies
#:file "Project.toml"))
(unless (null? julia-package-dependencies)
(let ((package-dir (string-append out "/share/julia/environments/v1.9/"))) ;XXXX: Fix v1.9
(format (current-error-port) "creating directory ~a for dependencies ~s~%"
package-dir inputs)
(mkdir-p package-dir)
(julia-create-package-toml package-dir
package-name uuid
version
julia-package-dependencies
#:file "Project.toml")))
;; When installing a package, julia looks first at in the JULIA_DEPOT_PATH
;; for a path like packages/PACKAGE/XXXX
;; Where XXXX is a slug encoding the package UUID and SHA1 of the files
;; Here we create a link with the correct path to enable julia to find the
;; package
(mkdir-p (string-append out "/share/julia/packages/" package-name))
(symlink package-dir (string-append out "/share/julia/packages/"
package-name "/" slug))))
(let ((target (string-append out "/share/julia/packages/" package-name
"/" slug)))
(format (current-error-port) "linking '~a' to '~a'~%"
target package-dir)
(mkdir-p (dirname target))
(symlink package-dir target))))
(define* (julia-create-package-toml location
name uuid version
@@ -178,6 +217,8 @@ println(Base.version_slug(Base.UUID(\"~a\"),
(file "Project.toml"))
"Some packages are not using the new Project.toml dependency specifications.
Write this FILE manually, so that Julia can find its dependencies."
(format (current-error-port) "creating '~a' for package ~a/~a/~a~%"
file name uuid version)
(let ((f (open-file
(string-append location "/" file)
"w")))
@@ -187,7 +228,7 @@ name = \"" name "\"
uuid = \"" uuid "\"
version = \"" version "\"
") f)
(when (not (null? deps))
(unless (null? deps)
(display "[deps]\n" f)
(for-each (match-lambda
((name . uuid)
@@ -200,9 +241,9 @@ version = \"" version "\"
(modify-phases gnu:%standard-phases
(delete 'check) ; tests must be run after installation
(replace 'install install)
(add-after 'install 'precompile precompile)
(add-after 'unpack 'link-depot link-depot)
(add-after 'install 'check check)
(add-after 'install 'precompile precompile)
(add-after 'precompile 'check check)
;; TODO: In the future we could add a "system-image-generation" phase
;; where we use PackageCompiler.jl to speed up package loading times
(delete 'configure)