Search code examples
lispcommon-lispclispasdf

ASDF output redirection


I would like to set directory where ASDF stores compiled files. I prefer to do it from a shell script. According to this page, one should define environment variable ASDF_OUTPUT_TRANSLATIONS.

OK, here it is:

$ export ASDF_OUTPUT_TRANSLATIONS="$HOME/.cache/common-lisp/my-dir/"

But when I try to test the configuration, it does not work:

$ clisp -x "(asdf:compile-system :my-system)"

Output:

;; Loading file /home/mark/.clisprc.lisp ...
;;  Loading file /home/mark/quicklisp/setup.lisp ...
*** - Uneven number of components in source to destination mapping:
      "/home/mark/.cache/common-lisp/my-dir/"
Bye.

Bye. Well, it's one of possible outputs. I've tried to assign lots of values to ASDF_OUTPUT_TRANSLATIONS. Even and odd. Small and big. No success. This would be way easier if there is an example of such configuration, but I could not find one.

Another problem is that I don't know if systems which will be compiled will not overwrite files with the same names of each other when ASDF puts everything into one directory. What I really want is temporarily setting of output directory from shell script, so every file would be in predictable place no matter where source files are.


Solution

  • I succeeded with the following:

    $ export ASDF_OUTPUT_TRANSLATIONS="/:$HOME/.cache/common-lisp/my-dir/"
    

    Note 1: destination directory may not exist: in this case ASDF will create it.

    Note 2: one cannot use symbols like * or ** in this string. Directory / denotes all possible directories.

    Note 3: ASDF will create subdirectories inside of my-dir like this:

    /home/mark/.cache/common-lisp/my-dir/home/mark/path/to/source/files/
    

    It is not exactly what I wanted, but since I can detect where source files are located before building takes place by placing them into subdirectory of the directory where my shell script is located, it's not a critical problem.