raco setup: add install-platform to "info.rkt"

The `install-platform` value determines whether files are
copied to "lib" and "share" directories.
This commit is contained in:
Matthew Flatt 2013-09-03 21:04:17 -06:00
parent 6391fe4ed0
commit 16c0b385de
2 changed files with 48 additions and 9 deletions

View File

@ -530,7 +530,9 @@ Optional @filepath{info.rkt} fields trigger additional actions by
@item{@indexed-racket[copy-foreign-libs] : @racket[(listof (and/c @item{@indexed-racket[copy-foreign-libs] : @racket[(listof (and/c
path-string? relative-path?))] --- Files to copy into a path-string? relative-path?))] --- Files to copy into a
directory where foreign libraries are found by @racket[ffi-lib].} directory where foreign libraries are found by @racket[ffi-lib].
If @racket[install-platform] is defined, then the files are copied
only if the current platform matches the definition.}
@item{@indexed-racket[move-foreign-libs] : @racket[(listof (and/c @item{@indexed-racket[move-foreign-libs] : @racket[(listof (and/c
path-string? relative-path?))] --- Like @racket[copy-foreign-libs], path-string? relative-path?))] --- Like @racket[copy-foreign-libs],
@ -539,7 +541,9 @@ Optional @filepath{info.rkt} fields trigger additional actions by
@item{@indexed-racket[copy-shared-files] : @racket[(listof (and/c @item{@indexed-racket[copy-shared-files] : @racket[(listof (and/c
path-string? relative-path?))] --- Files to copy into a path-string? relative-path?))] --- Files to copy into a
directory where shared files are found.} directory where shared files are found.
If @racket[install-platform] is defined, then the files are copied
only if the current platform matches the definition.}
@item{@indexed-racket[move-shared-files] : @racket[(listof (and/c @item{@indexed-racket[move-shared-files] : @racket[(listof (and/c
path-string? relative-path?))] --- Like @racket[copy-shared-files], path-string? relative-path?))] --- Like @racket[copy-shared-files],
@ -557,6 +561,19 @@ Optional @filepath{info.rkt} fields trigger additional actions by
@racket[copy-man-pages], but the original file is removed after it @racket[copy-man-pages], but the original file is removed after it
is copied (which makes sense for precompiled packages).} is copied (which makes sense for precompiled packages).}
@item{@indexed-racket[install-platform] : @racket[(or/c regexp?
string? symbol?)] --- Determines whether files are copied or moved
for @racket[copy-foreign-libs], @racket[move-foreign-libs],
@racket[copy-shared-files], or @racket[move-shared-files]. If
@racket[install-platform] is defined as a regexp, then files are
copied/moved only if the regexp matches the result of
@racket[(system-library-subpath #f)]. If @racket[install-platform]
is defined as a string, then files are copied/moved only if the
@racket[(path->string (system-library-subpath #f))] produces the
same string. If @racket[install-platform] is defined as a symbol,
then files are copied/moved only if the @racket[(system-type)]
produces the same symbol.}
@item{@indexed-racket[install-collection] : @racket[path-string?] --- A @item{@indexed-racket[install-collection] : @racket[path-string?] --- A
library module relative to the collection that provides library module relative to the collection that provides
@racket[installer]. The @racket[installer] procedure accepts one @racket[installer]. The @racket[installer] procedure accepts one

View File

@ -817,6 +817,21 @@
[else [else
(installer dir)])))))) (installer dir)]))))))
(define (this-platform? info)
(define sys
(call-info info
'install-platform
(lambda () #rx"")
(lambda (v)
(unless (or (regexp? v)
(string? v)
(symbol? v))
(error "entry is not regexp, string, or symbol:" v)))))
(cond
[(regexp? sys) (regexp-match? sys (system-library-subpath #f))]
[(symbol? sys) (eq? sys (system-type))]
[else (equal? sys (path->string (system-library-subpath #f)))]))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Make zo ;; ;; Make zo ;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1477,7 +1492,8 @@
receipt-file receipt-file
receipt-at-dest? receipt-at-dest?
check-entry check-entry
build-dest-path) build-dest-path
this-platform?)
(define (make-libs-step) (define (make-libs-step)
(setup-printf #f (format "--- installing ~a ---" whats)) (setup-printf #f (format "--- installing ~a ---" whats))
(define installed-libs (make-hash)) (define installed-libs (make-hash))
@ -1489,8 +1505,9 @@
(define move-libs (define move-libs
(call-info info move-tag (lambda () null) check-entry)) (call-info info move-tag (lambda () null) check-entry))
(unless (and (null? copy-libs) (unless (or (and (null? copy-libs)
(null? move-libs)) (null? move-libs))
(not (this-platform? info)))
(define dir (if (cc-main? cc) (define dir (if (cc-main? cc)
(find-target-dir) (find-target-dir)
(find-user-target-dir))) (find-user-target-dir)))
@ -1642,7 +1659,8 @@
(lambda (l) (lambda (l)
(unless (list-of relative-path-string? l) (unless (list-of relative-path-string? l)
(error "entry is not a list of relative path strings:" l))) (error "entry is not a list of relative path strings:" l)))
build-path)) build-path
this-platform?))
(define make-shares-step (define make-shares-step
(make-copy/move-step "shared file" (make-copy/move-step "shared file"
@ -1657,7 +1675,8 @@
(lambda (l) (lambda (l)
(unless (list-of relative-path-string? l) (unless (list-of relative-path-string? l)
(error "entry is not a list of relative path strings:" l))) (error "entry is not a list of relative path strings:" l)))
build-path)) build-path
this-platform?))
(define make-mans-step (define make-mans-step
(make-copy/move-step "man page" (make-copy/move-step "man page"
@ -1680,7 +1699,8 @@
(lambda (d n) (lambda (d n)
(build-path d (build-path d
(bytes->path-element (bytes-append #"man" (filename-extension n))) (bytes->path-element (bytes-append #"man" (filename-extension n)))
n)))) n))
(lambda (info) #t)))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Package-dependency checking ;; ;; Package-dependency checking ;;
@ -1740,7 +1760,9 @@
(do-install-part 'pre) (do-install-part 'pre)
(when (make-foreign-libs) (make-foreign-libs-step)) (when (make-foreign-libs)
(make-foreign-libs-step)
(make-shares-step))
(when (make-zo) (make-zo-step)) (when (make-zo) (make-zo-step))