guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quiet compilation for scripting


From: Olivier Dion
Subject: Re: Quiet compilation for scripting
Date: Fri, 15 Mar 2024 13:31:43 -0400

On Fri, 15 Mar 2024, ksoft@sent.com wrote:
> I am in the process of rewriting in Guile a script that I use
> regularly. Running Guile 3.0.9, when I execute a file containing
>
>   #!/usr/local/bin/guile -s
>   !#
>   (display "Hello, mailing list!")
>   (newline)
>
> the following is printed to standard error:
>
>   ;;; note: source file /Users/me/./test.scm
>   ;;;       newer than compiled 
> /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go
>   ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
>   ;;;       or pass the --no-auto-compile argument to disable.
>   ;;; compiling /Users/me/./test.scm
>   ;;; compiled
>   /Users/me/.cache/guile/ccache/3.0-LE-8-4.6/Users/me/test.scm.go

Like the warning says, you ought to either use the GUILE_AUTO_COMPILE
environment variable or use the `--no-auto-compile' switch.
Unfortunately, there is no `--quiet' or `--warning=/dev/null' option.

What I typically do is to compile modules and not compile scripts
(program entrypoints).  So in the end, I have the following prologue for
portable Guile script:

--8<---------------cut here---------------start------------->8---
#!/bin/sh
#-*-Scheme-*-
GUILE="$(command -v guile || command -v guile3.0)"

if [ -z "$GUILE" ]; then
  echo "Missing guile executable."
  exit 1
fi

exec $GUILE --no-auto-compile -e main -s "$0" "$@"
!#
--8<---------------cut here---------------end--------------->8---

Note the usage of `--no-auto-compile' which will prevent Guile from
auto-compiling file, while still loading already compiled modules.

[...]

-- 
Olivier Dion
oldiob.ca



reply via email to

[Prev in Thread] Current Thread [Next in Thread]