Subject: Re: [bug#41949] [PATCH 3/5] guix: Add gerbil-build-system

From: Ludovic Courtès <[email-masked]>
Date: Wed, 02 Sep 2020 17:10:09 +0200

Edouard Klein <[email-masked]> skribis:

> * guix/build-system/gerbil.scm: New file.
> (%gerbil-build-system-modules): New variable.
> (gerbil-build): New variable
> (gerbil-build-system): New variable
>
> * guix/build/gerbil-build-system.scm: New file.
> (%standard-phases): New variable.
> (gerbil-build): New variable.

[...]

> +;; Gerbil's build system and package management is documented at
> +;; https://cons.io/guide/package-manager.html
> +;; https://cons.io/guide/build.html
> +;; https://cons.io/guide/env-vars.html
> +;;
> +;; The compiler is writing its output in the directory
> +;; pointed to by GERBIL_PATH (or ~/.gerbil by default).
> +;;
> +;; Every package is supposed to have a build.ss script
> +;; whose default action (when called with no argument)
> +;; is to compile the package.
> +;;
> +;; The GERBIL_LOADPATH env variable tells gerbil's runtime
> +;; where it can find its loadable code.
> +;;
> +;; GERBIL_HOME tells gerbil where to find its runtime
> +;; and standard library
> +;;
> +;; This build system therefore just
> +;; - makes GERBIL_PATH point to the output directory in the store,
> +;; - makes GERBIL_LOADPATH point to the lib subdir
> +;; of all the gerbil inputs,
> +;; - calls ./build.ss,
> +;; - wrap any executable with GERBIL_LOADPATH set the the lib
> +;; subdir of all the gerbil inputs plus the lib subdir
> +;; of the current package's output, and with GERBIL_HOME
> +;; set to the lib directory of the 'gerbil' input
> +
> +(define (loadpath inputs)
> +  (string-join (map (match-lambda
> +                      ((_ . path)
> +                       (string-append path "/lib")))
> +                    ;; Restrict to inputs beginning with "gerbil-".
> +                    (filter (match-lambda
> +                              ((name . _)
> +                               (string-prefix? "gerbil-" name)))
> +                            inputs))
> +               ":"))

Shouldn’t ‘GERBIL_LOADPATH’ be in ‘native-search-paths’ of Gerbil, just
like ‘GUILE_LOAD_PATH’ for Guile?

In that case, you wouldn’t need this procedure.  Perhaps, you’d need to
adjust the convention, though, so that libraries are installed to
lib/gerbil/ instead of lib/gerbil-* (not strictly necessary because the
search path mechanism accepts regexps, as used for XML_CATALOG_FILES,
but somewhat “nicer” IMO).

Thoughts?

We’d also need an item in doc/guix.texi under “Build Systems”.

Please let us know if you cannot work on it in the foreseeable future.
I might be able to make these changes if they make sense to you.

Thanks,
Ludo’.