make in-place: keep non-default `PKGS' value in "racket/etc/link-pkgs.rktd"

This change makes a `PKGS=...' setting sticky for an in-place build via
`make', `make in-place', `make pkg-links', etc.
This commit is contained in:
Matthew Flatt 2013-07-05 07:00:49 -06:00
parent 0e7f6e3ddd
commit fb052532c0
4 changed files with 66 additions and 21 deletions

View File

@ -35,7 +35,8 @@ To install a subset of the packages in "pkgs", supply `PKGS' value to
links only the "gui-lib" and "readline-lib" packages and their links only the "gui-lib" and "readline-lib" packages and their
dependencies. The default value of `PKGS' reaches all packages in dependencies. The default value of `PKGS' reaches all packages in
"pkgs" among its dependencies. See "Linking Packages for Development "pkgs" among its dependencies. See "Linking Packages for Development
Mode", below, for more information. Mode", below, for more information on package links and the way that
`PKGS' is remembered for future `make in-place's.
Building Racket Pieces Building Racket Pieces
@ -60,6 +61,11 @@ but under Windows, encoding-conversion, extflonum, and SSL
functionality is hobbled until native libraries from the functionality is hobbled until native libraries from the
`racket-win32-i386' or `racket-win32-x86_64' package are installed.) `racket-win32-i386' or `racket-win32-x86_64' package are installed.)
On Unix or Mac OS X, you can use `make in-place' and still set
`configure' options by supplying `CONFIGURE_ARGS_qq'. (The `_qq'
suffix on the variable name is a convention that indicates that
single- and double-quote marks are allowed in the value.)
Installing Packages Installing Packages
------------------- -------------------
@ -70,22 +76,28 @@ packages via a package-catalog server (ignoring the content of
Linking Packages for Development Mode Linking Packages for Development Mode
------------------------------------- -------------------------------------
Aside from the issue of native-library packages, using all of the Aside from the issue of native-library packages, using the
packages in "pkgs" corresponds to a build that is like the main Racket "main-distribution" package corresponds to a build that is like the
distribution. Furthermore, if you install all of those packages with main Racket distribution. Furthermore, if you install all of those
`raco pkg install -i --link ...', then you can edit libraries or packages with `raco pkg install -i --link ...', then you can edit
update via `git pull' plus `raco setup' (as opposed to updating or libraries or update via `git pull' plus `raco setup' (as opposed to
reinstalling packages). updating or reinstalling packages).
The `pkg-links' target of the makefile links (or re-links) packages The `pkg-links' target of the makefile links (or re-links) packages
from "pkgs" into the "racket" build. (The `in-place' target of the from "pkgs" into the "racket" build. (The `in-place' target of the
makefile uses `pkg-links'.) By default, `pkg-links' starts with the makefile uses `pkg-links'.) By default, `pkg-links' starts with the
"main-distribution" and "plt-services" packages and links all of their "main-distribution" and "plt-services" packages and links all of their
dependencies, which includes all of the packages in "pkgs". Specify a dependencies, which includes all of the packages in "pkgs". Specify a
subset of the packages with `PKG="...."' as an argument to `make subset of the packages with `PKGS="...."' as an argument to `make
pkg-links'. Make the `pkg-links' target whenever the set of pkg-links'. Make the `pkg-links' target whenever the set of
dependencies can change (or, for the default mode, when any native dependencies can change.
package or package in "pkgs" changes).
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 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 added to the installation's search paths. As a result, the links
@ -106,9 +118,6 @@ as
build/native-pkgs build/native-pkgs
When you have a "build/native-pkgs" directory, then the `pkg-links'
makefile target also links relavant native packages.
Trying Packages Locally Trying Packages Locally
----------------------- -----------------------

View File

@ -43,7 +43,7 @@ win32-in-place:
# an empty set of link files, so that any installation-wide # an empty set of link files, so that any installation-wide
# links or packages are ignored during the core build. # links or packages are ignored during the core build.
CORE_CONFIGURE_ARGS = CONFIGURE_ARGS_qq =
core: core:
mkdir -p build/config mkdir -p build/config
@ -60,7 +60,7 @@ win32-core:
cmd /c racket\src\worksp\build-at racket\src\worksp ..\..\..\build\config cmd /c racket\src\worksp\build-at racket\src\worksp ..\..\..\build\config
racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in
cd racket/src/build; ../configure $(CORE_CONFIGURE_ARGS) cd racket/src/build; ../configure $(CONFIGURE_ARGS_qq)
# ------------------------------------------------------------ # ------------------------------------------------------------
# Configuration options for building installers # Configuration options for building installers
@ -74,7 +74,8 @@ racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in
# side of its definition. # side of its definition.
# Packages (separated by spaces) to include in a distribution: # Packages (separated by spaces) to include in a distribution:
PKGS = main-distribution plt-services DEFAULT_PKGS = main-distribution plt-services
PKGS = $(DEFAULT_PKGS)
# Catalog for sources and native packages; use "local" to bootstrap # Catalog for sources and native packages; use "local" to bootstrap
# from package directories (in the same directory as this makefile) # from package directories (in the same directory as this makefile)
@ -158,8 +159,11 @@ BUNDLE_CONFIG = bundle/racket/etc/config.rktd
# ------------------------------------------------------------ # ------------------------------------------------------------
# Linking all packages (development mode; not an installer build) # 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)"
pkg-links: pkg-links:
$(PLAIN_RACKET) -U -G build/config racket/src/link-all.rkt ++dir pkgs ++dir build/native-pkgs $(PKGS) $(PLAIN_RACKET) $(LINK_ALL) $(LINK_PKG_SPECS) $(PKGS)
win32-pkg-links: win32-pkg-links:
$(MAKE) pkg-links PLAIN_RACKET="$(WIN32_PLAIN_RACKET)" $(MAKE) pkg-links PLAIN_RACKET="$(WIN32_PLAIN_RACKET)"

View File

@ -237,8 +237,7 @@
(sh "cd " (q dir) " ; " (sh "cd " (q dir) " ; "
"make -j " j " client" "make -j " j " client"
(client-args c server 'unix) (client-args c server 'unix)
" CORE_CONFIGURE_ARGS=" (q (apply ~a #:separator " " " CONFIGURE_ARGS_qq=" (qq (get-opt c '#:configure null)))))
(get-opt c '#:configure null))))))
(define (windows-build c host port user server repo clean? pull?) (define (windows-build c host port user server repo clean? pull?)
(define dir (or (get-opt c '#:dir) (define dir (or (get-opt c '#:dir)

View File

@ -8,18 +8,24 @@
setup/getinfo setup/getinfo
pkg/lib) pkg/lib)
(define config-file-path (build-path "racket" "etc" "config.rktd")) (define config-dir-path (build-path "racket" "etc"))
(define config-file-path (build-path config-dir-path "config.rktd"))
(define devel-pkgs-dir (build-path "racket" "lib" "devel-pkgs")) (define devel-pkgs-dir (build-path "racket" "lib" "devel-pkgs"))
(define only-platform? #f) (define only-platform? #f)
(define sticky? #f)
(define keep-old? #f)
(define dirs null) (define dirs null)
(define pkgs (define cmdline-pkgs
(command-line (command-line
#:once-each #:once-each
[("--platform") "Only packages whose names match the platform name" [("--platform") "Only packages whose names match the platform name"
(set! only-platform? #t)] (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))]
#:multi #:multi
[("++dir") dir "Use packages in <dir>" [("++dir") dir "Use packages in <dir>"
(set! dirs (cons dir dirs))] (set! dirs (cons dir dirs))]
@ -27,6 +33,33 @@
pkg pkg
(list->set pkg))) (list->set pkg)))
(define pkgs-choice-path (build-path config-dir-path "link-pkgs.rktd"))
(define-values (pkgs keeping?)
(if (and keep-old?
(file-exists? pkgs-choice-path))
(values
(list->set
(call-with-input-file* pkgs-choice-path read))
#t)
(values cmdline-pkgs #f)))
(printf "Linking packages~a:\n"
(if keeping?
(format " (using packages choice from ~a)" pkgs-choice-path)
""))
(for ([p (in-set pkgs)])
(printf " ~a\n" p))
(when sticky?
(unless (or keeping? keep-old?)
(printf "Recording packages choice in ~a\n" pkgs-choice-path)
(call-with-output-file*
pkgs-choice-path
#:exists 'truncate/replace
(lambda (o)
(write (set->list pkgs) o)
(newline o)))))
(define devel-pkgs-bytes (define devel-pkgs-bytes
(path->bytes (path->complete-path devel-pkgs-dir))) (path->bytes (path->complete-path devel-pkgs-dir)))
(define devel-links-bytes (define devel-links-bytes