unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#75394] [PATCH v14 2/2] gnu: Improve user-experience for jpm.
  2025-01-06  1:22 [bug#75394] [PATCH v14 0/2] Add jpm Suhail Singh
@ 2024-10-08  3:22 ` Suhail Singh
  2025-01-06  2:14   ` bug#75394: [PATCH v14 0/2] Add jpm jgart via Guix-patches via
  2024-10-08  3:31 ` [bug#75394] [PATCH v14 1/2] gnu: Add jpm package Suhail Singh
  1 sibling, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2024-10-08  3:22 UTC (permalink / raw)
  To: 75394
  Cc: Guillaume Le Vaillant, Katherine Cox-Buday, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

* gnu/packages/lisp.scm (jpm): Ensure jpm respects JANET_HEADERPATH and
JANET_LIBPATH if set by user.  Ensure gcc/g++ is able to find header files and
compilation-related utilities.

Change-Id: Ic7218dbd10e6fabddded50894b82492de8cabc88
---
 gnu/packages/lisp.scm | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index f99ad68828..eb3063d3d9 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -30,6 +30,7 @@
 ;;; Copyright © 2024 bigbug <bigbookofbug@proton.me>
 ;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
 ;;; Copyright © 2024 Omar Bassam <omar.bassam88@gmail.com>
+;;; Copyright © 2024 Suhail Singh <suhail@bayesians.ca>
 ;;; Copyright © 2024 David Pflug <david@pflug.io>
 ;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
@@ -965,22 +966,39 @@ (define-public jpm
                        (setenv "PREFIX"
                                #$output)))
                    (replace 'install
-                     (lambda _
+                     (lambda* (#:key inputs #:allow-other-keys)
                        (for-each (lambda (dir)
                                    (mkdir-p (string-append #$output "/" dir)))
                                  '("lib/janet/jpm" "share/man/man1"))
                        (invoke "janet" "bootstrap.janet"
                                "configs/linux_config.janet")
-                       (wrap-program (string-append #$output "/bin/jpm")
-                         `("JANET_HEADERPATH" ":" =
-                           (,(string-append #$janet "/include/janet")))
-                         `("JANET_LIBPATH" ":" =
-                           (,(string-append #$janet "/lib")))))))))
+                       (let ((gcc-toolchain (assoc-ref inputs "gcc-toolchain"))
+                             (core-min (assoc-ref inputs "coreutils-minimal")))
+                         (wrap-program (string-append #$output "/bin/jpm")
+                           `("JANET_HEADERPATH" ":" prefix
+                             (,(string-append #$janet "/include/janet")))
+                           `("JANET_LIBPATH" ":" prefix
+                             (,(string-append #$janet "/lib")))
+                           `("C_INCLUDE_PATH" ":" prefix
+                             (,(string-append gcc-toolchain "/include")))
+                           `("CPLUS_INCLUDE_PATH" ":" prefix
+                             (,(string-append gcc-toolchain "/include/c++")
+                              ,(string-append gcc-toolchain "/include")))
+                           `("LIBRARY_PATH" ":" prefix
+                             (,(string-append gcc-toolchain "/lib")
+                              ,(string-append gcc-toolchain "/lib64")))
+                           `("PATH" ":" prefix
+                             (,(string-append gcc-toolchain "/bin")
+                              ,(string-append core-min "/bin"))))))))))
     (inputs (list bash-minimal
                   coreutils-minimal
                   curl
                   gcc
-                  git-minimal/pinned))
+                  git-minimal/pinned
+                  ;; Lazily resolve the gcc-toolchain to avoid a circular
+                  ;; dependency.
+                  (module-ref (resolve-interface '(gnu packages commencement))
+                              'gcc-toolchain)))
     (propagated-inputs (list janet))
     (native-search-paths
      (list $SSL_CERT_DIR $SSL_CERT_FILE))




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#75394] [PATCH v14 1/2] gnu: Add jpm package.
  2025-01-06  1:22 [bug#75394] [PATCH v14 0/2] Add jpm Suhail Singh
  2024-10-08  3:22 ` [bug#75394] [PATCH v14 2/2] gnu: Improve user-experience for jpm Suhail Singh
@ 2024-10-08  3:31 ` Suhail Singh
  1 sibling, 0 replies; 9+ messages in thread
From: Suhail Singh @ 2024-10-08  3:31 UTC (permalink / raw)
  To: 75394
  Cc: Guillaume Le Vaillant, Katherine Cox-Buday, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

* gnu/packages/lisp.scm (jpm): New variable.

Change-Id: I9f5ab89a38622689b5d3545abe5d87906dc61f3b
Signed-off-by: Suhail <suhail@bayesians.ca>
---
 gnu/packages/lisp.scm | 73 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 9cc630eec2..f99ad68828 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2024 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2024 bigbug <bigbookofbug@proton.me>
 ;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
+;;; Copyright © 2024 Omar Bassam <omar.bassam88@gmail.com>
 ;;; Copyright © 2024 David Pflug <david@pflug.io>
 ;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
@@ -64,6 +65,7 @@ (define-module (gnu packages lisp)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
   #:use-module (guix build-system trivial)
+  #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
   #:use-module (gnu packages admin)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
@@ -919,6 +921,77 @@ (define-public janet
 assembler, PEG) is less than 1MB.")
     (license license:expat)))
 
+(define-public jpm
+  (package
+    (name "jpm")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/janet-lang/jpm")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "05rdxigmiy7vf93s16a8n2029lq33073jccz1rjl4iisxj6piw4l"))))
+    (build-system copy-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'fix-paths
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (substitute* "configs/linux_config.janet"
+                         (("/usr/local")
+                          #$output)
+                         (("\"cc\"")
+                          (string-append "\""
+                                         (search-input-file inputs "/bin/gcc")
+                                         "\""))
+                         (("\"c\\+\\+\"")
+                          (string-append "\""
+                                         (search-input-file inputs "/bin/g++")
+                                         "\""))
+                         (("\"git\"")
+                          (string-append "\""
+                                         (search-input-file inputs "/bin/git")
+                                         "\""))
+                         (("\"curl\"")
+                          (string-append "\""
+                                         (search-input-file inputs "/bin/curl")
+                                         "\"")))
+                       (substitute* "jpm/shutil.janet"
+                         (("cp")
+                          (string-append (search-input-file inputs "/bin/cp"))))
+                       (setenv "PREFIX"
+                               #$output)))
+                   (replace 'install
+                     (lambda _
+                       (for-each (lambda (dir)
+                                   (mkdir-p (string-append #$output "/" dir)))
+                                 '("lib/janet/jpm" "share/man/man1"))
+                       (invoke "janet" "bootstrap.janet"
+                               "configs/linux_config.janet")
+                       (wrap-program (string-append #$output "/bin/jpm")
+                         `("JANET_HEADERPATH" ":" =
+                           (,(string-append #$janet "/include/janet")))
+                         `("JANET_LIBPATH" ":" =
+                           (,(string-append #$janet "/lib")))))))))
+    (inputs (list bash-minimal
+                  coreutils-minimal
+                  curl
+                  gcc
+                  git-minimal/pinned))
+    (propagated-inputs (list janet))
+    (native-search-paths
+     (list $SSL_CERT_DIR $SSL_CERT_FILE))
+    (home-page "https://janet-lang.org/")
+    (synopsis "Janet Project Manager for the Janet programming language")
+    (description
+     "@code{jpm} is the Janet Project Manager tool.  It is a build
+tool and its main uses are installing dependencies, compiling C/C++ to native
+libraries, and other management tasks for Janet projects.")
+    (license license:expat)))
+
 (define-public lisp-repl-core-dumper
   (package
     (name "lisp-repl-core-dumper")




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#75394] [PATCH v14 0/2] Add jpm.
@ 2025-01-06  1:22 Suhail Singh
  2024-10-08  3:22 ` [bug#75394] [PATCH v14 2/2] gnu: Improve user-experience for jpm Suhail Singh
  2024-10-08  3:31 ` [bug#75394] [PATCH v14 1/2] gnu: Add jpm package Suhail Singh
  0 siblings, 2 replies; 9+ messages in thread
From: Suhail Singh @ 2025-01-06  1:22 UTC (permalink / raw)
  To: 75394
  Cc: Guillaume Le Vaillant, Katherine Cox-Buday, Munyoki Kilyungi,
	Sharlatan Hellseher, jgart

Hello Guix,

This is same as v14 in #72925.  Starting a new issue in the hope of
working around mumi issue [1].

Copying below cover-letter content from v14 in #72925 for convenience:

> v14 is the same as v13, but has been rebased onto master.
>
> Given a profile containing only jpm, bash, coreutils-minimal and
> nss-certs and loading it using something like the below:
>
> #+begin_src sh
>   guix shell --pure -CPWN \
>     -E '.*GTK.*|.*XDG.*|.*DISPLAY.*|TERM|INSIDE_EMACS' \
>     -p /path/to/profile
> #+end_src
>
>
> I have tested using the below commands:
>
> #+begin_src sh
>   cd /tmp
>   mkdir -p review-72925 && cd review-72925
>   jpm install -l sh
>   jpm install -l spork
> #+end_src
>
>
> For "sh", the below successfully works in janet repl which is loaded via
> "jpm -l repl":
>
> #+begin_src janet
>   (import sh)
>   (sh/$ touch foo.txt)
> #+end_src
>
>
> For spork, I the following example has been tested as working in a janet
> repl invoked via "jpm -l repl":
>
> #+begin_src janet
>   (import spork/tasker)
>
>   (def t (tasker/new-tasker))
>
>   (ev/spawn
>     (tasker/run-executors t))
>
>   (tasker/queue-task t ["echo" "hello," "world"])
>   (tasker/queue-task t ["echo" "hello," "world"])
>   (tasker/queue-task t ["echo" "hello," "world"])
>   (tasker/queue-task t ["sleep" "5"])
> #+end_src


[1]: <https://yhetil.org/guix-patches/11be729cce0b193ddb3882df02260bbf7389e9d0@dismail.de/>

Omar Bassam (1):
  gnu: Add jpm package.

Suhail (1):
  gnu: Improve user-experience for jpm.

 gnu/packages/lisp.scm | 91 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)


base-commit: ddbb59f9bc5eb6dfaf1fc24881bb62f11960d664




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#75394: [PATCH v14 0/2] Add jpm.
  2024-10-08  3:22 ` [bug#75394] [PATCH v14 2/2] gnu: Improve user-experience for jpm Suhail Singh
@ 2025-01-06  2:14   ` jgart via Guix-patches via
  2025-01-07  1:56     ` [bug#75394] " Suhail Singh
  0 siblings, 1 reply; 9+ messages in thread
From: jgart via Guix-patches via @ 2025-01-06  2:14 UTC (permalink / raw)
  To: 75394-done; +Cc: Suhail Singh


Thanks! applied.

Should we add janet specific documentation in a follow up ticket somewhere?

-- 
all the best,
jgart




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#75394] [PATCH v14 0/2] Add jpm.
  2025-01-06  2:14   ` bug#75394: [PATCH v14 0/2] Add jpm jgart via Guix-patches via
@ 2025-01-07  1:56     ` Suhail Singh
  2025-01-07  2:51       ` jgart via Guix-patches via
  0 siblings, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2025-01-07  1:56 UTC (permalink / raw)
  To: jgart; +Cc: 75394-done, Suhail Singh

jgart <jgart@dismail.de> writes:

> Should we add janet specific documentation

As in the "docs" target in the janet Makefile?

-- 
Suhail




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#75394] [PATCH v14 0/2] Add jpm.
  2025-01-07  1:56     ` [bug#75394] " Suhail Singh
@ 2025-01-07  2:51       ` jgart via Guix-patches via
  2025-01-07  3:09         ` Suhail Singh
  0 siblings, 1 reply; 9+ messages in thread
From: jgart via Guix-patches via @ 2025-01-07  2:51 UTC (permalink / raw)
  To: Suhail Singh; +Cc: 75394-done, Suhail Singh

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

> 
> As in the "docs" target in the janet Makefile?
> 
I mean in the info manual for GNU Guix.

Do you intend to contribute a janet-build-system after this? In that case, then you can document any special instructions for using Guix with janet.

all best,

jgart

[-- Attachment #2: Type: text/html, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#75394] [PATCH v14 0/2] Add jpm.
  2025-01-07  2:51       ` jgart via Guix-patches via
@ 2025-01-07  3:09         ` Suhail Singh
  2025-01-07  7:15           ` Omar Bassam
  0 siblings, 1 reply; 9+ messages in thread
From: Suhail Singh @ 2025-01-07  3:09 UTC (permalink / raw)
  To: jgart; +Cc: Omar Bassam, Suhail Singh, 75394-done

"jgart" <jgart@dismail.de> writes:

> Do you intend to contribute a janet-build-system after this?

Not being a janet user, likely not any time soon.  I wasn't even
intending to contribute jpm, I was simply helping review Omar's
submission.  Omar had, at one point however, mentioned a
janet-build-system [1].

> In that case, then you can document any special instructions for using
> Guix with janet.

I do agree that that would be helpful.

[1]: <https://issues.guix.gnu.org/72925#12>

-- 
Suhail




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#75394] [PATCH v14 0/2] Add jpm.
  2025-01-07  3:09         ` Suhail Singh
@ 2025-01-07  7:15           ` Omar Bassam
  2025-01-08 15:30             ` Suhail Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Omar Bassam @ 2025-01-07  7:15 UTC (permalink / raw)
  To: Suhail Singh; +Cc: jgart, 75394-done

Suhail Singh <suhailsingh247@gmail.com> writes:

> "jgart" <jgart@dismail.de> writes:
>
>> Do you intend to contribute a janet-build-system after this?
>
> Not being a janet user, likely not any time soon.  I wasn't even
> intending to contribute jpm, I was simply helping review Omar's
> submission.  Omar had, at one point however, mentioned a
> janet-build-system [1].
>

Yes, Thanks Suhail, your reviews helped me alot. This was my first
contribution to guix and I learned alot from it.

I would like to contribute more to guix and would like to take building
a janet-build-system as a start. I would appreciate any guidance or
recommendations on where to start to learn about building a custom build
system.

>> In that case, then you can document any special instructions for using
>> Guix with janet.
>
> I do agree that that would be helpful.
>

I am not sure where should such document be added?

> [1]: <https://issues.guix.gnu.org/72925#12>

Many Thanks to all,
Omar Bassam




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#75394] [PATCH v14 0/2] Add jpm.
  2025-01-07  7:15           ` Omar Bassam
@ 2025-01-08 15:30             ` Suhail Singh
  0 siblings, 0 replies; 9+ messages in thread
From: Suhail Singh @ 2025-01-08 15:30 UTC (permalink / raw)
  To: Omar Bassam; +Cc: jgart, Suhail Singh, 75394-done

Omar Bassam <omar.bassam88@gmail.com> writes:

> Yes, Thanks Suhail, your reviews helped me alot.

You're welcome :)

> I would like to contribute more to guix and would like to take building
> a janet-build-system as a start. I would appreciate any guidance or
> recommendations on where to start to learn about building a custom build
> system.

I don't have any specific guidance other than to look at existing build
system definitions.  Perhaps jgart has some thoughts?

>>> In that case, then you can document any special instructions for using
>>> Guix with janet.
>>
>> I do agree that that would be helpful.
>>
>
> I am not sure where should such document be added?

I am no authority, but perhaps the Cookbook?  Jgart, thoughts?

-- 
Suhail




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-01-08 15:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06  1:22 [bug#75394] [PATCH v14 0/2] Add jpm Suhail Singh
2024-10-08  3:22 ` [bug#75394] [PATCH v14 2/2] gnu: Improve user-experience for jpm Suhail Singh
2025-01-06  2:14   ` bug#75394: [PATCH v14 0/2] Add jpm jgart via Guix-patches via
2025-01-07  1:56     ` [bug#75394] " Suhail Singh
2025-01-07  2:51       ` jgart via Guix-patches via
2025-01-07  3:09         ` Suhail Singh
2025-01-07  7:15           ` Omar Bassam
2025-01-08 15:30             ` Suhail Singh
2024-10-08  3:31 ` [bug#75394] [PATCH v14 1/2] gnu: Add jpm package Suhail Singh

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).