about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-12-17 18:08:09 +0300
committerMunyoki Kilyungi2024-12-17 18:09:00 +0300
commit823014e2d05920caaec1487c42d6c8a795724b7d (patch)
treea74886faeea4b9c42377eb021ec0e330f54f58ea
parented658666041947ad1bc04590949e9e25b57cf8c8 (diff)
downloadguix-bioinformatics-823014e2d05920caaec1487c42d6c8a795724b7d.tar.gz
Update gn-guile script.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn/packages/guile.scm92
1 files changed, 71 insertions, 21 deletions
diff --git a/gn/packages/guile.scm b/gn/packages/guile.scm
index 824350c..3396d8d 100644
--- a/gn/packages/guile.scm
+++ b/gn/packages/guile.scm
@@ -6,6 +6,7 @@
   #:use-module (guix build-system guile)
   #:use-module (guix build-system gnu)
   #:use-module ((gnu packages autotools) #:select (libltdl autoconf automake libtool))
+  #:use-module ((gnu packages bash) #:select (bash-minimal))
   #:use-module ((gnu packages databases) #:select (mariadb))
   #:use-module ((gnu packages compression) #:select (zlib))
   #:use-module ((gnu packages perl) #:select (perl))
@@ -117,7 +118,7 @@ for MySQL.")
     (license license:gpl2+)))
 
 (define-public gn-guile
-  (let ((commit "7af301caa7d8a5f01e7e3be007e4ba53dc482eee")
+  (let ((commit "99cf7800246f6af0df8407f7595641933891ad85")
 	(revision "0"))
     (package
       (name "gn-guile")
@@ -130,33 +131,82 @@ for MySQL.")
 		(file-name (string-append name "-" version))
 		(sha256
 		 (base32
-                  "0j6nf9k5rdanx5r74dw1rcw7rvyjhzvsv1l5s86jkgkhvrpbb82c"))))
+                  "0sxg3cd69g2sik1x4di20b4da2qn64d82ikmfkas5w2x1nq3r6pj"))))
       (build-system guile-build-system)
-      (propagated-inputs
+      (native-inputs (list guile-3.0))
+      (inputs
        (list guile-3.0 guile3-dbi guile3-dbd-mysql guile-fibers guile-gnutls guile-readline
 	     guile-commonmark guile-redis openssl nss-certs gemma parallel guile-hashing
-	     guile-json-4))
+	     guile-json-4 bash-minimal))
       (arguments
        (list
+	#:not-compiled-file-regexp "(guix|guix/.*)[.]scm$"
+	#:modules '((srfi srfi-1)
+		    (ice-9 popen)
+		    (guix build guile-build-system)
+		    (guix build utils))
 	#:phases
 	#~(modify-phases %standard-phases
-	    ;; When using the guile-build-system, guild doesn't
-	    ;; correctly set the GUILE_LOAD_PATH for the various guile
-	    ;; packages in the build phase leading to build failures.
-	    (add-before 'build 'augment-GUILE_LOAD_PATH
-	      (lambda* (#:key outputs #:allow-other-keys)
-		(let* ((guile-version (target-guile-effective-version)))
-		  ;; guild uses this: "\\.(scm|sls)$" regexp to try and
-		  ;; compile all scm files in this repository.  We don't
-		  ;; need to compile guix.scm and manifest.scm.
-		  (delete-file "guix.scm")
-		  (setenv "GUILE_LOAD_PATH"
-			  (format
-			    #f "~{~a:~}"
-			    (map (lambda (package)
-				   (format #f "~a/share/guile/site/~a"
-					   package guile-version))
-				 (list #$guile3-dbi #$guile-fibers #$guile-commonmark #$guile-json-4 #$guile-hashing))))))))))
+	    (add-after 'build 'install-script
+	      (lambda* _
+		(let* ((bash #$(this-package-input "bash-minimal"))
+		       (bash (string-append bash "/bin/bash"))
+		       (guile #$(this-package-input "guile"))
+		       (guile (string-append guile "/bin/guile"))
+		       (build-guile #$(this-package-native-input "guile"))
+                       (build-guile (string-append build-guile "/bin/guile"))
+		       (guile3-dbi #$(this-package-input "guile3-dbi"))
+		       (guile3-dbd-mysql #$(this-package-input "guile3-dbd-mysql"))
+		       (guile-fibers #$(this-package-input "guile-fibers"))
+		       (guile-gnutls #$(this-package-input "guile-gnutls"))
+		       (guile-readline #$(this-package-input "guile-readline"))
+		       (guile-commonmark #$(this-package-input "guile-commonmark"))
+		       (guile-redis #$(this-package-input "guile-redis"))
+		       (guile-hashing #$(this-package-input "guile-hashing"))
+		       (guile-json-4 #$(this-package-input "guile-json"))
+		       (out #$output)
+		       (bin (string-append out "/bin"))
+		       (effective (read
+                                   (open-pipe* OPEN_READ
+                                               build-guile "-c"
+                                               "(write (effective-version))")))
+		       (path (list (string-append guile "/bin")))
+		       (webserver (string-append
+				   out
+				   "/share/guile/site/"
+				   effective
+				   "/web/webserver.scm"))
+                       (scm-dir (string-append "/share/guile/site/" effective))
+		       (guile-inputs (list guile3-dbi
+					   guile3-dbd-mysql
+					   guile-fibers
+					   guile-gnutls
+					   guile-readline
+					   guile-commonmark
+					   guile-redis
+					   guile-hashing
+					   guile-json-4))
+		       (scm-path
+			(map (lambda (x) (string-append x scm-dir))
+			     (cons* out guile-inputs)))
+                       (go-dir (string-append "/lib/guile/" effective
+                                              "/site-ccache/"))
+		       (go-path
+			(map (lambda (x) (string-append x go-dir))
+			     (cons* out guile-inputs))))
+		  (mkdir-p "bin")
+		  (copy-file "gn-guile.sh" "bin/gn-guile")
+		  (substitute* "bin/gn-guile"
+                    (("@SHELL@") bash)
+		    (("web/webserver.scm") webserver))
+		  (chmod "bin/gn-guile" #o755)
+		  (install-file "bin/gn-guile" bin)
+		  (wrap-script
+		      (string-append out "/bin/gn-guile")
+                    `("PATH" ":" prefix ,path)
+                    `("GUILE_AUTO_COMPILE" ":" = ("0"))
+                    `("GUILE_LOAD_PATH" ":" prefix ,scm-path)
+                    `("GUILE_LOAD_COMPILED_PATH" ":" prefix ,go-path))))))))
       (home-page "https://git.genenetwork.com/gn-guile")
       (synopsis "Next generation GN code in guile")
       (description "Use of guile.")