commit 6c3971172aeae971ea518c505f9ec1ea64307e47
parent 8a1d196ff30b26049397ff389f509a34e57ca70f
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Sun, 30 Aug 2015 08:29:33 -0600
simplify cross-compilation with a `#:cross-target` option
Diffstat:
3 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/distro-build-doc/distro-build.scrbl b/distro-build-doc/distro-build.scrbl
@@ -248,13 +248,6 @@ spaces, etc.):
@item{@racket[#:pkgs (list _string* ...)] --- packages to install;
defaults to the @tt{PKGS} makefile variable}
- @item{@racket[#:racket _string-or-false] --- path to a native Racket
- executable when using the client machine for cross-compilation; if
- the value is @racket[#f], the the Racket executable generated for
- the client machine is used to prepare the installer; a
- non-@racket[#f] typically must be combined with
- @racket[#:configure] arguments to set up cross-compilation}
-
@item{@racket[#:dist-base-url _string] --- a URL that is used to
construct a default for @racket[#:doc-search] and
@racket[#:dist-catalogs], where the constructed values are
@@ -316,14 +309,33 @@ spaces, etc.):
shown, for example, in the Virtual Box GUI); if provided, the
virtual machine is started and stopped on the server as needed}
- @item{@racket[#:platform <symbol>] --- @racket['unix],
+ @item{@racket[#:platform _symbol] --- @racket['unix],
@racket['macosx], @racket['windows], or @racket['windows/bash]
(which means @racket['windows] though an SSH server providing
- @exec{bash}, such as Cygwin's); defaults to @racket[(system-type)]}
+ @exec{bash}, such as Cygwin's); the @racket[_symbol] names
+ the client machine's system, not the target for cross-compilation;
+ defaults to @racket[(system-type)]}
@item{@racket[#:configure (list _string ...)] --- arguments to
@exec{configure}}
+ @item{@racket[#:cross-target _string*] --- specifies a target for
+ cross-compilation, which adds @DFlag{host}@tt{=}@racket[_string*]
+ to the start of the list of @exec{configure} arguments; in
+ addition, if no @racket[#:racket] value is provided, a native
+ @exec{racket} executable for the client machine is created (by
+ using @exec{configure} with no arguments) and used for
+ cross-compilation in the same way as a @racket[#:racket] value}
+
+ @item{@racket[#:racket _string-or-false] --- an absolute path to a
+ native Racket executable to use for compilation, especially
+ cross-compilation; if the value is @racket[#f], then the Racket
+ executable generated for the client machine is used to prepare the
+ installer, or a client-native executable is generated
+ automatically if @racket[#:cross-target] is specified; a
+ non-@racket[#f] value for @racket[#:racket] is propagated to
+ @racket[#:configure] via @DFlag{enable-racket}}
+
@item{@racket[#:bits _integer] --- @racket[32] or @racket[64];
affects Visual Studio mode}
diff --git a/distro-build-server/config.rkt b/distro-build-server/config.rkt
@@ -114,6 +114,7 @@
(case kw
[(#:pkgs) (and (list? val) (andmap simple-string? val))]
[(#:racket) (or (not val) (string? val))]
+ [(#:cross-target) (simple-string? val)]
[(#:doc-search) (string? val)]
[(#:dist-name) (string? val)]
[(#:dist-base) (simple-string? val)]
@@ -190,7 +191,7 @@
(and (string? s)
;; No spaces, quotes, or other things that could
;; break a command-line, path, or URL construction:
- (regexp-match #rx"^[-a-zA-Z0-9.]*$" s)))
+ (regexp-match #rx"^[-a-zA-Z0-9._]*$" s)))
(define (email? s)
(and (string? s)
diff --git a/distro-build-server/drive-clients.rkt b/distro-build-server/drive-clients.rkt
@@ -300,6 +300,12 @@
(format "~a=~a" (car e) (cadr e)))))
(list "/bin/sh" "-c" (apply ~a args))))
(define j (or (get-opt c '#:j) 1))
+ (define cross-target (get-opt c '#:cross-target))
+ (define given-racket (and cross-target
+ (get-opt c '#:racket)))
+ (define need-native-racket? (and cross-target
+ (not given-racket)))
+ (define built-native-racket "cross/racket/racket3m") ; relative to build directory
(try-until-ready c host port user server-port 'unix (sh "echo hello"))
(ssh-script
host port user
@@ -313,11 +319,25 @@
(and pull?
(sh "cd " (q dir) " ; "
"git pull"))
+ (and need-native-racket?
+ (sh "cd " (q dir) " ; "
+ "make native-for-cross"))
(sh "cd " (q dir) " ; "
"make -j " j " client"
(client-args c server server-port 'unix readme)
" JOB_OPTIONS=\"-j " j "\""
- " CONFIGURE_ARGS_qq=" (qq (get-opt c '#:configure null) 'unix))))
+ (if need-native-racket?
+ (~a " PLAIN_RACKET=`pwd`/racket/src/build/" built-native-racket)
+ "")
+ " CONFIGURE_ARGS_qq=" (qq (append
+ (if cross-target
+ (list (~a "--enable-racket="
+ (or given-racket
+ (~a "`pwd`/" built-native-racket)))
+ (~a "--host=" cross-target))
+ null)
+ (get-opt c '#:configure null))
+ 'unix))))
(define (windows-build c platform host port user server server-port repo clean? pull? readme)
(define dir (get-path-opt c '#:dir "build\\plt" #:localhost (current-directory)))