commit f969d3ecd1f1ead1ce61469947dafdacb6e06590
parent 423d015cbfc2a37d42d26de40fe1c6e1425282bc
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Sun, 30 Aug 2015 10:48:46 -0600
fix content of README for cross-compilation
Diffstat:
3 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/distro-build-doc/distro-build.scrbl b/distro-build-doc/distro-build.scrbl
@@ -336,6 +336,13 @@ spaces, etc.):
non-@racket[#f] value for @racket[#:racket] is propagated to
@racket[#:configure] via @DFlag{enable-racket}}
+ @item{@racket[#:target-platform _symbol] --- @racket['unix],
+ @racket['macosx], or @racket['windows], or @racket[#f], indicating
+ the target platform's type (which is different from the client
+ system type in the case of cross-compilation); defaults to
+ @racket[#f], which means that the target platform should be
+ inferred from arguments such as @racket[#:cross-target]}
+
@item{@racket[#:bits _integer] --- @racket[32] or @racket[64];
affects Visual Studio mode}
@@ -517,9 +524,10 @@ hash table mapping configuration keywords to values.}
Produces basic @filepath{README} content, using information about the
distribution and the Racket license. The content is constructed using
-@racket[config] keys such as @racket[#:name], @racket[#:platform],
+@racket[config] keys such as @racket[#:name], @racket[#:target-platform],
@racket[#:dist-name], and @racket[#:dist-catalogs], and sometimes
-@racket[current-stamp].}
+@racket[current-stamp]. Some content depends on the result of
+@racket[(readme-system-type config)].}
@defproc[(make-macosx-notes [config hash?]) string?]{
@@ -529,6 +537,29 @@ distribution folder. This function is used by @racket[make-readme] when
@racket[#:platform] in @racket[config] is @racket['macosx].}
+@defproc[(readme-system-type [config hash?]) (or/c 'unix 'macosx 'windows)]{
+
+Determines the kind of platform for a generated @filepath{README}
+file:
+
+@itemlist[
+
+ @item{If @racket['#:target-platform] has a non-@racket[#f] value in
+ @racket[config], the value is returned.}
+
+ @item{Otherwise, if @racket['#:cross-target] has a string value, then
+ a system type is inferred if it contains any of the following
+ fragments: @litchar{mingw} implies @racket['windows],
+ @litchar{darwin} implies @racket['macosx], and @litchar{linux}
+ implies @racket['unix].}
+
+ @item{If the above fail, the value of @racket['#:platform] is
+ returned, if it is mapped in @racket[config].}
+
+ @item{As a last resort, @racket[(system-type)] is returned.}
+
+]}
+
@; ----------------------------------------
@section[#:tag "name-format"]{Names and Download Pages}
diff --git a/distro-build-server/config.rkt b/distro-build-server/config.rkt
@@ -141,6 +141,7 @@
val))]
[(#:vbox) (string? val)]
[(#:platform) (memq val '(unix macosx windows windows/bash))]
+ [(#:target-platform) (memq val '(unix macosx windows #f))]
[(#:configure) (and (list? val) (andmap string? val))]
[(#:bits) (or (equal? val 32) (equal? val 64))]
[(#:vc) (string? val)]
diff --git a/distro-build-server/readme.rkt b/distro-build-server/readme.rkt
@@ -5,7 +5,8 @@
(provide make-readme
make-source-notes
- make-macosx-notes)
+ make-macosx-notes
+ readme-system-type)
(define (maybe-stamp config)
(if (hash-ref config '#:release? #f)
@@ -28,7 +29,7 @@
"")@;
@(if (and (not (hash-ref config '#:source-runtime?
(hash-ref config '#:source? #f)))
- (eq? (hash-ref config '#:platform (system-type)) 'macosx))
+ (eq? (readme-system-type config) 'macosx))
(string-append "\n" (make-macosx-notes config) "\n")
"")@;
@(let* ([catalogs (filter
@@ -139,3 +140,21 @@
files within the folder. If you want to use the Racket command-line
programs, then (optionally) add the path of the "bin" subdirectory to
your PATH environment variable.}))
+
+(define (readme-system-type config)
+ (or (hash-ref config '#:cross-platform #f)
+ (let ([c (hash-ref config '#:cross-target #f)])
+ (or (and c
+ (cond
+ [(regexp-match? #rx"mingw" c)
+ 'windows]
+ [(regexp-match? #rx"darwin" c)
+ 'macosx]
+ [(regexp-match? #rx"linux" c)
+ 'unix]
+ [else
+ #f]))
+ (let ([p (hash-ref config '#:platform (system-type))])
+ (if (eq? p 'windows/bash)
+ 'windows
+ p))))))