Makefile: make PKGS' not sticky by default, add again' target

More generally, `LINK_MODE' controls how the `PKGS' value is saved
or restored: "--save" saves the value (the default), "--restore"
uses a previously saved value (if any), and "" disables saving or
restoring.

The `again' target recurs to `in-place' with `LINK_MODE=--restore'.
This commit is contained in:
Matthew Flatt 2013-07-08 19:41:12 -06:00
parent 267ba4c72b
commit 9cc50dc914
3 changed files with 35 additions and 22 deletions

View File

@ -35,8 +35,9 @@ To install a subset of the packages in "pkgs", supply `PKGS' value to
links only the "gui-lib" and "readline-lib" packages and their
dependencies. The default value of `PKGS' reaches all packages in
"pkgs" among its dependencies. See "Linking Packages for Development
Mode", below, for more information on package links and the way that
`PKGS' is remembered for future `make in-place's.
Mode", below, for more information on package links and using `again'
or `LINK_MODE' to use remembered `PKGS' values from previous `make
in-place's.
Note that `make -j <n>' controls parallelism for the makefile part of
a build, but not for the `raco setup' part. To control both the
@ -104,13 +105,6 @@ subset of the packages with `PKGS="...."' as an argument to `make
pkg-links'. Make the `pkg-links' target whenever the set of
dependencies can change.
When you supply `PKGS=' with a value that is not the default value,
then the set of packages is recorded in "racket/etc/pkg-links.rktd"
and used for any future `make pkg-links' where `PKGS' is the
default. So, you can supply a `PKGS=' and it sticks for future builds,
but you must manually delete "racket/etc/pkg-links.rktd" to get
back to the default configuration.
Packages are linked in a database (at "racket/lib/devel-pkgs") that is
added to the installation's search paths. As a result, the links
affect only the build in the "racket" directory, and they are not
@ -130,6 +124,15 @@ as
build/native-pkgs
By default, the `PKGS' value is remembered by `pkg-links', but a
previously remembered value is not used. Supply `LINK_MODE=--restore'
as an argument to to `make' to use the previously remembered `PKGS'
value, if any. The `again' (or `win32-again') makefile target is the
same as `in-place' (or `win32-in-place'), but with
`LINK_MODE=--restore'. To suppress remembering a `PKGS' value, supply
`LINK_MODE='; the `PKGS' value is saved by default because
`LINK_MODE=--save' is the default.
Trying Packages Locally
-----------------------

View File

@ -40,14 +40,22 @@ cpus-in-place:
plain-in-place:
$(MAKE) core
if $(MACOSX_CHECK) ; then $(MAKE) native-from-git ; fi
$(MAKE) pkg-links
$(MAKE) pkg-links LINK_MODE="$(LINK_MODE)"
$(PLAIN_RACKET) -N raco -l- raco setup $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
win32-in-place:
$(MAKE) win32-core
$(MAKE) win32-pkg-links
$(MAKE) win32-pkg-links PKGS="$(PKGS)" LINK_MODE="$(LINK_MODE)"
$(WIN32_PLAIN_RACKET) -N raco -l- raco setup $(JOB_OPTIONS) $(PLT_SETUP_OPTIONS)
again:
$(MAKE) LINK_MODE="--restore"
IN_PLACE_COPY_ARGS = JOB_OPTIONS="$(JOB_OPTIONS)" PLT_SETUP_OPTIONS="$(PLT_SETUP_OPTIONS)"
win32-again:
$(MAKE) LINK_MODE="--restore" $(IN_PLACE_COPY_ARGS)
# ------------------------------------------------------------
# Core build
@ -178,13 +186,13 @@ BUNDLE_CONFIG = bundle/racket/etc/config.rktd
# Linking all packages (development mode; not an installer build)
LINK_ALL = -U -G build/config racket/src/link-all.rkt ++dir pkgs ++dir build/native-pkgs
LINK_PKG_SPECS = --sticky "$(PKGS)" "$(DEFAULT_PKGS)"
LINK_MODE = --save
pkg-links:
$(PLAIN_RACKET) $(LINK_ALL) $(LINK_PKG_SPECS) $(PKGS)
$(PLAIN_RACKET) $(LINK_ALL) $(LINK_MODE) $(PKGS) $(REQUIRED_PKGS)
win32-pkg-links:
$(MAKE) pkg-links PLAIN_RACKET="$(WIN32_PLAIN_RACKET)"
$(MAKE) pkg-links PLAIN_RACKET="$(WIN32_PLAIN_RACKET)" LINK_MODE="$(LINK_MODE)" PKGS="$(PKGS)"
# ------------------------------------------------------------
# On a server platform (for an installer build):

View File

@ -14,8 +14,8 @@
(define devel-pkgs-dir (build-path "racket" "lib" devel-pkgs-rel-dir))
(define only-platform? #f)
(define sticky? #f)
(define keep-old? #f)
(define save? #f)
(define restore? #f)
(define dirs null)
@ -24,9 +24,11 @@
#:once-each
[("--platform") "Only packages whose names match the platform name"
(set! only-platform? #t)]
[("--sticky") a b "Record choice if <a> =/= <b>, use recorded if <a> == <b>"
(set! sticky? #t)
(set! keep-old? (equal? a b))]
#:once-any
[("--save") "Save package choices"
(set! save? #t)]
[("--restore") "Use saved package choices, if any"
(set! restore? #t)]
#:multi
[("++dir") dir "Use packages in <dir>"
(set! dirs (cons dir dirs))]
@ -37,7 +39,7 @@
(define pkgs-choice-path (build-path config-dir-path "link-pkgs.rktd"))
(define-values (pkgs keeping?)
(if (and keep-old?
(if (and restore?
(file-exists? pkgs-choice-path))
(values
(list->set
@ -51,8 +53,8 @@
""))
(for ([p (in-set pkgs)])
(printf " ~a\n" p))
(when sticky?
(unless (or keeping? keep-old?)
(when save?
(unless keeping?
(printf "Recording packages choice in ~a\n" pkgs-choice-path)
(call-with-output-file*
pkgs-choice-path