Skip to content
This repository was archived by the owner on Sep 13, 2019. It is now read-only.

Commit 385a76c

Browse files
committed
build less when using an existing Racket to build
1 parent 499328e commit 385a76c

File tree

13 files changed

+73
-15
lines changed

13 files changed

+73
-15
lines changed

pkgs/racket-doc/scribblings/raco/setup.scrbl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,28 @@ flags:
285285
install archive into the installation instead of a user-specific
286286
location.}
287287

288+
]}
289+
@item{Bootstrapping:
290+
@itemize[
291+
292+
@item{@DFlag{boot} @nonterm{module-file} @nonterm{build-dir} --- For
293+
use by directly running @racketmodname[setup] instead of
294+
through @exec{raco setup}, loads @nonterm{module-file} in the
295+
same way that @exec{raco setup} normally loads itself,
296+
auto-detecting the need to start from sources and rebuild the
297+
compiled files---even for the compilation manager itself. The
298+
@nonterm{build-dir} path is installed as the only path in
299+
@racket[current-compiled-file-roots], so all compiled files
300+
go there.}
301+
302+
@item{@DFlag{chain} @nonterm{module-file} @nonterm{build-dir} ---
303+
Like @DFlag{boot}, but adds @nonterm{build-dir} to the start of
304+
@racket[current-compiled-file-roots] instead of replacing the
305+
current value, which means that libraries already built in the
306+
normal location (including the compilation manager itself) will
307+
be used instead of rebuilt. This mode makes sense for
308+
cross-compilation.}
309+
288310
]}
289311

290312
]
@@ -1174,6 +1196,19 @@ form.}
11741196

11751197
}
11761198

1199+
@; ----------------------------------------
1200+
1201+
@subsection{Setup Start Module}
1202+
1203+
@defmodule[setup]{The @racketmodname[setup] library implements
1204+
@exec{raco setup}, including the part that bootstraps @exec{raco setup}
1205+
if its own implementation needs to be compiled.}
1206+
1207+
When running @racketmodname[setup] via @exec{racket}, supply the
1208+
@exec{@Flag{N} raco} to ensure that command-line arguments are parsed
1209+
the same way as for @exec{raco setup}, as opposed to a legacy
1210+
command-line mode.
1211+
11771212
@; ------------------------------------------------------------------------
11781213

