From fb052532c0d80905ff202f8acf271235800eea38 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 5 Jul 2013 07:00:49 -0600 Subject: [PATCH] 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. --- INSTALL.txt | 35 +++++++++++++++++---------- Makefile | 12 ++++++---- pkgs/distro-build/drive-clients.rkt | 3 +-- racket/src/link-all.rkt | 37 +++++++++++++++++++++++++++-- 4 files changed, 66 insertions(+), 21 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index 396dece36a..001c884005 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -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 dependencies. The default value of `PKGS' reaches all packages in "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 @@ -60,6 +61,11 @@ but under Windows, encoding-conversion, extflonum, and SSL functionality is hobbled until native libraries from the `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 ------------------- @@ -70,22 +76,28 @@ packages via a package-catalog server (ignoring the content of Linking Packages for Development Mode ------------------------------------- -Aside from the issue of native-library packages, using all of the -packages in "pkgs" corresponds to a build that is like the main Racket -distribution. Furthermore, if you install all of those packages with -`raco pkg install -i --link ...', then you can edit libraries or -update via `git pull' plus `raco setup' (as opposed to updating or -reinstalling packages). +Aside from the issue of native-library packages, using the +"main-distribution" package corresponds to a build that is like the +main Racket distribution. Furthermore, if you install all of those +packages with `raco pkg install -i --link ...', then you can edit +libraries or update via `git pull' plus `raco setup' (as opposed to +updating or reinstalling 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 makefile uses `pkg-links'.) By default, `pkg-links' starts with the "main-distribution" and "plt-services" packages and links all of their 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 -dependencies can change (or, for the default mode, when any native -package or package in "pkgs" changes). +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 @@ -106,9 +118,6 @@ as 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 ----------------------- diff --git a/Makefile b/Makefile index 5f415d080a..8ca831bed2 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ win32-in-place: # an empty set of link files, so that any installation-wide # links or packages are ignored during the core build. -CORE_CONFIGURE_ARGS = +CONFIGURE_ARGS_qq = core: mkdir -p build/config @@ -60,7 +60,7 @@ win32-core: cmd /c racket\src\worksp\build-at racket\src\worksp ..\..\..\build\config 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 @@ -74,7 +74,8 @@ racket/src/build/Makefile: racket/src/configure racket/src/Makefile.in # side of its definition. # 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 # 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) +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: - $(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: $(MAKE) pkg-links PLAIN_RACKET="$(WIN32_PLAIN_RACKET)" diff --git a/pkgs/distro-build/drive-clients.rkt b/pkgs/distro-build/drive-clients.rkt index c651e9ec80..f7fab0e68e 100644 --- a/pkgs/distro-build/drive-clients.rkt +++ b/pkgs/distro-build/drive-clients.rkt @@ -237,8 +237,7 @@ (sh "cd " (q dir) " ; " "make -j " j " client" (client-args c server 'unix) - " CORE_CONFIGURE_ARGS=" (q (apply ~a #:separator " " - (get-opt c '#:configure null)))))) + " CONFIGURE_ARGS_qq=" (qq (get-opt c '#:configure null))))) (define (windows-build c host port user server repo clean? pull?) (define dir (or (get-opt c '#:dir) diff --git a/racket/src/link-all.rkt b/racket/src/link-all.rkt index e3aeb8fa98..c2a384bac5 100644 --- a/racket/src/link-all.rkt +++ b/racket/src/link-all.rkt @@ -8,18 +8,24 @@ setup/getinfo 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 only-platform? #f) +(define sticky? #f) +(define keep-old? #f) (define dirs null) -(define pkgs +(define cmdline-pkgs (command-line #:once-each [("--platform") "Only packages whose names match the platform name" (set! only-platform? #t)] + [("--sticky") a b "Record choice if =/= , use recorded if == " + (set! sticky? #t) + (set! keep-old? (equal? a b))] #:multi [("++dir") dir "Use packages in " (set! dirs (cons dir dirs))] @@ -27,6 +33,33 @@ 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 (path->bytes (path->complete-path devel-pkgs-dir))) (define devel-links-bytes