guile-user
[Top][All Lists]
Advanced

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

Re: Generating compiled scm (.go) files as part of LilyPond build


From: Ian Hulin
Subject: Re: Generating compiled scm (.go) files as part of LilyPond build
Date: Thu, 30 Dec 2010 11:43:29 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b3pre Thunderbird/3.1.7

Hi Andy,
On 01/12/10 22:08, Andy Wingo wrote:
> On Wed 01 Dec 2010 22:21, Ian Hulin <address@hidden> writes:
> 
>> address@hidden guile-tools compile scm/lily-library.scm
>> wrote
>> `/home/ian/.cache/guile/ccache/2.0-0.S-LE-4/home/ian/lilypond/scm/lily-library.scm.go'
> 
> You will want to set the -o option, as in GCC. See guile-tools compile
> --help.
> 

Thanks for the work-round, but I think there are problems with
compiled-file-name, which in turn affect guile-tool compile,
load-from-path and what happens when autocompile is in force.

Documentation for compiled-file-name
"— Scheme Procedure: compiled-file-name file

    Compute an appropriate name for a compiled version of a Scheme file
named file.

    Usually, the result will be the original file name with the .scm
suffix replaced with .go, but the exact behavior depends on the contents
of the %load-extensions and %load-compiled-extensions lists. "

1. compiled-file-name doesn't respect any settings of
%load-compiled-path (which could be picked up from
GUILE_LOAD_COMPILED_PATH setting.

2.  compiled-file-name doesn't replace a .scm source extension with the
default .go extension - it appends it to the complete filename.

3. compiled-file-name isn't available at the API until either you've
used compile-file or else explicitly loaded
module (system base compile).

address@hidden:~/lilypond$ echo $GUILE_LOAD_COMPILED_PATH
/home/ian/lilypond/scm/out
address@hidden:~/address@hidden:~/lilypond$ guile -L /home/ian/lilypond/scm
GNU Guile 1.9.14
Copyright (C) 1995-2010 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> ,use (ice-9 readline)
scheme@(guile-user)> (activate-readline)
scheme@(guile-user)> ,use (system base compile)
scheme@(guile-user)> %load-compiled-path
$1 = ("/home/ian/lilypond/scm/out" "/usr/local/lib/guile/2.0/ccache")
scheme@(guile-user)> (compiled-file-name (%search-load-path "c++.scm"))
$1 =
"/home/ian/.cache/guile/ccache/2.0-0.T-LE-4/home/ian/lilypond/scm/c++.scm.go"
scheme@(guile-user)>

It looks like (compiled-file-name) uses a hard-coded default setting for
%load-compiled-files to use as the root for cache.

For LilyPond purposes it would be preferable if (compiled-file-name)
worked like this (this is only a prototype suggestion):

(define (ly-compiled-file-name filename)
        (let* ( (pathdef (car %load-compiled-files))
                (sextdef (car %load-extensions))
                (oextdef (car %load-compiled-extensions))
                (path (dirname filename))
                (outname (basename filename sextdef)))
        (if (equal? path "." )
                (set! path pathdef))
        (string-append path "/" outname oextdef)))

Cheers and Happy New Year,

Ian Hulin





reply via email to

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