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.rottm...@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.

---
 collects/r6rs/run.rkt                |   22 +++++++++++++++-------
 collects/r6rs/scribblings/r6rs.scrbl |    5 +++++
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/collects/r6rs/run.rkt b/collects/r6rs/run.rkt
index 2b3b7c3..1102291 100644
--- a/collects/r6rs/run.rkt
+++ b/collects/r6rs/run.rkt
@@ -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))
diff --git a/collects/r6rs/scribblings/r6rs.scrbl b/collects/r6rs/scribblings/r6rs.scrbl
index a77d942..df859bf 100644
--- a/collects/r6rs/scribblings/r6rs.scrbl
+++ b/collects/r6rs/scribblings/r6rs.scrbl
@@ -151,6 +151,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
-- 
tg: (3885ba4..) t/r6rs-install (depends on: master)
Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>
_________________________________________________
  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-dev

Reply via email to