Skip to content

Commit

Permalink
add --xpatch flag to the boot{quick} command target
Browse files Browse the repository at this point in the history
The `--xpatch` flag explicitly requests that an "xpatch" is created in
the "xc-..." directory. The file is created anyway, currently, but
`--xpatch` is meant to make it more official.

Original commit: racket/ChezScheme@288ad38
  • Loading branch information
mflatt committed Nov 16, 2022
1 parent 9fc73a4 commit 10d59cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
24 changes: 16 additions & 8 deletions build.zuo
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@

;; besides `<machine>` argument, accepts `--host-scheme <command>`
;; or `--host-workarea <dir>", and recognizes `SCHEME=...` if neither
;; flag is provided
(define (parse-boot-args args k)
;; flag is provided; also recognizes "--xpatch" before anything else
;; to request that "xpatch" is left in an "xc-" directory
(define (parse-boot-args orig-args k)
(define xpatch?
(and (pair? orig-args)
(equal? "--xpatch" (car orig-args))))
(define args (if xpatch? (cdr orig-args) orig-args))
(define host-scheme-via-flag
(and (pair? args)
(equal? (car args) "--host-scheme")
Expand Down Expand Up @@ -132,19 +137,19 @@
(define host-m (if host-scheme
(ask-scheme-machine host-scheme)
m))
(k xm host-m host-scheme host-workarea))
(k xm host-m host-scheme host-workarea xpatch?))

;; Cross-builds for a machine type that is specified as an argument;
;; the machine type defaults to the `defaultm` configuration entry, and
;; that default is normally useful if the current machine type is "pb"
(define (cross-build-boot token args ccopts make-targets record-dep?)
(parse-boot-args
args
(lambda (xm m host-scheme host-workarea)
(lambda (xm m host-scheme host-workarea xpatch?)
(unless (or host-scheme host-workarea)
(check-not-kernel-only))
(alert (~a "building boot files for " xm " using " m))
(boot:cross-build-boot token ccopts make-targets
(boot:cross-build-boot token ccopts make-targets xpatch?
xm host-scheme host-workarea
at-dir config vars m)
;; record success so boot files will not be rebuilt from pb
Expand All @@ -157,15 +162,18 @@
(define (cross-reboot token args)
(parse-boot-args
args
(lambda (xm m host-scheme host-workarea)
(lambda (xm m host-scheme host-workarea xpatch?)
(when xpatch? (error "cannot generate xpatch in reboot mode"))
(define scheme (or host-scheme
(build-path host-workarea m "bin" m (.exe "scheme"))))
(define options (if host-workarea
(hash 'env
(cons "SCHEMEHEAPDIRS"
(path->complete-path (build-path host-workarea "boot" m))))
(hash)))
(reboot m xm scheme (hash 'shell-options options 'out-dir (at-dir ".."))))))
(reboot m xm scheme (hash 'shell-options options
'out-dir (at-dir "..")
'work-dir (at-dir ".."))))))

;; used to create a target for "quickboot", or just record dependency for other modes
;; of building boot files
Expand Down Expand Up @@ -313,7 +321,7 @@
(check-not-kernel-only)
(parse-boot-args
args
(lambda (xm m host-scheme host-workarea)
(lambda (xm m host-scheme host-workarea xpatch?)
(unless (or host-scheme host-workarea)
(build/dep (find-target "kernel" the-targets) token))
(build-boot-target
Expand Down
6 changes: 4 additions & 2 deletions makefiles/boot.zuo
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
;; Cross-builds for a machine type that is specified as an argument;
;; the machine type defaults to the `defaultm` configuration entry, and
;; that default is normally useful if the current machine type is "pb"
(define (cross-build-boot token ccopts make-targets
(define (cross-build-boot token ccopts make-targets xpatch?
xm host-scheme host-workarea
at-dir config vars m)
(define dir (at-dir ".." (~a "xc-" xm)))
Expand Down Expand Up @@ -58,7 +58,9 @@
(build (find-target "clean" targets) token)
(map (lambda (t)
(build (find-target t targets) token))
make-targets))
make-targets)
(when xpatch?
(build (find-target (build-path s-dir "xpatch") targets) token)))
(define boot-xm-dir (at-dir "../boot" xm))
(mkdir-p boot-xm-dir)
(for-each (lambda (file)
Expand Down

0 comments on commit 10d59cc

Please sign in to comment.