11791214
@section[#:tag ".plt-archives"]{API for Installing @filepath{.plt} Archives}

racket/collects/setup/main.rkt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,19 @@
143143
(if (pair? (cdr flags))
144144
(filter-flags queued-flags (cddr flags))
145145
queued-flags)
146-
(if (equal? "--boot" (car flags))
147-
;; Record an alternate boot module and compiled-file root
146+
(if (or (equal? "--boot" (car flags))
147+
(equal? "--chain" (car flags)))
148+
;; Record an alternate boot module and [additional] compiled-file root
148149
(if (and (pair? (cdr flags))
149150
(pair? (cddr flags)))
150151
(begin
151152
(set! go-module (list 'file (cadr flags)))
152153
(set! print-loading-sources? #t)
153154
(let ([root (path->complete-path (caddr flags))])
154-
(current-compiled-file-roots (list root)))
155+
(current-compiled-file-roots
156+
(if (equal? "--boot" (car flags))
157+
(list root)
158+
(cons root (current-compiled-file-roots)))))
155159
(cons (car flags)
156160
(filter-flags queued-flags (cddr flags))))
157161
queued-flags)

racket/collects/setup/setup-cmdline.rkt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@
108108
[("--unused-pkg-deps") "Check for unused package-dependency declarations"
109109
(add-flags '((check-dependencies #t)
110110
(check-unused-dependencies #t)))]
111-
[("--boot") path dir "Select a continuation other than `setup/setup-go`"
111+
[("--chain") path dir "Select a continuation other than `setup/setup-go`"
112+
;; This flag is handled by `setup/main`
113+
(void)]
114+
[("--boot") path dir "Like `--chain`, but use compiled only from <dir>"
112115
;; This flag is handled by `setup/main`
113116
(void)]
114117
#:help-labels

racket/src/configure

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ MAKE_LOCAL_RACKET
628628
STARTUP_AS_AUTO
629629
STARTUP_AS_C
630630
STARTUP_AS_BYTECODE
631+
BOOT_MODE
631632
CGC_IF_NEEDED_FOR_MMM
632633
RUN_RACKET_MAIN_VARIANT
633634
RUN_RACKET_MMM
@@ -6637,11 +6638,13 @@ if test "${enable_racket}" = "" ; then
66376638
RUN_RACKET_MMM='$(RUN_THIS_RACKET_MMM)'
66386639
RUN_RACKET_MAIN_VARIANT='$(RUN_THIS_RACKET_MAIN_VARIANT)'
66396640
CGC_IF_NEEDED_FOR_MMM="cgc"
6641+
BOOT_MODE="--boot"
66406642
else
66416643
RUN_RACKET_CGC="${enable_racket}"
66426644
RUN_RACKET_MMM="${enable_racket}"
66436645
RUN_RACKET_MAIN_VARIANT="${enable_racket}"
66446646
CGC_IF_NEEDED_FOR_MMM="no-cgc-needed"
6647+
BOOT_MODE="--chain"
66456648
fi
66466649

66476650
############## libtool ################
@@ -6853,6 +6856,7 @@ LIBS="$LIBS $EXTRALIBS"
68536856

68546857

68556858

6859+
68566860

68576861

68586862
mk_needed_dir()

racket/src/cs/c/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ABS_SCHEME_SRC = "`$(RACKET) $(srcdir)/../absify.rkt $(SCHEME_SRC)`"
4747
ABS_SRCDIR = "`$(RACKET) $(srcdir)/../absify.rkt $(srcdir)`"
4848
ABS_BUILDDIR = "`$(RACKET) $(srcdir)/../absify.rkt $(builddir)`"
4949

50-
SETUP_BOOT = -W 'info@compiler/cm error' -l- setup --boot $(srcdir)/../../setup-go.rkt $(builddir)/compiled
50+
SETUP_BOOT = -W 'info@compiler/cm error' -l- setup --chain $(srcdir)/../../setup-go.rkt $(builddir)/compiled
5151

5252
# The "expander", "thread", "io", "regexp", and "schemify" makefiles
5353
# all use "expander.d", but they set `GENERATED_RKTL` so it refers to

racket/src/cs/c/configure

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ Optional Features:
13371337
--enable-iconv use iconv (usually auto-enabled)
13381338
--enable-xonx use Unix style (e.g., use Gtk) for Mac OS
13391339
--enable-racket=<path> use <path> as Racket to build; or "auto" to create
1340-
--enable-scheme=<path> Chez Scheme build dierctory at <path>
1340+
--enable-scheme=<path> Chez Scheme build directory at <path>
13411341
--enable-mach=<mac> Use Chez Scheme machine type <mach>
13421342
13431343
Some influential environment variables:
@@ -3291,6 +3291,10 @@ if test "${enable_scheme}" != "" ; then
32913291
SCHEME_SRC="${enable_scheme}"
32923292
fi
32933293

3294+
if test "${enable_racket}" != "" ; then
3295+
RACKET="${enable_racket}"
3296+
fi
3297+
32943298
if test "${enable_mach}" != "" ; then
32953299
MACH="${enable_mach}"
32963300
fi

racket/src/cs/c/configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ if test "${enable_scheme}" != "" ; then
186186
SCHEME_SRC="${enable_scheme}"
187187
fi
188188

189+
if test "${enable_racket}" != "" ; then
190+
RACKET="${enable_racket}"
191+
fi
192+
189193
if test "${enable_mach}" != "" ; then
190194
MACH="${enable_mach}"
191195
fi

racket/src/gracket/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ LINKRESULT_wx_xt = gracket@CGC@
8989
LINKRESULT_wx_mac = GRacket@CGC@.app/Contents/MacOS/GRacket@CGC@
9090
LINKRESULT = $(LINKRESULT_@WXVARIANT@)
9191

92-
BOOT_SETUP = --boot $(srcdir)/../setup-go.rkt ../compiled
92+
BOOT_SETUP = @BOOT_MODE@ $(srcdir)/../setup-go.rkt ../compiled
9393

9494
# Incremented each time the binaries change:
9595
DOWNLOAD_BIN_VERSION = 1

racket/src/gracket/gc2/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ MZMMM_wx_xt = @RUN_RACKET_MMM@
5656
MZMMM_wx_mac = @RUN_RACKET_MMM@
5757
MZMMM = $(MZMMM_@WXVARIANT@)
5858

59-
SETUP_BOOT = -l- setup --boot $(srcdir)/../../setup-go.rkt ../../compiled
59+
SETUP_BOOT = -l- setup @BOOT_MODE@ $(srcdir)/../../setup-go.rkt ../../compiled
6060

6161
XFORM_CMD = $(MZMMM) $(SELF_RACKET_FLAGS) $(SETUP_BOOT) --tag ++out $(srcdir)/../../racket/gc2/xform-mod.rkt
6262
XFORM_CPP_ARGS = -I$(srcdir)/../../racket/gc2 $(NOGCINC) $(OPTIONS) @PREFLAGS@ $(XFORM_INC_@WXVARIANT@)

racket/src/racket/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ RACKET = racket
4949
RUN_THIS_RACKET_CGC = ./racket@CGC@
5050
RUN_THIS_RACKET_MMM = ./racket@MMM@
5151

52-
SETUP_BOOT = -W "info@compiler/cm error" -l- setup --boot $(srcdir)/../setup-go.rkt ../compiled
52+
SETUP_BOOT = -W "info@compiler/cm error" -l- setup @BOOT_MODE@ $(srcdir)/../setup-go.rkt ../compiled
5353

5454
MZSRC = $(srcdir)/src
5555

racket/src/racket/configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,11 +1592,13 @@ if test "${enable_racket}" = "" ; then
15921592
RUN_RACKET_MMM='$(RUN_THIS_RACKET_MMM)'
15931593
RUN_RACKET_MAIN_VARIANT='$(RUN_THIS_RACKET_MAIN_VARIANT)'
15941594
CGC_IF_NEEDED_FOR_MMM="cgc"
1595+
BOOT_MODE="--boot"
15951596
else
15961597
RUN_RACKET_CGC="${enable_racket}"
15971598
RUN_RACKET_MMM="${enable_racket}"
15981599
RUN_RACKET_MAIN_VARIANT="${enable_racket}"
15991600
CGC_IF_NEEDED_FOR_MMM="no-cgc-needed"
1601+
BOOT_MODE="--chain"
16001602
fi
16011603

16021604
############## libtool ################
@@ -1803,6 +1805,7 @@ AC_SUBST(RUN_RACKET_CGC)
18031805
AC_SUBST(RUN_RACKET_MMM)
18041806
AC_SUBST(RUN_RACKET_MAIN_VARIANT)
18051807
AC_SUBST(CGC_IF_NEEDED_FOR_MMM)
1808+
AC_SUBST(BOOT_MODE)
18061809

18071810
AC_SUBST(STARTUP_AS_BYTECODE)
18081811
AC_SUBST(STARTUP_AS_C)

racket/src/racket/gc2/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ DEF_C_DIRS = $(DEF_COLLECTS_DIR) $(DEF_CONFIG_DIR)
4343
# typically redirects to RUN_THIS_RACKET_CGC:
4444
RUN_THIS_RACKET_CGC = ../racket@CGC@
4545

46-
SETUP_BOOT = -W "info@compiler/cm error" -l- setup --boot $(srcdir)/../../setup-go.rkt ../../compiled
46+
SETUP_BOOT = -W "info@compiler/cm error" -l- setup @BOOT_MODE@ $(srcdir)/../../setup-go.rkt ../../compiled
4747
XFORM_SETUP = @RUN_RACKET_CGC@ $(SELF_RACKET_FLAGS) $(SETUP_BOOT) --tag ++out $(srcdir)/xform-mod.rkt --depends
4848
XFORM_NOPRECOMP = $(XFORM_SETUP) --cpp "$(CPP) $(ALL_CPPFLAGS)" @XFORMFLAGS@ -o ++out
4949
XSRCDIR = xsrc

racket/src/setup-go.rkt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,9 @@
8383
(dynamic-require mod-file (void)))
8484
(lambda ()
8585
(port-file-unlock lock-port)))
86-
87-
;; Now that the lock is released, instantiate:
88-
(dynamic-require mod-file #f)
8986

90-
;; Record dependencies:
87+
;; Record dependencies (before running `mod-file`, in case
88+
;; it mangles parameters)
9189
(define deps (cons mod-file
9290
(module-recorded-dependencies mod-file)))
9391
(call-with-output-file make-dep-file
@@ -98,4 +96,7 @@
9896
target-file))
9997
(for ([dep (in-list deps)])
10098
(fprintf o " \\\n ~a" dep))
101-
(newline o))))))
99+
(newline o)))
100+
101+
;; Now that the lock is released, instantiate:
102+
(dynamic-require mod-file #f))))

0 commit comments

Comments
 (0)