cs: fix cross-build bootstrap

Fix the relevant makefile target.
This commit is contained in:
Matthew Flatt 2019-04-29 12:25:11 -06:00
parent bd5677da70
commit c4f44eaedd
2 changed files with 19 additions and 2 deletions

View File

@ -14,7 +14,9 @@
"config.rkt")
;; Set `SCHEME_SRC` and `MACH` to specify the ChezScheme source
;; directory and the target machine.
;; directory and the target machine. Set the `MAKE_BOOT_FOR_CROSS`
;; environment variable to generate just enough to run `configure`
;; for a corss build.
(unless scheme-dir
(error "set `SCHEME_SRC` environment variable"))
@ -297,6 +299,16 @@
(eval `(mkequates.h ,(path->string (build-path out-subdir "equates.h"))))
(plumber-flush-all (current-plumber))
(when (getenv "MAKE_BOOT_FOR_CROSS")
;; Working bootfiles are not needed for a cross build (only the
;; ".h" files are needed), so just make dummy files in that case
;; to let `configure` work
(define (touch p)
(unless (file-exists? p) (call-with-output-file* p void)))
(touch (build-path out-subdir "petite.boot"))
(touch (build-path out-subdir "scheme.boot"))
(exit))
(for ([s (in-list '("ftype.ss"
"fasl.ss"
"reloc.ss"

View File

@ -148,12 +148,15 @@ SCHEME_CONFIG_VARS = CC="$(CC)" CFLAGS="$(BASE_CFLAGS)" LD="$(LD)" LDFLAGS="$(LD
scheme-make-finish:
env SCHEME_SRC="$(SCHEME_SRC)" MACH="$(MACH)" $(BOOTSTRAP_RACKET) $(srcdir)/../bootstrap/make-boot.rkt
cd $(SCHEME_SRC) && ./configure @SCHEME_CONFIG_ARGS@ $(SCHEME_CONFIG_VARS)
$(MAKE) sync-bootfiles
cd $(SCHEME_SRC) && $(MAKE)
sync-bootfiles:
mkdir -p $(SCHEME_SRC)/$(MACH)/boot/$(MACH)
$(MAKE) $(SCHEME_SRC)/$(MACH)/boot/$(MACH)/equates.h
$(MAKE) $(SCHEME_SRC)/$(MACH)/boot/$(MACH)/scheme.h
$(MAKE) $(SCHEME_SRC)/$(MACH)/boot/$(MACH)/petite.boot
$(MAKE) $(SCHEME_SRC)/$(MACH)/boot/$(MACH)/scheme.boot
cd $(SCHEME_SRC) && $(MAKE)
# If "equates.h", etc., are newly built since previous build, move them into place
$(SCHEME_SRC)/$(MACH)/boot/$(MACH)/equates.h: $(SCHEME_SRC)/boot/$(MACH)/equates.h
@ -167,6 +170,8 @@ $(SCHEME_SRC)/$(MACH)/boot/$(MACH)/scheme.boot: $(SCHEME_SRC)/boot/$(MACH)/schem
scheme-cross:
cd $(SCHEME_SRC) && git submodule -q init && git submodule -q update
env MAKE_BOOT_FOR_CROSS=yes SCHEME_SRC="$(SCHEME_SRC)" MACH="$(TARGET_MACH)" $(BOOTSTRAP_RACKET) $(srcdir)/../bootstrap/make-boot.rkt
$(MAKE) sync-bootfiles MACH="$(TARGET_MACH)"
cd $(SCHEME_SRC) && ./configure @SCHEME_CROSS_CONFIG_ARGS@ $(SCHEME_CONFIG_VARS)
cd $(SCHEME_SRC)/$(TARGET_MACH)/c && $(MAKE) o=o cross=t
$(MAKE) $(SCHEME_SRC)/$(TARGET_MACH)/s/xpatch