Allow installation into arbitrary directories with "plt-r6rs --install"

Hi!

Here's an updated version of the patch, which also mentions the added
option in the docs; also the specified directory is added to the
collection paths, since compilation will fail otherwise.

From: Andreas Rottmann <a.rottmann@gmx.at>
Subject: Allow installation into arbitrary directories with "plt-r6rs --install"

Added a `--collections' option to plt-r6rs which allows to specify the
directory where libraries are installed into.
This commit is contained in:
Andreas Rottmann 2010-05-25 21:36:10 +02:00 committed by Eli Barzilay
parent 6f0e79feff
commit 53cbe874e0
2 changed files with 20 additions and 7 deletions

View File

@ -12,6 +12,7 @@
(define install-mode (make-parameter #f))
(define compile-mode (make-parameter #f))
(define install-all-users (make-parameter #f))
(define install-dir (make-parameter #f))
(define install-force (make-parameter #f))
(define extra-collection-dirs (make-parameter null))
@ -22,9 +23,11 @@
(install-mode #t)]
[("--compile") "compile <file> and all dependencies"
(compile-mode #t)]
#:once-each
#:once-any
[("--all-users") "install into main installation"
(install-all-users #t)]
[("--collections") dir "install into <dir>"
(install-dir (path->complete-path dir))]
[("--force") "overwrite existing libraries"
(install-force #t)]
#:multi
@ -39,9 +42,11 @@
(current-command-line-arguments (apply vector-immutable args))
(unless (null? (extra-collection-dirs))
(current-library-collection-paths (append (extra-collection-dirs)
(current-library-collection-paths))))
(current-library-collection-paths (append (extra-collection-dirs)
(if (install-dir)
(list (install-dir))
'())
(current-library-collection-paths)))
(define r6rs-read-syntax
(case-lambda
@ -142,9 +147,12 @@
(cddr name))]
[else name]))])
(apply build-path
(if (install-all-users)
(find-collects-dir)
(find-user-collects-dir))
(cond [(install-dir)
=> values]
[(install-all-users)
(find-collects-dir)]
[else
(find-user-collects-dir)])
(let loop ([name name])
(cond
[(and (pair? (cdr name))

View File

@ -165,6 +165,11 @@ instead (see @racket[find-collects-dir]):
@commandline{plt-r6rs --install --all-users @nonterm{libraries-file}}
You may as well specify an arbitrary collections directory by using
the @DFlag{collections} flag:
@commandline{plt-r6rs --install --collections @nonterm{directory} @nonterm{libraries-file}}
See @secref["libpaths"] for information on how @|r6rs| library names
are turned into collection-based module paths, which determines where
the files are written. Libraries installed by @exec{plt-r6rs