From 8ea53fa3d939b5f2eb7bdbfa4b7f0dc1f245b729 Mon Sep 17 00:00:00 2001 From: Jack Hill Date: Thu, 13 May 2021 01:13:08 -0400 Subject: [PATCH 5/7] gnu: janet: Respect GUIX_JANET_PATH * gnu/packages/patches/janet-guix-janet-path.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/lisp.scm (janet)[source]: Use it [native-search-paths]: New field. --- gnu/local.mk | 1 + gnu/packages/lisp.scm | 7 ++++ .../patches/janet-guix-janet-path.patch | 37 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 gnu/packages/patches/janet-guix-janet-path.patch diff --git a/gnu/local.mk b/gnu/local.mk index fc8e117a88..1f66a97030 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1258,6 +1258,7 @@ dist_patch_DATA = \ %D%/packages/patches/jamvm-2.0.0-aarch64-support.patch \ %D%/packages/patches/jamvm-2.0.0-disable-branch-patching.patch \ %D%/packages/patches/jamvm-2.0.0-opcode-guard.patch \ + %D%/packages/patches/janet-guix-janet-path.patch \ %D%/packages/patches/java-antlr4-Add-standalone-generator.patch \ %D%/packages/patches/java-antlr4-fix-code-too-large.java \ %D%/packages/patches/java-tunnelvisionlabs-antlr-code-too-large.patch \ diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index 6ee4651447..0dea527e3c 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -1064,6 +1064,8 @@ including a built-in database engine and a GUI system.") (file-name (git-file-name name version)) (sha256 (base32 "0gl0p3x0ylj4hxiwjclg1waxq8csadw60qw6pa9h5y4w1bcqffmk")) + (patches + (search-patches "janet-guix-janet-path.patch")))) (build-system gnu-build-system) (arguments `(#:make-flags (list @@ -1073,6 +1075,11 @@ including a built-in database engine and a GUI system.") #:phases (modify-phases %standard-phases (delete 'configure)))) + (native-search-paths + (list (search-path-specification + (variable "GUIX_JANET_PATH") + (separator ":") + (files '("lib/janet"))))) (home-page "https://janet-lang.org/") (synopsis "Functional, imperative and embeddable programming language") (description diff --git a/gnu/packages/patches/janet-guix-janet-path.patch b/gnu/packages/patches/janet-guix-janet-path.patch new file mode 100644 index 0000000000..5082beb378 --- /dev/null +++ b/gnu/packages/patches/janet-guix-janet-path.patch @@ -0,0 +1,37 @@ +author: Jack Hill +Upstream discussion: https://github.com/janet-lang/janet/discussions/695 +diff --git a/src/boot/boot.janet b/src/boot/boot.janet +index 59e0a016..f9174916 100644 +--- a/src/boot/boot.janet ++++ b/src/boot/boot.janet +@@ -3328,6 +3328,30 @@ + (if-let [jp (getenv-alias "JANET_HEADERPATH")] (setdyn :headerpath jp)) + (if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn :profilepath jprofile)) + ++ # Guix customization to make Janet respect GUIX_JANET_PATH ++ # environment variable. GUIX_JANET_PATH is a native search path ++ # added by Guix to tell Janet where to find modules install in the ++ # same profile via Guix packages. This is done by augmenting ++ # Janet's module/paths array. ++ (def- guix-janet-path (os/getenv "GUIX_JANET_PATH")) ++ ++ # The Janet standard extensions and loaders. List copied from ++ # the calls to module/add-paths in src/boot/boot.janet. ++ (def- default-janet-loaders ++ [[":native:" :native] ++ ["/init.janet" :source] ++ [".janet" :source] ++ [".jimage" :image]]) ++ ++ (defn- add-guix-path [p] ++ (each [ext loader] default-janet-loaders ++ (array/push module/paths [(string p "/:all:" ext) loader check-is-dep]))) ++ ++ (if guix-janet-path ++ (each elem (string/split ":" guix-janet-path) ++ (add-guix-path elem))) ++ # End of Guix customization ++ + # Flag handlers + (def handlers + {"h" (fn [&] \ No newline at end of file -- 2.31.1