Subject: bug#42947: Chez Scheme libraries are broken

From: Martin Becze <[email-masked]>
Date: Tue, 1 Sep 2020 04:22:03 -0500

> I see, but now we’re creating a directory that remains empty, and as I
 > wrote, chez-fmt is actually installed in another directory anyway:

Oh yikes! Yeah so I see half of the scheme libraries are installed in 
lib/csv-site and other are installed in lib/csv<version>-site. It 
appears that there was a missing make flag for scheme-fmt and several 
others. Attached is an updated patch that fixes that.

On 8/31/20 3:56 PM, Ludovic Courtès wrote:
> Hi,
> 
> Martin Becze <[email-masked]> skribis:
> 
>>> This is creating an empty directory, right?  Are you sure this helps?
>>
>> Yes, I think it solves the problem. On line 92 of the package
>> definition we have
>>
>> ```
>> (native-search-paths
>>       (list (search-path-specification
>>              (variable "CHEZSCHEMELIBDIRS")
>>              (files (list (string-append "lib/csv" version "-site"))))))
>> ```
>> search-path-specification won't set the environmental variable unless
>> the folder already exists. Note lib/csv<version> does exist at this
>> point but most libraries seem to want to live lib/csv<version>-site.
> 
> I see, but now we’re creating a directory that remains empty, and as I
> wrote, chez-fmt is actually installed in another directory anyway:
> 
>>> Isn’t the problem that packages like chez-fmt install libraries in
>>> ‘csv-site’ instead of ‘csv1.2.3-site’?
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> $ find $(./pre-inst-env  guix build chez-fmt)
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/lib
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/lib/csv-site
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/lib/csv-site/fmt-js.so
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/lib/csv-site/fmt-c.so
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/lib/csv-site/fmt.so
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/share
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/share/doc
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/share/doc/chez-fmt-0.8.11
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/share/doc/chez-fmt-0.8.11/fmt.css
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/share/doc/chez-fmt-0.8.11/README
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/share/doc/chez-fmt-0.8.11/fmt.html
>>> /gnu/store/qr8mgphbivlqbdmn355kps2cxlmi679d-chez-fmt-0.8.11/share/doc/chez-fmt-0.8.11/VERSION
>>> --8<---------------cut here---------------end--------------->8---
> 
> So perhaps the search path should be just lib/csv-site?  Is that
> consistent across Chez packages?
> 
> Thanks,
> Ludo’.
> 
>From 328ab304b47671dcdc03768f07484aae298ca646 Mon Sep 17 00:00:00 2001
From: Martin Becze <[email-masked]>
Date: Thu, 20 Aug 2020 12:39:50 -0500
Subject: [PATCH v2 1/2] gnu: chez-scheme: Fix libary directory issue.

This creates the directory lib/csv<version>-site which the scheme libary packages
expect.

* gnu/packages/chez.scm (chez-scheme): Create libary directory.
* gnu/packages/chez.scm (chez-make-flags): Add chezversion to make flags.
---
 gnu/packages/chez.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index da0b17e799..ac8fce5a1a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -194,6 +194,8 @@
                     (bin (string-append out "/bin"))
                     (lib (string-append out "/lib"))
                     (name "chez-scheme"))
+               ;; create the folder for libary installation
+               (mkdir (string-append lib "/csv" ,version "-site"))
                (symlink (string-append bin "/scheme")
                         (string-append bin "/" name))
                (map (lambda (file)
@@ -416,9 +418,11 @@ Chez Scheme.")
 ;; files.
 (define (chez-make-flags name version)
   `(let ((out (assoc-ref %outputs "out")))
-     (list (string-append "PREFIX=" out)
-           (string-append "DOCDIR=" out "/share/doc/"
-                          ,name "-" ,version))))
+     (list
+      (string-append "chezversion=" ,(package-version chez-scheme))
+      (string-append "PREFIX=" out)
+      (string-append "DOCDIR=" out "/share/doc/"
+                     ,name "-" ,version))))
 
 (define-public chez-matchable
   (package
-- 
2.28.0