diff --git a/pkgs/racket-pkgs/racket-doc/scribblings/raco/setup.scrbl b/pkgs/racket-pkgs/racket-doc/scribblings/raco/setup.scrbl index 877d48ccee..2e357429af 100644 --- a/pkgs/racket-pkgs/racket-doc/scribblings/raco/setup.scrbl +++ b/pkgs/racket-pkgs/racket-doc/scribblings/raco/setup.scrbl @@ -530,7 +530,9 @@ Optional @filepath{info.rkt} fields trigger additional actions by @item{@indexed-racket[copy-foreign-libs] : @racket[(listof (and/c 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 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 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 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 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 library module relative to the collection that provides @racket[installer]. The @racket[installer] procedure accepts one diff --git a/racket/collects/setup/setup-unit.rkt b/racket/collects/setup/setup-unit.rkt index b8da3078a5..1d110d7542 100644 --- a/racket/collects/setup/setup-unit.rkt +++ b/racket/collects/setup/setup-unit.rkt @@ -817,6 +817,21 @@ [else (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 ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1477,7 +1492,8 @@ receipt-file receipt-at-dest? check-entry - build-dest-path) + build-dest-path + this-platform?) (define (make-libs-step) (setup-printf #f (format "--- installing ~a ---" whats)) (define installed-libs (make-hash)) @@ -1489,8 +1505,9 @@ (define move-libs (call-info info move-tag (lambda () null) check-entry)) - (unless (and (null? copy-libs) - (null? move-libs)) + (unless (or (and (null? copy-libs) + (null? move-libs)) + (not (this-platform? info))) (define dir (if (cc-main? cc) (find-target-dir) (find-user-target-dir))) @@ -1642,7 +1659,8 @@ (lambda (l) (unless (list-of relative-path-string? l) (error "entry is not a list of relative path strings:" l))) - build-path)) + build-path + this-platform?)) (define make-shares-step (make-copy/move-step "shared file" @@ -1657,7 +1675,8 @@ (lambda (l) (unless (list-of relative-path-string? l) (error "entry is not a list of relative path strings:" l))) - build-path)) + build-path + this-platform?)) (define make-mans-step (make-copy/move-step "man page" @@ -1680,7 +1699,8 @@ (lambda (d n) (build-path d (bytes->path-element (bytes-append #"man" (filename-extension n))) - n)))) + n)) + (lambda (info) #t))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Package-dependency checking ;; @@ -1740,7 +1760,9 @@ (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))