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.
The way I read http://common-lisp.net/project/asdf/asdf/Controlling-where-ASDF-saves-compiled-files.html, you need to put a mapping there that specifies a match and a translation. In the sexp syntax, you can specify it as (t "/home.../...dir/")
, where t
means matching all.
You can also use functions to translate the directories:
(t (:function (lambda (dir) #|translate dir as you like|#)))
Also read about where to put such directives. The environment variable seems to be treated by some special syntax that I have not completely understood. You could use configuration files instead if it doesn't work out.
edit: Sorry, just reading the documentation (which really has room for improvement) http://common-lisp.net/project/asdf/asdf/Output-Configuration-DSL.html. You might need to be a bit more explicit:
(:output-translations (t "/foo/bar"))
The corresponding "shell friendly" syntax might be like this:
**/:/foo/bar
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.